#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);
              fprintf(stderr, "%s\n", c);
              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    17e1 <main+0x651>
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     179c <main+0x60c>
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    1757 <main+0x5c7>
jmp    1797 <main+0x607>
movsbl -0x410(%rbp),%eax
cmp    $0x9,%eax
jne    1609 <main+0x479>
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     1559 <main+0x3c9>
jmp    15ff <main+0x46f>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jle    154f <main+0x3bf>
movsbl -0x40b(%rbp),%eax
cmp    $0x20,%eax
jne    154f <main+0x3bf>
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    14fb <main+0x36b>
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    14f6 <main+0x366>
mov    0x2b22(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
lea    0xb6f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b05(%rip),%rax
mov    (%rax),%edi
mov    -0x418(%rbp),%rdx
lea    0xbee(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17e1 <main+0x651>
jmp    14fb <main+0x36b>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
lea    0xb36(%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    0xb2d(%rip),%rdi
call   1070 <fputs@plt>
jmp    1554 <main+0x3c4>
jmp    1757 <main+0x5c7>
jmp    1604 <main+0x474>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jle    15f5 <main+0x465>
movsbl -0x40d(%rbp),%eax
cmp    $0x20,%eax
jne    15f5 <main+0x465>
lea    -0x410(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    15c0 <main+0x430>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1590 <main+0x400>
mov    -0x448(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
mov    -0x418(%rbp),%r8
lea    0xa7a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    15fa <main+0x46a>
jmp    1757 <main+0x5c7>
jmp    1604 <main+0x474>
jmp    1757 <main+0x5c7>
jmp    1792 <main+0x602>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jle    1752 <main+0x5c2>
movsbl -0x40c(%rbp),%eax
cmp    $0x20,%eax
jne    1752 <main+0x5c2>
lea    -0x410(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1670 <main+0x4e0>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1640 <main+0x4b0>
cmpl   $0x0,-0x42c(%rbp)
je     1690 <main+0x500>
mov    -0x440(%rbp),%rsi
lea    0x9eb(%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    16ff <main+0x56f>
mov    0x28fb(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
lea    0x998(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17e1 <main+0x651>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    0x98d(%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    0x934(%rip),%rdi
call   1070 <fputs@plt>
movl   $0x1,-0x430(%rbp)
jmp    178d <main+0x5fd>
jmp    1757 <main+0x5c7>
mov    0x287a(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
mov    -0x430(%rbp),%ecx
lea    -0x410(%rbp),%r8
lea    0x935(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17e1 <main+0x651>
jmp    1792 <main+0x602>
jmp    1797 <main+0x607>
jmp    1242 <main+0xb2>
mov    -0x440(%rbp),%rsi
lea    0x92b(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x448(%rbp),%rsi
lea    0x953(%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),%r14
mov    (%r14),%edi
lea    0xae9(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r14),%edi
lea    0xb73(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14e6 <main+0x356>

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

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