#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 */
typedef int /*<<< orphan*/ divisors;

/* Variables and functions */
int /*<<< orphan*/ getDivisors(unsigned int, int *);
int sumOfArrayElements(int *, int);
char *clasifyNaturalNumber(unsigned number) {
  int sum = 0, divisors[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      limit = sizeof(divisors) / sizeof(divisors[0]);
  getDivisors(number, divisors);
  sum = sumOfArrayElements(divisors, limit);
  if (sum > number)
    return "abundante";
  else if (sum < number)
    return "deficiente";
  else
    return "perfecto";
}


x86 assembly (clang, -O0):
<clasifyNaturalNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0xa,-0x44(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1030 <getDivisors@plt>
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1050 <sumOfArrayElements@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jbe    1190 <clasifyNaturalNumber+0x60>
lea    0xe79(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <clasifyNaturalNumber+0x87>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11ac <clasifyNaturalNumber+0x7c>
lea    0xe67(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b7 <clasifyNaturalNumber+0x87>
lea    0xe62(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clasifyNaturalNumber>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
mov    %rsp,%r14
mov    %r14,%rsi
call   1030 <getDivisors@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1040 <sumOfArrayElements@plt>
cmp    %ebx,%eax
lea    0xeab(%rip),%rax
lea    0xeaf(%rip),%rcx
cmovb  %rax,%rcx
lea    0xe8f(%rip),%rax
cmovbe %rcx,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"abundante\00"
@.str.1 = [11 x i8] c"deficiente\00"
@.str.2 = [9 x i8] c"perfecto\00"
define i8* @clasifyNaturalNumber(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i32]
%6 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
%7 = bitcast [10 x i32]* %5 to i8*
store i32 10, i32* %6
%8 = load i32, i32* %3
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%10 = call i32 @getDivisors(i32 %8, i32* %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%12 = load i32, i32* %6
%13 = call i32 @sumOfArrayElements(i32* %11, i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = icmp ugt i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %24
18: ; preds = %1
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = icmp ult i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %24
23: ; preds = %18
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %24
24: ; preds = %23, %22, %17
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
@.str = [10 x i8] c"abundante\00"
@.str.1 = [11 x i8] c"deficiente\00"
@.str.2 = [9 x i8] c"perfecto\00"
define i8* @clasifyNaturalNumber(i32 %0) {
%2 = alloca [10 x i32]
%3 = bitcast [10 x i32]* %2 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%5 = call i32 @getDivisors(i32 %0, i32* %4)
%6 = call i32 @sumOfArrayElements(i32* %4, i32 10)
%7 = icmp ugt i32 %6, %0
%8 = icmp ult i32 %6, %0
%9 = select i1 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0)
%10 = select i1 %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %9
ret i8* %10
}