Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .file "Source.c"
- .text
- .globl good
- .data
- .align 4
- .type good, @object
- .size good, 4
- good:
- .long 2
- .section .rodata
- .align 8
- .LC0:
- .string "It worked! The first number is %d, and the second one is %d\n"
- .align 8
- .LC1:
- .string "The 10.001st prime number is: %d\n"
- .text
- .globl main
- .type main, @function
- main:
- .LFB0:
- .cfi_startproc
- pushq %rbp
- .cfi_def_cfa_offset 16
- .cfi_offset 6, -16
- movq %rsp, %rbp
- .cfi_def_cfa_register 6
- subq $16, %rsp
- movl good(%rip), %edx
- movl good(%rip), %eax
- movl %eax, %esi
- leaq .LC0(%rip), %rdi
- movl $0, %eax
- call printf@PLT
- movl $2, -8(%rbp)
- movl $1, -4(%rbp)
- jmp .L2
- .L4:
- movl -8(%rbp), %eax
- movl %eax, %edi
- call isPrime
- testb %al, %al
- je .L3
- addl $1, -4(%rbp)
- addl $1, -8(%rbp)
- jmp .L2
- .L3:
- addl $1, -8(%rbp)
- .L2:
- cmpl $10000, -4(%rbp)
- jle .L4
- movl -8(%rbp), %eax
- movl %eax, %esi
- leaq .LC1(%rip), %rdi
- movl $0, %eax
- call printf@PLT
- movl $0, %eax
- leave
- .cfi_def_cfa 7, 8
- ret
- .cfi_endproc
- .LFE0:
- .size main, .-main
- .globl isPrime
- .type isPrime, @function
- isPrime:
- .LFB1:
- .cfi_startproc
- pushq %rbp
- .cfi_def_cfa_offset 16
- .cfi_offset 6, -16
- movq %rsp, %rbp
- .cfi_def_cfa_register 6
- movl %edi, -20(%rbp)
- cmpl $1, -20(%rbp)
- jne .L7
- movl $0, %eax
- jmp .L8
- .L7:
- cmpl $2, -20(%rbp)
- jne .L9
- movl $1, %eax
- jmp .L8
- .L9:
- movl $2, -4(%rbp)
- jmp .L10
- .L12:
- movl -20(%rbp), %eax
- cltd
- idivl -4(%rbp)
- movl %edx, %eax
- testl %eax, %eax
- jne .L11
- movl $0, %eax
- jmp .L8
- .L11:
- addl $1, -4(%rbp)
- .L10:
- movl -4(%rbp), %eax
- cmpl -20(%rbp), %eax
- jl .L12
- movl $1, %eax
- .L8:
- popq %rbp
- .cfi_def_cfa 7, 8
- ret
- .cfi_endproc
- .LFE1:
- .size isPrime, .-isPrime
- .ident "GCC: (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0"
- .section .note.GNU-stack,"",@progbits
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement