Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .file   "Source.c"
  2.     .text
  3.     .globl  good
  4.     .data
  5.     .align 4
  6.     .type   good, @object
  7.     .size   good, 4
  8. good:
  9.     .long   2
  10.     .section    .rodata
  11.     .align 8
  12. .LC0:
  13.     .string "It worked! The first number is %d, and the second one is %d\n"
  14.     .align 8
  15. .LC1:
  16.     .string "The 10.001st prime number is: %d\n"
  17.     .text
  18.     .globl  main
  19.     .type   main, @function
  20. main:
  21. .LFB0:
  22.     .cfi_startproc
  23.     pushq   %rbp
  24.     .cfi_def_cfa_offset 16
  25.     .cfi_offset 6, -16
  26.     movq    %rsp, %rbp
  27.     .cfi_def_cfa_register 6
  28.     subq    $16, %rsp
  29.     movl    good(%rip), %edx
  30.     movl    good(%rip), %eax
  31.     movl    %eax, %esi
  32.     leaq    .LC0(%rip), %rdi
  33.     movl    $0, %eax
  34.     call    printf@PLT
  35.     movl    $2, -8(%rbp)
  36.     movl    $1, -4(%rbp)
  37.     jmp .L2
  38. .L4:
  39.     movl    -8(%rbp), %eax
  40.     movl    %eax, %edi
  41.     call    isPrime
  42.     testb   %al, %al
  43.     je  .L3
  44.     addl    $1, -4(%rbp)
  45.     addl    $1, -8(%rbp)
  46.     jmp .L2
  47. .L3:
  48.     addl    $1, -8(%rbp)
  49. .L2:
  50.     cmpl    $10000, -4(%rbp)
  51.     jle .L4
  52.     movl    -8(%rbp), %eax
  53.     movl    %eax, %esi
  54.     leaq    .LC1(%rip), %rdi
  55.     movl    $0, %eax
  56.     call    printf@PLT
  57.     movl    $0, %eax
  58.     leave
  59.     .cfi_def_cfa 7, 8
  60.     ret
  61.     .cfi_endproc
  62. .LFE0:
  63.     .size   main, .-main
  64.     .globl  isPrime
  65.     .type   isPrime, @function
  66. isPrime:
  67. .LFB1:
  68.     .cfi_startproc
  69.     pushq   %rbp
  70.     .cfi_def_cfa_offset 16
  71.     .cfi_offset 6, -16
  72.     movq    %rsp, %rbp
  73.     .cfi_def_cfa_register 6
  74.     movl    %edi, -20(%rbp)
  75.     cmpl    $1, -20(%rbp)
  76.     jne .L7
  77.     movl    $0, %eax
  78.     jmp .L8
  79. .L7:
  80.     cmpl    $2, -20(%rbp)
  81.     jne .L9
  82.     movl    $1, %eax
  83.     jmp .L8
  84. .L9:
  85.     movl    $2, -4(%rbp)
  86.     jmp .L10
  87. .L12:
  88.     movl    -20(%rbp), %eax
  89.     cltd
  90.     idivl   -4(%rbp)
  91.     movl    %edx, %eax
  92.     testl   %eax, %eax
  93.     jne .L11
  94.     movl    $0, %eax
  95.     jmp .L8
  96. .L11:
  97.     addl    $1, -4(%rbp)
  98. .L10:
  99.     movl    -4(%rbp), %eax
  100.     cmpl    -20(%rbp), %eax
  101.     jl  .L12
  102.     movl    $1, %eax
  103. .L8:
  104.     popq    %rbp
  105.     .cfi_def_cfa 7, 8
  106.     ret
  107.     .cfi_endproc
  108. .LFE1:
  109.     .size   isPrime, .-isPrime
  110.     .ident  "GCC: (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0"
  111.     .section    .note.GNU-stack,"",@progbits
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement