.data
x:	.long	0
s:	.string "%d\n\0"
.text
.global main
main:
	pushl	$x
	pushl	$s
	call	scanf
	addl	$8, %esp
	cmp		$3, x
	jl		zero
	bsr		x, %ecx
	xor		%eax, %eax
	inc		%eax
	shl		%cl, %eax
	mov		%eax, %ecx
	shr		%ecx
	add		%ecx, %eax
	sub		x, %eax
	cdq
	xor		%edx, %eax
	sub		%edx, %eax
	sub		%ecx, %eax
	neg		%eax
print:
	mov		%eax, x
	pushl	x
	pushl	$s
	call	printf
	addl	$8, %esp
	xor		%eax, %eax
	ret
zero:
	xor		%eax, %eax
	jmp		print