#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*/ EINVAL;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ handle_error(char **, char *);
scalar_t__ isxdigit(char);
char *malloc(int);
char *realloc(char *, int);
scalar_t__ strchr(char *, char);
int strlen(char *);
int xdigit_to_value(char);
int oldgaa_rfc1779_name_parse(char *rfc1779_string, char **imported_name,
                              char **errstring) {
  int escaped = 0;
  char *buffer = NULL;
  int buffer_len = 0;
  int buffer_index = 0;
  char rfc1779_char;
  if (!rfc1779_string) {
    handle_error(errstring, "bad input string parameter");
    errno = EINVAL;
    goto error_return;
  }
  if (!imported_name) {
    handle_error(errstring, "bad output string parameter");
    errno = EINVAL;
    goto error_return;
  }
  buffer_len = strlen(rfc1779_string);
  buffer = malloc(buffer_len);
  if (buffer == NULL) {
    handle_error(errstring, "out of memory");
    goto error_return;
  }
  while ((rfc1779_char = *(rfc1779_string++)) != '\0') {
    if (strchr("\\", rfc1779_char) && !escaped) {
      escaped = 1;
      continue;
    }
    if (strchr("\n", rfc1779_char) && !escaped) {
      handle_error(errstring, "closing double quote delimitor missing");
      goto error_return;
    }
    if (strchr("x", rfc1779_char) && escaped) {
      if (isxdigit(*rfc1779_string) && isxdigit(*(rfc1779_string + 1))) {
        rfc1779_char = (xdigit_to_value(*rfc1779_string) << 4) +
                       xdigit_to_value(*(rfc1779_string + 1));
        rfc1779_string += 2;
      } else {
        handle_error(errstring, "bad hex character format");
        goto error_return;
      }
    }
    if ((buffer_index + 1) >= buffer_len) {
      char *tmp_buffer;
      buffer_len += 16;
      tmp_buffer = realloc(buffer, buffer_len);
      if (tmp_buffer == NULL) {
        handle_error(errstring, "out of memory");
        goto error_return;
      }
      buffer = tmp_buffer;
    }
    buffer[buffer_index++] = rfc1779_char;
    buffer[buffer_index] = '\0';
    escaped = 0;
  }
  *imported_name = buffer;
  return 0;
error_return:
  if (buffer)
    free(buffer);
  return -1;
}


