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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ pq(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(void) {
  char line[1024], *c, *bra, vend[8];
  int vendors = 0;
  int mode = 0;
  int lino = 0;
  int vendor_len = 0;
  FILE *devf, *clsf;
  devf = fopen("devlist.h", "w");
  clsf = fopen("classlist.h", "w");
  if (!devf || !clsf) {
    fprintf(stderr, "Cannot create output file!\n");
    return 1;
  }
  while (fgets(line, sizeof(line) - 1, stdin)) {
    lino++;
    if ((c = strchr(line, '\n')))
      *c = 0;
    if (!line[0] || line[0] == '#')
      continue;
    if (line[1] == ' ') {
      if (line[0] == 'C' && strlen(line) > 4 && line[4] == ' ') {
        vend[0] = line[2];
        vend[1] = line[3];
        vend[2] = 0;
        mode = 2;
      } else
        goto err;
    } else if (line[0] == '\t') {
      if (line[1] == '\t')
        continue;
      switch (mode) {
      case 1:
        if (strlen(line) > 5 && line[5] == ' ') {
          c = line + 5;
          while (*c == ' ')
            *c++ = 0;
          if (vendor_len + strlen(c) + 1 > 79) {
            bra = strchr(c, '[');
            if (bra && bra > c && bra[-1] == ' ')
              bra[-1] = 0;
            if (vendor_len + strlen(c) + 1 > 79) {
              fprintf(stderr, "Line %d: Device name too long\n", lino);
              return 1;
            }
          }
          fprintf(devf, "\tDEVICE(%s,%s,\"", vend, line + 1);
          pq(devf, c);
          fputs("\")\n", devf);
        } else
          goto err;
        break;
      case 2:
        if (strlen(line) > 3 && line[3] == ' ') {
          c = line + 3;
          while (*c == ' ')
            *c++ = 0;
          fprintf(clsf, "CLASS(%s%s, \"%s\")\n", vend, line + 1, c);
        } else
          goto err;
        break;
      default:
        goto err;
      }
    } else if (strlen(line) > 4 && line[4] == ' ') {
      c = line + 4;
      while (*c == ' ')
        *c++ = 0;
      if (vendors)
        fputs("ENDVENDOR()\n\n", devf);
      vendors++;
      strcpy(vend, line);
      vendor_len = strlen(c);
      if (vendor_len + 24 > 79) {
        fprintf(stderr, "Line %d: Vendor name too long\n", lino);
        return 1;
      }
      fprintf(devf, "VENDOR(%s,\"", vend);
      pq(devf, c);
      fputs("\")\n", devf);
      mode = 1;
    } else {
    err:
      fprintf(stderr, "Line %d: Syntax error in mode %d: %s\n", lino, mode,
              line);
      return 1;
    }
  }
  fputs("ENDVENDOR()\n\n#undef VENDOR\n#undef DEVICE\n#undef ENDVENDOR\n",
        devf);
  fputs("\n#undef CLASS\n", clsf);
  fclose(devf);
  fclose(clsf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x42c(%rbp)
movl   $0x0,-0x430(%rbp)
movl   $0x0,-0x434(%rbp)
movl   $0x0,-0x438(%rbp)
lea    0xe2f(%rip),%rdi
lea    0xe32(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x440(%rbp)
lea    0xe21(%rip),%rdi
lea    0xe18(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x440(%rbp)
je     121a <main+0x8a>
cmpq   $0x0,-0x448(%rbp)
jne    123d <main+0xad>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17c3 <main+0x633>
jmp    1242 <main+0xb2>
lea    -0x410(%rbp),%rdi
mov    0x2d98(%rip),%rax
mov    (%rax),%edx
mov    $0x3ff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     177e <main+0x5ee>
mov    -0x434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x434(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     12a1 <main+0x111>
mov    -0x418(%rbp),%rax
movb   $0x0,(%rax)
cmpb   $0x0,-0x410(%rbp)
je     12be <main+0x12e>
movsbl -0x410(%rbp),%eax
cmp    $0x23,%eax
jne    12c3 <main+0x133>
jmp    1242 <main+0xb2>
movsbl -0x40f(%rbp),%eax
cmp    $0x20,%eax
jne    1340 <main+0x1b0>
movsbl -0x410(%rbp),%eax
cmp    $0x43,%eax
jne    1336 <main+0x1a6>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jle    1336 <main+0x1a6>
movsbl -0x40c(%rbp),%eax
cmp    $0x20,%eax
jne    1336 <main+0x1a6>
mov    -0x40e(%rbp),%al
mov    %al,-0x428(%rbp)
mov    -0x40d(%rbp),%al
mov    %al,-0x427(%rbp)
movb   $0x0,-0x426(%rbp)
movl   $0x2,-0x430(%rbp)
jmp    133b <main+0x1ab>
jmp    1739 <main+0x5a9>
jmp    1779 <main+0x5e9>
movsbl -0x410(%rbp),%eax
cmp    $0x9,%eax
jne    15eb <main+0x45b>
movsbl -0x40f(%rbp),%eax
cmp    $0x9,%eax
jne    1365 <main+0x1d5>
jmp    1242 <main+0xb2>
mov    -0x430(%rbp),%eax
mov    %eax,-0x44c(%rbp)
sub    $0x1,%eax
je     1393 <main+0x203>
jmp    137f <main+0x1ef>
mov    -0x44c(%rbp),%eax
sub    $0x2,%eax
je     153b <main+0x3ab>
jmp    15e1 <main+0x451>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jle    1531 <main+0x3a1>
movsbl -0x40b(%rbp),%eax
cmp    $0x20,%eax
jne    1531 <main+0x3a1>
lea    -0x410(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    13fa <main+0x26a>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    13ca <main+0x23a>
mov    -0x438(%rbp),%eax
mov    %eax,-0x450(%rbp)
mov    -0x418(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x450(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cmp    $0x4f,%eax
jle    14dd <main+0x34d>
mov    -0x418(%rbp),%rdi
mov    $0x5b,%esi
call   1060 <strchr@plt>
mov    %rax,-0x420(%rbp)
cmpq   $0x0,-0x420(%rbp)
je     1481 <main+0x2f1>
mov    -0x420(%rbp),%rax
cmp    -0x418(%rbp),%rax
jbe    1481 <main+0x2f1>
mov    -0x420(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
jne    1481 <main+0x2f1>
mov    -0x420(%rbp),%rax
movb   $0x0,-0x1(%rax)
mov    -0x438(%rbp),%eax
mov    %eax,-0x454(%rbp)
mov    -0x418(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x454(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cmp    $0x4f,%eax
jle    14d8 <main+0x348>
mov    0x2b22(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
lea    0xb6f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17c3 <main+0x633>
jmp    14dd <main+0x34d>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
lea    0xb54(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x418(%rbp),%rsi
call   10b0 <pq@plt>
mov    -0x440(%rbp),%rsi
lea    0xb4b(%rip),%rdi
call   1070 <fputs@plt>
jmp    1536 <main+0x3a6>
jmp    1739 <main+0x5a9>
jmp    15e6 <main+0x456>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jle    15d7 <main+0x447>
movsbl -0x40d(%rbp),%eax
cmp    $0x20,%eax
jne    15d7 <main+0x447>
lea    -0x410(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    15a2 <main+0x412>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1572 <main+0x3e2>
mov    -0x448(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
mov    -0x418(%rbp),%r8
lea    0xa98(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    15dc <main+0x44c>
jmp    1739 <main+0x5a9>
jmp    15e6 <main+0x456>
jmp    1739 <main+0x5a9>
jmp    1774 <main+0x5e4>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jle    1734 <main+0x5a4>
movsbl -0x40c(%rbp),%eax
cmp    $0x20,%eax
jne    1734 <main+0x5a4>
lea    -0x410(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1652 <main+0x4c2>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1622 <main+0x492>
cmpl   $0x0,-0x42c(%rbp)
je     1672 <main+0x4e2>
mov    -0x440(%rbp),%rsi
lea    0xa09(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x42c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x42c(%rbp)
lea    -0x428(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x418(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x438(%rbp)
mov    -0x438(%rbp),%eax
add    $0x18,%eax
cmp    $0x4f,%eax
jle    16e1 <main+0x551>
mov    0x2919(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
lea    0x9b6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17c3 <main+0x633>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    0x9ab(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x418(%rbp),%rsi
call   10b0 <pq@plt>
mov    -0x440(%rbp),%rsi
lea    0x952(%rip),%rdi
call   1070 <fputs@plt>
movl   $0x1,-0x430(%rbp)
jmp    176f <main+0x5df>
jmp    1739 <main+0x5a9>
mov    0x2898(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
mov    -0x430(%rbp),%ecx
lea    -0x410(%rbp),%r8
lea    0x953(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17c3 <main+0x633>
jmp    1774 <main+0x5e4>
jmp    1779 <main+0x5e9>
jmp    1242 <main+0xb2>
mov    -0x440(%rbp),%rsi
lea    0x949(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x448(%rbp),%rsi
lea    0x971(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x440(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x448(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
lea    0xe58(%rip),%rdi
lea    0xe5b(%rip),%rbx
mov    %rbx,%rsi
call   1090 <fopen@plt>
mov    %rax,%r12
lea    0xe4b(%rip),%rdi
mov    %rbx,%rsi
call   1090 <fopen@plt>
test   %r12,%r12
je     14cf <main+0x33f>
mov    %rax,%r14
test   %rax,%rax
je     14cf <main+0x33f>
mov    0x2e03(%rip),%r13
mov    0x0(%r13),%edx
lea    0x10(%rsp),%rdi
mov    $0x3ff,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     1489 <main+0x2f9>
lea    0x10(%rsp),%r15
movl   $0x0,(%rsp)
xor    %ebp,%ebp
xor    %ebx,%ebx
movl   $0x0,0x4(%rsp)
add    $0x1,%ebp
jmp    123d <main+0xad>
xchg   %ax,%ax
mov    0x0(%r13),%edx
mov    %r15,%rdi
mov    $0x3ff,%esi
call   1070 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
je     1489 <main+0x2f9>
mov    %r15,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1252 <main+0xc2>
movb   $0x0,(%rax)
movzbl 0x10(%rsp),%eax
test   %al,%al
je     1220 <main+0x90>
cmp    $0x23,%al
je     1220 <main+0x90>
movzbl 0x11(%rsp),%ecx
cmp    $0x20,%cl
je     131d <main+0x18d>
cmp    $0x9,%al
jne    1355 <main+0x1c5>
cmp    $0x9,%cl
je     1220 <main+0x90>
cmp    $0x2,%ebx
je     1414 <main+0x284>
cmp    $0x1,%ebx
jne    14fd <main+0x36d>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x6,%eax
jl     14fd <main+0x36d>
cmpb   $0x20,0x15(%rsp)
jne    14fd <main+0x36d>
lea    0x15(%rsp),%rbx
nopl   (%rax)
movb   $0x0,(%rbx)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     12b0 <main+0x120>
mov    %rbx,%rdi
call   1050 <strlen@plt>
add    (%rsp),%eax
cmp    $0x4f,%eax
jl     12fd <main+0x16d>
mov    %rbx,%rdi
mov    $0x5b,%esi
call   1060 <strchr@plt>
cmp    %rbx,%rax
jbe    12e9 <main+0x159>
cmpb   $0x20,-0x1(%rax)
jne    12e9 <main+0x159>
movb   $0x0,-0x1(%rax)
mov    %rbx,%rdi
call   1050 <strlen@plt>
add    (%rsp),%eax
cmp    $0x4f,%eax
jge    153a <main+0x3aa>
mov    %r12d,%edi
lea    0xd4c(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x11(%rsp),%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    13e9 <main+0x259>
cmp    $0x43,%al
jne    14fd <main+0x36d>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     14fd <main+0x36d>
cmpb   $0x20,0x14(%rsp)
jne    14fd <main+0x36d>
movzwl 0x12(%rsp),%eax
mov    %ax,0x8(%rsp)
movb   $0x0,0xa(%rsp)
jmp    146a <main+0x2da>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     14fd <main+0x36d>
cmpb   $0x20,0x14(%rsp)
jne    14fd <main+0x36d>
lea    0x14(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     1380 <main+0x1f0>
cmpl   $0x0,0x4(%rsp)
je     13ad <main+0x21d>
mov    $0xd,%esi
mov    $0x1,%edx
lea    0xcd1(%rip),%rdi
mov    %r12,%rcx
call   10b0 <fwrite@plt>
lea    0x8(%rsp),%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,(%rsp)
cmp    $0x38,%eax
jge    151f <main+0x38f>
addl   $0x1,0x4(%rsp)
mov    %r12d,%edi
lea    0xcc6(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <pq@plt>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xc6d(%rip),%rdi
mov    %r12,%rcx
call   10b0 <fwrite@plt>
mov    $0x1,%ebx
jmp    146f <main+0x2df>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jl     14fd <main+0x36d>
cmpb   $0x20,0x13(%rsp)
jne    14fd <main+0x36d>
lea    0x13(%rsp),%r8
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x0,(%r8)
cmpb   $0x20,0x1(%r8)
lea    0x1(%r8),%r8
je     1440 <main+0x2b0>
mov    %r14d,%edi
lea    0xc0a(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x11(%rsp),%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%ebx
mov    0x0(%r13),%edx
mov    %r15,%rdi
mov    $0x3ff,%esi
call   1070 <fgets@plt>
test   %rax,%rax
jne    1219 <main+0x89>
lea    0xc45(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10b0 <fwrite@plt>
lea    0xc67(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    14eb <main+0x35b>
mov    0x2b02(%rip),%rax
mov    (%rax),%edi
lea    0xb39(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ad4(%rip),%rax
mov    (%rax),%edi
lea    0xba2(%rip),%rsi
lea    0x10(%rsp),%r8
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14e6 <main+0x356>
mov    0x2ab2(%rip),%rax
mov    (%rax),%edi
lea    0xb55(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14e6 <main+0x356>
mov    0x2a97(%rip),%rax
mov    (%rax),%edi
lea    0xaea(%rip),%rsi
jmp    152f <main+0x39f>

LLVM IR (-O0):
@.str = [10 x i8] c"devlist.h\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [12 x i8] c"classlist.h\00"
@stderr = global i32 0
@.str.3 = [28 x i8] c"Cannot create output file!\0A\00"
@stdin = global i32 0
@.str.4 = [31 x i8] c"Line %d: Device name too long\0A\00"
@.str.5 = [16 x i8] c"\09DEVICE(%s,%s,\22\00"
@.str.6 = [4 x i8] c"\22)\0A\00"
@.str.7 = [19 x i8] c"CLASS(%s%s, \22%s\22)\0A\00"
@.str.8 = [14 x i8] c"ENDVENDOR()\0A\0A\00"
@.str.9 = [31 x i8] c"Line %d: Vendor name too long\0A\00"
@.str.10 = [12 x i8] c"VENDOR(%s,\22\00"
@.str.11 = [38 x i8] c"Line %d: Syntax error in mode %d: %s\0A\00"
@.str.12 = [59 x i8] c"ENDVENDOR()\0A\0A#undef VENDOR\0A#undef DEVICE\0A#undef ENDVENDOR\0A\00"
@.str.13 = [15 x i8] c"\0A#undef CLASS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [8 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%12 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %10
%13 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %11
%14 = load i32*, i32** %10
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = load i32*, i32** %11
%18 = icmp ne i32* %17, null
br i1 %18, label %22, label %19
19: ; preds = %16, %0
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %261
22: ; preds = %16
br label %23
23: ; preds = %251, %85, %45, %22
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%25 = load i32, i32* @stdin
%26 = call i64 @fgets(i8* %24, i32 1023, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %252
28: ; preds = %23
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%32 = call i8* @strchr(i8* %31, i8 signext 10)
store i8* %32, i8** %3
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = load i8*, i8** %3
store i8 0, i8* %35
br label %36
36: ; preds = %34, %28
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%38 = load i8, i8* %37
%39 = icmp ne i8 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 35
br i1 %44, label %45, label %46
45: ; preds = %40, %36
br label %23
46: ; preds = %40
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 1
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 32
br i1 %50, label %51, label %75
51: ; preds = %46
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 67
br i1 %55, label %56, label %73
56: ; preds = %51
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%58 = call i32 @strlen(i8* %57)
%59 = icmp sgt i32 %58, 4
br i1 %59, label %60, label %73
60: ; preds = %56
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 4
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp eq i32 %63, 32
br i1 %64, label %65, label %73
65: ; preds = %60
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 2
%67 = load i8, i8* %66
%68 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
store i8 %67, i8* %68
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 3
%70 = load i8, i8* %69
%71 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 1
store i8 %70, i8* %71
%72 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 2
store i8 0, i8* %72
store i32 2, i32* %7
br label %74
73: ; preds = %60, %56, %51
br label %243
74: ; preds = %65
br label %251
75: ; preds = %46
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 9
br i1 %79, label %80, label %191
80: ; preds = %75
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 1
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp eq i32 %83, 9
br i1 %84, label %85, label %86
85: ; preds = %80
br label %23
86: ; preds = %80
%87 = load i32, i32* %7
switch i32 %87, label %189 [
i32 1, label %88
i32 2, label %159
]
88: ; preds = %86
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%90 = call i32 @strlen(i8* %89)
%91 = icmp sgt i32 %90, 5
br i1 %91, label %92, label %157
92: ; preds = %88
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 5
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = icmp eq i32 %95, 32
br i1 %96, label %97, label %157
97: ; preds = %92
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%99 = getelementptr inbounds i8, i8* %98, i64 5
store i8* %99, i8** %3
br label %100
100: ; preds = %105, %97
%101 = load i8*, i8** %3
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 32
br i1 %104, label %105, label %108
105: ; preds = %100
%106 = load i8*, i8** %3
%107 = getelementptr inbounds i8, i8* %106, i32 1
store i8* %107, i8** %3
store i8 0, i8* %106
br label %100
108: ; preds = %100
%109 = load i32, i32* %9
%110 = load i8*, i8** %3
%111 = call i32 @strlen(i8* %110)
%112 = add nsw i32 %109, %111
%113 = add nsw i32 %112, 1
%114 = icmp sgt i32 %113, 79
br i1 %114, label %115, label %145
115: ; preds = %108
%116 = load i8*, i8** %3
%117 = call i8* @strchr(i8* %116, i8 signext 91)
store i8* %117, i8** %4
%118 = load i8*, i8** %4
%119 = icmp ne i8* %118, null
br i1 %119, label %120, label %133
120: ; preds = %115
%121 = load i8*, i8** %4
%122 = load i8*, i8** %3
%123 = icmp ugt i8* %121, %122
br i1 %123, label %124, label %133
124: ; preds = %120
%125 = load i8*, i8** %4
%126 = getelementptr inbounds i8, i8* %125, i64 -1
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp eq i32 %128, 32
br i1 %129, label %130, label %133
130: ; preds = %124
%131 = load i8*, i8** %4
%132 = getelementptr inbounds i8, i8* %131, i64 -1
store i8 0, i8* %132
br label %133
133: ; preds = %130, %124, %120, %115
%134 = load i32, i32* %9
%135 = load i8*, i8** %3
%136 = call i32 @strlen(i8* %135)
%137 = add nsw i32 %134, %136
%138 = add nsw i32 %137, 1
%139 = icmp sgt i32 %138, 79
br i1 %139, label %140, label %144
140: ; preds = %133
%141 = load i32, i32* @stderr
%142 = load i32, i32* %8
%143 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %142)
store i32 1, i32* %1
br label %261
144: ; preds = %133
br label %145
145: ; preds = %144, %108
%146 = load i32*, i32** %10
%147 = ptrtoint i32* %146 to i32
%148 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%150 = getelementptr inbounds i8, i8* %149, i64 1
%151 = call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %148, i8* %150)
%152 = load i32*, i32** %10
%153 = load i8*, i8** %3
%154 = call i32 @pq(i32* %152, i8* %153)
%155 = load i32*, i32** %10
%156 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %155)
br label %158
157: ; preds = %92, %88
br label %243
158: ; preds = %145
br label %190
159: ; preds = %86
%160 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%161 = call i32 @strlen(i8* %160)
%162 = icmp sgt i32 %161, 3
br i1 %162, label %163, label %187
163: ; preds = %159
%164 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 3
%165 = load i8, i8* %164
%166 = sext i8 %165 to i32
%167 = icmp eq i32 %166, 32
br i1 %167, label %168, label %187
168: ; preds = %163
%169 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%170 = getelementptr inbounds i8, i8* %169, i64 3
store i8* %170, i8** %3
br label %171
171: ; preds = %176, %168
%172 = load i8*, i8** %3
%173 = load i8, i8* %172
%174 = sext i8 %173 to i32
%175 = icmp eq i32 %174, 32
br i1 %175, label %176, label %179
176: ; preds = %171
%177 = load i8*, i8** %3
%178 = getelementptr inbounds i8, i8* %177, i32 1
store i8* %178, i8** %3
store i8 0, i8* %177
br label %171
179: ; preds = %171
%180 = load i32*, i32** %11
%181 = ptrtoint i32* %180 to i32
%182 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%183 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%184 = getelementptr inbounds i8, i8* %183, i64 1
%185 = load i8*, i8** %3
%186 = call i32 (i32, i8*, ...) @fprintf(i32 %181, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %182, i8* %184, i8* %185)
br label %188
187: ; preds = %163, %159
br label %243
188: ; preds = %179
br label %190
189: ; preds = %86
br label %243
190: ; preds = %188, %158
br label %250
191: ; preds = %75
%192 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%193 = call i32 @strlen(i8* %192)
%194 = icmp sgt i32 %193, 4
br i1 %194, label %195, label %242
195: ; preds = %191
%196 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 4
%197 = load i8, i8* %196
%198 = sext i8 %197 to i32
%199 = icmp eq i32 %198, 32
br i1 %199, label %200, label %242
200: ; preds = %195
%201 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%202 = getelementptr inbounds i8, i8* %201, i64 4
store i8* %202, i8** %3
br label %203
203: ; preds = %208, %200
%204 = load i8*, i8** %3
%205 = load i8, i8* %204
%206 = sext i8 %205 to i32
%207 = icmp eq i32 %206, 32
br i1 %207, label %208, label %211
208: ; preds = %203
%209 = load i8*, i8** %3
%210 = getelementptr inbounds i8, i8* %209, i32 1
store i8* %210, i8** %3
store i8 0, i8* %209
br label %203
211: ; preds = %203
%212 = load i32, i32* %6
%213 = icmp ne i32 %212, 0
br i1 %213, label %214, label %217
214: ; preds = %211
%215 = load i32*, i32** %10
%216 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32* %215)
br label %217
217: ; preds = %214, %211
%218 = load i32, i32* %6
%219 = add nsw i32 %218, 1
store i32 %219, i32* %6
%220 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%221 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%222 = call i32 @strcpy(i8* %220, i8* %221)
%223 = load i8*, i8** %3
%224 = call i32 @strlen(i8* %223)
store i32 %224, i32* %9
%225 = load i32, i32* %9
%226 = add nsw i32 %225, 24
%227 = icmp sgt i32 %226, 79
br i1 %227, label %228, label %232
228: ; preds = %217
%229 = load i32, i32* @stderr
%230 = load i32, i32* %8
%231 = call i32 (i32, i8*, ...) @fprintf(i32 %229, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %230)
store i32 1, i32* %1
br label %261
232: ; preds = %217
%233 = load i32*, i32** %10
%234 = ptrtoint i32* %233 to i32
%235 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%236 = call i32 (i32, i8*, ...) @fprintf(i32 %234, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %235)
%237 = load i32*, i32** %10
%238 = load i8*, i8** %3
%239 = call i32 @pq(i32* %237, i8* %238)
%240 = load i32*, i32** %10
%241 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32* %240)
store i32 1, i32* %7
br label %249
242: ; preds = %195, %191
br label %243
243: ; preds = %242, %189, %187, %157, %73
%244 = load i32, i32* @stderr
%245 = load i32, i32* %8
%246 = load i32, i32* %7
%247 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%248 = call i32 (i32, i8*, ...) @fprintf(i32 %244, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %245, i32 %246, i8* %247)
store i32 1, i32* %1
br label %261
249: ; preds = %232
br label %250
250: ; preds = %249, %190
br label %251
251: ; preds = %250, %74
br label %23
252: ; preds = %23
%253 = load i32*, i32** %10
%254 = call i32 @fputs(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.12, i64 0, i64 0), i32* %253)
%255 = load i32*, i32** %11
%256 = call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i32* %255)
%257 = load i32*, i32** %10
%258 = call i32 @fclose(i32* %257)
%259 = load i32*, i32** %11
%260 = call i32 @fclose(i32* %259)
store i32 0, i32* %1
br label %261
261: ; preds = %252, %243, %228, %140, %19
%262 = load i32, i32* %1
ret i32 %262
}

LLVM IR (-O2):
@.str = [10 x i8] c"devlist.h\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [12 x i8] c"classlist.h\00"
@stderr = global i32 0
@.str.3 = [28 x i8] c"Cannot create output file!\0A\00"
@stdin = global i32 0
@.str.4 = [31 x i8] c"Line %d: Device name too long\0A\00"
@.str.5 = [16 x i8] c"\09DEVICE(%s,%s,\22\00"
@.str.6 = [4 x i8] c"\22)\0A\00"
@.str.7 = [19 x i8] c"CLASS(%s%s, \22%s\22)\0A\00"
@.str.8 = [14 x i8] c"ENDVENDOR()\0A\0A\00"
@.str.9 = [31 x i8] c"Line %d: Vendor name too long\0A\00"
@.str.10 = [12 x i8] c"VENDOR(%s,\22\00"
@.str.11 = [38 x i8] c"Line %d: Syntax error in mode %d: %s\0A\00"
@.str.12 = [59 x i8] c"ENDVENDOR()\0A\0A#undef VENDOR\0A#undef DEVICE\0A#undef ENDVENDOR\0A\00"
@.str.13 = [15 x i8] c"\0A#undef CLASS\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp ne i32* %5, null
%8 = icmp ne i32* %6, null
%9 = and i1 %7, %8
br i1 %9, label %10, label %26
10: ; preds = %0
%11 = load i32, i32* @stdin
%12 = call i64 @fgets(i8* %3, i32 1023, i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %149, label %14
14: ; preds = %10
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 1
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 4
%17 = ptrtoint i32* %5 to i64
%18 = trunc i64 %17 to i32
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 3
%20 = ptrtoint i32* %6 to i64
%21 = trunc i64 %20 to i32
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 5
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 2
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
br label %144
26: ; preds = %0
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %154
29: ; preds = %144, %55
%30 = phi i32 [ %146, %144 ], [ %31, %55 ]
%31 = add nsw i32 %30, 1
%32 = call i8* @strchr(i8* %3, i8 signext 10)
%33 = icmp eq i8* %32, null
br i1 %33, label %35, label %34
34: ; preds = %29
store i8 0, i8* %32
br label %35
35: ; preds = %34, %29
%36 = load i8, i8* %3
switch i8 %36, label %37 [
i8 35, label %55
i8 0, label %55
]
37: ; preds = %35
%38 = load i8, i8* %15
%39 = icmp eq i8 %38, 32
br i1 %39, label %40, label %51
40: ; preds = %37
%41 = icmp eq i8 %36, 67
br i1 %41, label %42, label %134
42: ; preds = %40
%43 = call i32 @strlen(i8* %3)
%44 = icmp sgt i32 %43, 4
%45 = load i8, i8* %16
%46 = icmp eq i8 %45, 32
%47 = select i1 %44, i1 %46, i1 false
br i1 %47, label %48, label %134
48: ; preds = %42
%49 = load i8, i8* %23
store i8 %49, i8* %4
%50 = load i8, i8* %19
store i8 %50, i8* %24
store i8 0, i8* %25
br label %137
51: ; preds = %37
%52 = icmp eq i8 %36, 9
br i1 %52, label %53, label %107
53: ; preds = %51
%54 = icmp eq i8 %38, 9
br i1 %54, label %55, label %59
55: ; preds = %53, %35, %35
%56 = load i32, i32* @stdin
%57 = call i64 @fgets(i8* %3, i32 1023, i32 %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %149, label %29
59: ; preds = %53
switch i32 %147, label %134 [
i32 1, label %60
i32 2, label %94
]
60: ; preds = %59
%61 = call i32 @strlen(i8* %3)
%62 = icmp sgt i32 %61, 5
%63 = load i8, i8* %22
%64 = icmp eq i8 %63, 32
%65 = select i1 %62, i1 %64, i1 false
br i1 %65, label %66, label %134
66: ; preds = %60, %66
%67 = phi i8* [ %68, %66 ], [ %22, %60 ]
%68 = getelementptr inbounds i8, i8* %67, i64 1
store i8 0, i8* %67
%69 = load i8, i8* %68
%70 = icmp eq i8 %69, 32
br i1 %70, label %66, label %71
71: ; preds = %66
%72 = call i32 @strlen(i8* %68)
%73 = add nsw i32 %72, %145
%74 = icmp sgt i32 %73, 78
br i1 %74, label %75, label %90
75: ; preds = %71
%76 = call i8* @strchr(i8* %68, i8 signext 91)
%77 = icmp ugt i8* %76, %68
br i1 %77, label %78, label %83
78: ; preds = %75
%79 = getelementptr inbounds i8, i8* %76, i64 -1
%80 = load i8, i8* %79
%81 = icmp eq i8 %80, 32
br i1 %81, label %82, label %83
82: ; preds = %78
store i8 0, i8* %79
br label %83
83: ; preds = %82, %78, %75
%84 = call i32 @strlen(i8* %68)
%85 = add nsw i32 %84, %145
%86 = icmp sgt i32 %85, 78
br i1 %86, label %87, label %90
87: ; preds = %83
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %31)
br label %154
90: ; preds = %83, %71
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %4, i8* %15)
%92 = call i32 @pq(i32* %5, i8* %68)
%93 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 3, i64 1, i32* %5)
br label %137
94: ; preds = %59
%95 = call i32 @strlen(i8* %3)
%96 = icmp sgt i32 %95, 3
%97 = load i8, i8* %19
%98 = icmp eq i8 %97, 32
%99 = select i1 %96, i1 %98, i1 false
br i1 %99, label %100, label %134
100: ; preds = %94, %100
%101 = phi i8* [ %102, %100 ], [ %19, %94 ]
%102 = getelementptr inbounds i8, i8* %101, i64 1
store i8 0, i8* %101
%103 = load i8, i8* %102
%104 = icmp eq i8 %103, 32
br i1 %104, label %100, label %105
105: ; preds = %100
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8* %4, i8* %15, i8* %102)
br label %137
107: ; preds = %51
%108 = call i32 @strlen(i8* %3)
%109 = icmp sgt i32 %108, 4
%110 = load i8, i8* %16
%111 = icmp eq i8 %110, 32
%112 = select i1 %109, i1 %111, i1 false
br i1 %112, label %113, label %134
113: ; preds = %107, %113
%114 = phi i8* [ %115, %113 ], [ %16, %107 ]
%115 = getelementptr inbounds i8, i8* %114, i64 1
store i8 0, i8* %114
%116 = load i8, i8* %115
%117 = icmp eq i8 %116, 32
br i1 %117, label %113, label %118
118: ; preds = %113
%119 = icmp eq i32 %148, 0
br i1 %119, label %122, label %120
120: ; preds = %118
%121 = call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i64 13, i64 1, i32* %5)
br label %122
122: ; preds = %120, %118
%123 = call i32 @strcpy(i8* %4, i8* %3)
%124 = call i32 @strlen(i8* %115)
%125 = icmp sgt i32 %124, 55
br i1 %125, label %126, label %129
126: ; preds = %122
%127 = load i32, i32* @stderr
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %31)
br label %154
129: ; preds = %122
%130 = add nsw i32 %148, 1
%131 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %4)
%132 = call i32 @pq(i32* %5, i8* %115)
%133 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 3, i64 1, i32* %5)
br label %137
134: ; preds = %107, %59, %94, %60, %40, %42
%135 = load i32, i32* @stderr
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %31, i32 %147, i8* %3)
br label %154
137: ; preds = %129, %105, %90, %48
%138 = phi i32 [ %148, %48 ], [ %148, %105 ], [ %148, %90 ], [ %130, %129 ]
%139 = phi i32 [ 2, %48 ], [ 2, %105 ], [ 1, %90 ], [ 1, %129 ]
%140 = phi i32 [ %145, %48 ], [ %145, %105 ], [ %145, %90 ], [ %124, %129 ]
%141 = load i32, i32* @stdin
%142 = call i64 @fgets(i8* %3, i32 1023, i32 %141)
%143 = icmp eq i64 %142, 0
br i1 %143, label %149, label %144
144: ; preds = %14, %137
%145 = phi i32 [ 0, %14 ], [ %140, %137 ]
%146 = phi i32 [ 0, %14 ], [ %31, %137 ]
%147 = phi i32 [ 0, %14 ], [ %139, %137 ]
%148 = phi i32 [ 0, %14 ], [ %138, %137 ]
br label %29
149: ; preds = %137, %55, %10
%150 = call i64 @fwrite(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.12, i64 0, i64 0), i64 58, i64 1, i32* %5)
%151 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i64 14, i64 1, i32* %6)
%152 = call i32 @fclose(i32* %5)
%153 = call i32 @fclose(i32* %6)
br label %154
154: ; preds = %149, %134, %126, %87, %26
%155 = phi i32 [ 1, %134 ], [ 1, %87 ], [ 1, %126 ], [ 0, %149 ], [ 1, %26 ]
ret i32 %155
}