#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*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ isPrimeNumber(size_t);
int sqrt(size_t);
int /*<<< orphan*/ stdout;
void integerFactorization(size_t number) {
  size_t i;
  size_t power;
  fprintf(stdout, "%zu = ", number);
  if (isPrimeNumber(number)) {
    fprintf(stdout, "%zu\n", number);
    return;
  }
  for (i = 2; i <= sqrt(number) + 1; i++) {
    if (isPrimeNumber(i)) {
      if (number % i == 0) {
        power = 0;
        fprintf(stdout, "%zu", i);
        while (number % i == 0) {
          number = number / i;
          power++;
        }
        if (power > 1)
          fprintf(stdout, "^%zu", power);
        if (number >= 2) {
          fprintf(stdout, " * ");
        } else {
          fprintf(stdout, "\n");
          return;
        }
      }
    }
  }
  fprintf(stdout, "%zu\n", number);
}


x86 assembly (clang, -O0):
<integerFactorization>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <isPrimeNumber@plt>
cmp    $0x0,%rax
je     118a <integerFactorization+0x5a>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12df <integerFactorization+0x1af>
movq   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
add    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
ja     12c4 <integerFactorization+0x194>
mov    -0x10(%rbp),%rdi
call   1030 <isPrimeNumber@plt>
cmp    $0x0,%rax
je     12ae <integerFactorization+0x17e>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
cmp    $0x0,%rdx
jne    12a9 <integerFactorization+0x179>
movq   $0x0,-0x18(%rbp)
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
cmp    $0x0,%rdx
jne    123b <integerFactorization+0x10b>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1204 <integerFactorization+0xd4>
cmpq   $0x1,-0x18(%rbp)
jbe    1261 <integerFactorization+0x131>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdb2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x2,-0x8(%rbp)
jb     1288 <integerFactorization+0x158>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
lea    0xd95(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12a4 <integerFactorization+0x174>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
lea    0xd72(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12df <integerFactorization+0x1af>
jmp    12a9 <integerFactorization+0x179>
jmp    12ae <integerFactorization+0x17e>
jmp    12b3 <integerFactorization+0x183>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1192 <integerFactorization+0x62>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd2f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integerFactorization>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e9b(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xeb1(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r14,%rdi
call   1030 <isPrimeNumber@plt>
test   %rax,%rax
jne    1176 <integerFactorization+0x46>
mov    %r14,%rdi
call   1050 <sqrt@plt>
add    $0x1,%eax
cmp    $0x2,%eax
jae    1198 <integerFactorization+0x68>
mov    0x0(%rbp),%edi
lea    0xe87(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>
mov    $0x2,%ebx
lea    0xe69(%rip),%r15
lea    0xe61(%rip),%r12
lea    0xe5f(%rip),%r13
jmp    11d6 <integerFactorization+0xa6>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <sqrt@plt>
add    $0x1,%eax
cltq
cmp    %rax,%rbx
ja     1176 <integerFactorization+0x46>
mov    %rbx,%rdi
call   1030 <isPrimeNumber@plt>
test   %rax,%rax
je     11c0 <integerFactorization+0x90>
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1200 <integerFactorization+0xd0>
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
test   %rdx,%rdx
jne    11c0 <integerFactorization+0x90>
jmp    120c <integerFactorization+0xdc>
xchg   %ax,%ax
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
jne    11c0 <integerFactorization+0x90>
mov    0x0(%rbp),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %ecx,%ecx
jmp    1231 <integerFactorization+0x101>
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
add    $0x1,%rcx
test   %rdx,%rdx
jne    1270 <integerFactorization+0x140>
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1250 <integerFactorization+0x120>
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
mov    %rax,%r14
jmp    125a <integerFactorization+0x12a>
nopw   0x0(%rax,%rax,1)
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
mov    %eax,%r14d
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
jne    1220 <integerFactorization+0xf0>
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
jmp    1228 <integerFactorization+0xf8>
nop
cmp    $0x2,%rcx
jb     1286 <integerFactorization+0x156>
mov    0x0(%rbp),%edi
mov    %r12,%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
cmp    $0x2,%r14
jb     129e <integerFactorization+0x16e>
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11c0 <integerFactorization+0x90>
lea    0xd65(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"%zu = \00"
@.str.1 = [5 x i8] c"%zu\0A\00"
@.str.2 = [4 x i8] c"%zu\00"
@.str.3 = [5 x i8] c"^%zu\00"
@.str.4 = [4 x i8] c" * \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @integerFactorization(i64 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %0)
%4 = tail call i64 @isPrimeNumber(i64 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = tail call i32 @sqrt(i64 %0)
%8 = add nsw i32 %7, 1
%9 = icmp ult i32 %8, 2
br i1 %9, label %50, label %13
10: ; preds = %1
%11 = load i32, i32* @stdout
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %0)
br label %54
13: ; preds = %6, %43
%14 = phi i64 [ %45, %43 ], [ 2, %6 ]
%15 = phi i64 [ %44, %43 ], [ %0, %6 ]
%16 = tail call i64 @isPrimeNumber(i64 %14)
%17 = icmp eq i64 %16, 0
br i1 %17, label %43, label %18
18: ; preds = %13
%19 = urem i64 %15, %14
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %43
21: ; preds = %18
%22 = load i32, i32* @stdout
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 %14)
br label %24
24: ; preds = %21, %24
%25 = phi i64 [ %28, %24 ], [ 0, %21 ]
%26 = phi i64 [ %27, %24 ], [ %15, %21 ]
%27 = udiv i64 %26, %14
%28 = add i64 %25, 1
%29 = urem i64 %27, %14
%30 = icmp eq i64 %29, 0
br i1 %30, label %24, label %31
31: ; preds = %24
%32 = icmp ugt i64 %28, 1
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = load i32, i32* @stdout
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 %28)
br label %36
36: ; preds = %33, %31
%37 = icmp ugt i64 %27, 1
%38 = load i32, i32* @stdout
br i1 %37, label %39, label %41
39: ; preds = %36
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %43
41: ; preds = %36
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %54
43: ; preds = %13, %39, %18
%44 = phi i64 [ %27, %39 ], [ %15, %18 ], [ %15, %13 ]
%45 = add i64 %14, 1
%46 = tail call i32 @sqrt(i64 %44)
%47 = add nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = icmp ugt i64 %45, %48
br i1 %49, label %50, label %13
50: ; preds = %43, %6
%51 = phi i64 [ %0, %6 ], [ %44, %43 ]
%52 = load i32, i32* @stdout
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %51)
br label %54
54: ; preds = %50, %41, %10
ret void
}