#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
char *hextoString(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *parseHexString(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ *xorHex(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int main(int argc, char const *argv[]) {
  uint8_t *input = parseHexString("1c0111001f010100061a024b53535009181c", 36);
  uint8_t *key = parseHexString("686974207468652062756c6c277320657965", 36);
  uint8_t *result = xorHex(input, key, 36);
  printf("%s\n", hextoString(result, 18));
  free(result);
  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),%rdi
mov    $0x24,%esi
call   1070 <parseHexString@plt>
mov    %rax,-0x18(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x24,%esi
call   1070 <parseHexString@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x24,%edx
call   1050 <xorHex@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x12,%esi
call   1060 <hextoString@plt>
mov    %rax,%rsi
lea    0xe8c(%rip),%rdi
call   1040 <printf@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),%rdi
mov    $0x24,%esi
call   1070 <parseHexString@plt>
mov    %rax,%rbx
lea    0xeb9(%rip),%rdi
mov    $0x24,%esi
call   1070 <parseHexString@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x24,%edx
call   1050 <xorHex@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x12,%esi
call   1060 <hextoString@plt>
lea    0xead(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"1c0111001f010100061a024b53535009181c\00"
@.str.1 = [37 x i8] c"686974207468652062756c6c277320657965\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32* @parseHexString(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 36)
store i32* %9, i32** %6
%10 = call i32* @parseHexString(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 36)
store i32* %10, i32** %7
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = call i32* @xorHex(i32* %11, i32* %12, i32 36)
store i32* %13, i32** %8
%14 = load i32*, i32** %8
%15 = call i8* @hextoString(i32* %14, i32 18)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = load i32*, i32** %8
%18 = call i32 @free(i32* %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"1c0111001f010100061a024b53535009181c\00"
@.str.1 = [37 x i8] c"686974207468652062756c6c277320657965\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @parseHexString(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 36)
%4 = tail call i32* @parseHexString(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 36)
%5 = tail call i32* @xorHex(i32* %3, i32* %4, i32 36)
%6 = tail call i8* @hextoString(i32* %5, i32 18)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = tail call i32 @free(i32* %5)
ret i32 0
}