#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, *rt28xx_mode;
  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");
  rt28xx_mode = (char *)getenv("RT28xx_MODE");
  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) &&
      (strncmp(rt28xx_mode, "STA", 3) == 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    $0x850,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x844(%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)
lea    0xd9a(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x840(%rbp)
cmpq   $0x0,-0x828(%rbp)
jne    12bd <main+0xbd>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18fb <main+0x6fb>
cmpq   $0x0,-0x830(%rbp)
jne    12e5 <main+0xe5>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18fb <main+0x6fb>
mov    -0x828(%rbp),%rdi
call   1070 <strlen@plt>
cltq
cmp    $0x39c,%rax
jbe    1319 <main+0x119>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18fb <main+0x6fb>
lea    -0x420(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x830(%rbp),%rdi
lea    0xd77(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1366 <main+0x166>
lea    -0x420(%rbp),%rdi
lea    0xd5a(%rip),%rsi
call   10e0 <strcat@plt>
jmp    166d <main+0x46d>
mov    -0x830(%rbp),%rdi
lea    0xda5(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    13a0 <main+0x1a0>
lea    -0x420(%rbp),%rdi
lea    0xd33(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1668 <main+0x468>
mov    -0x830(%rbp),%rdi
lea    0xd2e(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    13da <main+0x1da>
lea    -0x420(%rbp),%rdi
lea    0xce6(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1663 <main+0x463>
mov    -0x830(%rbp),%rdi
lea    0xcf9(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1414 <main+0x214>
lea    -0x420(%rbp),%rdi
lea    0xcbf(%rip),%rsi
call   10e0 <strcat@plt>
jmp    165e <main+0x45e>
mov    -0x830(%rbp),%rdi
lea    0xcc4(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    144e <main+0x24e>
lea    -0x420(%rbp),%rdi
lea    0xc85(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1659 <main+0x459>
mov    -0x830(%rbp),%rdi
lea    0xc8f(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1488 <main+0x288>
lea    -0x420(%rbp),%rdi
lea    0xc4b(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1654 <main+0x454>
mov    -0x830(%rbp),%rdi
lea    0xc5a(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14c2 <main+0x2c2>
lea    -0x420(%rbp),%rdi
lea    0xc11(%rip),%rsi
call   10e0 <strcat@plt>
jmp    164f <main+0x44f>
mov    -0x830(%rbp),%rdi
lea    0xc25(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14fc <main+0x2fc>
lea    -0x420(%rbp),%rdi
lea    0xbd7(%rip),%rsi
call   10e0 <strcat@plt>
jmp    164a <main+0x44a>
mov    -0x830(%rbp),%rdi
lea    0xbf0(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1536 <main+0x336>
lea    -0x420(%rbp),%rdi
lea    0xb9d(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1645 <main+0x445>
mov    -0x830(%rbp),%rdi
lea    0xbbb(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1570 <main+0x370>
lea    -0x420(%rbp),%rdi
lea    0xb63(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1640 <main+0x440>
mov    -0x830(%rbp),%rdi
lea    0xb86(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    15aa <main+0x3aa>
lea    -0x420(%rbp),%rdi
lea    0xb16(%rip),%rsi
call   10e0 <strcat@plt>
jmp    163b <main+0x43b>
mov    -0x830(%rbp),%rdi
lea    0xb51(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    15e4 <main+0x3e4>
lea    -0x420(%rbp),%rdi
lea    0xaef(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1636 <main+0x436>
mov    -0x830(%rbp),%rdi
lea    0xb1b(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    161e <main+0x41e>
lea    -0x420(%rbp),%rdi
lea    0xaa2(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1631 <main+0x431>
lea    -0x420(%rbp),%rdi
lea    0xa8a(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1636 <main+0x436>
jmp    163b <main+0x43b>
jmp    1640 <main+0x440>
jmp    1645 <main+0x445>
jmp    164a <main+0x44a>
jmp    164f <main+0x44f>
jmp    1654 <main+0x454>
jmp    1659 <main+0x459>
jmp    165e <main+0x45e>
jmp    1663 <main+0x463>
jmp    1668 <main+0x468>
jmp    166d <main+0x46d>
cmpq   $0x0,-0x838(%rbp)
je     1717 <main+0x517>
mov    -0x838(%rbp),%rdi
lea    0xa88(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1717 <main+0x517>
mov    -0x840(%rbp),%rdi
lea    0xa68(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1717 <main+0x517>
lea    -0x420(%rbp),%rdi
lea    0xa4a(%rip),%rsi
call   1120 <strstr@plt>
mov    %rax,-0x838(%rbp)
cmp    $0x0,%rax
je     1712 <main+0x512>
mov    -0x838(%rbp),%rdi
lea    0xa2d(%rip),%rsi
call   1050 <strcpy@plt>
mov    0x28e3(%rip),%rax
mov    (%rax),%edi
lea    -0x420(%rbp),%rdx
lea    0xa20(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    1717 <main+0x517>
lea    -0x820(%rbp),%rdi
mov    -0x828(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xa01(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x420(%rbp),%rdi
lea    0xa02(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1780 <main+0x580>
lea    -0x420(%rbp),%rsi
lea    0x9e2(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18fb <main+0x6fb>
lea    -0x820(%rbp),%rdi
lea    0x9d6(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    17c3 <main+0x5c3>
lea    -0x820(%rbp),%rsi
lea    0x9b6(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    18fb <main+0x6fb>
mov    -0x20(%rbp),%rsi
lea    0x9b3(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x9a3(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x9ba(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x9aa(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x99c(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1110 <getc@plt>
mov    %al,-0x845(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <feof@plt>
cmp    $0x0,%rax
je     183a <main+0x63a>
jmp    18d2 <main+0x6d2>
lea    -0x848(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10a0 <memset@plt>
cmpl   $0x10,-0x844(%rbp)
jl     1874 <main+0x674>
mov    -0x20(%rbp),%rsi
lea    0x943(%rip),%rdi
call   1090 <fputs@plt>
movl   $0x0,-0x844(%rbp)
mov    -0x20(%rbp),%rsi
lea    0x948(%rip),%rdi
call   1090 <fputs@plt>
lea    -0x848(%rbp),%rdi
lea    0x938(%rip),%rsi
movzbl -0x845(%rbp),%edx
call   10f0 <sprintf@plt>
lea    -0x848(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x916(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x844(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x844(%rbp)
jmp    1813 <main+0x613>
mov    -0x20(%rbp),%rsi
lea    0x8f5(%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    $0x850,%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,%r12
lea    0xd8f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xd88(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r15
lea    0xd89(%rip),%rdi
call   1030 <getenv@plt>
test   %r12,%r12
je     12c4 <main+0x94>
test   %rbx,%rbx
je     12cd <main+0x9d>
mov    %rax,%r14
mov    %r12,%rdi
call   1080 <strlen@plt>
cmp    $0x39d,%eax
jb     12f0 <main+0xc0>
lea    0xee6(%rip),%rdi
jmp    12d4 <main+0xa4>
lea    0xe8a(%rip),%rdi
jmp    12d4 <main+0xa4>
lea    0xeac(%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    %r12,%rsi
call   1100 <strcat@plt>
lea    0xd2b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
lea    0xd1c(%rip),%rbp
test   %rax,%rax
je     1467 <main+0x237>
lea    0xd6f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
lea    0xd0b(%rip),%r13
test   %rax,%rax
je     146a <main+0x23a>
lea    0xd0e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1467 <main+0x237>
lea    0xcf6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xcde(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xcc6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xcae(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xc96(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xc82(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xc6e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xc5a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1467 <main+0x237>
lea    0xc46(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     146a <main+0x23a>
lea    0xc31(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
mov    %rbp,%r13
lea    0x10(%rsp),%rdi
mov    %r13,%rsi
call   1100 <strcat@plt>
test   %r15,%r15
je     14ed <main+0x2bd>
lea    0xc0c(%rip),%rsi
mov    %r15,%rdi
mov    $0x1,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    14ed <main+0x2bd>
lea    0xbf5(%rip),%rsi
mov    %r14,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    14ed <main+0x2bd>
lea    0xbe0(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1150 <strstr@plt>
test   %rax,%rax
je     14ed <main+0x2bd>
lea    0xbd1(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
mov    0x2b06(%rip),%rax
mov    (%rax),%edi
lea    0xbc8(%rip),%rsi
lea    0x10(%rsp),%rdx
call   10d0 <fprintf@plt>
lea    0x410(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1100 <strcat@plt>
lea    0xbb0(%rip),%rsi
mov    %rbx,%rdi
call   1100 <strcat@plt>
lea    0xbb5(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1552 <main+0x322>
mov    %rax,%rbx
lea    0xbb3(%rip),%rsi
lea    0x410(%rsp),%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
jne    156a <main+0x33a>
lea    0xb9c(%rip),%rdi
lea    0x410(%rsp),%rsi
jmp    155e <main+0x32e>
lea    0xb74(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    12d9 <main+0xa9>
mov    %rax,%r14
lea    0xb8b(%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    0xb69(%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    1690 <main+0x460>
xor    %r13d,%r13d
lea    0xd(%rsp),%r15
lea    0xb51(%rip),%rbp
jmp    1666 <main+0x436>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xb36(%rip),%rdi
mov    %r14,%rcx
call   1130 <fwrite@plt>
movzbl %r12b,%edx
mov    %r15,%rdi
lea    0xb23(%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    1690 <main+0x460>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10b0 <memset@plt>
cmp    $0x10,%r13d
jl     15fe <main+0x3ce>
mov    $0xa,%edi
mov    %r14,%rsi
call   10c0 <fputc@plt>
xor    %r13d,%r13d
jmp    15fe <main+0x3ce>
lea    0xab9(%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 = [12 x i8] c"RT28xx_MODE\00"
@.str.4 = [44 x i8] c"Environment value \22RT28xx_DIR\22 not export \0A\00"
@.str.5 = [41 x i8] c"Environment value \22CHIPSET\22 not export \0A\00"
@.str.6 = [45 x i8] c"Environment value \22RT28xx_DIR\22 is too long!\0A\00"
@.str.7 = [5 x i8] c"2860\00"
@.str.8 = [19 x i8] c"/common/rt2860.bin\00"
@.str.9 = [5 x i8] c"2870\00"
@.str.10 = [19 x i8] c"/common/rt2870.bin\00"
@.str.11 = [5 x i8] c"3090\00"
@.str.12 = [5 x i8] c"2070\00"
@.str.13 = [5 x i8] c"3070\00"
@.str.14 = [5 x i8] c"3572\00"
@.str.15 = [5 x i8] c"3573\00"
@.str.16 = [5 x i8] c"3370\00"
@.str.17 = [5 x i8] c"5370\00"
@.str.18 = [5 x i8] c"5572\00"
@.str.19 = [5 x i8] c"5592\00"
@.str.20 = [4 x i8] c"USB\00"
@.str.21 = [4 x i8] c"PCI\00"
@.str.22 = [2 x i8] c"y\00"
@.str.23 = [4 x i8] c"STA\00"
@.str.24 = [7 x i8] c"rt2870\00"
@.str.25 = [15 x i8] c"rt2870_wow.bin\00"
@stderr = global i32 0
@.str.26 = [12 x i8] c"infname %s\0A\00"
@.str.27 = [20 x i8] c"/include/firmware.h\00"
@.str.28 = [2 x i8] c"r\00"
@.str.29 = [21 x i8] c"Can't read file %s \0A\00"
@.str.30 = [2 x i8] c"w\00"
@.str.31 = [27 x i8] c"Can't open write file %s \0A\00"
@.str.32 = [41 x i8] c"/* AUTO GEN PLEASE DO NOT MODIFY IT */ \0A\00"
@.str.33 = [2 x i8] c"\0A\00"
@.str.34 = [29 x i8] c"UCHAR FirmwareImage [] = { \0A\00"
@.str.35 = [3 x i8] c"0x\00"
@.str.36 = [5 x i8] c"%02x\00"
@.str.37 = [3 x i8] c", \00"
@.str.38 = [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 i8*
%14 = alloca i32
%15 = alloca i8
%16 = alloca [3 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %14
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%18 = call i32 @memset(i8* %17, i32 0, i32 1024)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%20 = call i32 @memset(i8* %19, i32 0, i32 1024)
%21 = call i64 @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %10
%23 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%24 = inttoptr i64 %23 to i8*
store i8* %24, i8** %11
%25 = call i64 @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %12
%27 = call i64 @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %13
%29 = load i8*, i8** %10
%30 = icmp ne i8* %29, null
br i1 %30, label %33, label %31
31: ; preds = %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %244
33: ; preds = %2
%34 = load i8*, i8** %11
%35 = icmp ne i8* %34, null
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %244
38: ; preds = %33
%39 = load i8*, i8** %10
%40 = call i32 @strlen(i8* %39)
%41 = sext i32 %40 to i64
%42 = icmp ugt i64 %41, 924
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %244
45: ; preds = %38
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%47 = load i8*, i8** %10
%48 = call i32 @strcat(i8* %46, i8* %47)
%49 = load i8*, i8** %11
%50 = call i64 @strncmp(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %45
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%54 = call i32 @strcat(i8* %53, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %154
55: ; preds = %45
%56 = load i8*, i8** %11
%57 = call i64 @strncmp(i8* %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 4)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%61 = call i32 @strcat(i8* %60, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %153
62: ; preds = %55
%63 = load i8*, i8** %11
%64 = call i64 @strncmp(i8* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %152
69: ; preds = %62
%70 = load i8*, i8** %11
%71 = call i64 @strncmp(i8* %70, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 4)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %69
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%75 = call i32 @strcat(i8* %74, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %151
76: ; preds = %69
%77 = load i8*, i8** %11
%78 = call i64 @strncmp(i8* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i32 4)
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %76
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%82 = call i32 @strcat(i8* %81, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %150
83: ; preds = %76
%84 = load i8*, i8** %11
%85 = call i64 @strncmp(i8* %84, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i32 4)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %83
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%89 = call i32 @strcat(i8* %88, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %149
90: ; preds = %83
%91 = load i8*, i8** %11
%92 = call i64 @strncmp(i8* %91, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %90
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%96 = call i32 @strcat(i8* %95, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %148
97: ; preds = %90
%98 = load i8*, i8** %11
%99 = call i64 @strncmp(i8* %98, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i32 4)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %104
101: ; preds = %97
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%103 = call i32 @strcat(i8* %102, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %147
104: ; preds = %97
%105 = load i8*, i8** %11
%106 = call i64 @strncmp(i8* %105, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 4)
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %104
%109 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%110 = call i32 @strcat(i8* %109, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %146
111: ; preds = %104
%112 = load i8*, i8** %11
%113 = call i64 @strncmp(i8* %112, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i32 4)
%114 = icmp eq i64 %113, 0
br i1 %114, label %115, label %118
115: ; preds = %111
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%117 = call i32 @strcat(i8* %116, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %145
118: ; preds = %111
%119 = load i8*, i8** %11
%120 = call i64 @strncmp(i8* %119, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 4)
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %125
122: ; preds = %118
%123 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%124 = call i32 @strcat(i8* %123, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %144
125: ; preds = %118
%126 = load i8*, i8** %11
%127 = call i64 @strncmp(i8* %126, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i32 3)
%128 = icmp eq i64 %127, 0
br i1 %128, label %129, label %132
129: ; preds = %125
%130 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%131 = call i32 @strcat(i8* %130, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %143
132: ; preds = %125
%133 = load i8*, i8** %11
%134 = call i64 @strncmp(i8* %133, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0), i32 3)
%135 = icmp eq i64 %134, 0
br i1 %135, label %136, label %139
136: ; preds = %132
%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.8, i64 0, i64 0))
br label %142
139: ; preds = %132
%140 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%141 = call i32 @strcat(i8* %140, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %142
142: ; preds = %139, %136
br label %143
143: ; preds = %142, %129
br label %144
144: ; preds = %143, %122
br label %145
145: ; preds = %144, %115
br label %146
146: ; preds = %145, %108
br label %147
147: ; preds = %146, %101
br label %148
148: ; preds = %147, %94
br label %149
149: ; preds = %148, %87
br label %150
150: ; preds = %149, %80
br label %151
151: ; preds = %150, %73
br label %152
152: ; preds = %151, %66
br label %153
153: ; preds = %152, %59
br label %154
154: ; preds = %153, %52
%155 = load i8*, i8** %12
%156 = icmp ne i8* %155, null
br i1 %156, label %157, label %176
157: ; preds = %154
%158 = load i8*, i8** %12
%159 = call i64 @strncmp(i8* %158, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), i32 1)
%160 = icmp eq i64 %159, 0
br i1 %160, label %161, label %176
161: ; preds = %157
%162 = load i8*, i8** %13
%163 = call i64 @strncmp(i8* %162, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i64 0, i64 0), i32 3)
%164 = icmp eq i64 %163, 0
br i1 %164, label %165, label %176
165: ; preds = %161
%166 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%167 = call i8* @strstr(i8* %166, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0))
store i8* %167, i8** %12
%168 = icmp ne i8* %167, null
br i1 %168, label %169, label %175
169: ; preds = %165
%170 = load i8*, i8** %12
%171 = call i32 @strcpy(i8* %170, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.25, i64 0, i64 0))
%172 = load i32, i32* @stderr
%173 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%174 = call i32 @fprintf(i32 %172, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.26, i64 0, i64 0), i8* %173)
br label %175
175: ; preds = %169, %165
br label %176
176: ; preds = %175, %161, %157, %154
%177 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%178 = load i8*, i8** %10
%179 = call i32 @strcat(i8* %177, i8* %178)
%180 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%181 = call i32 @strcat(i8* %180, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.27, i64 0, i64 0))
%182 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%183 = call i32* @fopen(i8* %182, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
store i32* %183, i32** %6
%184 = load i32*, i32** %6
%185 = icmp eq i32* %184, null
br i1 %185, label %186, label %189
186: ; preds = %176
%187 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.29, i64 0, i64 0), i8* %187)
store i32 -1, i32* %3
br label %244
189: ; preds = %176
%190 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%191 = call i32* @fopen(i8* %190, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.30, i64 0, i64 0))
store i32* %191, i32** %7
%192 = load i32*, i32** %7
%193 = icmp eq i32* %192, null
br i1 %193, label %194, label %197
194: ; preds = %189
%195 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.31, i64 0, i64 0), i8* %195)
store i32 -1, i32* %3
br label %244
197: ; preds = %189
%198 = load i32*, i32** %7
%199 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.32, i64 0, i64 0), i32* %198)
%200 = load i32*, i32** %7
%201 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.32, i64 0, i64 0), i32* %200)
%202 = load i32*, i32** %7
%203 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.33, i64 0, i64 0), i32* %202)
%204 = load i32*, i32** %7
%205 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.33, i64 0, i64 0), i32* %204)
%206 = load i32*, i32** %7
%207 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.34, i64 0, i64 0), i32* %206)
br label %208
208: ; preds = %197, %223
%209 = load i32*, i32** %6
%210 = call zeroext i8 @getc(i32* %209)
store i8 %210, i8* %15
%211 = load i32*, i32** %6
%212 = call i64 @feof(i32* %211)
%213 = icmp ne i64 %212, 0
br i1 %213, label %214, label %215
214: ; preds = %208
br label %236
215: ; preds = %208
%216 = getelementptr inbounds [3 x i8], [3 x i8]* %16, i64 0, i64 0
%217 = call i32 @memset(i8* %216, i32 0, i32 2)
%218 = load i32, i32* %14
%219 = icmp sge i32 %218, 16
br i1 %219, label %220, label %223
220: ; preds = %215
%221 = load i32*, i32** %7
%222 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.33, i64 0, i64 0), i32* %221)
store i32 0, i32* %14
br label %223
223: ; preds = %220, %215
%224 = load i32*, i32** %7
%225 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.35, i64 0, i64 0), i32* %224)
%226 = getelementptr inbounds [3 x i8], [3 x i8]* %16, i64 0, i64 0
%227 = load i8, i8* %15
%228 = call i32 @sprintf(i8* %226, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.36, i64 0, i64 0), i8 zeroext %227)
%229 = getelementptr inbounds [3 x i8], [3 x i8]* %16, i64 0, i64 0
%230 = load i32*, i32** %7
%231 = call i32 @fputs(i8* %229, i32* %230)
%232 = load i32*, i32** %7
%233 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.37, i64 0, i64 0), i32* %232)
%234 = load i32, i32* %14
%235 = add nsw i32 %234, 1
store i32 %235, i32* %14
br label %208
236: ; preds = %214
%237 = load i32*, i32** %7
%238 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.38, i64 0, i64 0), i32* %237)
%239 = load i32*, i32** %6
%240 = call i32 @fclose(i32* %239)
%241 = load i32*, i32** %7
%242 = call i32 @fclose(i32* %241)
%243 = call i32 @exit(i32 0)
unreachable
244: ; preds = %194, %186, %43, %36, %31
%245 = load i32, i32* %3
ret i32 %245
}

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