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

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
unsigned char getc(int /*<<< orphan*/ *);
scalar_t__ getenv(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
char *strstr(char *, char *);
int main(int argc, char *argv[]) {
  FILE *infile, *outfile;
  char infname[1024];
  char outfname[1024];
  char *rt28xxdir;
  char *chipset;
  char *wow;
  int i = 0;
  unsigned char c;
  memset(infname, 0, 1024);
  memset(outfname, 0, 1024);
  rt28xxdir = (char *)getenv("RT28xx_DIR");
  chipset = (char *)getenv("CHIPSET");
  wow = (char *)getenv("HAS_WOW_SUPPORT");
  if (!rt28xxdir) {
    printf("Environment value \"RT28xx_DIR\" not export \n");
    return -1;
  }
  if (!chipset) {
    printf("Environment value \"CHIPSET\" not export \n");
    return -1;
  }
  if (strlen(rt28xxdir) > (sizeof(infname) - 100)) {
    printf("Environment value \"RT28xx_DIR\" is too long!\n");
    return -1;
  }
  strcat(infname, rt28xxdir);
  if (strncmp(chipset, "2860", 4) == 0)
    strcat(infname, "/common/rt2860.bin");
  else if (strncmp(chipset, "2870", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "3090", 4) == 0)
    strcat(infname, "/common/rt2860.bin");
  else if (strncmp(chipset, "2070", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "3070", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "3572", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "3573", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "3370", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "5370", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "5572", 4) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "5592", 4) == 0)
    strcat(infname, "/common/rt2860.bin");
  else if (strncmp(chipset, "USB", 3) == 0)
    strcat(infname, "/common/rt2870.bin");
  else if (strncmp(chipset, "PCI", 3) == 0)
    strcat(infname, "/common/rt2860.bin");
  else
    strcat(infname, "/common/rt2860.bin");
  if ((wow != NULL) && (strncmp(wow, "y", 1) == 0)) {
    if ((wow = strstr(infname, "rt2870")) != NULL) {
      strcpy(wow, "rt2870_wow.bin");
      fprintf(stderr, "infname %s\n", infname);
    }
  }
  strcat(outfname, rt28xxdir);
  strcat(outfname, "/include/firmware.h");
  infile = fopen(infname, "r");
  if (infile == (FILE *)NULL) {
    printf("Can't read file %s \n", infname);
    return -1;
  }
  outfile = fopen(outfname, "w");
  if (outfile == (FILE *)NULL) {
    printf("Can't open write file %s \n", outfname);
    return -1;
  }
  fputs("/* AUTO GEN PLEASE DO NOT MODIFY IT */ \n", outfile);
  fputs("/* AUTO GEN PLEASE DO NOT MODIFY IT */ \n", outfile);
  fputs("\n", outfile);
  fputs("\n", outfile);
  fputs("UCHAR FirmwareImage [] = { \n", outfile);
  while (1) {
    char cc[3];
    c = getc(infile);
    if (feof(infile))
      break;
    memset(cc, 0, 2);
    if (i >= 16) {
      fputs("\n", outfile);
      i = 0;
    }
    fputs("0x", outfile);
    sprintf(cc, "%02x", c);
    fputs(cc, outfile);
    fputs(", ", outfile);
    i++;
  }
  fputs("} ;\n", outfile);
  fclose(infile);
  fclose(outfile);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x83c(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    -0x820(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    0xdb0(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x828(%rbp)
lea    0xda8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x830(%rbp)
lea    0xd9d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x838(%rbp)
cmpq   $0x0,-0x828(%rbp)
jne    12aa <main+0xaa>
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18c6 <main+0x6c6>
cmpq   $0x0,-0x830(%rbp)
jne    12d2 <main+0xd2>
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18c6 <main+0x6c6>
mov    -0x828(%rbp),%rdi
call   1070 <strlen@plt>
cltq
cmp    $0x39c,%rax
jbe    1306 <main+0x106>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18c6 <main+0x6c6>
lea    -0x420(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x830(%rbp),%rdi
lea    0xd7e(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1353 <main+0x153>
lea    -0x420(%rbp),%rdi
lea    0xd61(%rip),%rsi
call   10e0 <strcat@plt>
jmp    165a <main+0x45a>
mov    -0x830(%rbp),%rdi
lea    0xda8(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    138d <main+0x18d>
lea    -0x420(%rbp),%rdi
lea    0xd3a(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1655 <main+0x455>
mov    -0x830(%rbp),%rdi
lea    0xd35(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    13c7 <main+0x1c7>
lea    -0x420(%rbp),%rdi
lea    0xced(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1650 <main+0x450>
mov    -0x830(%rbp),%rdi
lea    0xd00(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1401 <main+0x201>
lea    -0x420(%rbp),%rdi
lea    0xcc6(%rip),%rsi
call   10e0 <strcat@plt>
jmp    164b <main+0x44b>
mov    -0x830(%rbp),%rdi
lea    0xccb(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    143b <main+0x23b>
lea    -0x420(%rbp),%rdi
lea    0xc8c(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1646 <main+0x446>
mov    -0x830(%rbp),%rdi
lea    0xc96(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1475 <main+0x275>
lea    -0x420(%rbp),%rdi
lea    0xc52(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1641 <main+0x441>
mov    -0x830(%rbp),%rdi
lea    0xc61(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14af <main+0x2af>
lea    -0x420(%rbp),%rdi
lea    0xc18(%rip),%rsi
call   10e0 <strcat@plt>
jmp    163c <main+0x43c>
mov    -0x830(%rbp),%rdi
lea    0xc2c(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14e9 <main+0x2e9>
lea    -0x420(%rbp),%rdi
lea    0xbde(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1637 <main+0x437>
mov    -0x830(%rbp),%rdi
lea    0xbf7(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1523 <main+0x323>
lea    -0x420(%rbp),%rdi
lea    0xba4(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1632 <main+0x432>
mov    -0x830(%rbp),%rdi
lea    0xbc2(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    155d <main+0x35d>
lea    -0x420(%rbp),%rdi
lea    0xb6a(%rip),%rsi
call   10e0 <strcat@plt>
jmp    162d <main+0x42d>
mov    -0x830(%rbp),%rdi
lea    0xb8d(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1597 <main+0x397>
lea    -0x420(%rbp),%rdi
lea    0xb1d(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1628 <main+0x428>
mov    -0x830(%rbp),%rdi
lea    0xb58(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    15d1 <main+0x3d1>
lea    -0x420(%rbp),%rdi
lea    0xaf6(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1623 <main+0x423>
mov    -0x830(%rbp),%rdi
lea    0xb22(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    160b <main+0x40b>
lea    -0x420(%rbp),%rdi
lea    0xaa9(%rip),%rsi
call   10e0 <strcat@plt>
jmp    161e <main+0x41e>
lea    -0x420(%rbp),%rdi
lea    0xa91(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1623 <main+0x423>
jmp    1628 <main+0x428>
jmp    162d <main+0x42d>
jmp    1632 <main+0x432>
jmp    1637 <main+0x437>
jmp    163c <main+0x43c>
jmp    1641 <main+0x441>
jmp    1646 <main+0x446>
jmp    164b <main+0x44b>
jmp    1650 <main+0x450>
jmp    1655 <main+0x455>
jmp    165a <main+0x45a>
cmpq   $0x0,-0x838(%rbp)
je     16e2 <main+0x4e2>
mov    -0x838(%rbp),%rdi
lea    0xa8f(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    16e2 <main+0x4e2>
lea    -0x420(%rbp),%rdi
lea    0xa6f(%rip),%rsi
call   1120 <strstr@plt>
mov    %rax,-0x838(%rbp)
cmp    $0x0,%rax
je     16dd <main+0x4dd>
mov    -0x838(%rbp),%rdi
lea    0xa52(%rip),%rsi
call   1050 <strcpy@plt>
mov    0x2918(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rdx
lea    0xa45(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    16e2 <main+0x4e2>
lea    -0x820(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xa26(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    0xa27(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    174b <main+0x54b>
lea    -0x420(%rbp),%rsi
lea    0xa07(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18c6 <main+0x6c6>
lea    -0x820(%rbp),%rdi
lea    0x9fb(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    178e <main+0x58e>
lea    -0x820(%rbp),%rsi
lea    0x9db(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18c6 <main+0x6c6>
mov    -0x20(%rbp),%rsi
lea    0x9d8(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x9c8(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x9df(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x9cf(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x9c1(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1110 <getc@plt>
mov    %al,-0x83d(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <feof@plt>
cmp    $0x0,%rax
je     1805 <main+0x605>
jmp    189d <main+0x69d>
lea    -0x840(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10a0 <memset@plt>
cmpl   $0x10,-0x83c(%rbp)
jl     183f <main+0x63f>
mov    -0x20(%rbp),%rsi
lea    0x968(%rip),%rdi
call   1090 <fputs@plt>
movl   $0x0,-0x83c(%rbp)
mov    -0x20(%rbp),%rsi
lea    0x96d(%rip),%rdi
call   1090 <fputs@plt>
lea    -0x840(%rbp),%rdi
lea    0x95d(%rip),%rsi
movzbl -0x83d(%rbp),%edx
call   10f0 <sprintf@plt>
lea    -0x840(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x93b(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x83c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x83c(%rbp)
jmp    17de <main+0x5de>
mov    -0x20(%rbp),%rsi
lea    0x91a(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10b0 <memset@plt>
lea    0x410(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10b0 <memset@plt>
lea    0xd93(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r15
lea    0xd8f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xd88(%rip),%rdi
call   1030 <getenv@plt>
test   %r15,%r15
je     12b5 <main+0x85>
test   %rbx,%rbx
je     12be <main+0x8e>
mov    %rax,%r14
mov    %r15,%rdi
call   1080 <strlen@plt>
cmp    $0x39d,%eax
jb     12e1 <main+0xb1>
lea    0xee5(%rip),%rdi
jmp    12c5 <main+0x95>
lea    0xe89(%rip),%rdi
jmp    12c5 <main+0x95>
lea    0xeab(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%eax
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1100 <strcat@plt>
lea    0xd2e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
lea    0xd1f(%rip),%rbp
test   %rax,%rax
je     1458 <main+0x228>
lea    0xd6e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
lea    0xd0e(%rip),%r12
test   %rax,%rax
je     145b <main+0x22b>
lea    0xd11(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1458 <main+0x228>
lea    0xcf9(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xce1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xcc9(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xcb1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xc99(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xc85(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xc71(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xc5d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1458 <main+0x228>
lea    0xc49(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     145b <main+0x22b>
lea    0xc34(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
mov    %rbp,%r12
lea    0x10(%rsp),%rdi
mov    %r12,%rsi
call   1100 <strcat@plt>
test   %r14,%r14
je     14c5 <main+0x295>
lea    0xc0f(%rip),%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    14c5 <main+0x295>
lea    0xbf8(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1150 <strstr@plt>
test   %rax,%rax
je     14c5 <main+0x295>
lea    0xbe9(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
mov    0x2b2e(%rip),%rax
mov    (%rax),%edi
lea    0xbe0(%rip),%rsi
lea    0x10(%rsp),%rdx
call   10d0 <fprintf@plt>
lea    0x410(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1100 <strcat@plt>
lea    0xbc8(%rip),%rsi
mov    %rbx,%rdi
call   1100 <strcat@plt>
lea    0xbcd(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     152a <main+0x2fa>
mov    %rax,%rbx
lea    0xbcb(%rip),%rsi
lea    0x410(%rsp),%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
jne    1542 <main+0x312>
lea    0xbb4(%rip),%rdi
lea    0x410(%rsp),%rsi
jmp    1536 <main+0x306>
lea    0xb8c(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    12ca <main+0x9a>
mov    %rax,%r14
lea    0xba3(%rip),%rbp
mov    $0x28,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
mov    %rax,%rcx
call   1130 <fwrite@plt>
mov    $0x28,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
mov    %r14,%rcx
call   1130 <fwrite@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   10c0 <fputc@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   10c0 <fputc@plt>
lea    0xb81(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1130 <fwrite@plt>
mov    %rbx,%rdi
call   1140 <getc@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   10e0 <feof@plt>
test   %rax,%rax
jne    1668 <main+0x438>
xor    %r13d,%r13d
lea    0xd(%rsp),%r15
lea    0xb69(%rip),%rbp
jmp    163e <main+0x40e>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xb4e(%rip),%rdi
mov    %r14,%rcx
call   1130 <fwrite@plt>
movzbl %r12b,%edx
mov    %r15,%rdi
lea    0xb3b(%rip),%rsi
call   1110 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   10a0 <fputs@plt>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbp,%rdi
mov    %r14,%rcx
call   1130 <fwrite@plt>
add    $0x1,%r13d
mov    %rbx,%rdi
call   1140 <getc@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   10e0 <feof@plt>
test   %rax,%rax
jne    1668 <main+0x438>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10b0 <memset@plt>
cmp    $0x10,%r13d
jl     15d6 <main+0x3a6>
mov    $0xa,%edi
mov    %r14,%rsi
call   10c0 <fputc@plt>
xor    %r13d,%r13d
jmp    15d6 <main+0x3a6>
lea    0xad1(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1130 <fwrite@plt>
mov    %rbx,%rdi
call   1070 <fclose@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
xor    %edi,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"RT28xx_DIR\00"
@.str.1 = [8 x i8] c"CHIPSET\00"
@.str.2 = [16 x i8] c"HAS_WOW_SUPPORT\00"
@.str.3 = [44 x i8] c"Environment value \22RT28xx_DIR\22 not export \0A\00"
@.str.4 = [41 x i8] c"Environment value \22CHIPSET\22 not export \0A\00"
@.str.5 = [45 x i8] c"Environment value \22RT28xx_DIR\22 is too long!\0A\00"
@.str.6 = [5 x i8] c"2860\00"
@.str.7 = [19 x i8] c"/common/rt2860.bin\00"
@.str.8 = [5 x i8] c"2870\00"
@.str.9 = [19 x i8] c"/common/rt2870.bin\00"
@.str.10 = [5 x i8] c"3090\00"
@.str.11 = [5 x i8] c"2070\00"
@.str.12 = [5 x i8] c"3070\00"
@.str.13 = [5 x i8] c"3572\00"
@.str.14 = [5 x i8] c"3573\00"
@.str.15 = [5 x i8] c"3370\00"
@.str.16 = [5 x i8] c"5370\00"
@.str.17 = [5 x i8] c"5572\00"
@.str.18 = [5 x i8] c"5592\00"
@.str.19 = [4 x i8] c"USB\00"
@.str.20 = [4 x i8] c"PCI\00"
@.str.21 = [2 x i8] c"y\00"
@.str.22 = [7 x i8] c"rt2870\00"
@.str.23 = [15 x i8] c"rt2870_wow.bin\00"
@stderr = global i32 0
@.str.24 = [12 x i8] c"infname %s\0A\00"
@.str.25 = [20 x i8] c"/include/firmware.h\00"
@.str.26 = [2 x i8] c"r\00"
@.str.27 = [21 x i8] c"Can't read file %s \0A\00"
@.str.28 = [2 x i8] c"w\00"
@.str.29 = [27 x i8] c"Can't open write file %s \0A\00"
@.str.30 = [41 x i8] c"/* AUTO GEN PLEASE DO NOT MODIFY IT */ \0A\00"
@.str.31 = [2 x i8] c"\0A\00"
@.str.32 = [29 x i8] c"UCHAR FirmwareImage [] = { \0A\00"
@.str.33 = [3 x i8] c"0x\00"
@.str.34 = [5 x i8] c"%02x\00"
@.str.35 = [3 x i8] c", \00"
@.str.36 = [5 x i8] c"} ;\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8
%15 = alloca [3 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%17 = call i32 @memset(i8* %16, i32 0, i32 1024)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 1024)
%20 = call i64 @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %10
%22 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %11
%24 = call i64 @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %12
%26 = load i8*, i8** %10
%27 = icmp ne i8* %26, null
br i1 %27, label %30, label %28
28: ; preds = %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %237
30: ; preds = %2
%31 = load i8*, i8** %11
%32 = icmp ne i8* %31, null
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %237
35: ; preds = %30
%36 = load i8*, i8** %10
%37 = call i32 @strlen(i8* %36)
%38 = sext i32 %37 to i64
%39 = icmp ugt i64 %38, 924
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %237
42: ; preds = %35
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%44 = load i8*, i8** %10
%45 = call i32 @strcat(i8* %43, i8* %44)
%46 = load i8*, i8** %11
%47 = call i64 @strncmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %42
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %151
52: ; preds = %42
%53 = load i8*, i8** %11
%54 = call i64 @strncmp(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%58 = call i32 @strcat(i8* %57, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %150
59: ; preds = %52
%60 = load i8*, i8** %11
%61 = call i64 @strncmp(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%65 = call i32 @strcat(i8* %64, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %149
66: ; preds = %59
%67 = load i8*, i8** %11
%68 = call i64 @strncmp(i8* %67, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%72 = call i32 @strcat(i8* %71, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %148
73: ; preds = %66
%74 = load i8*, i8** %11
%75 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 4)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%79 = call i32 @strcat(i8* %78, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %147
80: ; preds = %73
%81 = load i8*, i8** %11
%82 = call i64 @strncmp(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 4)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %80
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%86 = call i32 @strcat(i8* %85, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %146
87: ; preds = %80
%88 = load i8*, i8** %11
%89 = call i64 @strncmp(i8* %88, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i32 4)
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %87
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%93 = call i32 @strcat(i8* %92, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %145
94: ; preds = %87
%95 = load i8*, i8** %11
%96 = call i64 @strncmp(i8* %95, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %101
98: ; preds = %94
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%100 = call i32 @strcat(i8* %99, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %144
101: ; preds = %94
%102 = load i8*, i8** %11
%103 = call i64 @strncmp(i8* %102, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i32 4)
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %101
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%107 = call i32 @strcat(i8* %106, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %143
108: ; preds = %101
%109 = load i8*, i8** %11
%110 = call i64 @strncmp(i8* %109, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 4)
%111 = icmp eq i64 %110, 0
br i1 %111, label %112, label %115
112: ; preds = %108
%113 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%114 = call i32 @strcat(i8* %113, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %142
115: ; preds = %108
%116 = load i8*, i8** %11
%117 = call i64 @strncmp(i8* %116, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i32 4)
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %115
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%121 = call i32 @strcat(i8* %120, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %141
122: ; preds = %115
%123 = load i8*, i8** %11
%124 = call i64 @strncmp(i8* %123, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 3)
%125 = icmp eq i64 %124, 0
br i1 %125, label %126, label %129
126: ; preds = %122
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%128 = call i32 @strcat(i8* %127, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
br label %140
129: ; preds = %122
%130 = load i8*, i8** %11
%131 = call i64 @strncmp(i8* %130, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 3)
%132 = icmp eq i64 %131, 0
br i1 %132, label %133, label %136
133: ; preds = %129
%134 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%135 = call i32 @strcat(i8* %134, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %139
136: ; preds = %129
%137 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%138 = call i32 @strcat(i8* %137, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %139
139: ; preds = %136, %133
br label %140
140: ; preds = %139, %126
br label %141
141: ; preds = %140, %119
br label %142
142: ; preds = %141, %112
br label %143
143: ; preds = %142, %105
br label %144
144: ; preds = %143, %98
br label %145
145: ; preds = %144, %91
br label %146
146: ; preds = %145, %84
br label %147
147: ; preds = %146, %77
br label %148
148: ; preds = %147, %70
br label %149
149: ; preds = %148, %63
br label %150
150: ; preds = %149, %56
br label %151
151: ; preds = %150, %49
%152 = load i8*, i8** %12
%153 = icmp ne i8* %152, null
br i1 %153, label %154, label %169
154: ; preds = %151
%155 = load i8*, i8** %12
%156 = call i64 @strncmp(i8* %155, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0), i32 1)
%157 = icmp eq i64 %156, 0
br i1 %157, label %158, label %169
158: ; preds = %154
%159 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%160 = call i8* @strstr(i8* %159, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0))
store i8* %160, i8** %12
%161 = icmp ne i8* %160, null
br i1 %161, label %162, label %168
162: ; preds = %158
%163 = load i8*, i8** %12
%164 = call i32 @strcpy(i8* %163, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0))
%165 = load i32, i32* @stderr
%166 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%167 = call i32 @fprintf(i32 %165, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.24, i64 0, i64 0), i8* %166)
br label %168
168: ; preds = %162, %158
br label %169
169: ; preds = %168, %154, %151
%170 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%171 = load i8*, i8** %10
%172 = call i32 @strcat(i8* %170, i8* %171)
%173 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%174 = call i32 @strcat(i8* %173, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.25, i64 0, i64 0))
%175 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%176 = call i32* @fopen(i8* %175, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i64 0, i64 0))
store i32* %176, i32** %6
%177 = load i32*, i32** %6
%178 = icmp eq i32* %177, null
br i1 %178, label %179, label %182
179: ; preds = %169
%180 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.27, i64 0, i64 0), i8* %180)
store i32 -1, i32* %3
br label %237
182: ; preds = %169
%183 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%184 = call i32* @fopen(i8* %183, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
store i32* %184, i32** %7
%185 = load i32*, i32** %7
%186 = icmp eq i32* %185, null
br i1 %186, label %187, label %190
187: ; preds = %182
%188 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.29, i64 0, i64 0), i8* %188)
store i32 -1, i32* %3
br label %237
190: ; preds = %182
%191 = load i32*, i32** %7
%192 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.30, i64 0, i64 0), i32* %191)
%193 = load i32*, i32** %7
%194 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.30, i64 0, i64 0), i32* %193)
%195 = load i32*, i32** %7
%196 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.31, i64 0, i64 0), i32* %195)
%197 = load i32*, i32** %7
%198 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.31, i64 0, i64 0), i32* %197)
%199 = load i32*, i32** %7
%200 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.32, i64 0, i64 0), i32* %199)
br label %201
201: ; preds = %190, %216
%202 = load i32*, i32** %6
%203 = call zeroext i8 @getc(i32* %202)
store i8 %203, i8* %14
%204 = load i32*, i32** %6
%205 = call i64 @feof(i32* %204)
%206 = icmp ne i64 %205, 0
br i1 %206, label %207, label %208
207: ; preds = %201
br label %229
208: ; preds = %201
%209 = getelementptr inbounds [3 x i8], [3 x i8]* %15, i64 0, i64 0
%210 = call i32 @memset(i8* %209, i32 0, i32 2)
%211 = load i32, i32* %13
%212 = icmp sge i32 %211, 16
br i1 %212, label %213, label %216
213: ; preds = %208
%214 = load i32*, i32** %7
%215 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.31, i64 0, i64 0), i32* %214)
store i32 0, i32* %13
br label %216
216: ; preds = %213, %208
%217 = load i32*, i32** %7
%218 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.33, i64 0, i64 0), i32* %217)
%219 = getelementptr inbounds [3 x i8], [3 x i8]* %15, i64 0, i64 0
%220 = load i8, i8* %14
%221 = call i32 @sprintf(i8* %219, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.34, i64 0, i64 0), i8 zeroext %220)
%222 = getelementptr inbounds [3 x i8], [3 x i8]* %15, i64 0, i64 0
%223 = load i32*, i32** %7
%224 = call i32 @fputs(i8* %222, i32* %223)
%225 = load i32*, i32** %7
%226 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i64 0, i64 0), i32* %225)
%227 = load i32, i32* %13
%228 = add nsw i32 %227, 1
store i32 %228, i32* %13
br label %201
229: ; preds = %207
%230 = load i32*, i32** %7
%231 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.36, i64 0, i64 0), i32* %230)
%232 = load i32*, i32** %6
%233 = call i32 @fclose(i32* %232)
%234 = load i32*, i32** %7
%235 = call i32 @fclose(i32* %234)
%236 = call i32 @exit(i32 0)
unreachable
237: ; preds = %187, %179, %40, %33, %28
%238 = load i32, i32* %3
ret i32 %238
}

LLVM IR (-O2):
@.str = [11 x i8] c"RT28xx_DIR\00"
@.str.1 = [8 x i8] c"CHIPSET\00"
@.str.2 = [16 x i8] c"HAS_WOW_SUPPORT\00"
@.str.6 = [5 x i8] c"2860\00"
@.str.7 = [19 x i8] c"/common/rt2860.bin\00"
@.str.8 = [5 x i8] c"2870\00"
@.str.9 = [19 x i8] c"/common/rt2870.bin\00"
@.str.10 = [5 x i8] c"3090\00"
@.str.11 = [5 x i8] c"2070\00"
@.str.12 = [5 x i8] c"3070\00"
@.str.13 = [5 x i8] c"3572\00"
@.str.14 = [5 x i8] c"3573\00"
@.str.15 = [5 x i8] c"3370\00"
@.str.16 = [5 x i8] c"5370\00"
@.str.17 = [5 x i8] c"5572\00"
@.str.18 = [5 x i8] c"5592\00"
@.str.19 = [4 x i8] c"USB\00"
@.str.20 = [4 x i8] c"PCI\00"
@.str.21 = [2 x i8] c"y\00"
@.str.22 = [7 x i8] c"rt2870\00"
@.str.23 = [15 x i8] c"rt2870_wow.bin\00"
@stderr = global i32 0
@.str.24 = [12 x i8] c"infname %s\0A\00"
@.str.25 = [20 x i8] c"/include/firmware.h\00"
@.str.26 = [2 x i8] c"r\00"
@.str.27 = [21 x i8] c"Can't read file %s \0A\00"
@.str.28 = [2 x i8] c"w\00"
@.str.29 = [27 x i8] c"Can't open write file %s \0A\00"
@.str.30 = [41 x i8] c"/* AUTO GEN PLEASE DO NOT MODIFY IT */ \0A\00"
@.str.32 = [29 x i8] c"UCHAR FirmwareImage [] = { \0A\00"
@.str.33 = [3 x i8] c"0x\00"
@.str.34 = [5 x i8] c"%02x\00"
@.str.35 = [3 x i8] c", \00"
@.str.36 = [5 x i8] c"} ;\0A\00"
@str = [43 x i8] c"Environment value \22RT28xx_DIR\22 not export \00"
@str.37 = [40 x i8] c"Environment value \22CHIPSET\22 not export \00"
@str.38 = [44 x i8] c"Environment value \22RT28xx_DIR\22 is too long!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [3 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = call i32 @memset(i8* %6, i32 0, i32 1024)
%9 = call i32 @memset(i8* %7, i32 0, i32 1024)
%10 = call i64 @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = inttoptr i64 %10 to i8*
%12 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%13 = inttoptr i64 %12 to i8*
%14 = call i64 @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%15 = inttoptr i64 %14 to i8*
%16 = icmp eq i64 %10, 0
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
br label %125
19: ; preds = %2
%20 = icmp eq i64 %12, 0
br i1 %20, label %21, label %23
21: ; preds = %19
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.37, i64 0, i64 0))
br label %125
23: ; preds = %19
%24 = call i32 @strlen(i8* %11)
%25 = icmp ugt i32 %24, 924
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.38, i64 0, i64 0))
br label %125
28: ; preds = %23
%29 = call i32 @strcat(i8* %6, i8* %11)
%30 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%31 = icmp eq i64 %30, 0
br i1 %31, label %67, label %32
32: ; preds = %28
%33 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%34 = icmp eq i64 %33, 0
br i1 %34, label %67, label %35
35: ; preds = %32
%36 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%37 = icmp eq i64 %36, 0
br i1 %37, label %67, label %38
38: ; preds = %35
%39 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%40 = icmp eq i64 %39, 0
br i1 %40, label %67, label %41
41: ; preds = %38
%42 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 4)
%43 = icmp eq i64 %42, 0
br i1 %43, label %67, label %44
44: ; preds = %41
%45 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 4)
%46 = icmp eq i64 %45, 0
br i1 %46, label %67, label %47
47: ; preds = %44
%48 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i32 4)
%49 = icmp eq i64 %48, 0
br i1 %49, label %67, label %50
50: ; preds = %47
%51 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%52 = icmp eq i64 %51, 0
br i1 %52, label %67, label %53
53: ; preds = %50
%54 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i32 4)
%55 = icmp eq i64 %54, 0
br i1 %55, label %67, label %56
56: ; preds = %53
%57 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 4)
%58 = icmp eq i64 %57, 0
br i1 %58, label %67, label %59
59: ; preds = %56
%60 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i32 4)
%61 = icmp eq i64 %60, 0
br i1 %61, label %67, label %62
62: ; preds = %59
%63 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 3)
%64 = icmp eq i64 %63, 0
br i1 %64, label %67, label %65
65: ; preds = %62
%66 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 3)
br label %67
67: ; preds = %62, %59, %56, %53, %50, %47, %44, %41, %38, %35, %32, %28, %65
%68 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), %65 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), %28 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %32 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), %35 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %38 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %41 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %44 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %47 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %50 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %53 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %56 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), %59 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), %62 ]
%69 = call i32 @strcat(i8* %6, i8* %68)
%70 = icmp eq i64 %14, 0
br i1 %70, label %81, label %71
71: ; preds = %67
%72 = call i64 @strncmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0), i32 1)
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %81
74: ; preds = %71
%75 = call i8* @strstr(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0))
%76 = icmp eq i8* %75, null
br i1 %76, label %81, label %77
77: ; preds = %74
%78 = call i32 @strcpy(i8* %75, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.23, i64 0, i64 0))
%79 = load i32, i32* @stderr
%80 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.24, i64 0, i64 0), i8* %6)
br label %81
81: ; preds = %74, %77, %71, %67
%82 = call i32 @strcat(i8* %7, i8* %11)
%83 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.25, i64 0, i64 0))
%84 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i64 0, i64 0))
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %88
86: ; preds = %81
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.27, i64 0, i64 0), i8* %6)
br label %125
88: ; preds = %81
%89 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
%90 = icmp eq i32* %89, null
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.29, i64 0, i64 0), i8* %7)
br label %125
93: ; preds = %88
%94 = call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.30, i64 0, i64 0), i64 40, i64 1, i32* %89)
%95 = call i64 @fwrite(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.30, i64 0, i64 0), i64 40, i64 1, i32* %89)
%96 = call i32 @fputc(i32 10, i32* %89)
%97 = call i32 @fputc(i32 10, i32* %89)
%98 = call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.32, i64 0, i64 0), i64 28, i64 1, i32* %89)
%99 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%100 = call zeroext i8 @getc(i32* %84)
%101 = call i64 @feof(i32* %84)
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %120
103: ; preds = %93, %110
%104 = phi i8 [ %117, %110 ], [ %100, %93 ]
%105 = phi i32 [ %116, %110 ], [ 0, %93 ]
%106 = call i32 @memset(i8* %99, i32 0, i32 2)
%107 = icmp sgt i32 %105, 15
br i1 %107, label %108, label %110
108: ; preds = %103
%109 = call i32 @fputc(i32 10, i32* %89)
br label %110
110: ; preds = %103, %108
%111 = phi i32 [ 0, %108 ], [ %105, %103 ]
%112 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.33, i64 0, i64 0), i64 2, i64 1, i32* %89)
%113 = call i32 @sprintf(i8* %99, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.34, i64 0, i64 0), i8 zeroext %104)
%114 = call i32 @fputs(i8* %99, i32* %89)
%115 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i64 0, i64 0), i64 2, i64 1, i32* %89)
%116 = add nsw i32 %111, 1
%117 = call zeroext i8 @getc(i32* %84)
%118 = call i64 @feof(i32* %84)
%119 = icmp eq i64 %118, 0
br i1 %119, label %103, label %120
120: ; preds = %110, %93
%121 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.36, i64 0, i64 0), i64 4, i64 1, i32* %89)
%122 = call i32 @fclose(i32* %84)
%123 = call i32 @fclose(i32* %89)
%124 = call i32 @exit(i32 0)
unreachable
125: ; preds = %91, %86, %26, %21, %17
ret i32 -1
}