faktorijal

mail@pastecode.io avatar
unknown
assembly_x86
2 years ago
425 B
4
Indexable
Never
#faktorijal 
#UROS GRAHOVAC PR100-2021
.section .data
.section .text
.globl main

	main:

movl $4, %eax
movl $5, %ebx
movl %eax, %ecx
movl $0, %edx

	mnozenje:

cmpl $0, %ecx
je menjaj
addl %ebx, %edx
subl $1, %ecx
jmp mnozenje

	menjaj:

cmpl $2, %eax
je kraj
subl $1, %eax 		# %eax = 4 - 1 = 3	
jmp dalje


	dalje:

movl %edx , %ebx 
movl %eax, %ecx
movl $0, %edx
jmp mnozenje

	kraj:

movl $1, %eax
movl $0, %ebx
int $0x80