#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__ printf(char *, int);
int main() {
  int j, i;
  for (i = 1; ++i < 1000000; i - j || printf("%d ", i))
    for (j = 1; i % ++j;)
      ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    $0xf4240,%eax
jge    1198 <main+0x88>
movl   $0x1,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltd
idiv   %ecx
cmp    $0x0,%edx
je     115e <main+0x4e>
jmp    1141 <main+0x31>
jmp    1163 <main+0x53>
mov    -0xc(%rbp),%ecx
sub    -0x8(%rbp),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
jne    1190 <main+0x80>
mov    -0xc(%rbp),%esi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x2,%ebx
mov    $0xffffffff,%ebp
lea    0xedb(%rip),%r14
jmp    113e <main+0x2e>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0xffffffff,%ebp
cmp    $0xf4240,%ebx
je     1170 <main+0x60>
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
add    $0x1,%ecx
test   %edx,%edx
jne    1150 <main+0x40>
add    %ebp,%ecx
cmp    $0x2,%ecx
jne    1130 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
br label %4
4: ; preds = %26, %0
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = icmp slt i32 %6, 1000000
br i1 %7, label %8, label %29
8: ; preds = %4
store i32 1, i32* %2
br label %9
9: ; preds = %15, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
%13 = srem i32 %10, %12
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %9
br label %9
16: ; preds = %9
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = sub nsw i32 %18, %19
%21 = icmp ne i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %17
%23 = load i32, i32* %3
%24 = call i64 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = icmp ne i64 %24, 0
br label %26
26: ; preds = %22, %17
%27 = phi i1 [ true, %17 ], [ %25, %22 ]
%28 = zext i1 %27 to i32
br label %4
29: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
br label %1
1: ; preds = %0, %13
%2 = phi i32 [ 2, %0 ], [ %14, %13 ]
%3 = phi i32 [ 1, %0 ], [ %2, %13 ]
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ %6, %4 ], [ 1, %1 ]
%6 = add nuw nsw i32 %5, 1
%7 = urem i32 %2, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = icmp eq i32 %3, %5
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i64 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %13
13: ; preds = %11, %9
%14 = add nuw nsw i32 %2, 1
%15 = icmp eq i32 %14, 1000000
br i1 %15, label %16, label %1
16: ; preds = %13
ret i32 0
}