Advertisement
Maki325

Untitled

Mar 14th, 2022
1,895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BITS 64
  2. section .text
  3. print64:
  4.   mov   r9, -3689348814741910323
  5.   sub   rsp, 40
  6.   mov   BYTE [rsp+31], 10
  7.   lea   rcx, [rsp+30]
  8. .print64L2:
  9.   mov   rax, rdi
  10.   lea   r8, [rsp+32]
  11.   mul   r9
  12.   mov   rax, rdi
  13.   sub   r8, rcx
  14.   shr   rdx, 3
  15.   lea   rsi, [rdx+rdx*4]
  16.   add   rsi, rsi
  17.   sub   rax, rsi
  18.   add   eax, 48
  19.   mov   BYTE [rcx], al
  20.   mov   rax, rdi
  21.   mov   rdi, rdx
  22.   mov   rdx, rcx
  23.   sub   rcx, 1
  24.   cmp   rax, 9
  25.   ja  .print64L2
  26.   lea   rax, [rsp+32]
  27.   mov   edi, 1
  28.   sub   rdx, rax
  29.   xor   eax, eax
  30.   lea   rsi, [rsp+32+rdx]
  31.   mov   rdx, r8
  32.   mov   rax, 1
  33.   syscall
  34.   add   rsp, 40
  35. ret
  36. global _start
  37. _start:
  38. xor rax, rax
  39. mov ax, [var_0_0]
  40. cmp eax, 0
  41. jne block_0_1
  42. jmp block_next_0_13
  43. block_0_1:
  44. xor rax, rax
  45. mov ax, [var_0_0]
  46. mov rdi, rax
  47. call print64
  48. jmp block_end_0_13
  49. block_next_0_13:
  50. block_end_0_13:
  51. xor rax, rax
  52. mov ax, [var_0_5]
  53. cmp eax, 0
  54. jne block_0_2
  55. jmp block_next_0_14
  56. block_0_2:
  57. xor rax, rax
  58. mov ax, [var_0_5]
  59. mov rdi, rax
  60. call print64
  61. jmp block_end_0_14
  62. block_next_0_14:
  63. block_end_0_14:
  64. xor rax, rax
  65. mov eax, [var_0_9]
  66. mov rdi, rax
  67. call print64
  68. xor rax, rax
  69. mov ax, 1
  70. mov [var_0_0], eax
  71. xor rax, rax
  72. mov ax, [var_0_0]
  73. cmp eax, 0
  74. jne block_0_3
  75. jmp block_next_0_21
  76. block_0_3:
  77. xor rax, rax
  78. mov ax, [var_0_0]
  79. mov rdi, rax
  80. call print64
  81. jmp block_end_0_21
  82. block_next_0_21:
  83. block_end_0_21:
  84. xor rax, rax
  85. mov ax, [var_0_5]
  86. cmp eax, 0
  87. jne block_0_4
  88. jmp block_next_0_22
  89. block_0_4:
  90. xor rax, rax
  91. mov ax, [var_0_5]
  92. mov rdi, rax
  93. call print64
  94. jmp block_end_0_22
  95. block_next_0_22:
  96. block_end_0_22:
  97. xor rax, rax
  98. mov eax, [var_0_9]
  99. mov rdi, rax
  100. call print64
  101. mov rax, 60
  102. mov rdi, 0
  103. syscall
  104.  
  105. section .data
  106. var_0_0 dd 0
  107. var_0_9 dd 123456
  108. var_0_5 dd 1
  109.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement