#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*/ Perfection(long);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, long *);
int main() {
  long int a, b = 0;
  while (scanf("%ld", &a) != EOF) {
    if (b == 0) {
      printf("PERFECTION OUTPUT\n");
      b++;
    }
    if (a == 0) {
      printf("END OF OUTPUT\n");
      break;
    }
    Perfection(a);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xeb2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%rax
je     11b4 <main+0x84>
cmpq   $0x0,-0x18(%rbp)
jne    118a <main+0x5a>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a6 <main+0x76>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    11b4 <main+0x84>
mov    -0x10(%rbp),%rdi
call   1040 <Perfection@plt>
jmp    1147 <main+0x17>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e97(%rip),%r15
cmp    (%r15),%rax
je     119d <main+0x6d>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%r14
lea    0x8(%rsp),%rbx
xchg   %ax,%ax
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     1191 <main+0x61>
call   1040 <Perfection@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmp    (%r15),%rax
jne    1170 <main+0x40>
jmp    119d <main+0x6d>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@EOF = global i64 0
@str = [14 x i8] c"END OF OUTPUT\00"
@str.3 = [18 x i8] c"PERFECTION OUTPUT\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %18, label %6
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.3, i64 0, i64 0))
br label %8
8: ; preds = %13, %6
%9 = load i64, i64* %1
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %18
13: ; preds = %8
%14 = call i32 @Perfection(i64 %9)
%15 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %8
18: ; preds = %13, %0, %11
ret i32 0
}