#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 *, ...);
void main() {
  int sum = 0;
  int i = 0, j = 0;
  int range = 1;
  int factor = 1;
  for (range = 1; range <= 1000; range++) {
    sum = 0;
    i = range;
    factor = 2;
    while (factor <= i) {
      if (0 == i % factor) {
        i = i / factor;
        sum = sum + factor;
      } else {
        factor++;
      }
    }
    if (range == sum + 1)
      printf("%-3d", range);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jg     11db <main+0xcb>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a6 <main+0x96>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x14(%rbp)
xor    %eax,%eax
cmp    %edx,%eax
jne    1198 <main+0x88>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a1 <main+0x91>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <main+0x53>
mov    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11c8 <main+0xb8>
mov    -0x10(%rbp),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cd <main+0xbd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <main+0x32>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebp
lea    0xed0(%rip),%r14
jmp    114b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    $0x3e9,%ebp
je     1193 <main+0x73>
mov    $0x0,%ebx
cmp    $0x2,%ebp
jb     117e <main+0x5e>
xor    %edi,%edi
mov    $0x2,%esi
mov    %ebp,%ecx
xchg   %ax,%ax
mov    %ecx,%eax
cltd
idiv   %esi
lea    (%rsi,%rdi,1),%ebx
test   %edx,%edx
cmove  %eax,%ecx
cmovne %edi,%ebx
lea    0x1(%rsi),%eax
cmove  %esi,%eax
mov    %eax,%esi
mov    %ebx,%edi
cmp    %ecx,%eax
jle    1160 <main+0x40>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1140 <main+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%-3d\00"
define void @main() {
br label %1
1: ; preds = %0, %23
%2 = phi i32 [ 1, %0 ], [ %24, %23 ]
%3 = icmp ult i32 %2, 2
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %15, %4 ], [ 2, %1 ]
%6 = phi i32 [ %14, %4 ], [ 0, %1 ]
%7 = phi i32 [ %13, %4 ], [ %2, %1 ]
%8 = srem i32 %7, %5
%9 = sdiv i32 %7, %5
%10 = icmp eq i32 %8, 0
%11 = add nsw i32 %5, %6
%12 = add nsw i32 %5, 1
%13 = select i1 %10, i32 %9, i32 %7
%14 = select i1 %10, i32 %11, i32 %6
%15 = select i1 %10, i32 %5, i32 %12
%16 = icmp sgt i32 %15, %13
br i1 %16, label %17, label %4
17: ; preds = %4, %1
%18 = phi i32 [ 0, %1 ], [ %14, %4 ]
%19 = add nsw i32 %18, 1
%20 = icmp eq i32 %2, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %23
23: ; preds = %17, %21
%24 = add nuw nsw i32 %2, 1
%25 = icmp eq i32 %24, 1001
br i1 %25, label %26, label %1
26: ; preds = %23
%27 = tail call i32 @putchar(i32 10)
ret void
}