#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 binary_to_decimal(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *hex_to_base64(char *string) {
  int STRING_LEN = strlen(string);
  int binLen = STRING_LEN * 4;
  char binaryString[binLen + 1];
  int extraDigits = binLen % 6;
  int enWordLen = (binLen / 6) + extraDigits + 1;
  char encodedWord[enWordLen];
  int i, count = 0;
  char base63[64] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
                     'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
                     'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
                     'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                     's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
                     '3', '4', '5', '6', '7', '8', '9', '+', '\\'};
  for (i = 0; i < STRING_LEN; i++) {
    char z[STRING_LEN];
    switch (string[i]) {
    case '0':
      strcpy(z, "0000");
      break;
    case '1':
      strcpy(z, "0001");
      break;
    case '2':
      strcpy(z, "0010");
      break;
    case '3':
      strcpy(z, "0011");
      break;
    case '4':
      strcpy(z, "0100");
      break;
    case '5':
      strcpy(z, "0101");
      break;
    case '6':
      strcpy(z, "0110");
      break;
    case '7':
      strcpy(z, "0111");
      break;
    case '8':
      strcpy(z, "1000");
      break;
    case '9':
      strcpy(z, "1001");
      break;
    case 'a':
      strcpy(z, "1010");
      break;
    case 'b':
      strcpy(z, "1011");
      break;
    case 'c':
      strcpy(z, "1100");
      break;
    case 'd':
      strcpy(z, "1101");
      break;
    case 'e':
      strcpy(z, "1110");
      break;
    case 'f':
      strcpy(z, "1111");
      break;
    default:
      printf("nothing here\n");
      break;
    }
    if (i == 0) {
      strcpy(binaryString, z);
    } else {
      strcat(binaryString, z);
    }
  }
  for (i = 0; i < enWordLen; i++) {
    char substr[7];
    int digits = 6;
    if (i == (binLen / 6))
      digits = extraDigits;
    if (digits == 0)
      break;
    strncpy(substr, binaryString + i * 6, digits);
    int num = binary_to_decimal(substr);
    encodedWord[count] = base63[num];
    count++;
  }
  encodedWord[enWordLen] = '\0';
  char *result = malloc(enWordLen);
  strcpy(result, encodedWord);
  return result;
}