x86 assembly (clang, -O0):
<oldgaa_rfc1779_name_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11e3 <oldgaa_rfc1779_name_parse+0x63>
mov    -0x20(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   10a0 <handle_error@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%ecx
mov    0x2e04(%rip),%rax
mov    %ecx,(%rax)
jmp    1417 <oldgaa_rfc1779_name_parse+0x297>
cmpq   $0x0,-0x18(%rbp)
jne    1215 <oldgaa_rfc1779_name_parse+0x95>
mov    -0x20(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   10a0 <handle_error@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%ecx
mov    0x2dd2(%rip),%rax
mov    %ecx,(%rax)
jmp    1417 <oldgaa_rfc1779_name_parse+0x297>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    124d <oldgaa_rfc1779_name_parse+0xcd>
mov    -0x20(%rbp),%rdi
lea    0xdf4(%rip),%rsi
call   10a0 <handle_error@plt>
jmp    1417 <oldgaa_rfc1779_name_parse+0x297>
jmp    1252 <oldgaa_rfc1779_name_parse+0xd2>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x39(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1400 <oldgaa_rfc1779_name_parse+0x280>
lea    0xdcc(%rip),%rdi
movsbl -0x39(%rbp),%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     12a2 <oldgaa_rfc1779_name_parse+0x122>
cmpl   $0x0,-0x24(%rbp)
jne    12a2 <oldgaa_rfc1779_name_parse+0x122>
movl   $0x1,-0x24(%rbp)
jmp    1252 <oldgaa_rfc1779_name_parse+0xd2>
lea    0xd9e(%rip),%rdi
movsbl -0x39(%rbp),%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     12db <oldgaa_rfc1779_name_parse+0x15b>
cmpl   $0x0,-0x24(%rbp)
jne    12db <oldgaa_rfc1779_name_parse+0x15b>
mov    -0x20(%rbp),%rdi
lea    0xd78(%rip),%rsi
call   10a0 <handle_error@plt>
jmp    1417 <oldgaa_rfc1779_name_parse+0x297>
lea    0xd8e(%rip),%rdi
movsbl -0x39(%rbp),%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     1380 <oldgaa_rfc1779_name_parse+0x200>
cmpl   $0x0,-0x24(%rbp)
je     1380 <oldgaa_rfc1779_name_parse+0x200>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1090 <isxdigit@plt>
cmp    $0x0,%rax
je     1366 <oldgaa_rfc1779_name_parse+0x1e6>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1090 <isxdigit@plt>
cmp    $0x0,%rax
je     1366 <oldgaa_rfc1779_name_parse+0x1e6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1060 <xdigit_to_value@plt>
shl    $0x4,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1060 <xdigit_to_value@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x39(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    137b <oldgaa_rfc1779_name_parse+0x1fb>
mov    -0x20(%rbp),%rdi
lea    0xd01(%rip),%rsi
call   10a0 <handle_error@plt>
jmp    1417 <oldgaa_rfc1779_name_parse+0x297>
jmp    1380 <oldgaa_rfc1779_name_parse+0x200>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cmp    -0x34(%rbp),%eax
jl     13d0 <oldgaa_rfc1779_name_parse+0x250>
mov    -0x34(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1080 <realloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    13c8 <oldgaa_rfc1779_name_parse+0x248>
mov    -0x20(%rbp),%rdi
lea    0xc79(%rip),%rsi
call   10a0 <handle_error@plt>
jmp    1417 <oldgaa_rfc1779_name_parse+0x297>
mov    -0x48(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x39(%rbp),%dl
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x38(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x24(%rbp)
jmp    1252 <oldgaa_rfc1779_name_parse+0xd2>
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1432 <oldgaa_rfc1779_name_parse+0x2b2>
cmpq   $0x0,-0x30(%rbp)
je     142b <oldgaa_rfc1779_name_parse+0x2ab>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oldgaa_rfc1779_name_parse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rbx
test   %rdi,%rdi
je     12e0 <oldgaa_rfc1779_name_parse+0x160>
mov    %rsi,%rbp
test   %rsi,%rsi
je     12e9 <oldgaa_rfc1779_name_parse+0x169>
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %eax,0xc(%rsp)
mov    %eax,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     1330 <oldgaa_rfc1779_name_parse+0x1b0>
mov    %rax,(%rsp)
mov    %rbp,0x20(%rsp)
mov    %rbx,0x18(%rsp)
xor    %ebp,%ebp
lea    0xe6c(%rip),%r13
mov    %rbp,0x10(%rsp)
xor    %ebp,%ebp
movzbl (%r15),%r12d
test   %r12b,%r12b
je     1311 <oldgaa_rfc1779_name_parse+0x191>
add    $0x1,%r15
movsbl %r12b,%r14d
mov    %r13,%rdi
mov    %r14d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
setne  %al
mov    %ebp,%ebx
not    %bl
mov    $0x1,%bpl
test   %al,%bl
jne    11e0 <oldgaa_rfc1779_name_parse+0x60>
lea    0xe2f(%rip),%rdi
mov    %r14d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
setne  %al
test   %al,%bl
jne    1341 <oldgaa_rfc1779_name_parse+0x1c1>
lea    0xe3b(%rip),%rdi
mov    %r14d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
sete   %al
or     %al,%bl
test   $0x1,%bl
jne    129c <oldgaa_rfc1779_name_parse+0x11c>
movsbl (%r15),%edi
call   1090 <isxdigit@plt>
test   %rax,%rax
mov    (%rsp),%r14
mov    0x10(%rsp),%rbx
je     134e <oldgaa_rfc1779_name_parse+0x1ce>
movsbl 0x1(%r15),%edi
call   1090 <isxdigit@plt>
test   %rax,%rax
je     134e <oldgaa_rfc1779_name_parse+0x1ce>
movsbl (%r15),%edi
call   1060 <xdigit_to_value@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%r15),%edi
call   1060 <xdigit_to_value@plt>
mov    %eax,%r12d
add    %ebp,%r12d
add    $0x2,%r15
jmp    12a5 <oldgaa_rfc1779_name_parse+0x125>
mov    (%rsp),%r14
mov    0x10(%rsp),%rbx
lea    0x1(%rbx),%rbp
mov    0xc(%rsp),%esi
cmp    %ebp,%esi
jle    12b6 <oldgaa_rfc1779_name_parse+0x136>
mov    %r14,%rax
jmp    12ce <oldgaa_rfc1779_name_parse+0x14e>
add    $0x10,%esi
mov    %r14,%rdi
mov    %esi,0xc(%rsp)
call   1080 <realloc@plt>
test   %rax,%rax
je     1357 <oldgaa_rfc1779_name_parse+0x1d7>
mov    %r12b,(%rax,%rbx,1)
movb   $0x0,0x1(%rax,%rbx,1)
mov    %rax,(%rsp)
jmp    11d9 <oldgaa_rfc1779_name_parse+0x59>
lea    0xd19(%rip),%rsi
jmp    12f0 <oldgaa_rfc1779_name_parse+0x170>
lea    0xd2b(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <handle_error@plt>
mov    0x2cd9(%rip),%rax
mov    (%rax),%eax
mov    0x2cd8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%ebx
jmp    131f <oldgaa_rfc1779_name_parse+0x19f>
mov    0x20(%rsp),%rax
mov    (%rsp),%rcx
mov    %rcx,(%rax)
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd00(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <handle_error@plt>
jmp    130a <oldgaa_rfc1779_name_parse+0x18a>
mov    (%rsp),%r14
lea    0xcfd(%rip),%rsi
jmp    135e <oldgaa_rfc1779_name_parse+0x1de>
lea    0xd1d(%rip),%rsi
jmp    135e <oldgaa_rfc1779_name_parse+0x1de>
lea    0xcd9(%rip),%rsi
mov    0x18(%rsp),%rdi
call   10a0 <handle_error@plt>
mov    $0xffffffff,%ebx
test   %r14,%r14
je     131f <oldgaa_rfc1779_name_parse+0x19f>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    131f <oldgaa_rfc1779_name_parse+0x19f>

LLVM IR (-O0):
@.str = [27 x i8] c"bad input string parameter\00"
@EINVAL = global i32 0
@errno = global i32 0
@.str.1 = [28 x i8] c"bad output string parameter\00"
@.str.2 = [14 x i8] c"out of memory\00"
@.str.3 = [2 x i8] c"\\\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [39 x i8] c"closing double quote delimitor missing\00"
@.str.6 = [2 x i8] c"x\00"
@.str.7 = [25 x i8] c"bad hex character format\00"
define i32 @oldgaa_rfc1779_name_parse(i8* %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8
%13 = alloca i8*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %8
store i8* null, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
%14 = load i8*, i8** %5
%15 = icmp ne i8* %14, null
br i1 %15, label %20, label %16
16: ; preds = %3
%17 = load i8**, i8*** %7
%18 = call i32 @handle_error(i8** %17, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* @EINVAL
store i32 %19, i32* @errno
br label %129
20: ; preds = %3
%21 = load i8**, i8*** %6
%22 = icmp ne i8** %21, null
br i1 %22, label %27, label %23
23: ; preds = %20
%24 = load i8**, i8*** %7
%25 = call i32 @handle_error(i8** %24, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @EINVAL
store i32 %26, i32* @errno
br label %129
27: ; preds = %20
%28 = load i8*, i8** %5
%29 = call i32 @strlen(i8* %28)
store i32 %29, i32* %10
%30 = load i32, i32* %10
%31 = call i8* @malloc(i32 %30)
store i8* %31, i8** %9
%32 = load i8*, i8** %9
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %37
34: ; preds = %27
%35 = load i8**, i8*** %7
%36 = call i32 @handle_error(i8** %35, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %129
37: ; preds = %27
br label %38
38: ; preds = %115, %51, %37
%39 = load i8*, i8** %5
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %5
%41 = load i8, i8* %39
store i8 %41, i8* %12
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %126
44: ; preds = %38
%45 = load i8, i8* %12
%46 = call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8 signext %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = load i32, i32* %8
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %48
store i32 1, i32* %8
br label %38
52: ; preds = %48, %44
%53 = load i8, i8* %12
%54 = call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8 signext %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %62
56: ; preds = %52
%57 = load i32, i32* %8
%58 = icmp ne i32 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %56
%60 = load i8**, i8*** %7
%61 = call i32 @handle_error(i8** %60, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %129
62: ; preds = %56, %52
%63 = load i8, i8* %12
%64 = call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8 signext %63)
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %97
66: ; preds = %62
%67 = load i32, i32* %8
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %97
69: ; preds = %66
%70 = load i8*, i8** %5
%71 = load i8, i8* %70
%72 = call i64 @isxdigit(i8 signext %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %93
74: ; preds = %69
%75 = load i8*, i8** %5
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = load i8, i8* %76
%78 = call i64 @isxdigit(i8 signext %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %93
80: ; preds = %74
%81 = load i8*, i8** %5
%82 = load i8, i8* %81
%83 = call i32 @xdigit_to_value(i8 signext %82)
%84 = shl i32 %83, 4
%85 = load i8*, i8** %5
%86 = getelementptr inbounds i8, i8* %85, i64 1
%87 = load i8, i8* %86
%88 = call i32 @xdigit_to_value(i8 signext %87)
%89 = add nsw i32 %84, %88
%90 = trunc i32 %89 to i8
store i8 %90, i8* %12
%91 = load i8*, i8** %5
%92 = getelementptr inbounds i8, i8* %91, i64 2
store i8* %92, i8** %5
br label %96
93: ; preds = %74, %69
%94 = load i8**, i8*** %7
%95 = call i32 @handle_error(i8** %94, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %129
96: ; preds = %80
br label %97
97: ; preds = %96, %66, %62
%98 = load i32, i32* %11
%99 = add nsw i32 %98, 1
%100 = load i32, i32* %10
%101 = icmp sge i32 %99, %100
br i1 %101, label %102, label %115
102: ; preds = %97
%103 = load i32, i32* %10
%104 = add nsw i32 %103, 16
store i32 %104, i32* %10
%105 = load i8*, i8** %9
%106 = load i32, i32* %10
%107 = call i8* @realloc(i8* %105, i32 %106)
store i8* %107, i8** %13
%108 = load i8*, i8** %13
%109 = icmp eq i8* %108, null
br i1 %109, label %110, label %113
110: ; preds = %102
%111 = load i8**, i8*** %7
%112 = call i32 @handle_error(i8** %111, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %129
113: ; preds = %102
%114 = load i8*, i8** %13
store i8* %114, i8** %9
br label %115
115: ; preds = %113, %97
%116 = load i8, i8* %12
%117 = load i8*, i8** %9
%118 = load i32, i32* %11
%119 = add nsw i32 %118, 1
store i32 %119, i32* %11
%120 = sext i32 %118 to i64
%121 = getelementptr inbounds i8, i8* %117, i64 %120
store i8 %116, i8* %121
%122 = load i8*, i8** %9
%123 = load i32, i32* %11
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8, i8* %122, i64 %124
store i8 0, i8* %125
store i32 0, i32* %8
br label %38
126: ; preds = %38
%127 = load i8*, i8** %9
%128 = load i8**, i8*** %6
store i8* %127, i8** %128
store i32 0, i32* %4
br label %136
129: ; preds = %110, %93, %59, %34, %23, %16
%130 = load i8*, i8** %9
%131 = icmp ne i8* %130, null
br i1 %131, label %132, label %135
132: ; preds = %129
%133 = load i8*, i8** %9
%134 = call i32 @free(i8* %133)
br label %135
135: ; preds = %132, %129
store i32 -1, i32* %4
br label %136
136: ; preds = %135, %126
%137 = load i32, i32* %4
ret i32 %137
}

LLVM IR (-O2):
@.str = [27 x i8] c"bad input string parameter\00"
@EINVAL = global i32 0
@errno = global i32 0
@.str.1 = [28 x i8] c"bad output string parameter\00"
@.str.2 = [14 x i8] c"out of memory\00"
@.str.3 = [2 x i8] c"\\\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [39 x i8] c"closing double quote delimitor missing\00"
@.str.6 = [2 x i8] c"x\00"
@.str.7 = [25 x i8] c"bad hex character format\00"
define i32 @oldgaa_rfc1779_name_parse(i8* %0, i8** writeonly %1, i8** %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @handle_error(i8** %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EINVAL
store i32 %7, i32* @errno
br label %82
8: ; preds = %3
%9 = icmp eq i8** %1, null
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = tail call i32 @handle_error(i8** %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @EINVAL
store i32 %12, i32* @errno
br label %82
13: ; preds = %8
%14 = tail call i32 @strlen(i8* %0)
%15 = tail call i8* @malloc(i32 %14)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %70
17: ; preds = %13
%18 = tail call i32 @handle_error(i8** %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %82
19: ; preds = %70, %25
%20 = phi i8* [ %22, %25 ], [ %72, %70 ]
%21 = phi i1 [ true, %25 ], [ false, %70 ]
%22 = getelementptr inbounds i8, i8* %20, i64 1
%23 = load i8, i8* %20
%24 = icmp eq i8 %23, 0
br i1 %24, label %75, label %25
25: ; preds = %19
%26 = tail call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8 signext %23)
%27 = icmp eq i64 %26, 0
%28 = or i1 %21, %27
br i1 %28, label %29, label %19
29: ; preds = %25
%30 = tail call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8 signext %23)
%31 = icmp eq i64 %30, 0
%32 = or i1 %21, %31
br i1 %32, label %33, label %76
33: ; preds = %29
%34 = tail call i64 @strchr(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8 signext %23)
%35 = icmp ne i64 %34, 0
%36 = and i1 %21, %35
br i1 %36, label %37, label %55
37: ; preds = %33
%38 = load i8, i8* %22
%39 = tail call i64 @isxdigit(i8 signext %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %76, label %41
41: ; preds = %37
%42 = getelementptr inbounds i8, i8* %20, i64 2
%43 = load i8, i8* %42
%44 = tail call i64 @isxdigit(i8 signext %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %76, label %46
46: ; preds = %41
%47 = load i8, i8* %22
%48 = tail call i32 @xdigit_to_value(i8 signext %47)
%49 = shl i32 %48, 4
%50 = load i8, i8* %42
%51 = tail call i32 @xdigit_to_value(i8 signext %50)
%52 = add nsw i32 %51, %49
%53 = trunc i32 %52 to i8
%54 = getelementptr inbounds i8, i8* %20, i64 3
br label %55
55: ; preds = %46, %33
%56 = phi i8* [ %54, %46 ], [ %22, %33 ]
%57 = phi i8 [ %53, %46 ], [ %23, %33 ]
%58 = add nuw i64 %71, 1
%59 = trunc i64 %58 to i32
%60 = icmp sgt i32 %74, %59
br i1 %60, label %65, label %61
61: ; preds = %55
%62 = add nsw i32 %74, 16
%63 = tail call i8* @realloc(i8* %73, i32 %62)
%64 = icmp eq i8* %63, null
br i1 %64, label %76, label %65
65: ; preds = %61, %55
%66 = phi i8* [ %73, %55 ], [ %63, %61 ]
%67 = phi i32 [ %74, %55 ], [ %62, %61 ]
%68 = getelementptr inbounds i8, i8* %66, i64 %71
store i8 %57, i8* %68
%69 = getelementptr inbounds i8, i8* %66, i64 %58
store i8 0, i8* %69
br label %70
70: ; preds = %13, %65
%71 = phi i64 [ %58, %65 ], [ 0, %13 ]
%72 = phi i8* [ %56, %65 ], [ %0, %13 ]
%73 = phi i8* [ %66, %65 ], [ %15, %13 ]
%74 = phi i32 [ %67, %65 ], [ %14, %13 ]
br label %19
75: ; preds = %19
store i8* %73, i8** %1
br label %82
76: ; preds = %61, %37, %41, %29
%77 = phi i8* [ getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), %29 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), %41 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), %37 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), %61 ]
%78 = tail call i32 @handle_error(i8** %2, i8* %77)
%79 = icmp eq i8* %73, null
br i1 %79, label %82, label %80
80: ; preds = %76
%81 = tail call i32 @free(i8* %73)
br label %82
82: ; preds = %5, %10, %17, %76, %80, %75
%83 = phi i32 [ 0, %75 ], [ -1, %80 ], [ -1, %76 ], [ -1, %17 ], [ -1, %10 ], [ -1, %5 ]
ret i32 %83
}