#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 */
struct katcl_line {
  int dummy;
};

/* Variables and functions */
unsigned int arg_buffer_katcl(struct katcl_line *, int, char *, unsigned int);
scalar_t__ arg_null_katcl(struct katcl_line *, int);
char *arg_string_katcl(struct katcl_line *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fwrite(char *, int, unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ isprint(char);
char *realloc(char *, unsigned int);
int /*<<< orphan*/ stdout;
int print_arg(struct katcl_line *l, int index, int fmt) {
  char *ptr, *tmp;
  unsigned int want, have, safe, i, dfmt;
  int c;
  if (arg_null_katcl(l, index) > 0) {
    c = '\0';
    fputc(c, stdout);
    return 0;
  }
  switch (fmt) {
  case 0:
    ptr = arg_string_katcl(l, index);
    if (ptr == NULL) {
      return -1;
    }
    fputs(ptr, stdout);
    return 0;
  case 2:
  case 3:
  case 1:
    ptr = NULL;
    want = 1024;
    have = 0;
    safe = 4;
    do {
      tmp = realloc(ptr, want);
      if (tmp == NULL) {
        free(ptr);
        return -1;
      }
      have = want;
      ptr = tmp;
      want = arg_buffer_katcl(l, index, ptr, have);
      safe--;
      if (!safe) {
        free(ptr);
        return -1;
      }
    } while (want > have);
    if (want <= 0) {
      free(ptr);
      return (want < 0) ? -1 : 0;
    }
    if (fmt == 1) {
      dfmt = 0;
      for (i = 0; i < want; i++) {
        if (!isprint(ptr[i])) {
          dfmt = 2;
        }
      }
    } else {
      dfmt = fmt;
    }
    switch (dfmt) {
    case 3:
    case 0:
      fwrite(ptr, 1, want, stdout);
      break;
    case 2:
      fprintf(stdout, "0x");
      for (i = 0; i < want; i++) {
        fprintf(stdout, "%02x", ((unsigned char *)ptr)[i]);
      }
    }
    free(ptr);
    return 0;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<print_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10b0 <arg_null_katcl@plt>
cmp    $0x0,%rax
jle    11ec <print_arg+0x4c>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%edi
mov    0x2e07(%rip),%rax
mov    (%rax),%esi
call   1050 <fputc@plt>
movl   $0x0,-0x4(%rbp)
jmp    145e <print_arg+0x2be>
mov    -0x18(%rbp),%eax
mov    %eax,-0x44(%rbp)
test   %eax,%eax
je     1213 <print_arg+0x73>
jmp    11ff <print_arg+0x5f>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     1258 <print_arg+0xb8>
jmp    1457 <print_arg+0x2b7>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1080 <arg_string_katcl@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    123a <print_arg+0x9a>
movl   $0xffffffff,-0x4(%rbp)
jmp    145e <print_arg+0x2be>
mov    -0x20(%rbp),%rdi
mov    0x2d9b(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
movl   $0x0,-0x4(%rbp)
jmp    145e <print_arg+0x2be>
movq   $0x0,-0x20(%rbp)
movl   $0x400,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x4,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1090 <realloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12a5 <print_arg+0x105>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145e <print_arg+0x2be>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%ecx
call   1070 <arg_buffer_katcl@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    12f1 <print_arg+0x151>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145e <print_arg+0x2be>
jmp    12f6 <print_arg+0x156>
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
ja     1275 <print_arg+0xd5>
cmpl   $0x0,-0x2c(%rbp)
ja     132d <print_arg+0x18d>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%edx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%edx
cmovb  %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    145e <print_arg+0x2be>
cmpl   $0x1,-0x18(%rbp)
jne    1389 <print_arg+0x1e9>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jae    1384 <print_arg+0x1e4>
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   10a0 <isprint@plt>
cmp    $0x0,%eax
jne    1371 <print_arg+0x1d1>
movl   $0x2,-0x3c(%rbp)
jmp    1376 <print_arg+0x1d6>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1345 <print_arg+0x1a5>
jmp    138f <print_arg+0x1ef>
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
test   %eax,%eax
je     13c4 <print_arg+0x224>
jmp    13a2 <print_arg+0x202>
mov    -0x48(%rbp),%eax
sub    $0x2,%eax
je     13e3 <print_arg+0x243>
jmp    13b3 <print_arg+0x213>
mov    -0x48(%rbp),%eax
sub    $0x3,%eax
jne    1442 <print_arg+0x2a2>
jmp    13c4 <print_arg+0x224>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    0x2c0e(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   10c0 <fwrite@plt>
jmp    1442 <print_arg+0x2a2>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
lea    0xc0d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jae    143d <print_arg+0x29d>
mov    0x2bcc(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
lea    0xbdb(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1401 <print_arg+0x261>
jmp    1442 <print_arg+0x2a2>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    145e <print_arg+0x2be>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r13d
mov    %rdi,%rbp
call   10b0 <arg_null_katcl@plt>
test   %rax,%rax
jle    11e2 <print_arg+0x42>
mov    0x2e1c(%rip),%rax
mov    (%rax),%esi
xor    %r12d,%r12d
xor    %edi,%edi
call   1050 <fputc@plt>
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%r12d
lea    -0x1(%rbx),%eax
cmp    $0x3,%eax
jae    12d9 <print_arg+0x139>
xor    %r15d,%r15d
xor    %edi,%edi
mov    $0x400,%esi
call   1090 <realloc@plt>
test   %rax,%rax
je     130b <print_arg+0x16b>
mov    %rax,%r14
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
mov    $0x400,%ecx
call   1070 <arg_buffer_katcl@plt>
cmp    $0x400,%eax
jbe    1318 <print_arg+0x178>
mov    %r14,%rdi
mov    %eax,%esi
mov    %eax,0x4(%rsp)
call   1090 <realloc@plt>
mov    %r14,%r15
test   %rax,%rax
je     130b <print_arg+0x16b>
mov    %rax,%r14
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
mov    0x4(%rsp),%r15d
mov    %r15d,%ecx
call   1070 <arg_buffer_katcl@plt>
cmp    %r15d,%eax
jbe    1318 <print_arg+0x178>
mov    %r14,%rdi
mov    %eax,0x4(%rsp)
mov    %eax,%esi
call   1090 <realloc@plt>
mov    %r14,%r15
test   %rax,%rax
je     130b <print_arg+0x16b>
mov    %rax,%r14
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
mov    0x4(%rsp),%r15d
mov    %r15d,%ecx
call   1070 <arg_buffer_katcl@plt>
cmp    %r15d,%eax
jbe    1318 <print_arg+0x178>
mov    %r14,%rdi
mov    %eax,%esi
mov    %eax,0x4(%rsp)
call   1090 <realloc@plt>
mov    %r14,%r15
test   %rax,%rax
je     130b <print_arg+0x16b>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
mov    0x4(%rsp),%ecx
call   1070 <arg_buffer_katcl@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    11d0 <print_arg+0x30>
test   %ebx,%ebx
jne    11d0 <print_arg+0x30>
mov    %rbp,%rdi
mov    %r13d,%esi
call   1080 <arg_string_katcl@plt>
test   %rax,%rax
je     11d0 <print_arg+0x30>
mov    0x2ce4(%rip),%rcx
mov    (%rcx),%esi
mov    %rax,%rdi
call   1040 <fputs@plt>
jmp    13d3 <print_arg+0x233>
mov    %r15,%rdi
call   1030 <free@plt>
jmp    11d0 <print_arg+0x30>
test   %eax,%eax
je     13cb <print_arg+0x22b>
mov    %eax,%r13d
cmp    $0x1,%ebx
jne    1359 <print_arg+0x1b9>
mov    %r13d,%r15d
xor    %ebp,%ebp
mov    $0x2,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%r14,%rbp,1),%edi
call   10a0 <isprint@plt>
test   %eax,%eax
cmove  %r12d,%ebx
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1340 <print_arg+0x1a0>
cmp    $0x3,%ebx
je     1367 <print_arg+0x1c7>
cmp    $0x2,%ebx
je     1382 <print_arg+0x1e2>
test   %ebx,%ebx
jne    13cb <print_arg+0x22b>
mov    0x2c72(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
call   10c0 <fwrite@plt>
jmp    13cb <print_arg+0x22b>
mov    0x2c57(%rip),%r15
mov    (%r15),%edi
lea    0xc6d(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
cmp    $0x2,%r13d
mov    $0x1,%ebp
cmovae %r13d,%ebp
lea    0xc55(%rip),%r12
xor    %ebx,%ebx
mov    (%r15),%edi
movzbl (%r14,%rbx,1),%edx
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    13b0 <print_arg+0x210>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %r12d,%r12d
jmp    11d0 <print_arg+0x30>

LLVM IR (-O0):
%struct.katcl_line = type { i32 }
@stdout = global i32 0
@.str = [3 x i8] c"0x\00"
@.str.1 = [5 x i8] c"%02x\00"
define i32 @print_arg(%struct.katcl_line* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.katcl_line*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store %struct.katcl_line* %0, %struct.katcl_line** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%16 = load %struct.katcl_line*, %struct.katcl_line** %5
%17 = load i32, i32* %6
%18 = call i64 @arg_null_katcl(%struct.katcl_line* %16, i32 %17)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %3
store i32 0, i32* %15
%21 = load i32, i32* %15
%22 = load i32, i32* @stdout
%23 = call i32 @fputc(i32 %21, i32 %22)
store i32 0, i32* %4
br label %132
24: ; preds = %3
%25 = load i32, i32* %7
switch i32 %25, label %131 [
i32 0, label %26
i32 2, label %37
i32 3, label %37
i32 1, label %37
]
26: ; preds = %24
%27 = load %struct.katcl_line*, %struct.katcl_line** %5
%28 = load i32, i32* %6
%29 = call i8* @arg_string_katcl(%struct.katcl_line* %27, i32 %28)
store i8* %29, i8** %8
%30 = load i8*, i8** %8
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %33
32: ; preds = %26
store i32 -1, i32* %4
br label %132
33: ; preds = %26
%34 = load i8*, i8** %8
%35 = load i32, i32* @stdout
%36 = call i32 @fputs(i8* %34, i32 %35)
store i32 0, i32* %4
br label %132
37: ; preds = %24, %24, %24
store i8* null, i8** %8
store i32 1024, i32* %10
store i32 0, i32* %11
store i32 4, i32* %12
br label %38
38: ; preds = %63, %37
%39 = load i8*, i8** %8
%40 = load i32, i32* %10
%41 = call i8* @realloc(i8* %39, i32 %40)
store i8* %41, i8** %9
%42 = load i8*, i8** %9
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %47
44: ; preds = %38
%45 = load i8*, i8** %8
%46 = call i32 @free(i8* %45)
store i32 -1, i32* %4
br label %132
47: ; preds = %38
%48 = load i32, i32* %10
store i32 %48, i32* %11
%49 = load i8*, i8** %9
store i8* %49, i8** %8
%50 = load %struct.katcl_line*, %struct.katcl_line** %5
%51 = load i32, i32* %6
%52 = load i8*, i8** %8
%53 = load i32, i32* %11
%54 = call i32 @arg_buffer_katcl(%struct.katcl_line* %50, i32 %51, i8* %52, i32 %53)
store i32 %54, i32* %10
%55 = load i32, i32* %12
%56 = add i32 %55, -1
store i32 %56, i32* %12
%57 = load i32, i32* %12
%58 = icmp ne i32 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %47
%60 = load i8*, i8** %8
%61 = call i32 @free(i8* %60)
store i32 -1, i32* %4
br label %132
62: ; preds = %47
br label %63
63: ; preds = %62
%64 = load i32, i32* %10
%65 = load i32, i32* %11
%66 = icmp ugt i32 %64, %65
br i1 %66, label %38, label %67
67: ; preds = %63
%68 = load i32, i32* %10
%69 = icmp ule i32 %68, 0
br i1 %69, label %70, label %77
70: ; preds = %67
%71 = load i8*, i8** %8
%72 = call i32 @free(i8* %71)
%73 = load i32, i32* %10
%74 = icmp ult i32 %73, 0
%75 = zext i1 %74 to i64
%76 = select i1 %74, i32 -1, i32 0
store i32 %76, i32* %4
br label %132
77: ; preds = %67
%78 = load i32, i32* %7
%79 = icmp eq i32 %78, 1
br i1 %79, label %80, label %99
80: ; preds = %77
store i32 0, i32* %14
store i32 0, i32* %13
br label %81
81: ; preds = %95, %80
%82 = load i32, i32* %13
%83 = load i32, i32* %10
%84 = icmp ult i32 %82, %83
br i1 %84, label %85, label %98
85: ; preds = %81
%86 = load i8*, i8** %8
%87 = load i32, i32* %13
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
%90 = load i8, i8* %89
%91 = call i32 @isprint(i8 signext %90)
%92 = icmp ne i32 %91, 0
br i1 %92, label %94, label %93
93: ; preds = %85
store i32 2, i32* %14
br label %94
94: ; preds = %93, %85
br label %95
95: ; preds = %94
%96 = load i32, i32* %13
%97 = add i32 %96, 1
store i32 %97, i32* %13
br label %81
98: ; preds = %81
br label %101
99: ; preds = %77
%100 = load i32, i32* %7
store i32 %100, i32* %14
br label %101
101: ; preds = %99, %98
%102 = load i32, i32* %14
switch i32 %102, label %128 [
i32 3, label %103
i32 0, label %103
i32 2, label %108
]
103: ; preds = %101, %101
%104 = load i8*, i8** %8
%105 = load i32, i32* %10
%106 = load i32, i32* @stdout
%107 = call i32 @fwrite(i8* %104, i32 1, i32 %105, i32 %106)
br label %128
108: ; preds = %101
%109 = load i32, i32* @stdout
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %13
br label %111
111: ; preds = %124, %108
%112 = load i32, i32* %13
%113 = load i32, i32* %10
%114 = icmp ult i32 %112, %113
br i1 %114, label %115, label %127
115: ; preds = %111
%116 = load i32, i32* @stdout
%117 = load i8*, i8** %8
%118 = load i32, i32* %13
%119 = zext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %117, i64 %119
%121 = load i8, i8* %120
%122 = zext i8 %121 to i32
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %122)
br label %124
124: ; preds = %115
%125 = load i32, i32* %13
%126 = add i32 %125, 1
store i32 %126, i32* %13
br label %111
127: ; preds = %111
br label %128
128: ; preds = %127, %101, %103
%129 = load i8*, i8** %8
%130 = call i32 @free(i8* %129)
store i32 0, i32* %4
br label %132
131: ; preds = %24
store i32 -1, i32* %4
br label %132
132: ; preds = %131, %128, %70, %59, %44, %33, %32, %20
%133 = load i32, i32* %4
ret i32 %133
}

LLVM IR (-O2):
%struct.katcl_line = type { i32 }
@stdout = global i32 0
@.str = [3 x i8] c"0x\00"
@.str.1 = [5 x i8] c"%02x\00"
define i32 @print_arg(%struct.katcl_line* %0, i32 %1, i32 %2) {
%4 = tail call i64 @arg_null_katcl(%struct.katcl_line* %0, i32 %1)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputc(i32 0, i32 %7)
br label %84
9: ; preds = %3
switch i32 %2, label %84 [
i32 0, label %10
i32 2, label %16
i32 3, label %16
i32 1, label %16
]
10: ; preds = %9
%11 = tail call i8* @arg_string_katcl(%struct.katcl_line* %0, i32 %1)
%12 = icmp eq i8* %11, null
br i1 %12, label %84, label %13
13: ; preds = %10
%14 = load i32, i32* @stdout
%15 = tail call i32 @fputs(i8* %11, i32 %14)
br label %84
16: ; preds = %9, %9, %9
%17 = tail call i8* @realloc(i8* null, i32 1024)
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %22
19: ; preds = %40, %34, %28, %16
%20 = phi i8* [ null, %16 ], [ %17, %28 ], [ %29, %34 ], [ %35, %40 ]
%21 = tail call i32 @free(i8* %20)
br label %84
22: ; preds = %16
%23 = tail call i32 @arg_buffer_katcl(%struct.katcl_line* %0, i32 %1, i8* %17, i32 1024)
%24 = icmp ugt i32 %23, 1024
br i1 %24, label %28, label %43
25: ; preds = %40
%26 = tail call i32 @arg_buffer_katcl(%struct.katcl_line* %0, i32 %1, i8* %41, i32 %38)
%27 = tail call i32 @free(i8* %41)
br label %84
28: ; preds = %22
%29 = tail call i8* @realloc(i8* %17, i32 %23)
%30 = icmp eq i8* %29, null
br i1 %30, label %19, label %31
31: ; preds = %28
%32 = tail call i32 @arg_buffer_katcl(%struct.katcl_line* %0, i32 %1, i8* %29, i32 %23)
%33 = icmp ugt i32 %32, %23
br i1 %33, label %34, label %43
34: ; preds = %31
%35 = tail call i8* @realloc(i8* %29, i32 %32)
%36 = icmp eq i8* %35, null
br i1 %36, label %19, label %37
37: ; preds = %34
%38 = tail call i32 @arg_buffer_katcl(%struct.katcl_line* %0, i32 %1, i8* %35, i32 %32)
%39 = icmp ugt i32 %38, %32
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = tail call i8* @realloc(i8* %35, i32 %38)
%42 = icmp eq i8* %41, null
br i1 %42, label %19, label %25
43: ; preds = %37, %31, %22
%44 = phi i32 [ %23, %22 ], [ %32, %31 ], [ %38, %37 ]
%45 = phi i8* [ %17, %22 ], [ %29, %31 ], [ %35, %37 ]
%46 = icmp eq i32 %44, 0
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = tail call i32 @free(i8* %45)
br label %84
49: ; preds = %43
%50 = icmp eq i32 %2, 1
br i1 %50, label %51, label %63
51: ; preds = %49
%52 = zext i32 %44 to i64
br label %53
53: ; preds = %51, %53
%54 = phi i64 [ 0, %51 ], [ %61, %53 ]
%55 = phi i32 [ 0, %51 ], [ %60, %53 ]
%56 = getelementptr inbounds i8, i8* %45, i64 %54
%57 = load i8, i8* %56
%58 = tail call i32 @isprint(i8 signext %57)
%59 = icmp eq i32 %58, 0
%60 = select i1 %59, i32 2, i32 %55
%61 = add nuw nsw i64 %54, 1
%62 = icmp eq i64 %61, %52
br i1 %62, label %63, label %53
63: ; preds = %53, %49
%64 = phi i32 [ %2, %49 ], [ %60, %53 ]
switch i32 %64, label %82 [
i32 3, label %65
i32 0, label %65
i32 2, label %68
]
65: ; preds = %63, %63
%66 = load i32, i32* @stdout
%67 = tail call i32 @fwrite(i8* %45, i32 1, i32 %44, i32 %66)
br label %82
68: ; preds = %63
%69 = load i32, i32* @stdout
%70 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%71 = call i32 @llvm.umax.i32(i32 %44, i32 1)
%72 = zext i32 %71 to i64
br label %73
73: ; preds = %68, %73
%74 = phi i64 [ 0, %68 ], [ %80, %73 ]
%75 = load i32, i32* @stdout
%76 = getelementptr inbounds i8, i8* %45, i64 %74
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
%79 = tail call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %78)
%80 = add nuw nsw i64 %74, 1
%81 = icmp eq i64 %80, %72
br i1 %81, label %82, label %73
82: ; preds = %73, %63, %65
%83 = tail call i32 @free(i8* %45)
br label %84
84: ; preds = %9, %10, %82, %47, %25, %19, %13, %6
%85 = phi i32 [ 0, %6 ], [ -1, %19 ], [ 0, %47 ], [ 0, %82 ], [ -1, %25 ], [ 0, %13 ], [ -1, %10 ], [ -1, %9 ]
ret i32 %85
}