#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 */
char *CreateBase64StringFromHexString(char *, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ free(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, const char *argv[]) {
  char *hexString = "49276d206b696c6c696e6720796f757220627261696e206c696b652061"
                    "20706f69736f6e6f7573206d757368726f6f6d";
  char *base64String =
      "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t";
  char *convertedString =
      CreateBase64StringFromHexString(hexString, strlen(hexString));
  assert(strcmp(convertedString, base64String) == 0);
  free(convertedString);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xee9(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1040 <CreateBase64StringFromHexString@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <CreateBase64StringFromHexString@plt>
mov    %rax,%rbx
lea    0xeed(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [97 x i8] c"49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d\00"
@.str.1 = [65 x i8] c"SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8** %7
%9 = load i8*, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @strlen(i8* %10)
%12 = call i8* @CreateBase64StringFromHexString(i8* %9, i32 %11)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = load i8*, i8** %7
%15 = call i64 @strcmp(i8* %13, i8* %14)
%16 = icmp eq i64 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i8*, i8** %8
%20 = call i32 @free(i8* %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [97 x i8] c"49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d\00"
@.str.1 = [65 x i8] c"SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0))
%4 = tail call i8* @CreateBase64StringFromHexString(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @free(i8* %4)
ret i32 0
}