#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() {
  int sum = 0;
  int num;
  printf("Enter num: ");
  scanf("%d", &num);
  for (int i = 1; i < num; ++i) {
    if (num % i == 0)
      sum += i;
  }
  if (sum > num)
    printf("The number you entered is abundant");
  else
    printf("%d is not abundant", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1193 <main+0x73>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1180 <main+0x60>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <main+0x65>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115b <main+0x3b>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11b2 <main+0x92>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c3 <main+0xa3>
mov    -0xc(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2,%esi
jl     1173 <main+0x53>
lea    -0x1(%rsi),%r8d
cmp    $0x2,%esi
jne    119d <main+0x7d>
xor    %ebx,%ebx
mov    $0x1,%ecx
test   $0x1,%r8b
je     1173 <main+0x53>
mov    %esi,%eax
cltd
idiv   %ecx
xor    %eax,%eax
test   %edx,%edx
cmove  %ecx,%eax
add    %eax,%ebx
cmp    %esi,%ebx
jle    1187 <main+0x67>
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1195 <main+0x75>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
xor    %ebx,%ebx
mov    $0x1,%ecx
jmp    11ba <main+0x9a>
nopl   (%rax)
add    %eax,%ebx
add    $0x2,%ecx
cmp    %r9d,%edi
je     115f <main+0x3f>
mov    %esi,%eax
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
je     11c7 <main+0xa7>
xor    %eax,%eax
add    %eax,%ebx
lea    0x1(%rcx),%edi
mov    %esi,%eax
cltd
idiv   %edi
mov    %edi,%eax
test   %edx,%edx
je     11b0 <main+0x90>
xor    %eax,%eax
jmp    11b0 <main+0x90>

LLVM IR (-O0):
@.str = [12 x i8] c"Enter num: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"The number you entered is abundant\00"
@.str.3 = [19 x i8] c"%d is not abundant\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 1, i32* %4
br label %7
7: ; preds = %21, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = srem i32 %12, %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = add nsw i32 %18, %17
store i32 %19, i32* %2
br label %20
20: ; preds = %16, %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %7
24: ; preds = %7
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = icmp sgt i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %33
30: ; preds = %24
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %28
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Enter num: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"The number you entered is abundant\00"
@.str.3 = [19 x i8] c"%d is not abundant\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %23
7: ; preds = %0
%8 = add i32 %5, -1
%9 = and i32 %8, 1
%10 = icmp eq i32 %5, 2
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = and i32 %8, -2
br label %26
13: ; preds = %26, %7
%14 = phi i32 [ undef, %7 ], [ %38, %26 ]
%15 = phi i32 [ 1, %7 ], [ %39, %26 ]
%16 = phi i32 [ 0, %7 ], [ %38, %26 ]
%17 = icmp eq i32 %9, 0
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = srem i32 %5, %15
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i32 %15, i32 0
%22 = add nuw nsw i32 %21, %16
br label %23
23: ; preds = %18, %13, %0
%24 = phi i32 [ 0, %0 ], [ %14, %13 ], [ %22, %18 ]
%25 = icmp sgt i32 %24, %5
br i1 %25, label %42, label %44
26: ; preds = %26, %11
%27 = phi i32 [ 1, %11 ], [ %39, %26 ]
%28 = phi i32 [ 0, %11 ], [ %38, %26 ]
%29 = phi i32 [ 0, %11 ], [ %40, %26 ]
%30 = srem i32 %5, %27
%31 = icmp eq i32 %30, 0
%32 = select i1 %31, i32 %27, i32 0
%33 = add nuw nsw i32 %32, %28
%34 = add nuw nsw i32 %27, 1
%35 = srem i32 %5, %34
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, i32 %34, i32 0
%38 = add nuw nsw i32 %37, %33
%39 = add nuw nsw i32 %27, 2
%40 = add i32 %29, 2
%41 = icmp eq i32 %40, %12
br i1 %41, label %13, label %26
42: ; preds = %23
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %46
44: ; preds = %23
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %5)
br label %46
46: ; preds = %44, %42
ret i32 0
}