#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*/ IO_printLine(char *);
int isPerfect(int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int);
int testPerfect(int i, int expected, int n) {
  char line[200];
  if (isPerfect(n) == expected) {
    snprintf(line, 200, "ok %d - isPerfect(%d) == %d", i, n, expected);
  } else {
    snprintf(line, 200, "not ok %d - isPerfect(%d) == %d", i, n, expected);
  }
  IO_printLine(line);
}


x86 assembly (clang, -O0):
<testPerfect>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <isPerfect@plt>
cmp    -0xc(%rbp),%eax
jne    117d <testPerfect+0x4d>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0xc(%rbp),%r9d
mov    $0xc8,%esi
lea    0xe91(%rip),%rdx
call   1040 <snprintf@plt>
jmp    11a0 <testPerfect+0x70>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0xc(%rbp),%r9d
mov    $0xc8,%esi
lea    0xe65(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <IO_printLine@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testPerfect>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
mov    %edx,%edi
call   1030 <isPerfect@plt>
cmp    %ebp,%eax
lea    0xeb0(%rip),%rax
lea    0xea5(%rip),%rdx
cmove  %rax,%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xc8,%esi
mov    %r14d,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
call   1040 <snprintf@plt>
mov    %r15,%rdi
call   1050 <IO_printLine@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"ok %d - isPerfect(%d) == %d\00"
@.str.1 = [32 x i8] c"not ok %d - isPerfect(%d) == %d\00"
define i32 @testPerfect(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [200 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %7
%10 = call i32 @isPerfect(i32 %9)
%11 = load i32, i32* %6
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %19
13: ; preds = %3
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%15 = load i32, i32* %5
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = call i32 @snprintf(i8* %14, i32 200, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
br label %25
19: ; preds = %3
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%21 = load i32, i32* %5
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = call i32 @snprintf(i8* %20, i32 200, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
br label %25
25: ; preds = %19, %13
%26 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%27 = call i32 @IO_printLine(i8* %26)
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@.str = [28 x i8] c"ok %d - isPerfect(%d) == %d\00"
@.str.1 = [32 x i8] c"not ok %d - isPerfect(%d) == %d\00"
define i32 @testPerfect(i32 %0, i32 %1, i32 %2) {
%4 = alloca [200 x i8]
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @isPerfect(i32 %2)
%7 = icmp eq i32 %6, %1
%8 = select i1 %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0)
%9 = call i32 @snprintf(i8* %5, i32 200, i8* %8, i32 %0, i32 %2, i32 %1)
%10 = call i32 @IO_printLine(i8* %5)
ret i32 undef
}