#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 /*<<< orphan*/ strcpy(char *, char *);
void hexBin(char *hexstring, char *binstring) {
  char *nchar = hexstring;
  while (*nchar) {
    switch (*nchar) {
    case '0':
      strcpy(binstring, "0000");
      break;
    case '1':
      strcpy(binstring, "0001");
      break;
    case '2':
      strcpy(binstring, "0010");
      break;
    case '3':
      strcpy(binstring, "0011");
      break;
    case '4':
      strcpy(binstring, "0100");
      break;
    case '5':
      strcpy(binstring, "0101");
      break;
    case '6':
      strcpy(binstring, "0110");
      break;
    case '7':
      strcpy(binstring, "0111");
      break;
    case '8':
      strcpy(binstring, "1000");
      break;
    case '9':
      strcpy(binstring, "1001");
      break;
    case 'A':
      strcpy(binstring, "1010");
      break;
    case 'B':
      strcpy(binstring, "1011");
      break;
    case 'C':
      strcpy(binstring, "1100");
      break;
    case 'D':
      strcpy(binstring, "1101");
      break;
    case 'E':
      strcpy(binstring, "1110");
      break;
    case 'F':
      strcpy(binstring, "1111");
      break;
    }
    binstring += 4;
    nchar++;
  }
}


x86 assembly (clang, -O0):
<hexBin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     12ca <hexBin+0x1ba>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x16,%eax
ja     12ad <hexBin+0x19d>
mov    -0x20(%rbp),%rax
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xeef(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xedf(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe2f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xe0f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    12ad <hexBin+0x19d>
mov    -0x10(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <hexBin+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexBin>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1174 <hexBin+0x64>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
mov    $0x7e03ff,%r15d
lea    0xf1c(%rip),%rbp
jmp    114f <hexBin+0x3f>
cs nopw 0x0(%rax,%rax,1)
add    $0x4,%r14
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1174 <hexBin+0x64>
movsbl %al,%eax
add    $0xffffffd0,%eax
cmp    $0x16,%eax
ja     1140 <hexBin+0x30>
bt     %eax,%r15d
jae    1140 <hexBin+0x30>
cltq
movslq 0x0(%rbp,%rax,4),%rsi
add    %rbp,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
jmp    1140 <hexBin+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.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"
define void @hexBin(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %63, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %68
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %63 [
i32 48, label %15
i32 49, label %18
i32 50, label %21
i32 51, label %24
i32 52, label %27
i32 53, label %30
i32 54, label %33
i32 55, label %36
i32 56, label %39
i32 57, label %42
i32 65, label %45
i32 66, label %48
i32 67, label %51
i32 68, label %54
i32 69, label %57
i32 70, label %60
]
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %63
18: ; preds = %11
%19 = load i8*, i8** %4
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %63
21: ; preds = %11
%22 = load i8*, i8** %4
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %63
24: ; preds = %11
%25 = load i8*, i8** %4
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %63
27: ; preds = %11
%28 = load i8*, i8** %4
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %63
30: ; preds = %11
%31 = load i8*, i8** %4
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %63
33: ; preds = %11
%34 = load i8*, i8** %4
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %63
36: ; preds = %11
%37 = load i8*, i8** %4
%38 = call i32 @strcpy(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %63
39: ; preds = %11
%40 = load i8*, i8** %4
%41 = call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %63
42: ; preds = %11
%43 = load i8*, i8** %4
%44 = call i32 @strcpy(i8* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %63
45: ; preds = %11
%46 = load i8*, i8** %4
%47 = call i32 @strcpy(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %63
48: ; preds = %11
%49 = load i8*, i8** %4
%50 = call i32 @strcpy(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
br label %63
51: ; preds = %11
%52 = load i8*, i8** %4
%53 = call i32 @strcpy(i8* %52, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %63
54: ; preds = %11
%55 = load i8*, i8** %4
%56 = call i32 @strcpy(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
br label %63
57: ; preds = %11
%58 = load i8*, i8** %4
%59 = call i32 @strcpy(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
br label %63
60: ; preds = %11
%61 = load i8*, i8** %4
%62 = call i32 @strcpy(i8* %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
br label %63
63: ; preds = %11, %60, %57, %54, %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15
%64 = load i8*, i8** %4
%65 = getelementptr inbounds i8, i8* %64, i64 4
store i8* %65, i8** %4
%66 = load i8*, i8** %5
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %5
br label %7
68: ; preds = %7
ret void
}

LLVM IR (-O2):
@.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"
@reltable.hexBin = [23 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.7 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.8 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.10 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.11 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.12 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.13 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.14 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.15 to i64), i64 ptrtoint ([23 x i32]* @reltable.hexBin to i64)) to i32)]
define void @hexBin(i8* nocapture %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %26, label %5
5: ; preds = %2, %21
%6 = phi i8 [ %24, %21 ], [ %3, %2 ]
%7 = phi i8* [ %23, %21 ], [ %0, %2 ]
%8 = phi i8* [ %22, %21 ], [ %1, %2 ]
%9 = sext i8 %6 to i32
%10 = add nsw i32 %9, -48
%11 = icmp ult i32 %10, 23
br i1 %11, label %12, label %21
12: ; preds = %5
%13 = lshr i32 8258559, %10
%14 = and i32 %13, 1
%15 = icmp eq i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %12
%17 = sext i32 %10 to i64
%18 = shl i64 %17, 2
%19 = call i8* @llvm.load.relative.i64(i8* bitcast ([23 x i32]* @reltable.hexBin to i8*), i64 %18)
%20 = tail call i32 @strcpy(i8* %8, i8* %19)
br label %21
21: ; preds = %12, %5, %16
%22 = getelementptr inbounds i8, i8* %8, i64 4
%23 = getelementptr inbounds i8, i8* %7, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %5
26: ; preds = %21, %2
ret void
}