#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 *, ...);
size_t pow(size_t, size_t);
int /*<<< orphan*/ stdout;
void changeRadix(size_t number, size_t radix) {
  size_t k, i, q;
  fprintf(stdout, "%zu = ", number);
  k = number / radix;
  while (number != 0 && number >= 0) {
    i = pow(radix, k);
    q = number / i;
    number -= (q * i);
    if (q != 0 && q >= 0)
      fprintf(stdout, "%zu * %zu^%zu", q, radix, k);
    if (number != 0 && number >= 0 && q != 0 && q >= 0)
      fprintf(stdout, " + ");
    k--;
  }
  fprintf(stdout, "\n");
}


x86 assembly (clang, -O0):
<changeRadix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x29(%rbp)
je     1176 <changeRadix+0x56>
cmpq   $0x0,-0x8(%rbp)
setae  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1186 <changeRadix+0x66>
jmp    1248 <changeRadix+0x128>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <pow@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
imul   -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11f4 <changeRadix+0xd4>
cmpq   $0x0,-0x28(%rbp)
jb     11f4 <changeRadix+0xd4>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x8(%rbp)
je     1237 <changeRadix+0x117>
cmpq   $0x0,-0x8(%rbp)
jb     1237 <changeRadix+0x117>
cmpq   $0x0,-0x28(%rbp)
je     1237 <changeRadix+0x117>
cmpq   $0x0,-0x28(%rbp)
jb     1237 <changeRadix+0x117>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    115b <changeRadix+0x3b>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
lea    0xdc1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changeRadix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2ea8(%rip),%r13
mov    0x0(%r13),%edi
lea    0xebd(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r15,%r15
je     120a <changeRadix+0xea>
mov    %r15,%rax
or     %r14,%rax
shr    $0x20,%rax
je     116f <changeRadix+0x4f>
mov    %r15,%rax
xor    %edx,%edx
div    %r14
mov    %rax,%rbx
jmp    1179 <changeRadix+0x59>
mov    %r15d,%eax
xor    %edx,%edx
div    %r14d
mov    %eax,%ebx
lea    0xe87(%rip),%r12
jmp    11ae <changeRadix+0x8e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13),%edi
lea    0xe7a(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0xffffffffffffffff,%rbx
mov    %rbp,%r15
test   %rbp,%rbp
je     120a <changeRadix+0xea>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    %r15,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     11e0 <changeRadix+0xc0>
mov    %r15,%rax
xor    %edx,%edx
div    %rcx
mov    %rdx,%rbp
cmp    %r15,%rcx
ja     11a2 <changeRadix+0x82>
jmp    11ee <changeRadix+0xce>
nopw   0x0(%rax,%rax,1)
mov    %r15d,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%ebp
cmp    %r15,%rcx
ja     11a2 <changeRadix+0x82>
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %rax,%rdx
mov    %r14,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %rbp,%rbp
jne    1190 <changeRadix+0x70>
mov    0x0(%r13),%edi
lea    0xe04(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [7 x i8] c"%zu = \00"
@.str.1 = [14 x i8] c"%zu * %zu^%zu\00"
@.str.2 = [4 x i8] c" + \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @changeRadix(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%8 = load i32, i32* @stdout
%9 = load i64, i64* %3
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = udiv i64 %11, %12
store i64 %13, i64* %5
br label %14
14: ; preds = %60, %2
%15 = load i64, i64* %3
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i64, i64* %3
%19 = icmp uge i64 %18, 0
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br i1 %21, label %22, label %63
22: ; preds = %20
%23 = load i64, i64* %4
%24 = load i64, i64* %5
%25 = call i64 @pow(i64 %23, i64 %24)
store i64 %25, i64* %6
%26 = load i64, i64* %3
%27 = load i64, i64* %6
%28 = udiv i64 %26, %27
store i64 %28, i64* %7
%29 = load i64, i64* %7
%30 = load i64, i64* %6
%31 = mul i64 %29, %30
%32 = load i64, i64* %3
%33 = sub i64 %32, %31
store i64 %33, i64* %3
%34 = load i64, i64* %7
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %45
36: ; preds = %22
%37 = load i64, i64* %7
%38 = icmp uge i64 %37, 0
br i1 %38, label %39, label %45
39: ; preds = %36
%40 = load i32, i32* @stdout
%41 = load i64, i64* %7
%42 = load i64, i64* %4
%43 = load i64, i64* %5
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 %41, i64 %42, i64 %43)
br label %45
45: ; preds = %39, %36, %22
%46 = load i64, i64* %3
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %60
48: ; preds = %45
%49 = load i64, i64* %3
%50 = icmp uge i64 %49, 0
br i1 %50, label %51, label %60
51: ; preds = %48
%52 = load i64, i64* %7
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %51
%55 = load i64, i64* %7
%56 = icmp uge i64 %55, 0
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.2, i64 0, i64 0))
br label %60
60: ; preds = %57, %54, %51, %48, %45
%61 = load i64, i64* %5
%62 = add i64 %61, -1
store i64 %62, i64* %5
br label %14
63: ; preds = %20
%64 = load i32, i32* @stdout
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"%zu = \00"
@.str.1 = [14 x i8] c"%zu * %zu^%zu\00"
@.str.2 = [4 x i8] c" + \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @changeRadix(i64 %0, i64 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %0)
%5 = icmp eq i64 %0, 0
br i1 %5, label %26, label %6
6: ; preds = %2
%7 = udiv i64 %0, %1
br label %8
8: ; preds = %6, %23
%9 = phi i64 [ %14, %23 ], [ %0, %6 ]
%10 = phi i64 [ %24, %23 ], [ %7, %6 ]
%11 = tail call i64 @pow(i64 %1, i64 %10)
%12 = udiv i64 %9, %11
%13 = mul i64 %12, %11
%14 = urem i64 %9, %11
%15 = icmp ugt i64 %11, %9
br i1 %15, label %23, label %16
16: ; preds = %8
%17 = load i32, i32* @stdout
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 %12, i64 %1, i64 %10)
%19 = icmp eq i64 %14, 0
br i1 %19, label %26, label %20
20: ; preds = %16
%21 = load i32, i32* @stdout
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %8, %20
%24 = add i64 %10, -1
%25 = icmp eq i64 %14, 0
br i1 %25, label %26, label %8
26: ; preds = %16, %23, %2
%27 = load i32, i32* @stdout
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}