Advertisement
Benjamin_Loison

ASM

Dec 16th, 2020
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. .bss
  2. .text
  3. .align 8
  4. .LC2:
  5. .string "%d = 12?, if 10 not false but not the gcc one"
  6. .LC1:
  7. .string "%d = 10? "
  8. .LC0:
  9. .string "%d = 12? "
  10.  
  11.  
  12. .text
  13. .globl main
  14. main:
  15. pushq %rbp
  16. movq %rsp, %rbp
  17. movq $12, -8(%rbp)
  18.  
  19. movq $10, -16(%rbp)
  20.  
  21. movq $1, %rcx
  22. cmp $0, %rcx
  23. jne .L0
  24.  
  25. jmp .L1
  26.  
  27. .L0:
  28. movq -8(%rbp), %rbx
  29. jmp .L2
  30. .L1:
  31. movq -16(%rbp), %rbx
  32. jmp .L2
  33. .L2:
  34.  
  35. movq %rbx, %rsi
  36. leaq .LC0(%rip), %rdi
  37. movq $0, %rax
  38. call printf
  39. movq $0, %rax
  40.  
  41. movq $0, %rcx
  42. cmp $0, %rcx
  43. jne .L3
  44.  
  45. jmp .L4
  46.  
  47. .L3:
  48. movq -8(%rbp), %rbx
  49. jmp .L5
  50. .L4:
  51. movq -16(%rbp), %rbx
  52. jmp .L5
  53. .L5:
  54.  
  55. movq %rbx, %rsi
  56. leaq .LC1(%rip), %rdi
  57. movq $0, %rax
  58. call printf
  59. movq $0, %rax
  60.  
  61. movq $18, %rcx
  62. cmp $0, %rcx
  63. jne .L6
  64.  
  65. jmp .L7
  66.  
  67. .L6:
  68. movq -8(%rbp), %rbx
  69. jmp .L8
  70. .L7:
  71. movq -16(%rbp), %rbx
  72. jmp .L8
  73. .L8:
  74.  
  75. movq %rbx, %rsi
  76. leaq .LC2(%rip), %rdi
  77. movq $0, %rax
  78. call printf
  79. movq $0, %rax
  80.  
  81. movq $0, %rax
  82. leave
  83. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement