#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*/ prime_factors(int, int *);
int /*<<< orphan*/ prime_list(int, int **);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int num = 13195;
  bool *primes = NULL;
  prime_list(num, &primes);
  printf("prime factors of %d: ", num);
  prime_factors(num, primes);
  num = 111475139;
  prime_list(num, &primes);
  printf("prime factors of %d: ", num);
  prime_factors(num, primes);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x338b,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1050 <prime_list@plt>
mov    -0x8(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <prime_factors@plt>
movl   $0x6a4f9c3,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1050 <prime_list@plt>
mov    -0x8(%rbp),%esi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <prime_factors@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%r14
mov    $0x338b,%edi
mov    %r14,%rsi
call   1050 <prime_list@plt>
lea    0xead(%rip),%rbx
mov    %rbx,%rdi
mov    $0x338b,%esi
call   1030 <printf@plt>
mov    (%rsp),%rsi
mov    $0x338b,%edi
call   1040 <prime_factors@plt>
mov    $0x6a4f9c3,%edi
mov    %r14,%rsi
call   1050 <prime_list@plt>
mov    %rbx,%rdi
mov    $0x6a4f9c3,%esi
call   1030 <printf@plt>
mov    (%rsp),%rsi
mov    $0x6a4f9c3,%edi
call   1040 <prime_factors@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"prime factors of %d: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 13195, i32* %2
store i32* null, i32** %3
%4 = load i32, i32* %2
%5 = call i32 @prime_list(i32 %4, i32** %3)
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %2
%9 = load i32*, i32** %3
%10 = call i32 @prime_factors(i32 %8, i32* %9)
store i32 111475139, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @prime_list(i32 %11, i32** %3)
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = load i32*, i32** %3
%17 = call i32 @prime_factors(i32 %15, i32* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"prime factors of %d: \00"
define i32 @main() {
%1 = alloca i32*
%2 = bitcast i32** %1 to i8*
store i32* null, i32** %1
%3 = call i32 @prime_list(i32 13195, i32** %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 13195)
%5 = load i32*, i32** %1
%6 = call i32 @prime_factors(i32 13195, i32* %5)
%7 = call i32 @prime_list(i32 111475139, i32** %1)
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 111475139)
%9 = load i32*, i32** %1
%10 = call i32 @prime_factors(i32 111475139, i32* %9)
ret i32 0
}