#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*/);
int /*<<< orphan*/ printf(char *, ...);
void print_prime_factors(uint64_t n) {
  uint64_t factors[64];
  int j, k;
  k = get_prime_factors(0, factors, n);
  printf("%ju: ", n);
  for (j = 0; j <= k; j++) {
    printf("%ju ", factors[j]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_prime_factors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x110(%rbp),%rsi
mov    -0x4(%rbp),%edx
xor    %edi,%edi
call   1040 <get_prime_factors@plt>
mov    %eax,-0x118(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmp    -0x118(%rbp),%eax
jg     11a2 <print_prime_factors+0x82>
movslq -0x114(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1160 <print_prime_factors+0x40>
lea    0xe62(%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
xor    %edi,%edi
mov    %ebp,%edx
call   1050 <get_prime_factors@plt>
mov    %eax,%ebx
lea    0xeae(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
js     1186 <print_prime_factors+0x56>
add    $0x1,%ebx
lea    0xe9d(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
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"%ju \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 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%7 = load i32, i32* %2
%8 = call i32 @get_prime_factors(i32 0, 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 sle 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"%ju \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, i32 %0)
%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 slt i32 %5, 0
br i1 %7, label %18, label %8
8: ; preds = %1
%9 = add nuw i32 %5, 1
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %16, %11 ]
%13 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %1
%19 = call i32 @putchar(i32 10)
ret void
}