Code:
[B]GCD:[/B]
push ebp
push esp
mov ebp,esp
mov ecx,[ebp+c]
mov eax,[ebp+8]
test ecx,ecx
jz [B]END[/B]
cdq
idiv ecx
push ecx
push edx
call [B]GCD[/B]
pop esp
[B]END:[/B]
pop ebp
ret
(result returned to eax)
[B]GCD:[/B]
push ebp
push esp
mov ebp,esp
mov ecx,[ebp+c]
mov eax,[ebp+8]
test ecx,ecx
jz [B]END[/B]
cdq
idiv ecx
push ecx
push edx
call [B]GCD[/B]
pop esp
[B]END:[/B]
pop ebp
ret
use strict;
use warnings;
print "Gimme a number:";
my $one = <>;
chomp $one;
print "Gimme another number:";
my $two = <>;
chomp $two;
my $x;
if($two<$one){
$x = $two;
}
else{
$x = $one;
}
my $GDC = GDC($x);
print $GDC;
<>;
sub GDC{
my ($z) = @_;
my $a = $one%$z;
my $b = $two%$z;
my $c = $a || $b;
if($c == 0){
return $z;
}
return GDC((--$z));
}
obviously the commented command at the end is the one that wouldn't work. Not something I'd expect most people to try but it definitely saves some space in the right context.mov eax, weapon
mov ecx, level
mov [eax+4], ecx
dec ecx
mov edx, [eax]
imul edx, edx, 0C
data 8B 8C 8A 60 36 49 00 ;mov ecx, [ecx*4 + edx + 493660]