#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 *_hex_to_base64(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *input_string = "49276d206b696c6c696e6720796f757220627261696e206c696b652"
                       "06120706f69736f6e6f7573206d757368726f6f6d";
  char *output_string = _hex_to_base64(input_string);
  if (!strcmp(
          output_string,
          "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t")) {
    printf("%s", "Strings match!\n");
  } else {
    printf("%s", "Strings don't match!\n");
    printf("Resulting output = %s\n", output_string);
    printf("Desired   output = %s\n",
           "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <_hex_to_base64@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xef8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    118f <main+0x5f>
lea    0xf24(%rip),%rdi
lea    0xf20(%rip),%rsi
call   1030 <printf@plt>
jmp    11d1 <main+0xa1>
lea    0xf0c(%rip),%rdi
lea    0xf18(%rip),%rsi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xf1e(%rip),%rdi
call   1030 <printf@plt>
lea    0xf29(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d8 <main+0xa8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1050 <_hex_to_base64@plt>
mov    %rax,%rbx
lea    0xf1a(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
lea    0xf4c(%rip),%rdi
test   %eax,%eax
je     118f <main+0x5f>
lea    0xf54(%rip),%rsi
call   1030 <printf@plt>
lea    0xf5e(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xf66(%rip),%rdi
lea    0xede(%rip),%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
lea    0xf0f(%rip),%rsi
call   1030 <printf@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"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [16 x i8] c"Strings match!\0A\00"
@.str.4 = [22 x i8] c"Strings don't match!\0A\00"
@.str.5 = [23 x i8] c"Resulting output = %s\0A\00"
@.str.6 = [23 x i8] c"Desired output = %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = 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
%8 = load i8*, i8** %6
%9 = call i8* @_hex_to_base64(i8* %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %20
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%17 = load i8*, i8** %7
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %21
20: ; preds = %13
store i32 0, i32* %3
br label %21
21: ; preds = %20, %15
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [97 x i8] c"49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d\00"
@.str.1 = [65 x i8] c"SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [16 x i8] c"Strings match!\0A\00"
@.str.4 = [22 x i8] c"Strings don't match!\0A\00"
@.str.5 = [23 x i8] c"Resulting output = %s\0A\00"
@.str.6 = [23 x i8] c"Desired output = %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @_hex_to_base64(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(65) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %12
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %6, %8
%13 = phi i32 [ -1, %8 ], [ 0, %6 ]
ret i32 %13
}