#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void *fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ printf(char *, char const *);
int strlen(char *);
void parse(const char *list, const char *output_h, const char *output_c,
           int record_first) {
  FILE *ifile = fopen(list, "r");
  if (!ifile) {
    printf("ERROR: cannot open/read file, %s.\n", list);
    exit(1);
  }
  FILE *ofile_h = fopen(output_h, "w");
  if (!ofile_h) {
    fclose(ifile);
    printf("ERROR: cannot open/write file, %s.\n", output_h);
    exit(1);
  }
  FILE *ofile_c = 0;
  if (output_c) {
    if (!(ofile_c = fopen(output_c, "w"))) {
      fclose(ifile);
      fclose(ofile_h);
      printf("ERROR: cannot open/write file, %s.\n", output_c);
      exit(1);
    }
  }
  char record[500];
  char description[1000];
  int number;
  int not_finished = 2;
  int i, c;
  fprintf(ofile_h, "// generated by BIFF Record List Parser\n\n");
  fprintf(ofile_h, "#ifndef "
                   "_BIFFRECORDLIST_H"
                   "\n");
  fprintf(ofile_h, "#define "
                   "_BIFFRECORDLIST_H"
                   "\n\n");
  fprintf(ofile_h, "typedef enum {\n");
  if (ofile_c) {
    fprintf(ofile_c, "// generated by BIFF Record List Parser\n\n");
    fprintf(ofile_c, "#include \"%s\"\n", output_h);
    fprintf(ofile_c, "#include <stdio.h>\n\n");
    fprintf(ofile_c, "void BIFFRecordNamePrint(int "
                     "record"
                     ")"
                     "\n{\n");
    fprintf(ofile_c, "\tswitch("
                     "record"
                     ")\n");
    fprintf(ofile_c, "\t{\n");
  }
  while (1) {
    if ((record_first = !record_first)) {
      if (fscanf(ifile, "%x", &number) == EOF)
        break;
      while ((c = fgetc(ifile)) != EOF && c != '\n')
        ;
      if (c == EOF)
        break;
    } else {
      for (i = 0; (record[i] = fgetc(ifile)) != ':' && record[i] != EOF; i++)
        ;
      if (record[i] == EOF)
        break;
      record[i] = 0;
      if (!fgets(description, 999, ifile))
        break;
      if (description[strlen(description) - 1] == '\n')
        description[strlen(description) - 1] = 0;
    }
    if (!(--not_finished)) {
      if (ofile_c) {
        fprintf(ofile_c,
                "\tcase "
                "BIFF_RECORD"
                "_%s:\n",
                record);
        fprintf(ofile_c, "\t\tprintf(\"%s (0x%.4x): %s\\n\");\n", record,
                number, description);
        fprintf(ofile_c, "\t\tbreak;\n");
      }
      fprintf(ofile_h,
              "\t"
              "BIFF_RECORD"
              "_%s\t\t= 0x%.4x,\t//%s\n",
              record, number, description);
      not_finished = 2;
    }
  }
  if (ofile_c) {
    fprintf(ofile_c, "\tdefault:\n");
    fprintf(ofile_c, "\t\tprintf(\"(0x%%.4x): unknown record!\\n\", "
                     "record"
                     ");\n");
    fprintf(ofile_c, "\t\tbreak;\n");
    fprintf(ofile_c, "\t}\n");
    fprintf(ofile_c, "}\n");
    fclose(ofile_c);
  }
  fprintf(ofile_h, "} "
                   "BIFF_RECORD_LIST"
                   ";\n\n");
  fprintf(ofile_h, "void BIFFRecordNamePrint(int "
                   "record"
                   ")"
                   ";\n\n");
  fprintf(ofile_h, "#endif // "
                   "_BIFFRECORDLIST_H"
                   "\n");
  fclose(ifile);
  fclose(ofile_h);
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x640,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11e3 <parse+0x53>
mov    -0x8(%rbp),%rsi
lea    0xe2e(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1225 <parse+0x95>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rsi
lea    0xe11(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movq   $0x0,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1287 <parse+0xf7>
mov    -0x18(%rbp),%rdi
lea    0xde2(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1282 <parse+0xf2>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rsi
lea    0xdb4(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
jmp    1287 <parse+0xf7>
movl   $0x2,-0x628(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xdc7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xdda(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpq   $0x0,-0x38(%rbp)
je     1354 <parse+0x1c4>
mov    -0x38(%rbp),%rdi
lea    0xd5c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xdcd(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xdcc(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1359 <parse+0x1c9>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x1c(%rbp)
test   $0x1,%al
jne    137a <parse+0x1ea>
jmp    1419 <parse+0x289>
mov    -0x28(%rbp),%rdi
lea    0xd98(%rip),%rsi
lea    -0x624(%rbp),%rdx
call   1060 <fscanf@plt>
mov    0x2c50(%rip),%rcx
cmp    (%rcx),%eax
jne    13a5 <parse+0x215>
jmp    15d9 <parse+0x449>
jmp    13aa <parse+0x21a>
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0x630(%rbp)
xor    %eax,%eax
mov    0x2c24(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x631(%rbp)
je     13e2 <parse+0x252>
cmpl   $0xa,-0x630(%rbp)
setne  %al
mov    %al,-0x631(%rbp)
mov    -0x631(%rbp),%al
test   $0x1,%al
jne    13f5 <parse+0x265>
jmp    13fa <parse+0x26a>
jmp    13aa <parse+0x21a>
mov    -0x630(%rbp),%eax
mov    0x2be1(%rip),%rcx
cmp    (%rcx),%eax
jne    1414 <parse+0x284>
jmp    15d9 <parse+0x449>
jmp    1530 <parse+0x3a0>
movl   $0x0,-0x62c(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
movslq -0x62c(%rbp),%rcx
mov    %al,-0x230(%rbp,%rcx,1)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x3a,%ecx
mov    %al,-0x632(%rbp)
je     146f <parse+0x2df>
movslq -0x62c(%rbp),%rax
movsbl -0x230(%rbp,%rax,1),%eax
ff
mov    0x2b84(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x632(%rbp)
mov    -0x632(%rbp),%al
test   $0x1,%al
jne    1482 <parse+0x2f2>
jmp    149b <parse+0x30b>
jmp    1487 <parse+0x2f7>
mov    -0x62c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x62c(%rbp)
jmp    1423 <parse+0x293>
movslq -0x62c(%rbp),%rax
movsbl -0x230(%rbp,%rax,1),%eax
ff
mov    0x2b37(%rip),%rcx
cmp    (%rcx),%eax
jne    14be <parse+0x32e>
jmp    15d9 <parse+0x449>
movslq -0x62c(%rbp),%rax
movb   $0x0,-0x230(%rbp,%rax,1)
lea    -0x620(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x3e7,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
jne    14f0 <parse+0x360>
jmp    15d9 <parse+0x449>
lea    -0x620(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x620(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    152b <parse+0x39b>
lea    -0x620(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x620(%rbp,%rax,1)
jmp    1530 <parse+0x3a0>
mov    -0x628(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x628(%rbp)
cmp    $0x0,%eax
jne    15d4 <parse+0x444>
cmpq   $0x0,-0x38(%rbp)
je     15a4 <parse+0x414>
mov    -0x38(%rbp),%rdi
lea    -0x230(%rbp),%rdx
lea    0xbbb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    -0x230(%rbp),%rdx
mov    -0x624(%rbp),%ecx
lea    -0x620(%rbp),%r8
lea    0xbac(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xbba(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    -0x230(%rbp),%rdx
mov    -0x624(%rbp),%ecx
lea    -0x620(%rbp),%r8
lea    0xb9e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x628(%rbp)
jmp    1359 <parse+0x1c9>
cmpq   $0x0,-0x38(%rbp)
je     1647 <parse+0x4b7>
mov    -0x38(%rbp),%rdi
lea    0xb93(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xb8c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xb44(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xb9b(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xb8a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x30(%rbp),%rdi
lea    0xb72(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xb76(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xb8c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x640,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x608,%rsp
mov    %ecx,%r13d
mov    %rdx,%rbp
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xe3c(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     15e3 <parse+0x443>
mov    %rax,%rbx
lea    0xe49(%rip),%rsi
mov    %r12,%rdi
call   10a0 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     15ef <parse+0x44f>
test   %rbp,%rbp
je     122f <parse+0x8f>
lea    0xe27(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1232 <parse+0x92>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1030 <fclose@plt>
lea    0xe00(%rip),%rdi
mov    %rbp,%rsi
jmp    1601 <parse+0x461>
xor    %r14d,%r14d
lea    0xe12(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
mov    0x8(%rsp),%rbp
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xe1e(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xe20(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xe23(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
test   %r14,%r14
je     1335 <parse+0x195>
lea    0xda0(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xdf8(%rip),%rsi
mov    %r14,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xdf3(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xdef(%rip),%rdi
mov    $0x27,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xdfe(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
lea    0xdf6(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10c0 <fwrite@plt>
mov    %r14,0x10(%rsp)
mov    0x2ca7(%rip),%r14
lea    0x220(%rsp),%r12
xor    %ebp,%ebp
jmp    1380 <parse+0x1e0>
nopl   (%rax)
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%rdi
lea    0xe01(%rip),%rsi
mov    %r13,%rdx
mov    %r12,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x18(%rsp),%rbp
mov    0x3(%rsp),%al
mov    %al,%r15b
xor    $0x1,%bpl
mov    %r15d,%r13d
xor    %r15d,%r15d
test   %r13d,%r13d
sete   0x3(%rsp)
mov    %rbx,%rdi
je     1400 <parse+0x260>
call   1070 <fgetc@plt>
mov    %al,0x20(%rsp)
cmp    $0x3a,%al
je     13a9 <parse+0x209>
movsbl %al,%ecx
cmp    %ecx,(%r14)
jne    14ab <parse+0x30b>
xor    %r13d,%r13d
movsbl %al,%eax
cmp    %eax,(%r14)
je     14ea <parse+0x34a>
mov    %r13d,%eax
movb   $0x0,0x20(%rsp,%rax,1)
mov    %r12,%rdi
mov    $0x3e7,%esi
mov    %rbx,%rdx
call   1080 <fgets@plt>
test   %eax,%eax
je     14ea <parse+0x34a>
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r12,1)
jne    143c <parse+0x29c>
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r12,1)
jmp    143c <parse+0x29c>
nopl   0x0(%rax)
lea    0xd16(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1060 <fscanf@plt>
cmp    (%r14),%eax
je     14ea <parse+0x34a>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    (%r14),%ecx
cmp    %eax,%ecx
je     1434 <parse+0x294>
cmp    $0xa,%eax
jne    1420 <parse+0x280>
cmp    %eax,%ecx
je     14ea <parse+0x34a>
test   $0x1,%bpl
je     1372 <parse+0x1d2>
mov    %rbp,0x18(%rsp)
mov    0x10(%rsp),%rbp
test   %rbp,%rbp
lea    0x20(%rsp),%r13
je     1350 <parse+0x1b0>
mov    %rbp,%rdi
lea    0xcb8(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x4(%rsp),%ecx
mov    %rbp,%rdi
lea    0xcb7(%rip),%rsi
mov    %r13,%rdx
mov    %r12,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x9,%esi
mov    $0x1,%edx
lea    0xcb9(%rip),%rdi
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
jmp    1350 <parse+0x1b0>
mov    $0x1,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %al,0x20(%rsp,%r13,1)
cmp    $0x3a,%al
je     13ac <parse+0x20c>
movsbl %al,%ecx
add    $0x1,%r13
cmp    %ecx,(%r14)
jne    14c0 <parse+0x320>
add    $0xffffffffffffffff,%r13
jmp    13ac <parse+0x20c>
mov    0x10(%rsp),%rbp
test   %rbp,%rbp
je     1571 <parse+0x3d1>
lea    0xc87(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xc79(%rip),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xc32(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xc82(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xc6a(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
lea    0xc4c(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    0x8(%rsp),%rbp
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xc44(%rip),%rdi
mov    $0x27,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
lea    0xc53(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
add    $0x608,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa18(%rip),%rdi
mov    %r14,%rsi
jmp    1601 <parse+0x461>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xa29(%rip),%rdi
mov    %r12,%rsi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [35 x i8] c"ERROR: cannot open/read file, %s.\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [36 x i8] c"ERROR: cannot open/write file, %s.\0A\00"
@.str.4 = [42 x i8] c"// generated by BIFF Record List Parser\0A\0A\00"
@.str.5 = [27 x i8] c"#ifndef _BIFFRECORDLIST_H\0A\00"
@.str.6 = [28 x i8] c"#define _BIFFRECORDLIST_H\0A\0A\00"
@.str.7 = [16 x i8] c"typedef enum {\0A\00"
@.str.8 = [15 x i8] c"#include \22%s\22\0A\00"
@.str.9 = [21 x i8] c"#include <stdio.h>\0A\0A\00"
@.str.10 = [40 x i8] c"void BIFFRecordNamePrint(int record)\0A{\0A\00"
@.str.11 = [17 x i8] c"\09switch(record)\0A\00"
@.str.12 = [4 x i8] c"\09{\0A\00"
@.str.13 = [3 x i8] c"%x\00"
@EOF = global i32 0
@.str.14 = [23 x i8] c"\09case BIFF_RECORD_%s:\0A\00"
@.str.15 = [32 x i8] c"\09\09printf(\22%s (0x%.4x): %s\\n\22);\0A\00"
@.str.16 = [10 x i8] c"\09\09break;\0A\00"
@.str.17 = [33 x i8] c"\09BIFF_RECORD_%s\09\09= 0x%.4x,\09//%s\0A\00"
@.str.18 = [11 x i8] c"\09default:\0A\00"
@.str.19 = [51 x i8] c"\09\09printf(\22(0x%%.4x): unknown record!\\n\22, record);\0A\00"
@.str.20 = [4 x i8] c"\09}\0A\00"
@.str.21 = [3 x i8] c"}\0A\00"
@.str.22 = [22 x i8] c"} BIFF_RECORD_LIST;\0A\0A\00"
@.str.23 = [40 x i8] c"void BIFFRecordNamePrint(int record);\0A\0A\00"
@.str.24 = [29 x i8] c"#endif // _BIFFRECORDLIST_H\0A\00"
define void @parse(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca [500 x i8]
%13 = alloca [1000 x i8]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%18 = load i8*, i8** %5
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %9
%20 = load i32*, i32** %9
%21 = icmp ne i32* %20, null
br i1 %21, label %26, label %22
22: ; preds = %4
%23 = load i8*, i8** %5
%24 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %4
%27 = load i8*, i8** %6
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %10
%29 = load i32*, i32** %10
%30 = icmp ne i32* %29, null
br i1 %30, label %37, label %31
31: ; preds = %26
%32 = load i32*, i32** %9
%33 = call i32 @fclose(i32* %32)
%34 = load i8*, i8** %6
%35 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %26
store i32* null, i32** %11
%38 = load i8*, i8** %7
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %53
40: ; preds = %37
%41 = load i8*, i8** %7
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %42, i32** %11
%43 = icmp ne i32* %42, null
br i1 %43, label %52, label %44
44: ; preds = %40
%45 = load i32*, i32** %9
%46 = call i32 @fclose(i32* %45)
%47 = load i32*, i32** %10
%48 = call i32 @fclose(i32* %47)
%49 = load i8*, i8** %7
%50 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %40
br label %53
53: ; preds = %52, %37
store i32 2, i32* %15
%54 = load i32*, i32** %10
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %54, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%56 = load i32*, i32** %10
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%58 = load i32*, i32** %10
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%60 = load i32*, i32** %10
%61 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%62 = load i32*, i32** %11
%63 = icmp ne i32* %62, null
br i1 %63, label %64, label %78
64: ; preds = %53
%65 = load i32*, i32** %11
%66 = call i32 (i32*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%67 = load i32*, i32** %11
%68 = load i8*, i8** %6
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %68)
%70 = load i32*, i32** %11
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%72 = load i32*, i32** %11
%73 = call i32 (i32*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
%74 = load i32*, i32** %11
%75 = call i32 (i32*, i8*, ...) @fprintf(i32* %74, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%76 = load i32*, i32** %11
%77 = call i32 (i32*, i8*, ...) @fprintf(i32* %76, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
br label %78
78: ; preds = %64, %53
br label %79
79: ; preds = %78, %191
%80 = load i32, i32* %8
%81 = icmp ne i32 %80, 0
%82 = xor i1 %81, true
%83 = zext i1 %82 to i32
store i32 %83, i32* %8
br i1 %82, label %84, label %109
84: ; preds = %79
%85 = load i32*, i32** %9
%86 = call i32 @fscanf(i32* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %14)
%87 = load i32, i32* @EOF
%88 = icmp eq i32 %86, %87
br i1 %88, label %89, label %90
89: ; preds = %84
br label %192
90: ; preds = %84
br label %91
91: ; preds = %102, %90
%92 = load i32*, i32** %9
%93 = call i8* @fgetc(i32* %92)
%94 = ptrtoint i8* %93 to i32
store i32 %94, i32* %17
%95 = load i32, i32* @EOF
%96 = icmp ne i32 %94, %95
br i1 %96, label %97, label %100
97: ; preds = %91
%98 = load i32, i32* %17
%99 = icmp ne i32 %98, 10
br label %100
100: ; preds = %97, %91
%101 = phi i1 [ false, %91 ], [ %99, %97 ]
br i1 %101, label %102, label %103
102: ; preds = %100
br label %91
103: ; preds = %100
%104 = load i32, i32* %17
%105 = load i32, i32* @EOF
%106 = icmp eq i32 %104, %105
br i1 %106, label %107, label %108
107: ; preds = %103
br label %192
108: ; preds = %103
br label %167
109: ; preds = %79
store i32 0, i32* %16
br label %110
110: ; preds = %130, %109
%111 = load i32*, i32** %9
%112 = call i8* @fgetc(i32* %111)
%113 = ptrtoint i8* %112 to i8
%114 = load i32, i32* %16
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [500 x i8], [500 x i8]* %12, i64 0, i64 %115
store i8 %113, i8* %116
%117 = sext i8 %113 to i32
%118 = icmp ne i32 %117, 58
br i1 %118, label %119, label %127
119: ; preds = %110
%120 = load i32, i32* %16
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [500 x i8], [500 x i8]* %12, i64 0, i64 %121
%123 = load i8, i8* %122
%124 = sext i8 %123 to i32
%125 = load i32, i32* @EOF
%126 = icmp ne i32 %124, %125
br label %127
127: ; preds = %119, %110
%128 = phi i1 [ false, %110 ], [ %126, %119 ]
br i1 %128, label %129, label %133
129: ; preds = %127
br label %130
130: ; preds = %129
%131 = load i32, i32* %16
%132 = add nsw i32 %131, 1
store i32 %132, i32* %16
br label %110
133: ; preds = %127
%134 = load i32, i32* %16
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [500 x i8], [500 x i8]* %12, i64 0, i64 %135
%137 = load i8, i8* %136
%138 = sext i8 %137 to i32
%139 = load i32, i32* @EOF
%140 = icmp eq i32 %138, %139
br i1 %140, label %141, label %142
141: ; preds = %133
br label %192
142: ; preds = %133
%143 = load i32, i32* %16
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [500 x i8], [500 x i8]* %12, i64 0, i64 %144
store i8 0, i8* %145
%146 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%147 = load i32*, i32** %9
%148 = call i32 @fgets(i8* %146, i32 999, i32* %147)
%149 = icmp ne i32 %148, 0
br i1 %149, label %151, label %150
150: ; preds = %142
br label %192
151: ; preds = %142
%152 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%153 = call i32 @strlen(i8* %152)
%154 = sub nsw i32 %153, 1
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 %155
%157 = load i8, i8* %156
%158 = sext i8 %157 to i32
%159 = icmp eq i32 %158, 10
br i1 %159, label %160, label %166
160: ; preds = %151
%161 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%162 = call i32 @strlen(i8* %161)
%163 = sub nsw i32 %162, 1
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 %164
store i8 0, i8* %165
br label %166
166: ; preds = %160, %151
br label %167
167: ; preds = %166, %108
%168 = load i32, i32* %15
%169 = add nsw i32 %168, -1
store i32 %169, i32* %15
%170 = icmp ne i32 %169, 0
br i1 %170, label %191, label %171
171: ; preds = %167
%172 = load i32*, i32** %11
%173 = icmp ne i32* %172, null
br i1 %173, label %174, label %185
174: ; preds = %171
%175 = load i32*, i32** %11
%176 = getelementptr inbounds [500 x i8], [500 x i8]* %12, i64 0, i64 0
%177 = call i32 (i32*, i8*, ...) @fprintf(i32* %175, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i8* %176)
%178 = load i32*, i32** %11
%179 = getelementptr inbounds [500 x i8], [500 x i8]* %12, i64 0, i64 0
%180 = load i32, i32* %14
%181 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%182 = call i32 (i32*, i8*, ...) @fprintf(i32* %178, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i8* %179, i32 %180, i8* %181)
%183 = load i32*, i32** %11
%184 = call i32 (i32*, i8*, ...) @fprintf(i32* %183, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
br label %185
185: ; preds = %174, %171
%186 = load i32*, i32** %10
%187 = getelementptr inbounds [500 x i8], [500 x i8]* %12, i64 0, i64 0
%188 = load i32, i32* %14
%189 = getelementptr inbounds [1000 x i8], [1000 x i8]* %13, i64 0, i64 0
%190 = call i32 (i32*, i8*, ...) @fprintf(i32* %186, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0), i8* %187, i32 %188, i8* %189)
store i32 2, i32* %15
br label %191
191: ; preds = %185, %167
br label %79
192: ; preds = %150, %141, %107, %89
%193 = load i32*, i32** %11
%194 = icmp ne i32* %193, null
br i1 %194, label %195, label %208
195: ; preds = %192
%196 = load i32*, i32** %11
%197 = call i32 (i32*, i8*, ...) @fprintf(i32* %196, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0))
%198 = load i32*, i32** %11
%199 = call i32 (i32*, i8*, ...) @fprintf(i32* %198, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.19, i64 0, i64 0))
%200 = load i32*, i32** %11
%201 = call i32 (i32*, i8*, ...) @fprintf(i32* %200, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
%202 = load i32*, i32** %11
%203 = call i32 (i32*, i8*, ...) @fprintf(i32* %202, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0))
%204 = load i32*, i32** %11
%205 = call i32 (i32*, i8*, ...) @fprintf(i32* %204, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0))
%206 = load i32*, i32** %11
%207 = call i32 @fclose(i32* %206)
br label %208
208: ; preds = %195, %192
%209 = load i32*, i32** %10
%210 = call i32 (i32*, i8*, ...) @fprintf(i32* %209, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.22, i64 0, i64 0))
%211 = load i32*, i32** %10
%212 = call i32 (i32*, i8*, ...) @fprintf(i32* %211, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.23, i64 0, i64 0))
%213 = load i32*, i32** %10
%214 = call i32 (i32*, i8*, ...) @fprintf(i32* %213, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0))
%215 = load i32*, i32** %9
%216 = call i32 @fclose(i32* %215)
%217 = load i32*, i32** %10
%218 = call i32 @fclose(i32* %217)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [35 x i8] c"ERROR: cannot open/read file, %s.\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [36 x i8] c"ERROR: cannot open/write file, %s.\0A\00"
@.str.4 = [42 x i8] c"// generated by BIFF Record List Parser\0A\0A\00"
@.str.5 = [27 x i8] c"#ifndef _BIFFRECORDLIST_H\0A\00"
@.str.6 = [28 x i8] c"#define _BIFFRECORDLIST_H\0A\0A\00"
@.str.7 = [16 x i8] c"typedef enum {\0A\00"
@.str.8 = [15 x i8] c"#include \22%s\22\0A\00"
@.str.9 = [21 x i8] c"#include <stdio.h>\0A\0A\00"
@.str.10 = [40 x i8] c"void BIFFRecordNamePrint(int record)\0A{\0A\00"
@.str.11 = [17 x i8] c"\09switch(record)\0A\00"
@.str.12 = [4 x i8] c"\09{\0A\00"
@.str.13 = [3 x i8] c"%x\00"
@EOF = global i32 0
@.str.14 = [23 x i8] c"\09case BIFF_RECORD_%s:\0A\00"
@.str.15 = [32 x i8] c"\09\09printf(\22%s (0x%.4x): %s\\n\22);\0A\00"
@.str.16 = [10 x i8] c"\09\09break;\0A\00"
@.str.17 = [33 x i8] c"\09BIFF_RECORD_%s\09\09= 0x%.4x,\09//%s\0A\00"
@.str.18 = [11 x i8] c"\09default:\0A\00"
@.str.19 = [51 x i8] c"\09\09printf(\22(0x%%.4x): unknown record!\\n\22, record);\0A\00"
@.str.20 = [4 x i8] c"\09}\0A\00"
@.str.21 = [3 x i8] c"}\0A\00"
@.str.22 = [22 x i8] c"} BIFF_RECORD_LIST;\0A\0A\00"
@.str.23 = [40 x i8] c"void BIFFRecordNamePrint(int record);\0A\0A\00"
@.str.24 = [29 x i8] c"#endif // _BIFFRECORDLIST_H\0A\00"
define void @parse(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [500 x i8]
%6 = alloca [1000 x i8]
%7 = alloca i32
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %4
%14 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = tail call i32 @fclose(i32* %8)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %13
%21 = icmp eq i8* %2, null
br i1 %21, label %30, label %22
22: ; preds = %20
%23 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = tail call i32 @fclose(i32* %8)
%27 = tail call i32 @fclose(i32* %14)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %22, %20
%31 = phi i32* [ %23, %22 ], [ null, %20 ]
%32 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%34 = bitcast i32* %7 to i8*
%35 = tail call i64 @fwrite(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i64 41, i64 1, i32* %14)
%36 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i64 26, i64 1, i32* %14)
%37 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i64 27, i64 1, i32* %14)
%38 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i64 15, i64 1, i32* %14)
%39 = icmp eq i32* %31, null
br i1 %39, label %47, label %40
40: ; preds = %30
%41 = tail call i64 @fwrite(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i64 41, i64 1, i32* %31)
%42 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %1)
%43 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i64 20, i64 1, i32* %31)
%44 = tail call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), i64 39, i64 1, i32* %31)
%45 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i64 16, i64 1, i32* %31)
%46 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i64 3, i64 1, i32* %31)
br label %47
47: ; preds = %40, %30
br label %48
48: ; preds = %134, %47
%49 = phi i1 [ false, %47 ], [ %135, %134 ]
%50 = phi i32 [ %3, %47 ], [ %52, %134 ]
%51 = icmp eq i32 %50, 0
%52 = zext i1 %51 to i32
br i1 %51, label %62, label %53
53: ; preds = %48
%54 = call i8* @fgetc(i32* %8)
%55 = ptrtoint i8* %54 to i64
%56 = trunc i64 %55 to i8
store i8 %56, i8* %32
%57 = icmp eq i8 %56, 58
br i1 %57, label %99, label %58
58: ; preds = %53
%59 = sext i8 %56 to i32
%60 = load i32, i32* @EOF
%61 = icmp eq i32 %60, %59
br i1 %61, label %82, label %87
62: ; preds = %48
%63 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32* %7)
%64 = load i32, i32* @EOF
%65 = icmp eq i32 %63, %64
br i1 %65, label %136, label %66
66: ; preds = %62, %66
%67 = call i8* @fgetc(i32* %8)
%68 = ptrtoint i8* %67 to i64
%69 = trunc i64 %68 to i32
%70 = load i32, i32* @EOF
%71 = icmp ne i32 %70, %69
%72 = icmp ne i32 %69, 10
%73 = and i1 %71, %72
br i1 %73, label %66, label %74
74: ; preds = %66
%75 = ptrtoint i8* %67 to i64
%76 = trunc i64 %75 to i32
%77 = icmp eq i32 %70, %76
br i1 %77, label %136, label %124
78: ; preds = %87
%79 = sext i8 %94 to i32
%80 = load i32, i32* @EOF
%81 = icmp eq i32 %80, %79
br i1 %81, label %82, label %87
82: ; preds = %78, %58
%83 = phi i64 [ 0, %58 ], [ %90, %78 ]
%84 = phi i8* [ %54, %58 ], [ %92, %78 ]
%85 = trunc i64 %83 to i32
%86 = ptrtoint i8* %84 to i64
br label %99
87: ; preds = %58, %78
%88 = phi i32 [ %91, %78 ], [ 0, %58 ]
%89 = phi i64 [ %90, %78 ], [ 0, %58 ]
%90 = add nuw i64 %89, 1
%91 = add nuw nsw i32 %88, 1
%92 = call i8* @fgetc(i32* %8)
%93 = ptrtoint i8* %92 to i64
%94 = trunc i64 %93 to i8
%95 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 %90
store i8 %94, i8* %95
%96 = icmp eq i8 %94, 58
br i1 %96, label %97, label %78
97: ; preds = %87
%98 = ptrtoint i8* %92 to i64
br label %99
99: ; preds = %97, %82, %53
%100 = phi i64 [ %55, %53 ], [ %86, %82 ], [ %98, %97 ]
%101 = phi i32 [ 0, %53 ], [ %85, %82 ], [ %91, %97 ]
%102 = trunc i64 %100 to i32
%103 = shl i32 %102, 24
%104 = ashr exact i32 %103, 24
%105 = load i32, i32* @EOF
%106 = icmp eq i32 %105, %104
br i1 %106, label %136, label %107
107: ; preds = %99
%108 = zext i32 %101 to i64
%109 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 %108
store i8 0, i8* %109
%110 = call i32 @fgets(i8* %33, i32 999, i32* %8)
%111 = icmp eq i32 %110, 0
br i1 %111, label %136, label %112
112: ; preds = %107
%113 = call i32 @strlen(i8* %33)
%114 = add nsw i32 %113, -1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %115
%117 = load i8, i8* %116
%118 = icmp eq i8 %117, 10
br i1 %118, label %119, label %124
119: ; preds = %112
%120 = call i32 @strlen(i8* %33)
%121 = add nsw i32 %120, -1
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %122
store i8 0, i8* %123
br label %124
124: ; preds = %112, %119, %74
br i1 %49, label %125, label %134
125: ; preds = %124
br i1 %39, label %131, label %126
126: ; preds = %125
%127 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i8* %32)
%128 = load i32, i32* %7
%129 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i8* %32, i32 %128, i8* %33)
%130 = call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i64 9, i64 1, i32* %31)
br label %131
131: ; preds = %126, %125
%132 = load i32, i32* %7
%133 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0), i8* %32, i32 %132, i8* %33)
br label %134
134: ; preds = %131, %124
%135 = xor i1 %49, true
br label %48
136: ; preds = %107, %99, %74, %62
br i1 %39, label %144, label %137
137: ; preds = %136
%138 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0), i64 10, i64 1, i32* %31)
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.19, i64 0, i64 0))
%140 = call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i64 9, i64 1, i32* %31)
%141 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i64 3, i64 1, i32* %31)
%142 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i64 2, i64 1, i32* %31)
%143 = call i32 @fclose(i32* %31)
br label %144
144: ; preds = %137, %136
%145 = call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.22, i64 0, i64 0), i64 21, i64 1, i32* %14)
%146 = call i64 @fwrite(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.23, i64 0, i64 0), i64 39, i64 1, i32* %14)
%147 = call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0), i64 28, i64 1, i32* %14)
%148 = call i32 @fclose(i32* %8)
%149 = call i32 @fclose(i32* %14)
ret void
}