#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int hex_convert(char);
scalar_t__ is_valid_hex_char(char);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
size_t strlen(char *);
size_t mp_expand(const char *in_buf, const size_t in_len, char *out_buf,
                 char *mp_sys[6], int hex_charset) {
  size_t in_pos;
  for (in_pos = 0; in_pos < in_len; in_pos++) {
    char p0 = in_buf[in_pos];
    if (p0 == '?') {
      in_pos++;
      char p1 = in_buf[in_pos];
      switch (p1) {
      case 'l':
        strcat(out_buf, mp_sys[0]);
        break;
      case 'u':
        strcat(out_buf, mp_sys[1]);
        break;
      case 'd':
        strcat(out_buf, mp_sys[2]);
        break;
      case 's':
        strcat(out_buf, mp_sys[3]);
        break;
      case 'a':
        strcat(out_buf, mp_sys[4]);
        break;
      case 'b':
        memcpy(out_buf, mp_sys[5], 256);
        break;
      case '?':
        strcat(out_buf, "?");
        break;
      default:
        fprintf(stderr, "ERROR: Syntax Error: %s\n", in_buf);
        exit(-1);
      }
    } else {
      if (hex_charset) {
        in_pos++;
        if (in_pos == in_len) {
          fprintf(stderr,
                  "ERROR: the hex-charset option always expects couples of "
                  "exactly 2 hexadecimal chars, failed mask: %s\n",
                  in_buf);
          exit(-1);
        }
        char p1 = in_buf[in_pos];
        if ((is_valid_hex_char(p0) == 0) || (is_valid_hex_char(p1) == 0)) {
          fprintf(stderr, "ERROR: invalid hex character detected in mask %s\n",
                  in_buf);
          exit(-1);
        }
        char s[2] = {0, 0};
        s[0] = hex_convert(p1) << 0;
        s[0] |= hex_convert(p0) << 4;
        strcat(out_buf, s);
      } else {
        char s[2] = {p0, 0};
        strcat(out_buf, s);
      }
    }
  }
  return strlen(out_buf);
}


