#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ handle(int);
scalar_t__ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int n, i;
  while (scanf("%d", &n) != EOF) {
    if (n == 0)
      break;
    handle(n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%rax
je     1172 <main+0x52>
cmpl   $0x0,-0x14(%rbp)
jne    1165 <main+0x45>
jmp    1172 <main+0x52>
mov    -0x14(%rbp),%edi
call   1030 <handle@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2ea7(%rip),%r15
cmp    (%r15),%rax
je     117d <main+0x5d>
mov    0xc(%rsp),%edi
test   %edi,%edi
je     117d <main+0x5d>
lea    0xeab(%rip),%r14
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
call   1030 <handle@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    (%r15),%rax
je     117d <main+0x5d>
mov    0xc(%rsp),%edi
test   %edi,%edi
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %16, %2
%9 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%10 = load i64, i64* @EOF
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
br label %19
16: ; preds = %12
%17 = load i32, i32* %6
%18 = call i32 @handle(i32 %17)
br label %8
19: ; preds = %15, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %20, label %11
11: ; preds = %2, %11
%12 = phi i32 [ %17, %11 ], [ %8, %2 ]
%13 = call i32 @handle(i32 %12)
%14 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 0
%19 = select i1 %16, i1 true, i1 %18
br i1 %19, label %20, label %11
20: ; preds = %11, %2
ret i32 0
}