Assembler in Pascal
var
n:Integer;
r:cardinal;
begin
read(n);
asm
xor eax,eax
mov ebx,eax
inc eax
mov esi,eax
mov edi,eax
mov ecx,1 shl 5
@@3:
or ecx,ecx
je @@1
mov eax,ebx
mul eax
mov ebx,eax
mov eax,esi
mul eax
add eax,ebx
mov esi,eax
mov eax,edi
mul eax
add eax,ebx
mov edi,eax
sub eax,esi
mov ebx,eax
test n,ecx
je @@2
add edi,ebx
add ebx,esi
mov esi,edi
sub esi,ebx
@@2:
shr ecx,1
jmp @@3
@@1:
mov eax,ebx
shl eax,1
mov r,eax
end;
write(r);
end.