#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*/ primeFactor(unsigned long const, unsigned long *);
int /*<<< orphan*/ printf(char *, unsigned long);
int main(void) {
  unsigned long int factors[100];
  const unsigned long int BIGNUM = 600851475143;
  for (int pre = 0; pre < 100; pre++) {
    *(factors + pre) = 0;
  }
  primeFactor(BIGNUM, factors);
  for (int i = 0; i < 100; i++) {
    printf("%lu ", factors[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x8be589eac7,%rax
mov    %rax,-0x338(%rbp)
movl   $0x0,-0x33c(%rbp)
cmpl   $0x64,-0x33c(%rbp)
jge    1181 <main+0x61>
movslq -0x33c(%rbp),%rax
movq   $0x0,-0x330(%rbp,%rax,8)
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    114d <main+0x2d>
lea    -0x330(%rbp),%rsi
movabs $0x8be589eac7,%rdi
call   1040 <primeFactor@plt>
movl   $0x0,-0x340(%rbp)
cmpl   $0x64,-0x340(%rbp)
jge    11dd <main+0xbd>
movslq -0x340(%rbp),%rax
mov    -0x330(%rbp,%rax,8),%rsi
ff
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x340(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x340(%rbp)
jmp    11a1 <main+0x81>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x328,%rsp
mov    %rsp,%r14
xor    %ebx,%ebx
mov    $0x320,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
movabs $0x8be589eac7,%rdi
mov    %r14,%rsi
call   1050 <primeFactor@plt>
lea    0xe99(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lu \00"
define i32 @main() {
%1 = alloca [100 x i64]
%2 = bitcast [100 x i64]* %1 to i8*
%3 = getelementptr inbounds [100 x i64], [100 x i64]* %1, i64 0, i64 0
%4 = call i32 @primeFactor(i64 600851475143, i64* %3)
br label %6
5: ; preds = %6
ret i32 0
6: ; preds = %0, %6
%7 = phi i64 [ 0, %0 ], [ %11, %6 ]
%8 = getelementptr inbounds [100 x i64], [100 x i64]* %1, i64 0, i64 %7
%9 = load i64, i64* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, 100
br i1 %12, label %5, label %6
}