#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);
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 > 200) {
            bra = strchr(c, '[');
            if (bra && bra > c && bra[-1] == ' ')
              bra[-1] = 0;
            if (vendor_len + strlen(c) + 1 > 200) {
              fprintf(stderr,
                      "Line %d: Device name too long. Name truncated.\n", lino);
              fprintf(stderr, "%s\n", c);
            }
          }
          fprintf(devf, "\tDEVICE(%s,%s,\"", vend, line + 1);
          pq(devf, c, 200 - vendor_len - 1);
          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 > 200) {
        fprintf(stderr, "Line %d: Vendor name too long\n", lino);
        return 1;
      }
      fprintf(devf, "VENDOR(%s,\"", vend);
      pq(devf, c, 0);
      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    17eb <main+0x65b>
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     17a6 <main+0x616>
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    1761 <main+0x5d1>
jmp    17a1 <main+0x611>
movsbl -0x410(%rbp),%eax
cmp    $0x9,%eax
jne    160f <main+0x47f>
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     155f <main+0x3cf>
jmp    1605 <main+0x475>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jle    1555 <main+0x3c5>
movsbl -0x40b(%rbp),%eax
cmp    $0x20,%eax
jne    1555 <main+0x3c5>
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    $0xc8,%eax
jle    14f3 <main+0x363>
mov    -0x418(%rbp),%rdi
mov    $0x5b,%esi
call   1060 <strchr@plt>
mov    %rax,-0x420(%rbp)
cmpq   $0x0,-0x420(%rbp)
je     1483 <main+0x2f3>
mov    -0x420(%rbp),%rax
cmp    -0x418(%rbp),%rax
jbe    1483 <main+0x2f3>
mov    -0x420(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
jne    1483 <main+0x2f3>
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    $0xc8,%eax
jle    14ee <main+0x35e>
mov    0x2b1e(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
lea    0xb6b(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2b01(%rip),%rax
mov    (%rax),%edi
mov    -0x418(%rbp),%rdx
lea    0xbfb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    14f3 <main+0x363>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
lea    0xb4f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x418(%rbp),%rsi
mov    $0xc8,%edx
sub    -0x438(%rbp),%edx
sub    $0x1,%edx
call   10b0 <pq@plt>
mov    -0x440(%rbp),%rsi
lea    0xb38(%rip),%rdi
call   1070 <fputs@plt>
jmp    155a <main+0x3ca>
jmp    1761 <main+0x5d1>
jmp    160a <main+0x47a>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x3,%eax
jle    15fb <main+0x46b>
movsbl -0x40d(%rbp),%eax
cmp    $0x20,%eax
jne    15fb <main+0x46b>
lea    -0x410(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    15c6 <main+0x436>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1596 <main+0x406>
mov    -0x448(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    -0x410(%rbp),%rcx
add    $0x1,%rcx
mov    -0x418(%rbp),%r8
lea    0xa85(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1600 <main+0x470>
jmp    1761 <main+0x5d1>
jmp    160a <main+0x47a>
jmp    1761 <main+0x5d1>
jmp    179c <main+0x60c>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jle    175c <main+0x5cc>
movsbl -0x40c(%rbp),%eax
cmp    $0x20,%eax
jne    175c <main+0x5cc>
lea    -0x410(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1676 <main+0x4e6>
mov    -0x418(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x418(%rbp)
movb   $0x0,(%rax)
jmp    1646 <main+0x4b6>
cmpl   $0x0,-0x42c(%rbp)
je     1696 <main+0x506>
mov    -0x440(%rbp),%rsi
lea    0x9f6(%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    $0xc8,%eax
jle    1707 <main+0x577>
mov    0x28f3(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
lea    0x9a1(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17eb <main+0x65b>
mov    -0x440(%rbp),%rax
mov    %eax,%edi
lea    -0x428(%rbp),%rdx
lea    0x996(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x440(%rbp),%rdi
mov    -0x418(%rbp),%rsi
xor    %edx,%edx
call   10b0 <pq@plt>
mov    -0x440(%rbp),%rsi
lea    0x93b(%rip),%rdi
call   1070 <fputs@plt>
movl   $0x1,-0x430(%rbp)
jmp    1797 <main+0x607>
jmp    1761 <main+0x5d1>
mov    0x2870(%rip),%rax
mov    (%rax),%edi
mov    -0x434(%rbp),%edx
mov    -0x430(%rbp),%ecx
lea    -0x410(%rbp),%r8
lea    0x93c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17eb <main+0x65b>
jmp    179c <main+0x60c>
jmp    17a1 <main+0x611>
jmp    1242 <main+0xb2>
mov    -0x440(%rbp),%rsi
lea    0x932(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x448(%rbp),%rsi
lea    0x95a(%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     14dd <main+0x34d>
mov    %rax,%r14
test   %rax,%rax
je     14dd <main+0x34d>
mov    0x2e03(%rip),%r13
mov    0x0(%r13),%edx
lea    0x10(%rsp),%rdi
mov    $0x3ff,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     14fb <main+0x36b>
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     14fb <main+0x36b>
mov    %r15,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1252 <main+0xc2>
movb   $0x0,(%rax)
mov    0x10(%rsp),%al
test   %al,%al
je     1220 <main+0x90>
cmp    $0x23,%al
je     1220 <main+0x90>
mov    0x11(%rsp),%cl
cmp    $0x20,%cl
je     136b <main+0x1db>
cmp    $0x9,%al
jne    13a3 <main+0x213>
cmp    $0x9,%cl
je     1220 <main+0x90>
cmp    $0x2,%ebx
je     1468 <main+0x2d8>
cmp    $0x1,%ebx
jne    1551 <main+0x3c1>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x6,%eax
jl     1551 <main+0x3c1>
cmpb   $0x20,0x15(%rsp)
jne    1551 <main+0x3c1>
lea    0x15(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     12b0 <main+0x120>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    (%rsp),%ecx
add    %ecx,%eax
cmp    $0xc8,%eax
jl     133a <main+0x1aa>
mov    %rbx,%rdi
mov    $0x5b,%esi
call   1060 <strchr@plt>
cmp    %rbx,%rax
jbe    12ed <main+0x15d>
cmpb   $0x20,-0x1(%rax)
jne    12ed <main+0x15d>
movb   $0x0,-0x1(%rax)
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    (%rsp),%ecx
add    %ecx,%eax
cmp    $0xc8,%eax
jl     133a <main+0x1aa>
mov    0x2cd0(%rip),%rax
mov    (%rax),%edi
lea    0xd23(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
mov    %ecx,(%rsp)
call   1080 <fprintf@plt>
mov    0x2cb4(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rsp),%ecx
mov    %ecx,(%rsp)
mov    %r12d,%edi
lea    0xd1d(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x11(%rsp),%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xc7,%edx
sub    (%rsp),%edx
mov    %r12,%rdi
mov    %rbx,%rsi
jmp    1443 <main+0x2b3>
cmp    $0x43,%al
jne    1551 <main+0x3c1>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     1551 <main+0x3c1>
cmpb   $0x20,0x14(%rsp)
jne    1551 <main+0x3c1>
movzwl 0x12(%rsp),%eax
mov    %ax,0x8(%rsp)
movb   $0x0,0xa(%rsp)
jmp    14ba <main+0x32a>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%eax
jl     1551 <main+0x3c1>
cmpb   $0x20,0x14(%rsp)
jne    1551 <main+0x3c1>
lea    0x14(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x0,(%rbx)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     13d0 <main+0x240>
cmpl   $0x0,0x4(%rsp)
je     13fd <main+0x26d>
mov    $0xd,%esi
mov    $0x1,%edx
lea    0xc92(%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>
cmp    $0xb1,%eax
jge    1573 <main+0x3e3>
mov    %eax,(%rsp)
addl   $0x1,0x4(%rsp)
mov    %r12d,%edi
lea    0xc85(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   10a0 <pq@plt>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xc2a(%rip),%rdi
mov    %r12,%rcx
call   10b0 <fwrite@plt>
mov    $0x1,%ebx
jmp    14bf <main+0x32f>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jl     1551 <main+0x3c1>
cmpb   $0x20,0x13(%rsp)
jne    1551 <main+0x3c1>
lea    0x13(%rsp),%r8
nopl   0x0(%rax)
movb   $0x0,(%r8)
cmpb   $0x20,0x1(%r8)
lea    0x1(%r8),%r8
je     1490 <main+0x300>
mov    %r14d,%edi
lea    0xbcb(%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
je     14fb <main+0x36b>
add    $0x1,%ebp
jmp    123d <main+0xad>
mov    0x2af4(%rip),%rax
mov    (%rax),%edi
lea    0xb2b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
jmp    153f <main+0x3af>
lea    0xbe4(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10b0 <fwrite@plt>
lea    0xc06(%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
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a80(%rip),%rax
mov    (%rax),%edi
lea    0xb5f(%rip),%rsi
lea    0x10(%rsp),%r8
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14f4 <main+0x364>
mov    0x2a5e(%rip),%rax
mov    (%rax),%edi
lea    0xb12(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14f4 <main+0x364>

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

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