#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 *, long);
long strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  long number = strtol(argv[1], NULL, 0);
  for (long candidate = 2; number > 1; candidate++) {
    for (; number % candidate == 0; number /= candidate) {
      printf("%ld\n", candidate);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %rax,-0x18(%rbp)
movq   $0x2,-0x20(%rbp)
cmpq   $0x1,-0x18(%rbp)
jle    11b5 <main+0x95>
jmp    1165 <main+0x45>
mov    -0x18(%rbp),%rax
cqto
idivq  -0x20(%rbp)
cmp    $0x0,%rdx
jne    119f <main+0x7f>
mov    -0x20(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
jmp    1165 <main+0x45>
jmp    11a4 <main+0x84>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1155 <main+0x35>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtol@plt>
cmp    $0x2,%rax
jl     11b6 <main+0x96>
mov    %rax,%r14
mov    $0x2,%ebx
lea    0xeb9(%rip),%r15
jmp    115b <main+0x3b>
nopl   0x0(%rax)
mov    %r14,%rax
cqto
idiv   %rbx
mov    %rax,%r14
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     11a0 <main+0x80>
mov    %r14,%rax
cqto
idiv   %rbx
test   %rdx,%rdx
jne    11ac <main+0x8c>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
jne    1150 <main+0x30>
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
mov    %eax,%r14d
jmp    115b <main+0x3b>
nopw   0x0(%rax,%rax,1)
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
je     1174 <main+0x54>
add    $0x1,%rbx
cmp    $0x1,%r14
jg     115b <main+0x3b>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

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