#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ atoll(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ print_prime_factors(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *file;
  char line[256];
  if (argc < 2)
    return 1;
  file = fopen(argv[1], "r");
  if (file == NULL)
    return 1;
  while (fgets(line, 256, file) != NULL)
    print_prime_factors(atoll(line));
  fclose(file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    117f <main+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    11fa <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe72(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11ae <main+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    11fa <main+0xaa>
jmp    11b3 <main+0x63>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11ea <main+0x9a>
lea    -0x120(%rbp),%rdi
call   1050 <atoll@plt>
mov    %eax,%edi
call   1060 <print_prime_factors@plt>
jmp    11b3 <main+0x63>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
mov    $0x1,%ebp
cmp    $0x2,%edi
jl     11ce <main+0x7e>
mov    0x8(%rsi),%rdi
lea    0xe92(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11ce <main+0x7e>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11c4 <main+0x74>
mov    %rsp,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rdi
call   1050 <atoll@plt>
mov    %eax,%edi
call   1060 <print_prime_factors@plt>
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    11a0 <main+0x50>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %21, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %21, label %11
11: ; preds = %6
%12 = call i32* @fgets(i8* %4, i32 256, i32* %9)
%13 = icmp eq i32* %12, null
br i1 %13, label %19, label %14
14: ; preds = %11, %14
%15 = call i32 @atoll(i8* %4)
%16 = call i32 @print_prime_factors(i32 %15)
%17 = call i32* @fgets(i8* %4, i32 256, i32* %9)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %14
19: ; preds = %14, %11
%20 = call i32 @fclose(i32* %9)
br label %21
21: ; preds = %6, %2, %19
%22 = phi i32 [ 0, %19 ], [ 1, %2 ], [ 1, %6 ]
ret i32 %22
}