#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;

/* Variables and functions */
int get_prime_factors(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
void print_prime_factors(uint64_t n) {
  uint64_t factors[64];
  int j, k;
  k = get_prime_factors(n, factors);
  printf("%ju: ", n);
  for (j = 0; j < k; j++) {
    printf("%lu ", factors[j]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_prime_factors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x110(%rbp),%rsi
call   1040 <get_prime_factors@plt>
mov    %eax,-0x118(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmp    -0x118(%rbp),%eax
jge    11a0 <print_prime_factors+0x80>
movslq -0x114(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    115e <print_prime_factors+0x3e>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_prime_factors>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %edi,%ebp
mov    %rsp,%rsi
call   1050 <get_prime_factors@plt>
mov    %eax,%ebx
lea    0xeb2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    1186 <print_prime_factors+0x56>
mov    %ebx,%ebp
lea    0xea2(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <print_prime_factors+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%ju: \00"
@.str.1 = [5 x i8] c"%lu \00"
define void @print_prime_factors(i32 %0) {
%2 = alloca [64 x i32]
%3 = bitcast [64 x i32]* %2 to i8*
%4 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%5 = call i32 @get_prime_factors(i32 %0, i32* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %17
8: ; preds = %1
%9 = zext i32 %5 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %15, %10 ]
%12 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, %9
br i1 %16, label %17, label %10
17: ; preds = %10, %1
%18 = call i32 @putchar(i32 10)
ret void
}