#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 */
unsigned char unHex(unsigned char const);
char deQuoted(char *out, const unsigned char *in) {
  unsigned char c1, c2;
  unsigned short icnt = 0;
  while (*in) {
    if (*in == '=') {
      c1 = unHex(*++in);
      c2 = unHex(*++in);
      if ((c1 < 15) && (c2 < 15))
        out[icnt++] = c1 * 16 + c2;
    } else
      out[icnt++] = *in++;
  }
  out[icnt] = 000;
  return (0);
}


x86 assembly (clang, -O0):
<deQuoted>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ef <deQuoted+0xdf>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x3d,%eax
jne    11c0 <deQuoted+0xb0>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl 0x1(%rax),%edi
call   1030 <unHex@plt>
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl 0x1(%rax),%edi
call   1030 <unHex@plt>
mov    %al,-0x12(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0xf,%eax
jge    11bb <deQuoted+0xab>
movzbl -0x12(%rbp),%eax
cmp    $0xf,%eax
jge    11bb <deQuoted+0xab>
movzbl -0x11(%rbp),%eax
shl    $0x4,%eax
movzbl -0x12(%rbp),%ecx
add    %ecx,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%cx
mov    %cx,%si
add    $0x1,%si
mov    %si,-0x14(%rbp)
movzwl %cx,%ecx
mov    %dl,(%rax,%rcx,1)
jmp    11ea <deQuoted+0xda>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%cx
mov    %cx,%si
add    $0x1,%si
mov    %si,-0x14(%rbp)
movzwl %cx,%ecx
mov    %dl,(%rax,%rcx,1)
jmp    1126 <deQuoted+0x16>
mov    -0x8(%rbp),%rax
movzwl -0x14(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deQuoted>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %r15d,%r15d
movzbl (%rbx),%eax
cmp    $0x3d,%al
jne    1152 <deQuoted+0x42>
movzbl 0x1(%rbx),%edi
call   1030 <unHex@plt>
mov    %eax,%ebp
movzbl 0x2(%rbx),%edi
add    $0x2,%rbx
call   1030 <unHex@plt>
cmp    $0xe,%bpl
ja     1120 <deQuoted+0x10>
cmp    $0xe,%al
ja     1120 <deQuoted+0x10>
shl    $0x4,%bpl
add    %bpl,%al
jmp    115a <deQuoted+0x4a>
test   %al,%al
je     116b <deQuoted+0x5b>
add    $0x1,%rbx
movzwl %r15w,%ecx
lea    0x1(%r15),%edx
mov    %al,(%r14,%rcx,1)
mov    %edx,%r15d
jmp    1120 <deQuoted+0x10>
movzwl %r15w,%eax
movb   $0x0,(%r14,%rax,1)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @deQuoted(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i16
store i8* %0, i8** %3
store i8* %1, i8** %4
store i16 0, i16* %7
br label %8
8: ; preds = %56, %2
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %57
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = icmp eq i32 %15, 61
br i1 %16, label %17, label %47
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
%20 = load i8, i8* %19
%21 = call zeroext i8 @unHex(i8 zeroext %20)
store i8 %21, i8* %5
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = load i8, i8* %23
%25 = call zeroext i8 @unHex(i8 zeroext %24)
store i8 %25, i8* %6
%26 = load i8, i8* %5
%27 = zext i8 %26 to i32
%28 = icmp slt i32 %27, 15
br i1 %28, label %29, label %46
29: ; preds = %17
%30 = load i8, i8* %6
%31 = zext i8 %30 to i32
%32 = icmp slt i32 %31, 15
br i1 %32, label %33, label %46
33: ; preds = %29
%34 = load i8, i8* %5
%35 = zext i8 %34 to i32
%36 = mul nsw i32 %35, 16
%37 = load i8, i8* %6
%38 = zext i8 %37 to i32
%39 = add nsw i32 %36, %38
%40 = trunc i32 %39 to i8
%41 = load i8*, i8** %3
%42 = load i16, i16* %7
%43 = add i16 %42, 1
store i16 %43, i16* %7
%44 = zext i16 %42 to i64
%45 = getelementptr inbounds i8, i8* %41, i64 %44
store i8 %40, i8* %45
br label %46
46: ; preds = %33, %29, %17
br label %56
47: ; preds = %12
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %4
%50 = load i8, i8* %48
%51 = load i8*, i8** %3
%52 = load i16, i16* %7
%53 = add i16 %52, 1
store i16 %53, i16* %7
%54 = zext i16 %52 to i64
%55 = getelementptr inbounds i8, i8* %51, i64 %54
store i8 %50, i8* %55
br label %56
56: ; preds = %47, %46
br label %8
57: ; preds = %8
%58 = load i8*, i8** %3
%59 = load i16, i16* %7
%60 = zext i16 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
store i8 0, i8* %61
ret i8 0
}

LLVM IR (-O2):
define signext i8 @deQuoted(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %24, %2
%4 = phi i8* [ %26, %24 ], [ %1, %2 ]
%5 = phi i16 [ %27, %24 ], [ 0, %2 ]
br label %6
6: ; preds = %3, %9
%7 = phi i8* [ %13, %9 ], [ %4, %3 ]
%8 = load i8, i8* %7
switch i8 %8, label %22 [
i8 0, label %30
i8 61, label %9
]
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = tail call zeroext i8 @unHex(i8 zeroext %11)
%13 = getelementptr inbounds i8, i8* %7, i64 2
%14 = load i8, i8* %13
%15 = tail call zeroext i8 @unHex(i8 zeroext %14)
%16 = icmp ult i8 %12, 15
%17 = icmp ult i8 %15, 15
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %19, label %6
19: ; preds = %9
%20 = shl nuw i8 %12, 4
%21 = add nuw i8 %15, %20
br label %24
22: ; preds = %6
%23 = getelementptr inbounds i8, i8* %7, i64 1
br label %24
24: ; preds = %22, %19
%25 = phi i8 [ %21, %19 ], [ %8, %22 ]
%26 = phi i8* [ %13, %19 ], [ %23, %22 ]
%27 = add i16 %5, 1
%28 = zext i16 %5 to i64
%29 = getelementptr inbounds i8, i8* %0, i64 %28
store i8 %25, i8* %29
br label %3
30: ; preds = %6
%31 = zext i16 %5 to i64
%32 = getelementptr inbounds i8, i8* %0, i64 %31
store i8 0, i8* %32
ret i8 0
}