x86 assembly (clang, -O0):
<mp_expand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    13ee <mp_expand+0x26e>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x31(%rbp)
movsbl -0x31(%rbp),%eax
cmp    $0x3f,%eax
jne    12d6 <mp_expand+0x156>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x32(%rbp)
movsbl -0x32(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x36,%eax
ja     12ae <mp_expand+0x12e>
mov    -0x40(%rbp),%rax
lea    0xdf8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1090 <strcat@plt>
jmp    12d1 <mp_expand+0x151>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rsi
call   1090 <strcat@plt>
jmp    12d1 <mp_expand+0x151>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rsi
call   1090 <strcat@plt>
jmp    12d1 <mp_expand+0x151>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rsi
call   1090 <strcat@plt>
jmp    12d1 <mp_expand+0x151>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x20(%rax),%rsi
call   1090 <strcat@plt>
jmp    12d1 <mp_expand+0x151>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x28(%rax),%rsi
mov    $0x100,%edx
call   1080 <memcpy@plt>
jmp    12d1 <mp_expand+0x151>
mov    -0x18(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1090 <strcat@plt>
jmp    12d1 <mp_expand+0x151>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe1c(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
jmp    13d8 <mp_expand+0x258>
cmpl   $0x0,-0x24(%rbp)
je     13bc <mp_expand+0x23c>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    131d <mp_expand+0x19d>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xde9(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x33(%rbp)
movsbl -0x31(%rbp),%edi
call   1050 <is_valid_hex_char@plt>
cmp    $0x0,%rax
je     1351 <mp_expand+0x1d1>
movsbl -0x33(%rbp),%edi
call   1050 <is_valid_hex_char@plt>
cmp    $0x0,%rax
jne    1374 <mp_expand+0x1f4>
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdf8(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    -0x35(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1060 <memset@plt>
movsbl -0x33(%rbp),%edi
call   1030 <hex_convert@plt>
shl    $0x0,%eax
mov    %al,-0x35(%rbp)
movsbl -0x31(%rbp),%edi
call   1030 <hex_convert@plt>
mov    %eax,%ecx
shl    $0x4,%ecx
movsbl -0x35(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x35(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x35(%rbp),%rsi
call   1090 <strcat@plt>
jmp    13d3 <mp_expand+0x253>
mov    -0x31(%rbp),%al
mov    %al,-0x37(%rbp)
movb   $0x0,-0x36(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x37(%rbp),%rsi
call   1090 <strcat@plt>
jmp    13d8 <mp_expand+0x258>
jmp    13dd <mp_expand+0x25d>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11a4 <mp_expand+0x24>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_expand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,0x1c(%rsp)
mov    %rcx,0x10(%rsp)
mov    %rdx,%rbp
test   %rsi,%rsi
je     1301 <mp_expand+0x191>
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %r12d,%r12d
mov    %rdi,0x20(%rsp)
jmp    11c7 <mp_expand+0x57>
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %rbp,%rdi
lea    0xe(%rsp),%rsi
call   1080 <strcat@plt>
add    $0x1,%r12
cmp    %r15,%r12
jae    1301 <mp_expand+0x191>
movzbl (%rbx,%r12,1),%eax
cmp    $0x3f,%al
jne    1210 <mp_expand+0xa0>
movsbl 0x1(%rbx,%r12,1),%eax
add    $0xffffffc1,%eax
cmp    $0x36,%eax
ja     1341 <mp_expand+0x1d1>
add    $0x1,%r12
lea    0xe13(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rbp,%rdi
lea    0xedc(%rip),%rsi
jmp    11b5 <mp_expand+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpl   $0x0,0x1c(%rsp)
je     11a4 <mp_expand+0x34>
add    $0x1,%r12
cmp    %r15,%r12
je     132f <mp_expand+0x1bf>
mov    %r15,%r14
movzbl (%rbx,%r12,1),%ebx
movsbl %al,%r13d
mov    %r13d,%edi
call   1050 <is_valid_hex_char@plt>
test   %rax,%rax
je     1318 <mp_expand+0x1a8>
movsbl %bl,%r15d
mov    %r15d,%edi
call   1050 <is_valid_hex_char@plt>
test   %rax,%rax
je     1318 <mp_expand+0x1a8>
movw   $0x0,0xc(%rsp)
mov    %r15d,%edi
call   1030 <hex_convert@plt>
mov    %al,0xc(%rsp)
mov    %r13d,%edi
call   1030 <hex_convert@plt>
shl    $0x4,%al
or     %al,0xc(%rsp)
mov    %rbp,%rdi
lea    0xc(%rsp),%rsi
call   1080 <strcat@plt>
mov    %r14,%r15
mov    0x20(%rsp),%rbx
jmp    11ba <mp_expand+0x4a>
mov    0x10(%rsp),%rax
mov    0x20(%rax),%rsi
mov    %rbp,%rdi
jmp    11b5 <mp_expand+0x45>
mov    0x10(%rsp),%rax
mov    0x28(%rax),%rsi
mov    %rbp,%rdi
mov    $0x100,%edx
call   1070 <memcpy@plt>
jmp    11ba <mp_expand+0x4a>
mov    0x10(%rsp),%rax
mov    0x10(%rax),%rsi
mov    %rbp,%rdi
jmp    11b5 <mp_expand+0x45>
mov    0x10(%rsp),%rax
mov    (%rax),%rsi
mov    %rbp,%rdi
jmp    11b5 <mp_expand+0x45>
mov    0x10(%rsp),%rax
mov    0x18(%rax),%rsi
mov    %rbp,%rdi
jmp    11b5 <mp_expand+0x45>
mov    0x10(%rsp),%rax
mov    0x8(%rax),%rsi
mov    %rbp,%rdi
jmp    11b5 <mp_expand+0x45>
mov    %rbp,%rdi
call   1040 <strlen@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
lea    0xe35(%rip),%rsi
mov    0x20(%rsp),%rdx
jmp    1354 <mp_expand+0x1e4>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
jmp    1351 <mp_expand+0x1e1>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
lea    0xd8d(%rip),%rsi
mov    %rbx,%rdx
call   1060 <fprintf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"?\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"ERROR: Syntax Error: %s\0A\00"
@.str.2 = [102 x i8] c"ERROR: the hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s\0A\00"
@.str.3 = [50 x i8] c"ERROR: invalid hex character detected in mask %s\0A\00"
define i64 @mp_expand(i8* %0, i64 %1, i8* %2, i8** %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i64
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
%15 = alloca [2 x i8]
%16 = alloca [2 x i8]
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i8** %3, i8*** %9
store i32 %4, i32* %10
store i64 0, i64* %11
br label %17
17: ; preds = %141, %5
%18 = load i64, i64* %11
%19 = load i64, i64* %7
%20 = icmp ult i64 %18, %19
br i1 %20, label %21, label %144
21: ; preds = %17
%22 = load i8*, i8** %6
%23 = load i64, i64* %11
%24 = getelementptr inbounds i8, i8* %22, i64 %23
%25 = load i8, i8* %24
store i8 %25, i8* %12
%26 = load i8, i8* %12
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 63
br i1 %28, label %29, label %83
29: ; preds = %21
%30 = load i64, i64* %11
%31 = add i64 %30, 1
store i64 %31, i64* %11
%32 = load i8*, i8** %6
%33 = load i64, i64* %11
%34 = getelementptr inbounds i8, i8* %32, i64 %33
%35 = load i8, i8* %34
store i8 %35, i8* %13
%36 = load i8, i8* %13
%37 = sext i8 %36 to i32
switch i32 %37, label %77 [
i32 108, label %38
i32 117, label %44
i32 100, label %50
i32 115, label %56
i32 97, label %62
i32 98, label %68
i32 63, label %74
]
38: ; preds = %29
%39 = load i8*, i8** %8
%40 = load i8**, i8*** %9
%41 = getelementptr inbounds i8*, i8** %40, i64 0
%42 = load i8*, i8** %41
%43 = call i32 @strcat(i8* %39, i8* %42)
br label %82
44: ; preds = %29
%45 = load i8*, i8** %8
%46 = load i8**, i8*** %9
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 @strcat(i8* %45, i8* %48)
br label %82
50: ; preds = %29
%51 = load i8*, i8** %8
%52 = load i8**, i8*** %9
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32 @strcat(i8* %51, i8* %54)
br label %82
56: ; preds = %29
%57 = load i8*, i8** %8
%58 = load i8**, i8*** %9
%59 = getelementptr inbounds i8*, i8** %58, i64 3
%60 = load i8*, i8** %59
%61 = call i32 @strcat(i8* %57, i8* %60)
br label %82
62: ; preds = %29
%63 = load i8*, i8** %8
%64 = load i8**, i8*** %9
%65 = getelementptr inbounds i8*, i8** %64, i64 4
%66 = load i8*, i8** %65
%67 = call i32 @strcat(i8* %63, i8* %66)
br label %82
68: ; preds = %29
%69 = load i8*, i8** %8
%70 = load i8**, i8*** %9
%71 = getelementptr inbounds i8*, i8** %70, i64 5
%72 = load i8*, i8** %71
%73 = call i32 @memcpy(i8* %69, i8* %72, i32 256)
br label %82
74: ; preds = %29
%75 = load i8*, i8** %8
%76 = call i32 @strcat(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %82
77: ; preds = %29
%78 = load i32, i32* @stderr
%79 = load i8*, i8** %6
%80 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %79)
%81 = call i32 @exit(i32 -1)
unreachable
82: ; preds = %74, %68, %62, %56, %50, %44, %38
br label %140
83: ; preds = %21
%84 = load i32, i32* %10
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %132
86: ; preds = %83
%87 = load i64, i64* %11
%88 = add i64 %87, 1
store i64 %88, i64* %11
%89 = load i64, i64* %11
%90 = load i64, i64* %7
%91 = icmp eq i64 %89, %90
br i1 %91, label %92, label %97
92: ; preds = %86
%93 = load i32, i32* @stderr
%94 = load i8*, i8** %6
%95 = call i32 @fprintf(i32 %93, i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.2, i64 0, i64 0), i8* %94)
%96 = call i32 @exit(i32 -1)
unreachable
97: ; preds = %86
%98 = load i8*, i8** %6
%99 = load i64, i64* %11
%100 = getelementptr inbounds i8, i8* %98, i64 %99
%101 = load i8, i8* %100
store i8 %101, i8* %14
%102 = load i8, i8* %12
%103 = call i64 @is_valid_hex_char(i8 signext %102)
%104 = icmp eq i64 %103, 0
br i1 %104, label %109, label %105
105: ; preds = %97
%106 = load i8, i8* %14
%107 = call i64 @is_valid_hex_char(i8 signext %106)
%108 = icmp eq i64 %107, 0
br i1 %108, label %109, label %114
109: ; preds = %105, %97
%110 = load i32, i32* @stderr
%111 = load i8*, i8** %6
%112 = call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %111)
%113 = call i32 @exit(i32 -1)
unreachable
114: ; preds = %105
%115 = bitcast [2 x i8]* %15 to i8*
%116 = load i8, i8* %14
%117 = call i32 @hex_convert(i8 signext %116)
%118 = shl i32 %117, 0
%119 = trunc i32 %118 to i8
%120 = getelementptr inbounds [2 x i8], [2 x i8]* %15, i64 0, i64 0
store i8 %119, i8* %120
%121 = load i8, i8* %12
%122 = call i32 @hex_convert(i8 signext %121)
%123 = shl i32 %122, 4
%124 = getelementptr inbounds [2 x i8], [2 x i8]* %15, i64 0, i64 0
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = or i32 %126, %123
%128 = trunc i32 %127 to i8
store i8 %128, i8* %124
%129 = load i8*, i8** %8
%130 = getelementptr inbounds [2 x i8], [2 x i8]* %15, i64 0, i64 0
%131 = call i32 @strcat(i8* %129, i8* %130)
br label %139
132: ; preds = %83
%133 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%134 = load i8, i8* %12
store i8 %134, i8* %133
%135 = getelementptr inbounds i8, i8* %133, i64 1
store i8 0, i8* %135
%136 = load i8*, i8** %8
%137 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%138 = call i32 @strcat(i8* %136, i8* %137)
br label %139
139: ; preds = %132, %114
br label %140
140: ; preds = %139, %82
br label %141
141: ; preds = %140
%142 = load i64, i64* %11
%143 = add i64 %142, 1
store i64 %143, i64* %11
br label %17
144: ; preds = %17
%145 = load i8*, i8** %8
%146 = call i64 @strlen(i8* %145)
ret i64 %146
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"ERROR: Syntax Error: %s\0A\00"
@.str.2 = [102 x i8] c"ERROR: the hex-charset option always expects couples of exactly 2 hexadecimal chars, failed mask: %s\0A\00"
@.str.3 = [50 x i8] c"ERROR: invalid hex character detected in mask %s\0A\00"
define i64 @mp_expand(i8* %0, i64 %1, i8* %2, i8** nocapture %3, i32 %4) {
%6 = alloca i16
%7 = alloca [2 x i8]
%8 = icmp eq i64 %1, 0
br i1 %8, label %88, label %9
9: ; preds = %5
%10 = icmp eq i32 %4, 0
%11 = bitcast i16* %6 to i8*
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
%14 = getelementptr inbounds i8*, i8** %3, i64 5
%15 = getelementptr inbounds i8*, i8** %3, i64 4
%16 = getelementptr inbounds i8*, i8** %3, i64 3
%17 = getelementptr inbounds i8*, i8** %3, i64 2
%18 = getelementptr inbounds i8*, i8** %3, i64 1
br label %19
19: ; preds = %9, %84
%20 = phi i64 [ 0, %9 ], [ %86, %84 ]
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 63
br i1 %23, label %24, label %53
24: ; preds = %19
%25 = add nuw i64 %20, 1
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
switch i32 %28, label %49 [
i32 108, label %29
i32 117, label %32
i32 100, label %35
i32 115, label %38
i32 97, label %41
i32 98, label %44
i32 63, label %47
]
29: ; preds = %24
%30 = load i8*, i8** %3
%31 = call i32 @strcat(i8* %2, i8* %30)
br label %84
32: ; preds = %24
%33 = load i8*, i8** %18
%34 = call i32 @strcat(i8* %2, i8* %33)
br label %84
35: ; preds = %24
%36 = load i8*, i8** %17
%37 = call i32 @strcat(i8* %2, i8* %36)
br label %84
38: ; preds = %24
%39 = load i8*, i8** %16
%40 = call i32 @strcat(i8* %2, i8* %39)
br label %84
41: ; preds = %24
%42 = load i8*, i8** %15
%43 = call i32 @strcat(i8* %2, i8* %42)
br label %84
44: ; preds = %24
%45 = load i8*, i8** %14
%46 = call i32 @memcpy(i8* %2, i8* %45, i32 256)
br label %84
47: ; preds = %24
%48 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %84
49: ; preds = %24
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%52 = call i32 @exit(i32 -1)
unreachable
53: ; preds = %19
br i1 %10, label %82, label %54
54: ; preds = %53
%55 = add nuw i64 %20, 1
%56 = icmp eq i64 %55, %1
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%60 = call i32 @exit(i32 -1)
unreachable
61: ; preds = %54
%62 = getelementptr inbounds i8, i8* %0, i64 %55
%63 = load i8, i8* %62
%64 = call i64 @is_valid_hex_char(i8 signext %22)
%65 = icmp eq i64 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %61
%67 = call i64 @is_valid_hex_char(i8 signext %63)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %66, %61
%70 = load i32, i32* @stderr
%71 = call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%72 = call i32 @exit(i32 -1)
unreachable
73: ; preds = %66
store i16 0, i16* %6
%74 = call i32 @hex_convert(i8 signext %63)
%75 = trunc i32 %74 to i8
store i8 %75, i8* %11
%76 = call i32 @hex_convert(i8 signext %22)
%77 = load i8, i8* %11
%78 = trunc i32 %76 to i8
%79 = shl i8 %78, 4
%80 = or i8 %79, %77
store i8 %80, i8* %11
%81 = call i32 @strcat(i8* %2, i8* %11)
br label %84
82: ; preds = %53
store i8 %22, i8* %12
store i8 0, i8* %13
%83 = call i32 @strcat(i8* %2, i8* %12)
br label %84
84: ; preds = %29, %32, %35, %38, %41, %44, %47, %73, %82
%85 = phi i64 [ %55, %73 ], [ %20, %82 ], [ %25, %47 ], [ %25, %44 ], [ %25, %41 ], [ %25, %38 ], [ %25, %35 ], [ %25, %32 ], [ %25, %29 ]
%86 = add i64 %85, 1
%87 = icmp ult i64 %86, %1
br i1 %87, label %19, label %88
88: ; preds = %84, %5
%89 = call i64 @strlen(i8* dereferenceable(1) %2)
ret i64 %89
}