x86 assembly (clang, -O0):
<hex_to_base64>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movslq -0x10(%rbp),%rcx
mov    %ecx,%eax
imul   $0x2aaaaaab,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rdx
add    %ecx,%edx
add    %edx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
movslq -0x10(%rbp),%rax
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
shr    $0x20,%rcx
mov    %ecx,%edx
add    %eax,%edx
mov    -0x24(%rbp),%ecx
mov    %ecx,%eax
mov    %edx,%ecx
lea    0x1(%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe8e(%rip),%rsi
mov    $0x40,%edx
call   1080 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    14af <hex_to_base64+0x32f>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x90(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0xc0(%rbp)
sub    $0x36,%eax
ja     1456 <hex_to_base64+0x2d6>
mov    -0xc0(%rbp),%rax
lea    0xd33(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xc8(%rbp),%rdi
lea    0xe3c(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xe03(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xdf0(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xd91(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xd7e(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xd6b(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xd58(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xd45(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xd32(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
mov    -0xc8(%rbp),%rdi
lea    0xd1f(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1462 <hex_to_base64+0x2e2>
lea    0xd13(%rip),%rdi
call   1070 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1484 <hex_to_base64+0x304>
mov    -0xc8(%rbp),%rsi
mov    -0xb8(%rbp),%rdi
call   1050 <strcpy@plt>
jmp    1497 <hex_to_base64+0x317>
mov    -0xc8(%rbp),%rsi
mov    -0xb8(%rbp),%rdi
call   10a0 <strcat@plt>
mov    -0x88(%rbp),%rax
mov    %rax,%rsp
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1263 <hex_to_base64+0xe3>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1571 <hex_to_base64+0x3f1>
movl   $0x6,-0x9c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xcc(%rbp),%eax
cmp    %ecx,%eax
jne    14f9 <hex_to_base64+0x379>
mov    -0x24(%rbp),%eax
mov    %eax,-0x9c(%rbp)
cmpl   $0x0,-0x9c(%rbp)
jne    150b <hex_to_base64+0x38b>
jmp    1571 <hex_to_base64+0x3f1>
mov    -0xb8(%rbp),%rsi
lea    -0x97(%rbp),%rdi
imul   $0x6,-0x34(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0x9c(%rbp),%edx
call   1040 <strncpy@plt>
lea    -0x97(%rbp),%rdi
call   1030 <binary_to_decimal@plt>
mov    %eax,%ecx
mov    -0xb0(%rbp),%rax
mov    %ecx,-0xa0(%rbp)
movslq -0xa0(%rbp),%rcx
mov    -0x80(%rbp,%rcx,1),%dl
movslq -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14b6 <hex_to_base64+0x336>
mov    -0xb0(%rbp),%rax
movslq -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%edi
call   1090 <malloc@plt>
mov    -0xb0(%rbp),%rsi
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rdi
call   1050 <strcpy@plt>
mov    -0xa8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_to_base64>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,-0x60(%rbp)
call   1070 <strlen@plt>
lea    0x0(,%rax,4),%ecx
lea    0x1(,%rax,4),%edx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%r15
sub    %rdx,%r15
mov    %r15,%rsp
movslq %ecx,%rdx
imul   $0x2aaaaaab,%rdx,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rsi
add    %ecx,%esi
lea    (%rsi,%rsi,1),%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%edx
lea    (%rsi,%rdx,1),%ecx
mov    %ecx,-0x2c(%rbp)
mov    %rdx,-0x50(%rbp)
mov    %rsi,-0x48(%rbp)
lea    (%rdx,%rsi,1),%ecx
add    $0x1,%ecx
mov    %rcx,-0x38(%rbp)
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
test   %eax,%eax
jle    13b0 <hex_to_base64+0x240>
mov    %eax,%eax
xor    %r14d,%r14d
mov    %rax,-0x58(%rbp)
lea    0xf(%rax),%rbx
and    $0xfffffffffffffff0,%rbx
jmp    1241 <hex_to_base64+0xd1>
lea    0xf59(%rip),%rdi
call   1060 <puts@plt>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r13,%rsi
test   %r14,%r14
je     1280 <hex_to_base64+0x110>
call   1090 <strcat@plt>
mov    %r12,%rsp
add    $0x1,%r14
cmp    %r14,-0x58(%rbp)
je     13b0 <hex_to_base64+0x240>
mov    %rsp,%r12
mov    %rsp,%r13
sub    %rbx,%r13
mov    %r13,%rsp
mov    -0x60(%rbp),%rax
movsbl (%rax,%r14,1),%eax
add    $0xffffffd0,%eax
cmp    $0x36,%eax
ja     1210 <hex_to_base64+0xa0>
lea    0xd9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r13,%rdi
lea    0xea8(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
nop
call   1050 <strcpy@plt>
jmp    1230 <hex_to_base64+0xc0>
mov    %r13,%rdi
lea    0xe94(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe88(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe79(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe6a(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe5b(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe4c(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe3d(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe2e(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe1f(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe10(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xe01(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xdf2(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xde3(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xdd4(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
mov    %r13,%rdi
lea    0xdc5(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1220 <hex_to_base64+0xb0>
cmpl   $0x0,-0x2c(%rbp)
js     140f <hex_to_base64+0x29f>
mov    -0x48(%rbp),%r14d
xor    %ebx,%ebx
lea    -0x67(%rbp),%r12
lea    0xd19(%rip),%r13
nopw   0x0(%rax,%rax,1)
cmp    %rbx,%r14
mov    $0x6,%edx
cmove  -0x50(%rbp),%edx
test   %edx,%edx
je     140f <hex_to_base64+0x29f>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strncpy@plt>
mov    %r12,%rdi
call   1030 <binary_to_decimal@plt>
cltq
movzbl (%rax,%r13,1),%eax
mov    -0x40(%rbp),%rcx
mov    %al,(%rcx,%rbx,1)
add    $0x1,%rbx
add    $0x6,%r15
cmp    %rbx,-0x38(%rbp)
jne    13d0 <hex_to_base64+0x260>
movslq -0x38(%rbp),%rdi
mov    -0x40(%rbp),%r14
movb   $0x0,(%r14,%rdi,1)
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.hex_to_base64.base63 = [64 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\\"
@.str = [5 x i8] c"0000\00"
@.str.1 = [5 x i8] c"0001\00"
@.str.2 = [5 x i8] c"0010\00"
@.str.3 = [5 x i8] c"0011\00"
@.str.4 = [5 x i8] c"0100\00"
@.str.5 = [5 x i8] c"0101\00"
@.str.6 = [5 x i8] c"0110\00"
@.str.7 = [5 x i8] c"0111\00"
@.str.8 = [5 x i8] c"1000\00"
@.str.9 = [5 x i8] c"1001\00"
@.str.10 = [5 x i8] c"1010\00"
@.str.11 = [5 x i8] c"1011\00"
@.str.12 = [5 x i8] c"1100\00"
@.str.13 = [5 x i8] c"1101\00"
@.str.14 = [5 x i8] c"1110\00"
@.str.15 = [5 x i8] c"1111\00"
@.str.16 = [14 x i8] c"nothing here\0A\00"
define i8* @hex_to_base64(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca [64 x i8]
%13 = alloca i8*
%14 = alloca i64
%15 = alloca [7 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
store i8* %0, i8** %2
%19 = load i8*, i8** %2
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = mul nsw i32 %21, 4
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %5
%27 = alloca i8, i64 %25
store i64 %25, i64* %6
%28 = load i32, i32* %4
%29 = srem i32 %28, 6
store i32 %29, i32* %7
%30 = load i32, i32* %4
%31 = sdiv i32 %30, 6
%32 = load i32, i32* %7
%33 = add nsw i32 %31, %32
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = zext i32 %35 to i64
%37 = alloca i8, i64 %36
store i64 %36, i64* %9
store i32 0, i32* %11
%38 = bitcast [64 x i8]* %12 to i8*
store i32 0, i32* %10
br label %39
39: ; preds = %97, %1
%40 = load i32, i32* %10
%41 = load i32, i32* %3
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %100
43: ; preds = %39
%44 = load i32, i32* %3
%45 = zext i32 %44 to i64
%46 = call i8* @llvm.stacksave()
store i8* %46, i8** %13
%47 = alloca i8, i64 %45
store i64 %45, i64* %14
%48 = load i8*, i8** %2
%49 = load i32, i32* %10
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
switch i32 %53, label %86 [
i32 48, label %54
i32 49, label %56
i32 50, label %58
i32 51, label %60
i32 52, label %62
i32 53, label %64
i32 54, label %66
i32 55, label %68
i32 56, label %70
i32 57, label %72
i32 97, label %74
i32 98, label %76
i32 99, label %78
i32 100, label %80
i32 101, label %82
i32 102, label %84
]
54: ; preds = %43
%55 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %88
56: ; preds = %43
%57 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %88
58: ; preds = %43
%59 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %88
60: ; preds = %43
%61 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %88
62: ; preds = %43
%63 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %88
64: ; preds = %43
%65 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %88
66: ; preds = %43
%67 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %88
68: ; preds = %43
%69 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %88
70: ; preds = %43
%71 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %88
72: ; preds = %43
%73 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %88
74: ; preds = %43
%75 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %88
76: ; preds = %43
%77 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %88
78: ; preds = %43
%79 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %88
80: ; preds = %43
%81 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
br label %88
82: ; preds = %43
%83 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
br label %88
84: ; preds = %43
%85 = call i32 @strcpy(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
br label %88
86: ; preds = %43
%87 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0))
br label %88
88: ; preds = %86, %84, %82, %80, %78, %76, %74, %72, %70, %68, %66, %64, %62, %60, %58, %56, %54
%89 = load i32, i32* %10
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = call i32 @strcpy(i8* %27, i8* %47)
br label %95
93: ; preds = %88
%94 = call i32 @strcat(i8* %27, i8* %47)
br label %95
95: ; preds = %93, %91
%96 = load i8*, i8** %13
br label %97
97: ; preds = %95
%98 = load i32, i32* %10
%99 = add nsw i32 %98, 1
store i32 %99, i32* %10
br label %39
100: ; preds = %39
store i32 0, i32* %10
br label %101
101: ; preds = %135, %100
%102 = load i32, i32* %10
%103 = load i32, i32* %8
%104 = icmp slt i32 %102, %103
br i1 %104, label %105, label %138
105: ; preds = %101
store i32 6, i32* %16
%106 = load i32, i32* %10
%107 = load i32, i32* %4
%108 = sdiv i32 %107, 6
%109 = icmp eq i32 %106, %108
br i1 %109, label %110, label %112
110: ; preds = %105
%111 = load i32, i32* %7
store i32 %111, i32* %16
br label %112
112: ; preds = %110, %105
%113 = load i32, i32* %16
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %116
115: ; preds = %112
br label %138
116: ; preds = %112
%117 = getelementptr inbounds [7 x i8], [7 x i8]* %15, i64 0, i64 0
%118 = load i32, i32* %10
%119 = mul nsw i32 %118, 6
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8, i8* %27, i64 %120
%122 = load i32, i32* %16
%123 = call i32 @strncpy(i8* %117, i8* %121, i32 %122)
%124 = getelementptr inbounds [7 x i8], [7 x i8]* %15, i64 0, i64 0
%125 = call i32 @binary_to_decimal(i8* %124)
store i32 %125, i32* %17
%126 = load i32, i32* %17
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 %127
%129 = load i8, i8* %128
%130 = load i32, i32* %11
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %37, i64 %131
store i8 %129, i8* %132
%133 = load i32, i32* %11
%134 = add nsw i32 %133, 1
store i32 %134, i32* %11
br label %135
135: ; preds = %116
%136 = load i32, i32* %10
%137 = add nsw i32 %136, 1
store i32 %137, i32* %10
br label %101
138: ; preds = %115, %101
%139 = load i32, i32* %8
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %37, i64 %140
store i8 0, i8* %141
%142 = load i32, i32* %8
%143 = call i8* @malloc(i32 %142)
store i8* %143, i8** %18
%144 = load i8*, i8** %18
%145 = call i32 @strcpy(i8* %144, i8* %37)
%146 = load i8*, i8** %18
%147 = load i8*, i8** %5
ret i8* %146
}

LLVM IR (-O2):
@__const.hex_to_base64.base63 = [64 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\\"
@.str = [5 x i8] c"0000\00"
@.str.1 = [5 x i8] c"0001\00"
@.str.2 = [5 x i8] c"0010\00"
@.str.3 = [5 x i8] c"0011\00"
@.str.4 = [5 x i8] c"0100\00"
@.str.5 = [5 x i8] c"0101\00"
@.str.6 = [5 x i8] c"0110\00"
@.str.7 = [5 x i8] c"0111\00"
@.str.8 = [5 x i8] c"1000\00"
@.str.9 = [5 x i8] c"1001\00"
@.str.10 = [5 x i8] c"1010\00"
@.str.11 = [5 x i8] c"1011\00"
@.str.12 = [5 x i8] c"1100\00"
@.str.13 = [5 x i8] c"1101\00"
@.str.14 = [5 x i8] c"1110\00"
@.str.15 = [5 x i8] c"1111\00"
@str = [13 x i8] c"nothing here\00"
define i8* @hex_to_base64(i8* %0) {
%2 = alloca [7 x i8]
%3 = tail call i32 @strlen(i8* %0)
%4 = shl nsw i32 %3, 2
%5 = or i32 %4, 1
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = srem i32 %4, 6
%9 = sdiv i32 %4, 6
%10 = add nsw i32 %9, %8
%11 = add nsw i32 %10, 1
%12 = zext i32 %11 to i64
%13 = alloca i8, i64 %12
%14 = icmp sgt i32 %3, 0
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = zext i32 %3 to i64
br label %22
17: ; preds = %69, %1
%18 = icmp slt i32 %10, 0
br i1 %18, label %89, label %19
19: ; preds = %17
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%21 = zext i32 %9 to i64
br label %72
22: ; preds = %15, %69
%23 = phi i64 [ 0, %15 ], [ %70, %69 ]
%24 = call i8* @llvm.stacksave()
%25 = alloca i8, i64 %16
%26 = getelementptr inbounds i8, i8* %0, i64 %23
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
switch i32 %28, label %61 [
i32 48, label %29
i32 49, label %31
i32 50, label %33
i32 51, label %35
i32 52, label %37
i32 53, label %39
i32 54, label %41
i32 55, label %43
i32 56, label %45
i32 57, label %47
i32 97, label %49
i32 98, label %51
i32 99, label %53
i32 100, label %55
i32 101, label %57
i32 102, label %59
]
29: ; preds = %22
%30 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %63
31: ; preds = %22
%32 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %63
33: ; preds = %22
%34 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %63
35: ; preds = %22
%36 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %63
37: ; preds = %22
%38 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %63
39: ; preds = %22
%40 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %63
41: ; preds = %22
%42 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %63
43: ; preds = %22
%44 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %63
45: ; preds = %22
%46 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %63
47: ; preds = %22
%48 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %63
49: ; preds = %22
%50 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %63
51: ; preds = %22
%52 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %63
53: ; preds = %22
%54 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %63
55: ; preds = %22
%56 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
br label %63
57: ; preds = %22
%58 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
br label %63
59: ; preds = %22
%60 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
br label %63
61: ; preds = %22
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %63
63: ; preds = %61, %59, %57, %55, %53, %51, %49, %47, %45, %43, %41, %39, %37, %35, %33, %31, %29
%64 = icmp eq i64 %23, 0
br i1 %64, label %65, label %67
65: ; preds = %63
%66 = call i32 @strcpy(i8* %7, i8* %25)
br label %69
67: ; preds = %63
%68 = call i32 @strcat(i8* %7, i8* %25)
br label %69
69: ; preds = %67, %65
%70 = add nuw nsw i64 %23, 1
%71 = icmp eq i64 %70, %16
br i1 %71, label %17, label %22
72: ; preds = %19, %78
%73 = phi i64 [ 0, %19 ], [ %87, %78 ]
%74 = icmp eq i64 %73, %21
%75 = select i1 %74, i32 %8, i32 6
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %72
br label %89
78: ; preds = %72
%79 = mul nuw nsw i64 %73, 6
%80 = getelementptr inbounds i8, i8* %7, i64 %79
%81 = call i32 @strncpy(i8* %20, i8* %80, i32 %75)
%82 = call i32 @binary_to_decimal(i8* %20)
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [64 x i8], [64 x i8]* @__const.hex_to_base64.base63, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = getelementptr inbounds i8, i8* %13, i64 %73
store i8 %85, i8* %86
%87 = add nuw nsw i64 %73, 1
%88 = icmp eq i64 %87, %12
br i1 %88, label %89, label %72
89: ; preds = %78, %17, %77
%90 = sext i32 %11 to i64
%91 = getelementptr inbounds i8, i8* %13, i64 %90
store i8 0, i8* %91
%92 = call i8* @malloc(i32 %11)
%93 = call i32 @strcpy(i8* %92, i8* %13)
ret i8* %92
}