#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*/ printf(char *, ...);
int /*<<< orphan*/ replace(char *, char *, char *);
int sscanf(char **, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void *strdup(char *);
char **strstr(char **, char *);
char *pack_table(const char *buf, const char *header, const char *name) {
  struct {
    int len;
    char *buf[256];
    int cnt[256];
  } tbl = {.len = 0, .cnt = {0}};
  char flags[32], last[32];
  int i, j;
  while (buf && sscanf(buf, " db %32s", flags) == 1) {
    if (!tbl.len || strcmp(last, flags) || tbl.cnt[tbl.len - 1] == 7) {
      if (tbl.len++)
        tbl.buf[tbl.len - 2] = strdup(last);
      strcpy(last, flags);
    } else {
      tbl.cnt[tbl.len - 1]++;
    }
    buf = strstr(buf + 2, "\n") + 1;
  }
  tbl.buf[tbl.len - 1] = strdup(last);
  printf("%s (%d bytes)\n\n%s\n", header, tbl.len, name);
  for (i = 0, j = 0; i < tbl.len; i++) {
    replace(tbl.buf[i], "C_", "");
    replace(tbl.buf[i], "+", "_");
    printf("\tdb T_%-17s + %d shl 5", tbl.buf[i], tbl.cnt[i]);
    if (tbl.cnt[i]) {
      printf(" ; %02X-%02X\n", j, j + tbl.cnt[i]);
      j += tbl.cnt[i] + 1;
    } else {
      printf(" ; %02X\n", j++);
    }
  }
  return (char *)buf;
}


x86 assembly (clang, -O0):
<pack_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0xc20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc08,%edx
call   1050 <memset@plt>
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xc69(%rbp)
je     11e0 <pack_table+0x60>
mov    -0x8(%rbp),%rdi
lea    -0xc40(%rbp),%rdx
lea    0xe31(%rip),%rsi
call   1070 <sscanf@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0xc69(%rbp)
mov    -0xc69(%rbp),%al
test   $0x1,%al
jne    11f3 <pack_table+0x73>
jmp    12c7 <pack_table+0x147>
cmpl   $0x0,-0xc20(%rbp)
je     1236 <pack_table+0xb6>
lea    -0xc60(%rbp),%rdi
lea    -0xc40(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1236 <pack_table+0xb6>
mov    -0xc20(%rbp),%eax
sub    $0x1,%eax
cltq
cmpl   $0x7,-0x418(%rbp,%rax,4)
07
jne    128a <pack_table+0x10a>
mov    -0xc20(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc20(%rbp)
cmp    $0x0,%eax
je     1272 <pack_table+0xf2>
lea    -0xc60(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,%rcx
mov    -0xc20(%rbp),%eax
sub    $0x2,%eax
cltq
mov    %rcx,-0xc18(%rbp,%rax,8)
ff
lea    -0xc60(%rbp),%rdi
lea    -0xc40(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    12a6 <pack_table+0x126>
mov    -0xc20(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x418(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x418(%rbp,%rax,4)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
lea    0xd98(%rip),%rsi
call   10a0 <strstr@plt>
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    11aa <pack_table+0x2a>
lea    -0xc60(%rbp),%rdi
call   1090 <strdup@plt>
mov    %rax,%rcx
mov    -0xc20(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %rcx,-0xc18(%rbp,%rax,8)
ff
mov    -0x10(%rbp),%rsi
mov    -0xc20(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc64(%rbp)
movl   $0x0,-0xc68(%rbp)
mov    -0xc64(%rbp),%eax
cmp    -0xc20(%rbp),%eax
jge    1431 <pack_table+0x2b1>
movslq -0xc64(%rbp),%rax
mov    -0xc18(%rbp,%rax,8),%rdi
ff
lea    0xcdb(%rip),%rsi
lea    0xd06(%rip),%rdx
call   1080 <replace@plt>
movslq -0xc64(%rbp),%rax
mov    -0xc18(%rbp,%rax,8),%rdi
ff
lea    0xcbc(%rip),%rsi
lea    0xcb3(%rip),%rdx
call   1080 <replace@plt>
movslq -0xc64(%rbp),%rax
mov    -0xc18(%rbp,%rax,8),%rsi
ff
movslq -0xc64(%rbp),%rax
mov    -0x418(%rbp,%rax,4),%edx
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0xc64(%rbp),%rax
cmpl   $0x0,-0x418(%rbp,%rax,4)
je     13f9 <pack_table+0x279>
mov    -0xc68(%rbp),%esi
mov    -0xc68(%rbp),%edx
movslq -0xc64(%rbp),%rax
add    -0x418(%rbp,%rax,4),%edx
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0xc64(%rbp),%rax
mov    -0x418(%rbp,%rax,4),%eax
add    $0x1,%eax
add    -0xc68(%rbp),%eax
mov    %eax,-0xc68(%rbp)
jmp    1418 <pack_table+0x298>
mov    -0xc68(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc68(%rbp)
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    141d <pack_table+0x29d>
mov    -0xc64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc64(%rbp)
jmp    1319 <pack_table+0x199>
mov    -0x8(%rbp),%rax
add    $0xc70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc58,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x50(%rsp),%rdi
xor    %r12d,%r12d
mov    $0xc08,%edx
xor    %esi,%esi
call   1060 <memset@plt>
test   %rbx,%rbx
je     1285 <pack_table+0x105>
mov    %r14,0x8(%rsp)
lea    0xe3d(%rip),%rsi
lea    0x30(%rsp),%rdx
mov    %rbx,%rdi
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1279 <pack_table+0xf9>
lea    0x10(%rsp),%r12
lea    0x30(%rsp),%r13
lea    0xe16(%rip),%rbp
jmp    122e <pack_table+0xae>
nopl   0x0(%rax)
movl   $0x1,0x50(%rsp)
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
add    $0x2,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
add    $0x8,%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1279 <pack_table+0xf9>
movslq 0x50(%rsp),%r14
test   %r14,%r14
je     11f0 <pack_table+0x70>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1255 <pack_table+0xd5>
mov    0x854(%rsp,%r14,4),%eax
cmp    $0x7,%eax
jne    126c <pack_table+0xec>
lea    0x1(%r14),%eax
mov    %eax,0x50(%rsp)
mov    %r12,%rdi
call   10a0 <strdup@plt>
mov    %rax,0x50(%rsp,%r14,8)
jmp    11f8 <pack_table+0x78>
add    $0x1,%eax
mov    %eax,0x854(%rsp,%r14,4)
jmp    1203 <pack_table+0x83>
mov    0x50(%rsp),%r12d
mov    0x8(%rsp),%r14
jmp    1287 <pack_table+0x107>
xor    %ebx,%ebx
lea    0x10(%rsp),%rdi
call   10a0 <strdup@plt>
movslq %r12d,%rbp
mov    %rax,0x50(%rsp,%rbp,8)
lea    0xd69(%rip),%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebp,%ebp
jle    1360 <pack_table+0x1e0>
mov    %r12d,%r13d
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    12f3 <pack_table+0x173>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xd6f(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%r15d
add    %r15d,%r14d
add    $0x1,%rbp
cmp    %rbp,%r13
je     1360 <pack_table+0x1e0>
mov    0x58(%rsp,%rbp,8),%r12
mov    %r12,%rdi
lea    0xd1a(%rip),%rsi
lea    0xd45(%rip),%rdx
call   1090 <replace@plt>
mov    %r12,%rdi
lea    0xd07(%rip),%rsi
lea    0xcfe(%rip),%rdx
call   1090 <replace@plt>
mov    0x858(%rsp,%rbp,4),%r15d
lea    0xcee(%rip),%rdi
mov    %r12,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
je     12d0 <pack_table+0x150>
lea    (%r15,%r14,1),%edx
lea    0xce8(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15d
jmp    12e7 <pack_table+0x167>
mov    %rbx,%rax
add    $0xc58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.anon = type { i32, [256 x i8*], [256 x i32] }
@.str = [9 x i8] c" db %32s\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [19 x i8] c"%s (%d bytes)\0A\0A%s\0A\00"
@.str.3 = [3 x i8] c"C_\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c"+\00"
@.str.6 = [2 x i8] c"_\00"
@.str.7 = [23 x i8] c"\09db T_%-17s + %d shl 5\00"
@.str.8 = [14 x i8] c" ; %02X-%02X\0A\00"
@.str.9 = [9 x i8] c" ; %02X\0A\00"
define i8* @pack_table(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.anon
%8 = alloca [32 x i8]
%9 = alloca [32 x i8]
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%12 = bitcast %struct.anon* %7 to i8*
br label %13
13: ; preds = %69, %3
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i8*, i8** %4
%18 = bitcast i8* %17 to i8**
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%20 = call i32 @sscanf(i8** %18, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = icmp eq i32 %20, 1
br label %22
22: ; preds = %16, %13
%23 = phi i1 [ false, %13 ], [ %21, %16 ]
br i1 %23, label %24, label %76
24: ; preds = %22
%25 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %24
%29 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%31 = call i64 @strcmp(i8* %29, i8* %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %42, label %33
33: ; preds = %28
%34 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 2
%35 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%36 = load i32, i32* %35
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [256 x i32], [256 x i32]* %34, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 7
br i1 %41, label %42, label %60
42: ; preds = %33, %28, %24
%43 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%44 = load i32, i32* %43
%45 = add nsw i32 %44, 1
store i32 %45, i32* %43
%46 = icmp ne i32 %44, 0
br i1 %46, label %47, label %56
47: ; preds = %42
%48 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%49 = call i8* @strdup(i8* %48)
%50 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 1
%51 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%52 = load i32, i32* %51
%53 = sub nsw i32 %52, 2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [256 x i8*], [256 x i8*]* %50, i64 0, i64 %54
store i8* %49, i8** %55
br label %56
56: ; preds = %47, %42
%57 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%58 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%59 = call i32 @strcpy(i8* %57, i8* %58)
br label %69
60: ; preds = %33
%61 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 2
%62 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%63 = load i32, i32* %62
%64 = sub nsw i32 %63, 1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [256 x i32], [256 x i32]* %61, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = add nsw i32 %67, 1
store i32 %68, i32* %66
br label %69
69: ; preds = %60, %56
%70 = load i8*, i8** %4
%71 = getelementptr inbounds i8, i8* %70, i64 2
%72 = bitcast i8* %71 to i8**
%73 = call i8** @strstr(i8** %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = bitcast i8** %74 to i8*
store i8* %75, i8** %4
br label %13
76: ; preds = %22
%77 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%78 = call i8* @strdup(i8* %77)
%79 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 1
%80 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%81 = load i32, i32* %80
%82 = sub nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [256 x i8*], [256 x i8*]* %79, i64 0, i64 %83
store i8* %78, i8** %84
%85 = load i8*, i8** %5
%86 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%87 = load i32, i32* %86
%88 = load i8*, i8** %6
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %85, i32 %87, i8* %88)
store i32 0, i32* %10
store i32 0, i32* %11
br label %90
90: ; preds = %148, %76
%91 = load i32, i32* %10
%92 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
%93 = load i32, i32* %92
%94 = icmp slt i32 %91, %93
br i1 %94, label %95, label %151
95: ; preds = %90
%96 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 1
%97 = load i32, i32* %10
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [256 x i8*], [256 x i8*]* %96, i64 0, i64 %98
%100 = load i8*, i8** %99
%101 = call i32 @replace(i8* %100, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%102 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 1
%103 = load i32, i32* %10
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [256 x i8*], [256 x i8*]* %102, i64 0, i64 %104
%106 = load i8*, i8** %105
%107 = call i32 @replace(i8* %106, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%108 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 1
%109 = load i32, i32* %10
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [256 x i8*], [256 x i8*]* %108, i64 0, i64 %110
%112 = load i8*, i8** %111
%113 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 2
%114 = load i32, i32* %10
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [256 x i32], [256 x i32]* %113, i64 0, i64 %115
%117 = load i32, i32* %116
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %112, i32 %117)
%119 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 2
%120 = load i32, i32* %10
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [256 x i32], [256 x i32]* %119, i64 0, i64 %121
%123 = load i32, i32* %122
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %143
125: ; preds = %95
%126 = load i32, i32* %11
%127 = load i32, i32* %11
%128 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 2
%129 = load i32, i32* %10
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [256 x i32], [256 x i32]* %128, i64 0, i64 %130
%132 = load i32, i32* %131
%133 = add nsw i32 %127, %132
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 %126, i32 %133)
%135 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 2
%136 = load i32, i32* %10
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [256 x i32], [256 x i32]* %135, i64 0, i64 %137
%139 = load i32, i32* %138
%140 = add nsw i32 %139, 1
%141 = load i32, i32* %11
%142 = add nsw i32 %141, %140
store i32 %142, i32* %11
br label %147
143: ; preds = %95
%144 = load i32, i32* %11
%145 = add nsw i32 %144, 1
store i32 %145, i32* %11
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 %144)
br label %147
147: ; preds = %143, %125
br label %148
148: ; preds = %147
%149 = load i32, i32* %10
%150 = add nsw i32 %149, 1
store i32 %150, i32* %10
br label %90
151: ; preds = %90
%152 = load i8*, i8** %4
ret i8* %152
}

LLVM IR (-O2):
%struct.anon = type { i32, [256 x i8*], [256 x i32] }
@.str = [9 x i8] c" db %32s\00"
@.str.2 = [19 x i8] c"%s (%d bytes)\0A\0A%s\0A\00"
@.str.3 = [3 x i8] c"C_\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [2 x i8] c"+\00"
@.str.6 = [2 x i8] c"_\00"
@.str.7 = [23 x i8] c"\09db T_%-17s + %d shl 5\00"
@.str.8 = [14 x i8] c" ; %02X-%02X\0A\00"
@.str.9 = [9 x i8] c" ; %02X\0A\00"
define i8* @pack_table(i8* %0, i8* %1, i8* %2) {
%4 = alloca %struct.anon
%5 = alloca [32 x i8]
%6 = alloca [32 x i8]
%7 = bitcast %struct.anon* %4 to i8*
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%10 = icmp eq i8* %0, null
br i1 %10, label %48, label %11
11: ; preds = %3
%12 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 0
%13 = bitcast i8* %0 to i8**
%14 = call i32 @sscanf(i8** %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %45
16: ; preds = %11, %38
%17 = phi i8* [ %41, %38 ], [ %0, %11 ]
%18 = load i32, i32* %12
%19 = icmp eq i32 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %16
%21 = call i64 @strcmp(i8* %9, i8* %8)
%22 = icmp eq i64 %21, 0
%23 = add nsw i32 %18, -1
%24 = sext i32 %23 to i64
br i1 %22, label %25, label %30
25: ; preds = %20
%26 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 2, i64 %24
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 7
br i1 %28, label %30, label %36
29: ; preds = %16
store i32 1, i32* %12
br label %34
30: ; preds = %20, %25
%31 = add nsw i32 %18, 1
store i32 %31, i32* %12
%32 = call i8* @strdup(i8* %9)
%33 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 1, i64 %24
store i8* %32, i8** %33
br label %34
34: ; preds = %29, %30
%35 = call i32 @strcpy(i8* %9, i8* %8)
br label %38
36: ; preds = %25
%37 = add nsw i32 %27, 1
store i32 %37, i32* %26
br label %38
38: ; preds = %36, %34
%39 = getelementptr inbounds i8, i8* %17, i64 2
%40 = call i8* @strchr(i8* %39, i32 10)
%41 = getelementptr inbounds i8, i8* %40, i64 8
%42 = bitcast i8* %41 to i8**
%43 = call i32 @sscanf(i8** %42, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
%44 = icmp eq i32 %43, 1
br i1 %44, label %16, label %45
45: ; preds = %38, %11
%46 = phi i8* [ %0, %11 ], [ %41, %38 ]
%47 = load i32, i32* %12
br label %48
48: ; preds = %45, %3
%49 = phi i32 [ 0, %3 ], [ %47, %45 ]
%50 = phi i8* [ null, %3 ], [ %46, %45 ]
%51 = call i8* @strdup(i8* %9)
%52 = add nsw i32 %49, -1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 1, i64 %53
store i8* %51, i8** %54
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %1, i32 %49, i8* %2)
%56 = icmp sgt i32 %49, 0
br i1 %56, label %57, label %81
57: ; preds = %48
%58 = zext i32 %49 to i64
br label %59
59: ; preds = %57, %76
%60 = phi i64 [ 0, %57 ], [ %79, %76 ]
%61 = phi i32 [ 0, %57 ], [ %78, %76 ]
%62 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 1, i64 %60
%63 = load i8*, i8** %62
%64 = call i32 @replace(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%65 = call i32 @replace(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%66 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 2, i64 %60
%67 = load i32, i32* %66
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %63, i32 %67)
%69 = icmp eq i32 %67, 0
br i1 %69, label %74, label %70
70: ; preds = %59
%71 = add nsw i32 %67, %61
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 %61, i32 %71)
%73 = add nsw i32 %67, 1
br label %76
74: ; preds = %59
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32 %61)
br label %76
76: ; preds = %70, %74
%77 = phi i32 [ %73, %70 ], [ 1, %74 ]
%78 = add nsw i32 %77, %61
%79 = add nuw nsw i64 %60, 1
%80 = icmp eq i64 %79, %58
br i1 %80, label %81, label %59
81: ; preds = %76, %48
ret i8* %50
}