Advertisement
KirillSamokhin

buff

Dec 13th, 2022
1,946
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .586p
  2. .MODEL FLAT, C
  3. .CODE
  4. function PROC C USES EDI ESI, Digits:dword, len:dword, LBInt:dword, NInt:dword, result:dword, medians:dword
  5.  
  6.     push eax
  7.     push ebx
  8.     push ecx
  9.     push edi
  10.     push esi
  11.  
  12.     mov ecx, len
  13.     mov esi, Digits
  14.     mov edi, LBInt
  15.     mov eax, 0
  16.  
  17. cycle:
  18.         mov ebx, 0
  19.     iter:
  20.         cmp ebx, NInt
  21.         jge out_iter
  22.         push eax
  23.         mov eax, [esi + 4 * eax]
  24.         cmp eax, [edi + 4 * ebx]
  25.         pop eax
  26.         jl out_iter
  27.         inc ebx
  28.         jmp iter
  29.  
  30.     out_iter:
  31.         dec ebx
  32.         cmp ebx, -1
  33.         je next_num
  34.         mov edi, result
  35.         push eax
  36.         mov eax, [edi + 4 * ebx]
  37.         inc eax
  38.         mov [edi + 4 * ebx], eax
  39.         pop eax
  40.         mov edi, LBInt
  41.  
  42.     next_num:
  43.         inc eax
  44.  
  45. loop cycle
  46.  
  47. pop esi
  48. pop edi
  49. pop ecx
  50. pop ebx
  51. pop eax
  52.  
  53. ret
  54.  
  55. function ENDP
  56. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement