#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*/ Substring(char *, int, int, unsigned char *);
scalar_t__ strToHex(int /*<<< orphan*/);
int strlen(char *);
unsigned char *Hex2Bin(char *values, unsigned char *___Hex2Bin) {
  int i;
  unsigned char temp[3];
  for (i = 0; i < strlen(values) / 2; i++) {
    ___Hex2Bin[i] = (unsigned char)strToHex(Substring(values, i * 2, 2, temp));
  }
  return ___Hex2Bin;
}


x86 assembly (clang, -O0):
<Hex2Bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    11a5 <Hex2Bin+0x75>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
shl    $0x1,%esi
lea    -0x17(%rbp),%rcx
mov    $0x2,%edx
call   1030 <Substring@plt>
mov    %eax,%edi
call   1050 <strToHex@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <Hex2Bin+0x17>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hex2Bin>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     119f <Hex2Bin+0x6f>
xor    %r13d,%r13d
lea    0xd(%rsp),%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13d,%esi
mov    $0x2,%edx
mov    %r12,%rcx
call   1030 <Substring@plt>
mov    %eax,%edi
call   1050 <strToHex@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%rax
add    $0x2,%r13d
cmp    %rax,%rbx
jl     1160 <Hex2Bin+0x30>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @Hex2Bin(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [3 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %5
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = sdiv i32 %10, 2
%12 = icmp slt i32 %8, %11
br i1 %12, label %13, label %28
13: ; preds = %7
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = mul nsw i32 %15, 2
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%18 = call i32 @Substring(i8* %14, i32 %16, i32 2, i8* %17)
%19 = call i64 @strToHex(i32 %18)
%20 = trunc i64 %19 to i8
%21 = load i8*, i8** %4
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
store i8 %20, i8* %24
br label %25
25: ; preds = %13
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
%29 = load i8*, i8** %4
ret i8* %29
}

LLVM IR (-O2):
define i8* @Hex2Bin(i8* %0, i8* returned writeonly %1) {
%3 = alloca [3 x i8]
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%5 = call i32 @strlen(i8* %0)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %20
7: ; preds = %2, %7
%8 = phi i64 [ %15, %7 ], [ 0, %2 ]
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 1
%11 = call i32 @Substring(i8* %0, i32 %10, i32 2, i8* %4)
%12 = call i64 @strToHex(i32 %11)
%13 = trunc i64 %12 to i8
%14 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 %13, i8* %14
%15 = add nuw nsw i64 %8, 1
%16 = call i32 @strlen(i8* %0)
%17 = sdiv i32 %16, 2
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %15, %18
br i1 %19, label %7, label %20
20: ; preds = %7, %2
ret i8* %1
}