#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__ is_perfect_num(int);
int /*<<< orphan*/ printf(char *, ...);
void disp_perfect_num() {
  int x;
  printf("The perfect numbers are : \n");
  for (x = 1; x < 10000; x++)
    if (is_perfect_num(x))
      printf("%d\n", x);
}


x86 assembly (clang, -O0):
<disp_perfect_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jge    1180 <disp_perfect_num+0x60>
mov    -0x4(%rbp),%edi
call   1040 <is_perfect_num@plt>
cmp    $0x0,%rax
je     116d <disp_perfect_num+0x4d>
mov    -0x4(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1172 <disp_perfect_num+0x52>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <disp_perfect_num+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disp_perfect_num>:
push   %r14
push   %rbx
push   %rax
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
lea    0xeb4(%rip),%r14
jmp    115b <disp_perfect_num+0x2b>
xchg   %ax,%ax
add    $0x1,%ebx
cmp    $0x2710,%ebx
je     1175 <disp_perfect_num+0x45>
mov    %ebx,%edi
call   1050 <is_perfect_num@plt>
test   %rax,%rax
je     1150 <disp_perfect_num+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <disp_perfect_num+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"The perfect numbers are : \0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @disp_perfect_num() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 10000
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i64 @is_perfect_num(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %6
br label %14
14: ; preds = %13
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %3
17: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [27 x i8] c"The perfect numbers are : \00"
define void @disp_perfect_num() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %8
%3 = phi i32 [ 1, %0 ], [ %9, %8 ]
%4 = tail call i64 @is_perfect_num(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %8
8: ; preds = %2, %6
%9 = add nuw nsw i32 %3, 1
%10 = icmp eq i32 %9, 10000
br i1 %10, label %11, label %2
11: ; preds = %8
ret void
}