void decimal_to_other(unsigned long long int input, unsigned int target_num_sys,
                      _Bool verbosemode) {
  char *output =
      malloc((int)(log(input) / log(target_num_sys) + 2) * sizeof(char));
  if (verbosemode == 1) {
    printf("Allocated memory for '%f (rounded down) + 2' chars to store "
           "result.\n\n",
           (log(input) / log(target_num_sys)) * sizeof(char));
  }
  int i = 0;
  static char numberArray[] = "0123456789abcdefghijklmnopqrstuvwxyz";
  for (; input != 0; i++) {
    output[i] = numberArray[input % target_num_sys];
    if (verbosemode == 1) {
      printf("i: %i ----------- \tquotient:\t%llu\tremainder:\t%c\n", i, input,
             output[i]);
    }
    input /= target_num_sys;
  }
  output[i] = '\0';
  do {
    putchar(output[--i]);
  } while (i >= 0);
  free(output);
}


x86 assembly (clang, -O0):
<decimal_to_other>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
and    $0x1,%al
mov    %al,-0xd(%rbp)
movaps 0xea3(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xea2(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1070 <log@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm0
call   1070 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movslq %eax,%rdi
shl    $0x0,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
jne    1245 <decimal_to_other+0xf5>
movaps 0xe28(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe27(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1070 <log@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm0
call   1070 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xdd5(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xdf2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     12ca <decimal_to_other+0x17a>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
div    %rcx
lea    0x2de6(%rip),%rax
mov    (%rax,%rdx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
jne    12aa <decimal_to_other+0x15a>
mov    -0x1c(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    124c <decimal_to_other+0xfc>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
mov    $0x0,%al
call   1040 <putchar@plt>
cmpl   $0x0,-0x1c(%rbp)
jge    12d6 <decimal_to_other+0x186>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimal_to_other>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%rbp
movq   %rdi,%xmm1
punpckldq 0xe8d(%rip),%xmm1
subpd  0xe95(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
call   1070 <log@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%r12d
xorps  %xmm0,%xmm0
cvtsi2sd %r12,%xmm0
movsd  %xmm0,0x20(%rsp)
call   1070 <log@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0xe60(%rip),%xmm1
cvttsd2si %xmm1,%eax
movslq %eax,%rdi
call   1060 <malloc@plt>
mov    %rax,%r15
test   %r14d,%r14d
je     120b <decimal_to_other+0xbb>
movaps 0x10(%rsp),%xmm0
call   1070 <log@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
call   1070 <log@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
lea    0xe28(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
test   %rbp,%rbp
je     12a3 <decimal_to_other+0x153>
lea    0xe85(%rip),%rsi
xor    %ebx,%ebx
mov    %r15,0x8(%rsp)
jmp    123c <decimal_to_other+0xec>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %r12,%rbp
mov    %r13,%rbp
jb     12a5 <decimal_to_other+0x155>
mov    %rbp,%rax
shr    $0x20,%rax
je     1260 <decimal_to_other+0x110>
mov    %rbp,%rax
xor    %edx,%edx
div    %r12
mov    %rax,%r13
jmp    126a <decimal_to_other+0x11a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%eax
xor    %edx,%edx
div    %r12d
mov    %eax,%r13d
movsbl (%rdx,%rsi,1),%ecx
mov    %cl,(%r15,%rbx,1)
test   %r14b,%r14b
je     1230 <decimal_to_other+0xe0>
lea    0xdf0(%rip),%rdi
mov    %r12,%r15
mov    %r14d,%r12d
mov    %rsi,%r14
mov    %ebx,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rsi
mov    %r12d,%r14d
mov    %r15,%r12
mov    0x8(%rsp),%r15
jmp    1230 <decimal_to_other+0xe0>
xor    %ebx,%ebx
mov    %ebx,%eax
movb   $0x0,(%r15,%rax,1)
movslq %ebx,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl -0x2(%r15,%rbx,1),%edi
xor    %eax,%eax
call   1040 <putchar@plt>
add    $0xffffffffffffffff,%rbx
jg     12c0 <decimal_to_other+0x170>
mov    %r15,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"Allocated memory for '%f (rounded down) + 2' chars to store result.\0A\0A\00"
@decimal_to_other.numberArray = internal global [37 x i8] c"0123456789abcdefghijklmnopqrstuvwxyz\00"
@.str.1 = [49 x i8] c"i: %i ----------- \09quotient:\09%llu\09remainder:\09%c\0A\00"
define void @decimal_to_other(i64 %0, i32 %1, i1 zeroext %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
%9 = zext i1 %2 to i8
store i8 %9, i8* %6
%10 = load i64, i64* %4
%11 = uitofp i64 %10 to double
%12 = call double @log(double %11)
%13 = load i32, i32* %5
%14 = uitofp i32 %13 to double
%15 = call double @log(double %14)
%16 = fdiv double %12, %15
%17 = fadd double %16, 2.000000e+00
%18 = fptosi double %17 to i32
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 1
%21 = call i8* @malloc(i64 %20)
store i8* %21, i8** %7
%22 = load i8, i8* %6
%23 = trunc i8 %22 to i1
%24 = zext i1 %23 to i32
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %36
26: ; preds = %3
%27 = load i64, i64* %4
%28 = uitofp i64 %27 to double
%29 = call double @log(double %28)
%30 = load i32, i32* %5
%31 = uitofp i32 %30 to double
%32 = call double @log(double %31)
%33 = fdiv double %29, %32
%34 = fmul double %33, 1.000000e+00
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), double %34)
br label %36
36: ; preds = %26, %3
store i32 0, i32* %8
br label %37
37: ; preds = %70, %36
%38 = load i64, i64* %4
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %73
40: ; preds = %37
%41 = load i64, i64* %4
%42 = load i32, i32* %5
%43 = zext i32 %42 to i64
%44 = urem i64 %41, %43
%45 = getelementptr inbounds [37 x i8], [37 x i8]* @decimal_to_other.numberArray, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = load i8*, i8** %7
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8 %46, i8* %50
%51 = load i8, i8* %6
%52 = trunc i8 %51 to i1
%53 = zext i1 %52 to i32
%54 = icmp eq i32 %53, 1
br i1 %54, label %55, label %65
55: ; preds = %40
%56 = load i32, i32* %8
%57 = load i64, i64* %4
%58 = load i8*, i8** %7
%59 = load i32, i32* %8
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 %56, i64 %57, i32 %63)
br label %65
65: ; preds = %55, %40
%66 = load i32, i32* %5
%67 = zext i32 %66 to i64
%68 = load i64, i64* %4
%69 = udiv i64 %68, %67
store i64 %69, i64* %4
br label %70
70: ; preds = %65
%71 = load i32, i32* %8
%72 = add nsw i32 %71, 1
store i32 %72, i32* %8
br label %37
73: ; preds = %37
%74 = load i8*, i8** %7
%75 = load i32, i32* %8
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %74, i64 %76
store i8 0, i8* %77
br label %78
78: ; preds = %87, %73
%79 = load i8*, i8** %7
%80 = load i32, i32* %8
%81 = add nsw i32 %80, -1
store i32 %81, i32* %8
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %79, i64 %82
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %85)
br label %87
87: ; preds = %78
%88 = load i32, i32* %8
%89 = icmp sge i32 %88, 0
br i1 %89, label %78, label %90
90: ; preds = %87
%91 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"Allocated memory for '%f (rounded down) + 2' chars to store result.\0A\0A\00"
@decimal_to_other.numberArray = internal unnamed_addr constant [37 x i8] c"0123456789abcdefghijklmnopqrstuvwxyz\00"
@.str.1 = [49 x i8] c"i: %i ----------- \09quotient:\09%llu\09remainder:\09%c\0A\00"
define void @decimal_to_other(i64 %0, i32 %1, i1 zeroext %2) {
%4 = uitofp i64 %0 to double
%5 = tail call double @log(double %4)
%6 = uitofp i32 %1 to double
%7 = tail call double @log(double %6)
%8 = fdiv double %5, %7
%9 = fadd double %8, 2.000000e+00
%10 = fptosi double %9 to i32
%11 = sext i32 %10 to i64
%12 = tail call i8* @malloc(i64 %11)
br i1 %2, label %13, label %18
13: ; preds = %3
%14 = tail call double @log(double %4)
%15 = tail call double @log(double %6)
%16 = fdiv double %14, %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), double %16)
br label %18
18: ; preds = %13, %3
%19 = icmp eq i64 %0, 0
br i1 %19, label %39, label %20
20: ; preds = %18
%21 = zext i32 %1 to i64
br label %22
22: ; preds = %20, %34
%23 = phi i64 [ 0, %20 ], [ %35, %34 ]
%24 = phi i64 [ %0, %20 ], [ %26, %34 ]
%25 = urem i64 %24, %21
%26 = udiv i64 %24, %21
%27 = getelementptr inbounds [37 x i8], [37 x i8]* @decimal_to_other.numberArray, i64 0, i64 %25
%28 = load i8, i8* %27
%29 = getelementptr inbounds i8, i8* %12, i64 %23
store i8 %28, i8* %29
br i1 %2, label %30, label %34
30: ; preds = %22
%31 = sext i8 %28 to i32
%32 = trunc i64 %23 to i32
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 %32, i64 %24, i32 %31)
br label %34
34: ; preds = %30, %22
%35 = add nuw i64 %23, 1
%36 = icmp ult i64 %24, %21
br i1 %36, label %37, label %22
37: ; preds = %34
%38 = trunc i64 %35 to i32
br label %39
39: ; preds = %37, %18
%40 = phi i32 [ 0, %18 ], [ %38, %37 ]
%41 = zext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %12, i64 %41
store i8 0, i8* %42
%43 = sext i32 %40 to i64
br label %44
44: ; preds = %44, %39
%45 = phi i64 [ %46, %44 ], [ %43, %39 ]
%46 = add nsw i64 %45, -1
%47 = getelementptr inbounds i8, i8* %12, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %49)
%51 = icmp sgt i64 %45, 0
br i1 %51, label %44, label %52
52: ; preds = %44
tail call void @free(i8* %12)
ret void
}