#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int N, i, cpyN;
  scanf("%d", &N);
  for (i = 2; i * i <= N; i++) {
    while (N % i == 0) {
      printf("%d\n", i);
      N /= i;
    }
  }
  if (N > 1)
    printf("%d\n", N);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     119e <main+0x7e>
jmp    115b <main+0x3b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    118b <main+0x6b>
mov    -0xc(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    115b <main+0x3b>
jmp    1190 <main+0x70>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
cmpl   $0x1,-0x8(%rbp)
jle    11b7 <main+0x97>
mov    -0x8(%rbp),%esi
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x4,%esi
jge    1159 <main+0x39>
cmp    $0x2,%esi
jl     114f <main+0x2f>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x2,%ebx
lea    0xe9e(%rip),%r14
jmp    117c <main+0x5c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %ebx,%eax
imul   %ebx,%eax
cmp    %esi,%eax
jg     113e <main+0x1e>
mov    %esi,%eax
xchg   %ax,%ax
cltd
idiv   %ebx
test   %edx,%edx
jne    1170 <main+0x50>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cltd
idiv   %ebx
mov    %eax,%esi
mov    %eax,0x4(%rsp)
jmp    1180 <main+0x60>

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

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