#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 *, ...);
int main() {
  int i, temp;
  printf("\n1");
  for (i = 2; i <= 10000; i++) {
    temp = i;
    while (temp % 2 == 0)
      temp = temp / 2;
    while (temp % 3 == 0)
      temp = temp / 3;
    while (temp % 5 == 0)
      temp = temp / 5;
    if (temp == 1)
      printf("\n%d", i);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jg     11f4 <main+0xe4>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116e <main+0x5e>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1147 <main+0x37>
jmp    1173 <main+0x63>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119a <main+0x8a>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1173 <main+0x63>
jmp    119f <main+0x8f>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c6 <main+0xb6>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    119f <main+0x8f>
cmpl   $0x1,-0xc(%rbp)
jne    11e1 <main+0xd1>
mov    -0x8(%rbp),%esi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <main+0xd6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%ebx
lea    0xed5(%rip),%r14
jmp    113f <main+0x2f>
add    $0x1,%ebx
cmp    $0x2711,%ebx
je     1204 <main+0xf4>
mov    %ebx,%eax
test   $0x1,%bl
jne    1160 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ecx,%eax
test   $0x1,%cl
je     1150 <main+0x40>
imul   $0xaaaaaaab,%eax,%ecx
add    $0x2aaaaaaa,%ecx
cmp    $0x55555554,%ecx
ja     11aa <main+0x9a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
imul   $0xaaaaaaab,%eax,%ecx
add    $0x2aaaaaaa,%ecx
cmp    $0x55555555,%ecx
jb     1180 <main+0x70>
imul   $0xcccccccd,%eax,%ecx
add    $0x19999999,%ecx
cmp    $0x33333332,%ecx
ja     11ea <main+0xda>
xchg   %ax,%ax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
imul   $0xcccccccd,%eax,%ecx
add    $0x19999999,%ecx
cmp    $0x33333333,%ecx
jb     11c0 <main+0xb0>
cmp    $0x1,%eax
jne    1130 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0A1\00"
@.str.1 = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %34
%3 = phi i32 [ 2, %0 ], [ %35, %34 ]
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %10, %2
%7 = phi i32 [ %3, %2 ], [ %12, %10 ]
%8 = srem i32 %7, 3
%9 = icmp eq i32 %8, 0
br i1 %9, label %19, label %15
10: ; preds = %2, %10
%11 = phi i32 [ %12, %10 ], [ %3, %2 ]
%12 = sdiv i32 %11, 2
%13 = and i32 %12, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %10, label %6
15: ; preds = %19, %6
%16 = phi i32 [ %7, %6 ], [ %21, %19 ]
%17 = srem i32 %16, 5
%18 = icmp eq i32 %17, 0
br i1 %18, label %24, label %29
19: ; preds = %6, %19
%20 = phi i32 [ %21, %19 ], [ %7, %6 ]
%21 = sdiv i32 %20, 3
%22 = srem i32 %21, 3
%23 = icmp eq i32 %22, 0
br i1 %23, label %19, label %15
24: ; preds = %15, %24
%25 = phi i32 [ %26, %24 ], [ %16, %15 ]
%26 = sdiv i32 %25, 5
%27 = srem i32 %26, 5
%28 = icmp eq i32 %27, 0
br i1 %28, label %24, label %29
29: ; preds = %24, %15
%30 = phi i32 [ %16, %15 ], [ %26, %24 ]
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = 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 %34
34: ; preds = %29, %32
%35 = add nuw nsw i32 %3, 1
%36 = icmp eq i32 %35, 10001
br i1 %36, label %37, label %2
37: ; preds = %34
ret i32 0
}