#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 */
scalar_t__ isPrime(int);
int /*<<< orphan*/ printf(char *, int);
void primeFactorization(long n) {
  while (n != 1) {
    int i;
    if (isPrime(n)) {
      printf("%ld\n", n);
      break;
    }
    for (i = 0; i <= n; i++) {
      if (!isPrime(i))
        continue;
      else {
        if ((n % i == 0) && (n / i != 1)) {
          printf("%d * ", i);
          n /= i;
          break;
        } else if ((n % i == 0) && (n / i == 1)) {
          printf("%d\n", i);
          n /= i;
          break;
        } else {
          continue;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<primeFactorization>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x1,-0x8(%rbp)
je     124d <primeFactorization+0x12d>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1163 <primeFactorization+0x43>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    124d <primeFactorization+0x12d>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1248 <primeFactorization+0x128>
mov    -0xc(%rbp),%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
jne    118f <primeFactorization+0x6f>
jmp    123a <primeFactorization+0x11a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    11e2 <primeFactorization+0xc2>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x1,%rax
je     11e2 <primeFactorization+0xc2>
mov    -0xc(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    1248 <primeFactorization+0x128>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    1235 <primeFactorization+0x115>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x1,%rax
jne    1235 <primeFactorization+0x115>
mov    -0xc(%rbp),%esi
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    1248 <primeFactorization+0x128>
jmp    123a <primeFactorization+0x11a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <primeFactorization+0x4a>
jmp    112c <primeFactorization+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primeFactorization>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x1,%rdi
jne    1139 <primeFactorization+0x19>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    %rdi,%r12
lea    0xebd(%rip),%r14
lea    0xec1(%rip),%r13
lea    0xeb4(%rip),%r15
jmp    1166 <primeFactorization+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x1,%r12
je     112f <primeFactorization+0xf>
mov    %r12d,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
jne    1203 <primeFactorization+0xe3>
test   %r12,%r12
js     1160 <primeFactorization+0x40>
xor    %ebx,%ebx
jmp    1190 <primeFactorization+0x70>
mov    %r12,%rax
cqto
idiv   %rbx
test   %rdx,%rdx
jne    11b4 <primeFactorization+0x94>
jmp    11c0 <primeFactorization+0xa0>
nop
mov    %ebx,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
je     11b4 <primeFactorization+0x94>
mov    %r12,%rax
or     %rbx,%rax
shr    $0x20,%rax
jne    1180 <primeFactorization+0x60>
mov    %r12d,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
je     11c0 <primeFactorization+0xa0>
add    $0x1,%rbx
cmp    %rbx,%r12
jge    1190 <primeFactorization+0x70>
jmp    1160 <primeFactorization+0x40>
nop
mov    %ebx,%ecx
mov    %r12,%rax
shr    $0x20,%rax
je     11de <primeFactorization+0xbe>
mov    %r12,%rax
cqto
idiv   %rcx
mov    %rax,%r12
cmp    $0x1,%r12
jne    11ee <primeFactorization+0xce>
jmp    11fd <primeFactorization+0xdd>
mov    %r12d,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%r12d
cmp    $0x1,%r12
je     11fd <primeFactorization+0xdd>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1160 <primeFactorization+0x40>
mov    %rbx,%r12
mov    %r13,%r14
mov    %r14,%rdi
mov    %r12d,%esi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [6 x i8] c"%d * \00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @primeFactorization(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
br label %4
4: ; preds = %69, %1
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 1
br i1 %6, label %7, label %70
7: ; preds = %4
%8 = load i64, i64* %2
%9 = trunc i64 %8 to i32
%10 = call i64 @isPrime(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i64, i64* %2
%14 = trunc i64 %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %70
16: ; preds = %7
store i32 0, i32* %3
br label %17
17: ; preds = %66, %16
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = load i64, i64* %2
%21 = icmp sle i64 %19, %20
br i1 %21, label %22, label %69
22: ; preds = %17
%23 = load i32, i32* %3
%24 = call i64 @isPrime(i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
br label %66
27: ; preds = %22
%28 = load i64, i64* %2
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = srem i64 %28, %30
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %46
33: ; preds = %27
%34 = load i64, i64* %2
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = sdiv i64 %34, %36
%38 = icmp ne i64 %37, 1
br i1 %38, label %39, label %46
39: ; preds = %33
%40 = load i32, i32* %3
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = load i64, i64* %2
%45 = sdiv i64 %44, %43
store i64 %45, i64* %2
br label %69
46: ; preds = %33, %27
%47 = load i64, i64* %2
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = srem i64 %47, %49
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %65
52: ; preds = %46
%53 = load i64, i64* %2
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = sdiv i64 %53, %55
%57 = icmp eq i64 %56, 1
br i1 %57, label %58, label %65
58: ; preds = %52
%59 = load i32, i32* %3
%60 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %3
%62 = sext i32 %61 to i64
%63 = load i64, i64* %2
%64 = sdiv i64 %63, %62
store i64 %64, i64* %2
br label %69
65: ; preds = %52, %46
br label %66
66: ; preds = %65, %26
%67 = load i32, i32* %3
%68 = add nsw i32 %67, 1
store i32 %68, i32* %3
br label %17
69: ; preds = %58, %39, %17
br label %4
70: ; preds = %12, %4
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [6 x i8] c"%d * \00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @primeFactorization(i64 %0) {
%2 = icmp eq i64 %0, 1
br i1 %2, label %36, label %3
3: ; preds = %1, %28
%4 = phi i64 [ %29, %28 ], [ %0, %1 ]
%5 = trunc i64 %4 to i32
%6 = tail call i64 @isPrime(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %31
8: ; preds = %3
%9 = icmp slt i64 %4, 0
br i1 %9, label %28, label %10
10: ; preds = %8, %25
%11 = phi i64 [ %26, %25 ], [ 0, %8 ]
%12 = trunc i64 %11 to i32
%13 = tail call i64 @isPrime(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %25, label %15
15: ; preds = %10
%16 = srem i64 %4, %11
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = and i64 %11, 4294967295
%20 = sdiv i64 %4, %19
%21 = icmp eq i64 %20, 1
br i1 %21, label %31, label %22
22: ; preds = %18
%23 = trunc i64 %11 to i32
%24 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %28
25: ; preds = %15, %10
%26 = add nuw i64 %11, 1
%27 = icmp slt i64 %4, %26
br i1 %27, label %28, label %10
28: ; preds = %25, %8, %22
%29 = phi i64 [ %20, %22 ], [ %4, %8 ], [ %4, %25 ]
%30 = icmp eq i64 %29, 1
br i1 %30, label %36, label %3
31: ; preds = %18, %3
%32 = phi i64 [ %4, %3 ], [ %11, %18 ]
%33 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %18 ]
%34 = trunc i64 %32 to i32
%35 = tail call i32 @printf(i8* %33, i32 %34)
br label %36
36: ; preds = %28, %31, %1
ret void
}