#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 */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int i, x, sum;
  scanf("%d ", &x);
  printf("PERFECTION OUTPUT\n");
  while (x != 0) {
    sum = 0;
    for (i = 1; i < x; i++) {
      if (x % i == 0)
        sum += i;
    }
    if (sum == x)
      printf("%5d  PERFECT\n", x);
    else if (sum < x)
      printf("%5d  DEFICIENT\n", x);
    else
      printf("%5d  ABUNDANT\n", x);
    scanf("%d ", &x);
  }
  printf("END OF OUTPUT\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     120c <main+0xec>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119d <main+0x7d>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    118a <main+0x6a>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    118f <main+0x6f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <main+0x45>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11bf <main+0x9f>
mov    -0xc(%rbp),%esi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f7 <main+0xd7>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e1 <main+0xc1>
mov    -0xc(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
mov    -0xc(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f7 <main+0xd7>
lea    0xe02(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     1255 <main+0x125>
lea    0xea7(%rip),%rbx
lea    0xeb0(%rip),%r15
lea    0xe8b(%rip),%r13
lea    0xe80(%rip),%r14
lea    0x4(%rsp),%r12
jmp    11bb <main+0x8b>
nopw   0x0(%rax,%rax,1)
cmp    %esi,%ecx
mov    %r15,%rdi
cmovl  %rbx,%rdi
cmove  %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     1255 <main+0x125>
mov    $0x0,%ecx
cmp    $0x2,%esi
jl     1190 <main+0x60>
lea    -0x1(%rsi),%r8d
cmp    $0x2,%esi
jne    11e0 <main+0xb0>
mov    $0x1,%edi
xor    %ecx,%ecx
test   $0x1,%r8b
je     1190 <main+0x60>
jmp    123d <main+0x10d>
nopl   (%rax)
mov    %rbx,%r9
mov    %r8d,%ebp
and    $0xfffffffe,%ebp
mov    $0x1,%edi
xor    %ecx,%ecx
jmp    1209 <main+0xd9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %eax,%ecx
add    $0x2,%edi
cmp    %ebp,%ebx
je     1230 <main+0x100>
mov    %esi,%eax
cltd
idiv   %edi
mov    %edi,%eax
test   %edx,%edx
je     1216 <main+0xe6>
xor    %eax,%eax
add    %eax,%ecx
lea    0x1(%rdi),%ebx
mov    %esi,%eax
cltd
idiv   %ebx
mov    %ebx,%eax
test   %edx,%edx
je     1200 <main+0xd0>
xor    %eax,%eax
jmp    1200 <main+0xd0>
nopw   0x0(%rax,%rax,1)
mov    %r9,%rbx
test   $0x1,%r8b
je     1190 <main+0x60>
mov    %esi,%eax
cltd
idiv   %edi
test   %edx,%edx
mov    $0x0,%eax
cmovne %eax,%edi
add    %ecx,%edi
mov    %edi,%ecx
jmp    1190 <main+0x60>
lea    0xde7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [19 x i8] c"PERFECTION OUTPUT\0A\00"
@.str.2 = [14 x i8] c"%5d PERFECT\0A\00"
@.str.3 = [16 x i8] c"%5d DEFICIENT\0A\00"
@.str.4 = [15 x i8] c"%5d ABUNDANT\0A\00"
@.str.5 = [15 x i8] c"END OF OUTPUT\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %46, %0
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %48
10: ; preds = %7
store i32 0, i32* %4
store i32 1, i32* %2
br label %11
11: ; preds = %25, %10
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %28
15: ; preds = %11
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = srem i32 %16, %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i32, i32* %2
%22 = load i32, i32* %4
%23 = add nsw i32 %22, %21
store i32 %23, i32* %4
br label %24
24: ; preds = %20, %15
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %11
28: ; preds = %11
%29 = load i32, i32* %4
%30 = load i32, i32* %3
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load i32, i32* %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %33)
br label %46
35: ; preds = %28
%36 = load i32, i32* %4
%37 = load i32, i32* %3
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load i32, i32* %3
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %40)
br label %45
42: ; preds = %35
%43 = load i32, i32* %3
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42, %39
br label %46
46: ; preds = %45, %32
%47 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %7
48: ; preds = %7
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.2 = [14 x i8] c"%5d PERFECT\0A\00"
@.str.3 = [16 x i8] c"%5d DEFICIENT\0A\00"
@.str.4 = [15 x i8] c"%5d ABUNDANT\0A\00"
@str = [18 x i8] c"PERFECTION OUTPUT\00"
@str.6 = [14 x i8] c"END OF OUTPUT\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %52, label %7
7: ; preds = %0, %42
%8 = phi i32 [ %50, %42 ], [ %5, %0 ]
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %42
10: ; preds = %7
%11 = add i32 %8, -1
%12 = and i32 %11, 1
%13 = icmp eq i32 %8, 2
br i1 %13, label %32, label %14
14: ; preds = %10
%15 = and i32 %11, -2
br label %16
16: ; preds = %16, %14
%17 = phi i32 [ 0, %14 ], [ %28, %16 ]
%18 = phi i32 [ 1, %14 ], [ %29, %16 ]
%19 = phi i32 [ 0, %14 ], [ %30, %16 ]
%20 = srem i32 %8, %18
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i32 %18, i32 0
%23 = add nuw nsw i32 %22, %17
%24 = add nuw nsw i32 %18, 1
%25 = srem i32 %8, %24
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i32 %24, i32 0
%28 = add nuw nsw i32 %27, %23
%29 = add nuw nsw i32 %18, 2
%30 = add i32 %19, 2
%31 = icmp eq i32 %30, %15
br i1 %31, label %32, label %16
32: ; preds = %16, %10
%33 = phi i32 [ undef, %10 ], [ %28, %16 ]
%34 = phi i32 [ 0, %10 ], [ %28, %16 ]
%35 = phi i32 [ 1, %10 ], [ %29, %16 ]
%36 = icmp eq i32 %12, 0
br i1 %36, label %42, label %37
37: ; preds = %32
%38 = srem i32 %8, %35
%39 = icmp eq i32 %38, 0
%40 = select i1 %39, i32 %35, i32 0
%41 = add nuw nsw i32 %40, %34
br label %42
42: ; preds = %37, %32, %7
%43 = phi i32 [ 0, %7 ], [ %33, %32 ], [ %41, %37 ]
%44 = icmp eq i32 %43, %8
%45 = icmp slt i32 %43, %8
%46 = select i1 %45, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0)
%47 = select i1 %44, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %47, i32 %8)
%49 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%50 = load i32, i32* %1
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %7
52: ; preds = %42, %0
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}