#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) {
              c[79 - 1 - vendor_len] = 0;
            }
          }
          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    17b3 <main+0x623>
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     176e <main+0x5de>
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    1729 <main+0x599>
jmp    1769 <main+0x5d9>
movsbl -0x410(%rbp),%eax
cmp    $0x9,%eax
jne    15db <main+0x44b>
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     152b <main+0x39b>
jmp    15d1 <main+0x441>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jle    1521 <main+0x391>
movsbl -0x40b(%rbp),%eax
cmp    $0x20,%eax
jne    1521 <main+0x391>
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    14cd <main+0x33d>
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    14c8 <main+0x338>
mov    -0x418(%rbp),%rax
mov    $0x4e,%ecx
sub    -0x438(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    14cd <main+0x33d>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
lea    0xb45(%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    0xb3c(%rip),%rdi
call   1070 <fputs@plt>
jmp    1526 <main+0x396>
jmp    1729 <main+0x599>
jmp    15d6 <main+0x446>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jle    15c7 <main+0x437>
movsbl -0x40d(%rbp),%eax
cmp    $0x20,%eax
jne    15c7 <main+0x437>
lea    -0x410(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1592 <main+0x402>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1562 <main+0x3d2>
mov    -0x448(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
mov    -0x418(%rbp),%r8
lea    0xa89(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    15cc <main+0x43c>
jmp    1729 <main+0x599>
jmp    15d6 <main+0x446>
jmp    1729 <main+0x599>
jmp    1764 <main+0x5d4>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jle    1724 <main+0x594>
movsbl -0x40c(%rbp),%eax
cmp    $0x20,%eax
jne    1724 <main+0x594>
lea    -0x410(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1642 <main+0x4b2>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1612 <main+0x482>
cmpl   $0x0,-0x42c(%rbp)
je     1662 <main+0x4d2>
mov    -0x440(%rbp),%rsi
lea    0x9fa(%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    16d1 <main+0x541>
mov    0x2929(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
lea    0x9a7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17b3 <main+0x623>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    0x99c(%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    0x943(%rip),%rdi
call   1070 <fputs@plt>
movl   $0x1,-0x430(%rbp)
jmp    175f <main+0x5cf>
jmp    1729 <main+0x599>
mov    0x28a8(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
mov    -0x430(%rbp),%ecx
lea    -0x410(%rbp),%r8
lea    0x944(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17b3 <main+0x623>
jmp    1764 <main+0x5d4>
jmp    1769 <main+0x5d9>
jmp    1242 <main+0xb2>
mov    -0x440(%rbp),%rsi
lea    0x93a(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x448(%rbp),%rsi
lea    0x962(%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    $0x428,%rsp
lea    0xe58(%rip),%rdi
lea    0xe5b(%rip),%rbx
mov    %rbx,%rsi
call   1090 <fopen@plt>
mov    %rax,%r15
lea    0xe4b(%rip),%rdi
mov    %rbx,%rsi
call   1090 <fopen@plt>
test   %r15,%r15
je     14cd <main+0x33d>
mov    %rax,%r12
test   %rax,%rax
je     14cd <main+0x33d>
mov    0x2e03(%rip),%r13
mov    0x0(%r13),%edx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x3ff,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     14eb <main+0x35b>
movl   $0x0,0x8(%rsp)
xor    %ebp,%ebp
xor    %ebx,%ebx
movl   $0x0,0xc(%rsp)
add    $0x1,%ebp
jmp    123d <main+0xad>
nopl   (%rax)
mov    0x0(%r13),%edx
mov    %r14,%rdi
mov    $0x3ff,%esi
call   1070 <fgets@plt>
add    $0x1,%ebp
test   %rax,%rax
je     14eb <main+0x35b>
mov    %r14,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1252 <main+0xc2>
movb   $0x0,(%rax)
mov    0x20(%rsp),%al
test   %al,%al
je     1220 <main+0x90>
cmp    $0x23,%al
je     1220 <main+0x90>
mov    0x21(%rsp),%cl
cmp    $0x20,%cl
je     1362 <main+0x1d2>
cmp    $0x9,%al
jne    139a <main+0x20a>
cmp    $0x9,%cl
je     1220 <main+0x90>
cmp    $0x2,%ebx
je     1455 <main+0x2c5>
cmp    $0x1,%ebx
jne    1541 <main+0x3b1>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x6,%eax
jl     1541 <main+0x3b1>
cmpb   $0x20,0x25(%rsp)
jne    1541 <main+0x3b1>
mov    %r12,0x18(%rsp)
mov    %r14,%r12
xchg   %ax,%ax
movb   $0x0,0x5(%r12)
cmpb   $0x20,0x6(%r12)
lea    0x1(%r12),%r12
je     12b0 <main+0x120>
lea    0x5(%r12),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
add    0x8(%rsp),%eax
cmp    $0x4f,%eax
jl     1314 <main+0x184>
mov    %rbx,%rdi
mov    $0x5b,%esi
call   1060 <strchr@plt>
cmp    %rbx,%rax
jbe    12f5 <main+0x165>
cmpb   $0x20,-0x1(%rax)
jne    12f5 <main+0x165>
movb   $0x0,-0x1(%rax)
mov    %rbx,%rdi
call   1050 <strlen@plt>
add    0x8(%rsp),%eax
cmp    $0x4f,%eax
jl     1314 <main+0x184>
movslq 0x8(%rsp),%rax
sub    %rax,%r12
movb   $0x0,0x53(%r12)
mov    %r15d,%edi
lea    0xd16(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x21(%rsp),%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10a0 <pq@plt>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xd08(%rip),%rdi
mov    %r15,%rcx
call   10b0 <fwrite@plt>
mov    $0x1,%ebx
mov    0x18(%rsp),%r12
jmp    14af <main+0x31f>
cmp    $0x43,%al
jne    1541 <main+0x3b1>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     1541 <main+0x3b1>
cmpb   $0x20,0x24(%rsp)
jne    1541 <main+0x3b1>
movzwl 0x22(%rsp),%eax
mov    %ax,0x10(%rsp)
movb   $0x0,0x12(%rsp)
jmp    14aa <main+0x31a>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     1541 <main+0x3b1>
cmpb   $0x20,0x24(%rsp)
jne    1541 <main+0x3b1>
lea    0x24(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     13c0 <main+0x230>
cmpl   $0x0,0xc(%rsp)
je     13ed <main+0x25d>
mov    $0xd,%esi
mov    $0x1,%edx
lea    0xc72(%rip),%rdi
mov    %r15,%rcx
call   10b0 <fwrite@plt>
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,0x8(%rsp)
cmp    $0x38,%eax
jge    1563 <main+0x3d3>
addl   $0x1,0xc(%rsp)
mov    %r15d,%edi
lea    0xc66(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10a0 <pq@plt>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xc0d(%rip),%rdi
mov    %r15,%rcx
call   10b0 <fwrite@plt>
mov    $0x1,%ebx
jmp    14af <main+0x31f>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jl     1541 <main+0x3b1>
cmpb   $0x20,0x23(%rsp)
jne    1541 <main+0x3b1>
lea    0x23(%rsp),%r8
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,(%r8)
cmpb   $0x20,0x1(%r8)
lea    0x1(%r8),%r8
je     1480 <main+0x2f0>
mov    %r12d,%edi
lea    0xbab(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x21(%rsp),%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%ebx
mov    0x0(%r13),%edx
mov    %r14,%rdi
mov    $0x3ff,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     14eb <main+0x35b>
add    $0x1,%ebp
jmp    123d <main+0xad>
mov    0x2b04(%rip),%rax
mov    (%rax),%edi
lea    0xb3b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
jmp    152f <main+0x39f>
lea    0xbc4(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   10b0 <fwrite@plt>
lea    0xbe6(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10b0 <fwrite@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a90(%rip),%rax
mov    (%rax),%edi
lea    0xb3f(%rip),%rsi
lea    0x20(%rsp),%r8
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14e4 <main+0x354>
mov    0x2a6e(%rip),%rax
mov    (%rax),%edi
lea    0xaf2(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14e4 <main+0x354>

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 = [16 x i8] c"\09DEVICE(%s,%s,\22\00"
@.str.5 = [4 x i8] c"\22)\0A\00"
@.str.6 = [19 x i8] c"CLASS(%s%s, \22%s\22)\0A\00"
@.str.7 = [14 x i8] c"ENDVENDOR()\0A\0A\00"
@.str.8 = [31 x i8] c"Line %d: Vendor name too long\0A\00"
@.str.9 = [12 x i8] c"VENDOR(%s,\22\00"
@.str.10 = [38 x i8] c"Line %d: Syntax error in mode %d: %s\0A\00"
@.str.11 = [59 x i8] c"ENDVENDOR()\0A\0A#undef VENDOR\0A#undef DEVICE\0A#undef ENDVENDOR\0A\00"
@.str.12 = [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 %263
22: ; preds = %16
br label %23
23: ; preds = %253, %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 %254
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 %245
74: ; preds = %65
br label %253
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 %193
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 %191 [
i32 1, label %88
i32 2, label %161
]
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 %159
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 %159
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 %147
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 %146
140: ; preds = %133
%141 = load i8*, i8** %3
%142 = load i32, i32* %9
%143 = sub nsw i32 78, %142
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8, i8* %141, i64 %144
store i8 0, i8* %145
br label %146
146: ; preds = %140, %133
br label %147
147: ; preds = %146, %108
%148 = load i32*, i32** %10
%149 = ptrtoint i32* %148 to i32
%150 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%151 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%152 = getelementptr inbounds i8, i8* %151, i64 1
%153 = call i32 (i32, i8*, ...) @fprintf(i32 %149, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %150, i8* %152)
%154 = load i32*, i32** %10
%155 = load i8*, i8** %3
%156 = call i32 @pq(i32* %154, i8* %155)
%157 = load i32*, i32** %10
%158 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32* %157)
br label %160
159: ; preds = %92, %88
br label %245
160: ; preds = %147
br label %192
161: ; preds = %86
%162 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%163 = call i32 @strlen(i8* %162)
%164 = icmp sgt i32 %163, 3
br i1 %164, label %165, label %189
165: ; preds = %161
%166 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 3
%167 = load i8, i8* %166
%168 = sext i8 %167 to i32
%169 = icmp eq i32 %168, 32
br i1 %169, label %170, label %189
170: ; preds = %165
%171 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%172 = getelementptr inbounds i8, i8* %171, i64 3
store i8* %172, i8** %3
br label %173
173: ; preds = %178, %170
%174 = load i8*, i8** %3
%175 = load i8, i8* %174
%176 = sext i8 %175 to i32
%177 = icmp eq i32 %176, 32
br i1 %177, label %178, label %181
178: ; preds = %173
%179 = load i8*, i8** %3
%180 = getelementptr inbounds i8, i8* %179, i32 1
store i8* %180, i8** %3
store i8 0, i8* %179
br label %173
181: ; preds = %173
%182 = load i32*, i32** %11
%183 = ptrtoint i32* %182 to i32
%184 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%185 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%186 = getelementptr inbounds i8, i8* %185, i64 1
%187 = load i8*, i8** %3
%188 = call i32 (i32, i8*, ...) @fprintf(i32 %183, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %184, i8* %186, i8* %187)
br label %190
189: ; preds = %165, %161
br label %245
190: ; preds = %181
br label %192
191: ; preds = %86
br label %245
192: ; preds = %190, %160
br label %252
193: ; preds = %75
%194 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%195 = call i32 @strlen(i8* %194)
%196 = icmp sgt i32 %195, 4
br i1 %196, label %197, label %244
197: ; preds = %193
%198 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 4
%199 = load i8, i8* %198
%200 = sext i8 %199 to i32
%201 = icmp eq i32 %200, 32
br i1 %201, label %202, label %244
202: ; preds = %197
%203 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%204 = getelementptr inbounds i8, i8* %203, i64 4
store i8* %204, i8** %3
br label %205
205: ; preds = %210, %202
%206 = load i8*, i8** %3
%207 = load i8, i8* %206
%208 = sext i8 %207 to i32
%209 = icmp eq i32 %208, 32
br i1 %209, label %210, label %213
210: ; preds = %205
%211 = load i8*, i8** %3
%212 = getelementptr inbounds i8, i8* %211, i32 1
store i8* %212, i8** %3
store i8 0, i8* %211
br label %205
213: ; preds = %205
%214 = load i32, i32* %6
%215 = icmp ne i32 %214, 0
br i1 %215, label %216, label %219
216: ; preds = %213
%217 = load i32*, i32** %10
%218 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32* %217)
br label %219
219: ; preds = %216, %213
%220 = load i32, i32* %6
%221 = add nsw i32 %220, 1
store i32 %221, i32* %6
%222 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%223 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%224 = call i32 @strcpy(i8* %222, i8* %223)
%225 = load i8*, i8** %3
%226 = call i32 @strlen(i8* %225)
store i32 %226, i32* %9
%227 = load i32, i32* %9
%228 = add nsw i32 %227, 24
%229 = icmp sgt i32 %228, 79
br i1 %229, label %230, label %234
230: ; preds = %219
%231 = load i32, i32* @stderr
%232 = load i32, i32* %8
%233 = call i32 (i32, i8*, ...) @fprintf(i32 %231, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %232)
store i32 1, i32* %1
br label %263
234: ; preds = %219
%235 = load i32*, i32** %10
%236 = ptrtoint i32* %235 to i32
%237 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%238 = call i32 (i32, i8*, ...) @fprintf(i32 %236, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* %237)
%239 = load i32*, i32** %10
%240 = load i8*, i8** %3
%241 = call i32 @pq(i32* %239, i8* %240)
%242 = load i32*, i32** %10
%243 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32* %242)
store i32 1, i32* %7
br label %251
244: ; preds = %197, %193
br label %245
245: ; preds = %244, %191, %189, %159, %73
%246 = load i32, i32* @stderr
%247 = load i32, i32* %8
%248 = load i32, i32* %7
%249 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%250 = call i32 (i32, i8*, ...) @fprintf(i32 %246, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %247, i32 %248, i8* %249)
store i32 1, i32* %1
br label %263
251: ; preds = %234
br label %252
252: ; preds = %251, %192
br label %253
253: ; preds = %252, %74
br label %23
254: ; preds = %23
%255 = load i32*, i32** %10
%256 = call i32 @fputs(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.11, i64 0, i64 0), i32* %255)
%257 = load i32*, i32** %11
%258 = call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32* %257)
%259 = load i32*, i32** %10
%260 = call i32 @fclose(i32* %259)
%261 = load i32*, i32** %11
%262 = call i32 @fclose(i32* %261)
store i32 0, i32* %1
br label %263
263: ; preds = %254, %245, %230, %19
%264 = load i32, i32* %1
ret i32 %264
}

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 = [16 x i8] c"\09DEVICE(%s,%s,\22\00"
@.str.5 = [4 x i8] c"\22)\0A\00"
@.str.6 = [19 x i8] c"CLASS(%s%s, \22%s\22)\0A\00"
@.str.7 = [14 x i8] c"ENDVENDOR()\0A\0A\00"
@.str.8 = [31 x i8] c"Line %d: Vendor name too long\0A\00"
@.str.9 = [12 x i8] c"VENDOR(%s,\22\00"
@.str.10 = [38 x i8] c"Line %d: Syntax error in mode %d: %s\0A\00"
@.str.11 = [59 x i8] c"ENDVENDOR()\0A\0A#undef VENDOR\0A#undef DEVICE\0A#undef ENDVENDOR\0A\00"
@.str.12 = [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 %150, 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 %145
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 %155
29: ; preds = %145, %55
%30 = phi i32 [ %147, %145 ], [ %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 %135
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 %135
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 %138
51: ; preds = %37
%52 = icmp eq i8 %36, 9
br i1 %52, label %53, label %108
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 %150, label %29
59: ; preds = %53
switch i32 %148, label %135 [
i32 1, label %60
i32 2, label %95
]
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 %135
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, %146
%74 = icmp sgt i32 %73, 78
br i1 %74, label %75, label %91
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, %146
%86 = icmp sgt i32 %85, 78
br i1 %86, label %87, label %91
87: ; preds = %83
%88 = sub nsw i32 78, %146
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %68, i64 %89
store i8 0, i8* %90
br label %91
91: ; preds = %83, %87, %71
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %4, i8* %15)
%93 = call i32 @pq(i32* %5, i8* %68)
%94 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i64 3, i64 1, i32* %5)
br label %138
95: ; preds = %59
%96 = call i32 @strlen(i8* %3)
%97 = icmp sgt i32 %96, 3
%98 = load i8, i8* %19
%99 = icmp eq i8 %98, 32
%100 = select i1 %97, i1 %99, i1 false
br i1 %100, label %101, label %135
101: ; preds = %95, %101
%102 = phi i8* [ %103, %101 ], [ %19, %95 ]
%103 = getelementptr inbounds i8, i8* %102, i64 1
store i8 0, i8* %102
%104 = load i8, i8* %103
%105 = icmp eq i8 %104, 32
br i1 %105, label %101, label %106
106: ; preds = %101
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %4, i8* %15, i8* %103)
br label %138
108: ; preds = %51
%109 = call i32 @strlen(i8* %3)
%110 = icmp sgt i32 %109, 4
%111 = load i8, i8* %16
%112 = icmp eq i8 %111, 32
%113 = select i1 %110, i1 %112, i1 false
br i1 %113, label %114, label %135
114: ; preds = %108, %114
%115 = phi i8* [ %116, %114 ], [ %16, %108 ]
%116 = getelementptr inbounds i8, i8* %115, i64 1
store i8 0, i8* %115
%117 = load i8, i8* %116
%118 = icmp eq i8 %117, 32
br i1 %118, label %114, label %119
119: ; preds = %114
%120 = icmp eq i32 %149, 0
br i1 %120, label %123, label %121
121: ; preds = %119
%122 = call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i64 13, i64 1, i32* %5)
br label %123
123: ; preds = %121, %119
%124 = call i32 @strcpy(i8* %4, i8* %3)
%125 = call i32 @strlen(i8* %116)
%126 = icmp sgt i32 %125, 55
br i1 %126, label %127, label %130
127: ; preds = %123
%128 = load i32, i32* @stderr
%129 = call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %31)
br label %155
130: ; preds = %123
%131 = add nsw i32 %149, 1
%132 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* %4)
%133 = call i32 @pq(i32* %5, i8* %116)
%134 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i64 3, i64 1, i32* %5)
br label %138
135: ; preds = %108, %59, %95, %60, %40, %42
%136 = load i32, i32* @stderr
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %136, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %31, i32 %148, i8* %3)
br label %155
138: ; preds = %130, %106, %91, %48
%139 = phi i32 [ %149, %48 ], [ %149, %106 ], [ %149, %91 ], [ %131, %130 ]
%140 = phi i32 [ 2, %48 ], [ 2, %106 ], [ 1, %91 ], [ 1, %130 ]
%141 = phi i32 [ %146, %48 ], [ %146, %106 ], [ %146, %91 ], [ %125, %130 ]
%142 = load i32, i32* @stdin
%143 = call i64 @fgets(i8* %3, i32 1023, i32 %142)
%144 = icmp eq i64 %143, 0
br i1 %144, label %150, label %145
145: ; preds = %14, %138
%146 = phi i32 [ 0, %14 ], [ %141, %138 ]
%147 = phi i32 [ 0, %14 ], [ %31, %138 ]
%148 = phi i32 [ 0, %14 ], [ %140, %138 ]
%149 = phi i32 [ 0, %14 ], [ %139, %138 ]
br label %29
150: ; preds = %138, %55, %10
%151 = call i64 @fwrite(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.11, i64 0, i64 0), i64 58, i64 1, i32* %5)
%152 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i64 14, i64 1, i32* %6)
%153 = call i32 @fclose(i32* %5)
%154 = call i32 @fclose(i32* %6)
br label %155
155: ; preds = %150, %135, %127, %26
%156 = phi i32 [ 1, %135 ], [ 1, %127 ], [ 0, %150 ], [ 1, %26 ]
ret i32 %156
}