Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 3.53 KB | None | 0 0
  1.        .text
  2.         .global mul64p
  3. mul64p:
  4.         push    %ebp
  5.         mov     %esp,   %ebp
  6.         push    %edi
  7.         push    %esi
  8.         push    %ebx
  9.  
  10.         //fourth part
  11.         movl    $0,        %ebx
  12.         movl    8(%ebp),   %esi
  13.         movl    16(%ebp),  %eax
  14.         movl    $0,        %edx
  15.         mull    %esi
  16.         movl    %eax,      a
  17.  
  18.         //third part
  19.         movl    $0,        %edi
  20.         movl    8(%ebp),   %esi
  21.         movl    16(%ebp),  %eax
  22.         movl    $0,        %edx
  23.         mull    %esi
  24.         addl    %edx,      %edi
  25.         adc     $0,        %ebx
  26.  
  27.         movl    12(%ebp),  %esi
  28.         movl    16(%ebp),  %eax
  29.         movl    $0,        %edx
  30.         mull    %esi
  31.         add     %eax,      %edi
  32.         adc     $0,        %ebx
  33.  
  34.         movl    8(%ebp),   %esi
  35.         movl    20(%ebp),  %eax
  36.         movl    $0,        %edx
  37.         mull    %esi
  38.         addl    %eax,      %edi
  39.         adc     $0,        %ebx
  40.         movl    %edi,      b
  41.  
  42.         //second part
  43.         movl    $0,        %edi
  44.         movl    12(%ebp),  %esi
  45.         movl    20(%ebp),  %eax
  46.         movl    $0,        %edx
  47.         mull    %esi
  48.         movl    $0,        %ecx
  49.         addl    %eax,      %edi
  50.         addl    %ebx,      %edi
  51.         adc     $0,        %ecx
  52.         movl    $0,        %ebx
  53.         movl    %ecx,      %ebx
  54.  
  55.         movl    12(%ebp),  %esi
  56.         movl    16(%ebp),  %eax
  57.         movl    $0,        %edx
  58.         mull    %esi
  59.         add     %edx,      %edi
  60.         adc     $0,        %ebx
  61.  
  62.         movl    8(%ebp),   %esi
  63.         movl    20(%ebp),  %eax
  64.         movl    $0,        %edx
  65.         mull    %esi
  66.         addl    %edx,      %edi
  67.         adc     $0,        %ebx
  68.         movl    %edi,      c
  69.  
  70.         //fist part
  71.         movl    12(%ebp),  %esi
  72.         movl    20(%ebp),  %eax
  73.         movl    $0,        %edx
  74.         mull    %esi
  75.         addl    %ebx,      %edx
  76.         movl    %edx,      d
  77.  
  78.         //writeResults
  79.  
  80.         movl    $0,       %ebx
  81.         movl    d,        %eax
  82.         testl   %eax,     %eax
  83.         jz      NWF
  84.         movl    $1,       %ebx
  85.         push    %eax
  86.         push    $L
  87.         call    printf
  88. NWF:
  89.         movl    c,        %eax
  90.         testl   %ebx,     %ebx
  91.         jnz     WFS
  92.         testl   %eax,     %eax
  93.         jnz     WS
  94.         jmp     NWS
  95. WFS:
  96.         push    %eax
  97.         push    $8
  98.         push    $FL
  99.         call    printf
  100.         jmp     NWS
  101. WS:
  102.         push    %eax
  103.         push    $L
  104.         call    printf
  105. NWS:
  106.         movl    b,        %eax
  107.         testl   %ebx,     %ebx
  108.         jnz     WFT
  109.         testl   %eax,     %eax
  110.         jnz     WT
  111.         jmp     NWT
  112. WFT:
  113.         push    %eax
  114.         push    $8
  115.         push    $FL
  116.         call    printf
  117.         jmp     NWT
  118. WT:
  119.         push    %eax
  120.         push    $L
  121.         call    printf
  122.  
  123. NWT:
  124.         movl    a,        %eax
  125.         testl   %ebx,     %ebx
  126.         jnz     WF
  127.         push    %eax
  128.         push    $NL
  129.         call    printf
  130.         jmp     END
  131. WF:
  132.         push    %eax
  133.         push    $8
  134.         push    $NFL
  135.         call    printf
  136.         jmp     END
  137. END:
  138.  
  139.         movl    %ebp,    %esp
  140.         movl    -12(%ebp), %ebx
  141.         movl    -8(%ebp),  %esi
  142.         movl    -4(%ebp),  %edi
  143.         pop     %ebp
  144.         ret
  145. L:      .asciz  "%x"
  146. FL:     .asciz  "%0*x"
  147. NL:     .asciz  "%x\n"
  148. NFL:    .asciz  "%0*x\n"
  149.         .data
  150. a:      .int    0
  151. b:      .int    0
  152. c:      .int    0
  153. d:      .int    0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement