मशीन भाषा (X86, 32 बिट) + सी भाषा पुस्तकालय मॉलोक () / नि: शुल्क () फ़ंक्शन, बाइट्स 325
00000750 51 push ecx
00000751 52 push edx
00000752 8B44240C mov eax,[esp+0xc]
00000756 8B4C2410 mov ecx,[esp+0x10]
0000075A 3D00000000 cmp eax,0x0
0000075F 7414 jz 0x775
00000761 81F900000000 cmp ecx,0x0
00000767 740C jz 0x775
00000769 39C8 cmp eax,ecx
0000076B 7710 ja 0x77d
0000076D 89C2 mov edx,eax
0000076F 89C8 mov eax,ecx
00000771 89D1 mov ecx,edx
00000773 EB08 jmp short 0x77d
00000775 B8FFFFFFFF mov eax,0xffffffff
0000077A F9 stc
0000077B EB11 jmp short 0x78e
0000077D 31D2 xor edx,edx
0000077F F7F1 div ecx
00000781 89C8 mov eax,ecx
00000783 89D1 mov ecx,edx
00000785 81FA00000000 cmp edx,0x0
0000078B 77F0 ja 0x77d
0000078D F8 clc
0000078E 5A pop edx
0000078F 59 pop ecx
00000790 C20800 ret 0x8
00000793 53 push ebx
00000794 56 push esi
00000795 57 push edi
00000796 55 push ebp
00000797 55 push ebp
00000798 8B442418 mov eax,[esp+0x18]
0000079C 3D02000000 cmp eax,0x2
000007A1 7641 jna 0x7e4
000007A3 3DA0860100 cmp eax,0x186a0
000007A8 7757 ja 0x801
000007AA 40 inc eax
000007AB 89C7 mov edi,eax
000007AD C1E003 shl eax,0x3
000007B0 50 push eax
000007B1 E80E050000 call 0xcc4
000007B6 81C404000000 add esp,0x4
000007BC 3D00000000 cmp eax,0x0
000007C1 743E jz 0x801
000007C3 89C5 mov ebp,eax
000007C5 89F8 mov eax,edi
000007C7 C1E002 shl eax,0x2
000007CA 890424 mov [esp],eax
000007CD 50 push eax
000007CE E8F1040000 call 0xcc4
000007D3 81C404000000 add esp,0x4
000007D9 3D00000000 cmp eax,0x0
000007DE 7415 jz 0x7f5
000007E0 89C3 mov ebx,eax
000007E2 EB28 jmp short 0x80c
000007E4 E9A3000000 jmp 0x88c
000007E9 53 push ebx
000007EA E8E5040000 call 0xcd4
000007EF 81C404000000 add esp,0x4
000007F5 55 push ebp
000007F6 E8D9040000 call 0xcd4
000007FB 81C404000000 add esp,0x4
00000801 B8FFFFFFFF mov eax,0xffffffff
00000806 F9 stc
00000807 E981000000 jmp 0x88d
0000080C C60301 mov byte [ebx],0x1
0000080F C6430101 mov byte [ebx+0x1],0x1
00000813 C7450001000000 mov dword [ebp+0x0],0x1
0000081A C7450402000000 mov dword [ebp+0x4],0x2
00000821 B902000000 mov ecx,0x2
00000826 BE01000000 mov esi,0x1
0000082B B802000000 mov eax,0x2
00000830 8B542418 mov edx,[esp+0x18]
00000834 4A dec edx
00000835 C6040300 mov byte [ebx+eax],0x0
00000839 40 inc eax
0000083A 3B0424 cmp eax,[esp]
0000083D 72F6 jc 0x835
0000083F BF02000000 mov edi,0x2
00000844 81C701000000 add edi,0x1
0000084A 3B3C24 cmp edi,[esp]
0000084D 779A ja 0x7e9
0000084F 803C3B01 cmp byte [ebx+edi],0x1
00000853 74EF jz 0x844
00000855 57 push edi
00000856 51 push ecx
00000857 E8F4FEFFFF call 0x750
0000085C 3D01000000 cmp eax,0x1
00000861 76E1 jna 0x844
00000863 46 inc esi
00000864 897CB500 mov [ebp+esi*4+0x0],edi
00000868 89F9 mov ecx,edi
0000086A C6043B01 mov byte [ebx+edi],0x1
0000086E 39D6 cmp esi,edx
00000870 72CD jc 0x83f
00000872 53 push ebx
00000873 E85C040000 call 0xcd4
00000878 81C404000000 add esp,0x4
0000087E 55 push ebp
0000087F E850040000 call 0xcd4
00000884 81C404000000 add esp,0x4
0000088A 89F8 mov eax,edi
0000088C F8 clc
0000088D 5D pop ebp
0000088E 5D pop ebp
0000088F 5F pop edi
00000890 5E pop esi
00000891 5B pop ebx
00000892 C20400 ret 0x4
00000895
Gcd और function के ऊपर ... यह नीचे विधानसभा कोड कार्य और परीक्षण कार्यक्रम उत्पन्न करता है:
; nasmw -fobj this.asm
; bcc32 -v this.obj
section _DATA use32 public class=DATA
global _main
extern _printf
extern _malloc
extern _free
dspace dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
fmt db "%u " , 13, 10, 0, 0
fmt1 db "%u %u" , 13, 10, 0, 0
IgcdIIuIIIuIIIuIn db "gcd(%u, %u)=%u" , 13, 10, 0, 0
IfunIIuIIIuIn db "fun(%u)=%u" , 13, 10, 0, 0
section _TEXT use32 public class=CODE
gcd:
push ecx
push edx
mov eax, dword[esp+ 12]
mov ecx, dword[esp+ 16]
cmp eax, 0
je .e
cmp ecx, 0
je .e
cmp eax, ecx
ja .1
mov edx, eax
mov eax, ecx
mov ecx, edx
jmp short .1
.e: mov eax, -1
stc
jmp short .z
.1: xor edx, edx
div ecx
mov eax, ecx
mov ecx, edx
cmp edx, 0
ja .1 ; r<c
.2: clc
.z:
pop edx
pop ecx
ret 8
fun:
push ebx
push esi
push edi
push ebp
push ebp
mov eax, dword[esp+ 24]
cmp eax, 2
jbe .a
cmp eax, 100000
ja .e
inc eax
mov edi, eax
shl eax, 3
push eax
call _malloc
add esp, 4
cmp eax, 0
je .e
mov ebp, eax
mov eax, edi
shl eax, 2
mov dword[esp+ 0], eax
push eax
call _malloc
add esp, 4
cmp eax, 0
je .0
mov ebx, eax
jmp short .1
.a: jmp .y
.b: push ebx
call _free
add esp, 4
.0: push ebp
call _free
add esp, 4
.e: mov eax, -1
stc
jmp .z
.1: mov byte[ebx], 1
mov byte[ebx+1], 1
mov dword[ebp], 1
mov dword[ebp+4], 2
mov ecx, 2
mov esi, 1
mov eax, 2
mov edx, dword[esp+ 24]
dec edx
.2: mov byte[ebx+eax], 0
inc eax
cmp eax, dword[esp+ 0]
jb .2
.3: mov edi, 2
.4: add edi, 1
cmp edi, dword[esp+ 0]
ja .b
cmp byte[ebx+edi], 1
je .4
push edi
push ecx
call gcd
cmp eax, 1
jbe .4
inc esi
mov [ebp+esi*4], edi
mov ecx, edi
mov byte[ebx+edi], 1
cmp esi, edx
jb .3
push ebx
call _free
add esp, 4
push ebp
call _free
add esp, 4
mov eax, edi
.y: clc
.z:
pop ebp
pop ebp
pop edi
pop esi
pop ebx
ret 4
_main:
pushad
push 6
push 3
call gcd
pushad
push eax
push 6
push 3
push IgcdIIuIIIuIIIuIn
call _printf
add esp, 16
popad
push 2
push 2
call gcd
pushad
push eax
push 2
push 2
push IgcdIIuIIIuIIIuIn
call _printf
add esp, 16
popad
push 1
push 1
call gcd
pushad
push eax
push 1
push 1
push IgcdIIuIIIuIIIuIn
call _printf
add esp, 16
popad
push 0
push 1
call gcd
pushad
push eax
push 0
push 1
push IgcdIIuIIIuIIIuIn
call _printf
add esp, 16
popad
push 0
call fun
pushad
push eax
push 0
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 1
call fun
pushadpush eax
push 1
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 2
call fun
pushad
push eax
push 2
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 3
call fun
pushad
push eax
push 3
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 4
call fun
pushad
push eax
push 4
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 5
call fun
pushad
push eax
push 5
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 123
call fun
pushad
push eax
push 123
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 1234
call fun
pushad
push eax
push 1234
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 3000
call fun
pushad
push eax
push 3000
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 9999
call fun
pushad
push eax
push 9999
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
push 99999
call fun
pushad
push eax
push 99999
push IfunIIuIIIuIn
call _printf
add esp, 12
popad
popad
mov eax, 0
ret
परिणाम:
gcd(3, 6)=3
gcd(2, 2)=2
gcd(1, 1)=1
gcd(1, 0)=4294967295
fun(0)=0
fun(1)=1
fun(2)=2
fun(3)=4
fun(4)=6
fun(5)=3
fun(123)=132
fun(1234)=1296
fun(3000)=3122
fun(9999)=10374
fun(99999)=102709
यह संभव कीड़े और गलत प्रतिलिपि अतीत है ...