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

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ print_prime_factors(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  uint64_t p;
  int result = 0;
  FILE *fichier;
  fichier = fopen("number.txt", "r");
  int finish = 0;
  while (finish == 0) {
    if (fscanf(fichier, "%ju", &p) != EOF) {
      print_prime_factors(p);
    } else {
      finish = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeac(%rip),%rdi
lea    0xeb0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11b2 <main+0x82>
mov    -0x20(%rbp),%rdi
lea    0xe8d(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <fscanf@plt>
mov    0x2e58(%rip),%rcx
cmp    (%rcx),%rax
je     11a6 <main+0x76>
mov    -0x14(%rbp),%edi
call   1040 <print_prime_factors@plt>
jmp    11ad <main+0x7d>
movl   $0x1,-0x24(%rbp)
jmp    116b <main+0x3b>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
call   1030 <fscanf@plt>
mov    0x2e7f(%rip),%r12
cmp    (%r12),%rax
je     119d <main+0x6d>
lea    0xe97(%rip),%r14
lea    0x4(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
call   1040 <print_prime_factors@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <fscanf@plt>
cmp    (%r12),%rax
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"number.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%ju\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%10 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %8
store i32 0, i32* %9
br label %11
11: ; preds = %23, %2
%12 = load i32, i32* %9
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32*, i32** %8
%16 = call i64 @fscanf(i32* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%17 = load i64, i64* @EOF
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* %6
%21 = call i32 @print_prime_factors(i32 %20)
br label %23
22: ; preds = %14
store i32 1, i32* %9
br label %23
23: ; preds = %22, %19
br label %11
24: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"number.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%ju\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i64 @fscanf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %15, label %9
9: ; preds = %2, %9
%10 = load i32, i32* %3
%11 = call i32 @print_prime_factors(i32 %10)
%12 = call i64 @fscanf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %9
15: ; preds = %9, %2
ret i32 0
}