#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 fw_name[128];
  char *rt28xxdir;
  char *chipset;
  char *wow, *rt28xx_mode;
  int i = 0;
  unsigned char c;
  memset(infname, 0, 1024);
  memset(outfname, 0, 1024);
  memset(fw_name, 0, 128);
  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);
  strcat(outfname, rt28xxdir);
  if (strncmp(chipset, "2860", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2860.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "2870", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "3090", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2860.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "2070", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "3070", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "3572", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "3573", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "3370", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "5370", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "5572", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "5592", 4) == 0) {
    strcat(infname, "/mcu/bin/rt2860.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "USB", 3) == 0) {
    strcat(infname, "/mcu/bin/rt2870.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if (strncmp(chipset, "PCI", 3) == 0) {
    strcat(infname, "/mcu/bin/rt2860.bin");
    strcat(outfname, "/include/mcu/firmware.h");
    strcat(fw_name, "FirmwareImage");
  } else if ((strncmp(chipset, "6590", 4) == 0) ||
             (strncmp(chipset, "6570", 4) == 0)) {
    strcat(infname, "/mcu/bin/MT7650.bin");
    strcat(outfname, "/include/mcu/MT7650_firmware.h");
    strcat(fw_name, "MT7650_FirmwareImage");
  } else if ((strncmp(chipset, "MT7662E", 7) == 0) ||
             (strncmp(chipset, "MT7662U", 7) == 0)) {
    strcat(infname, "/mcu/bin/MT7662.bin");
    strcat(outfname, "/include/mcu/MT7662_firmware.h");
    strcat(fw_name, "MT7662_FirmwareImage");
  } else if (strncmp(chipset, "7601", 4) == 0) {
    strcat(infname, "/mcu/bin/MT7601.bin");
    strcat(outfname, "/include/mcu/MT7601_firmware.h");
    strcat(fw_name, "MT7601_FirmwareImage");
  } else {
    strcat(infname, "/mcu/bin/rt2860.bin");
    strcat(outfname, "/include/firmware.h");
  }
  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);
    }
  }
  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);
  fprintf(outfile, "UCHAR %s[] = {\n", fw_name);
  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    $0x8d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x8c4(%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    -0x8a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   10a0 <memset@plt>
lea    0xd9d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8a8(%rbp)
lea    0xd95(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8b0(%rbp)
lea    0xd8a(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8b8(%rbp)
lea    0xd87(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8c0(%rbp)
cmpq   $0x0,-0x8a8(%rbp)
jne    12d0 <main+0xd0>
lea    0xd72(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1c77 <main+0xa77>
cmpq   $0x0,-0x8b0(%rbp)
jne    12f8 <main+0xf8>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1c77 <main+0xa77>
mov    -0x8a8(%rbp),%rdi
call   1070 <strlen@plt>
cltq
cmp    $0x39c,%rax
jbe    132c <main+0x12c>
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1c77 <main+0xa77>
lea    -0x420(%rbp),%rdi
mov    -0x8a8(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
mov    -0x8a8(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x8b0(%rbp),%rdi
lea    0xd51(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    13b2 <main+0x1b2>
lea    -0x420(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xd35(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xdc7(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1a07 <main+0x807>
mov    -0x8b0(%rbp),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1412 <main+0x212>
lea    -0x420(%rbp),%rdi
lea    0xd00(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xcd5(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xd67(%rip),%rsi
call   10e0 <strcat@plt>
jmp    1a02 <main+0x802>
mov    -0x8b0(%rbp),%rdi
lea    0xcd6(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1472 <main+0x272>
lea    -0x420(%rbp),%rdi
lea    0xc74(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xc75(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xd07(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19fd <main+0x7fd>
mov    -0x8b0(%rbp),%rdi
lea    0xc7b(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    14d2 <main+0x2d2>
lea    -0x420(%rbp),%rdi
lea    0xc40(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xc15(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xca7(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19f8 <main+0x7f8>
mov    -0x8b0(%rbp),%rdi
lea    0xc20(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1532 <main+0x332>
lea    -0x420(%rbp),%rdi
lea    0xbe0(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xbb5(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xc47(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19f3 <main+0x7f3>
mov    -0x8b0(%rbp),%rdi
lea    0xbc5(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1592 <main+0x392>
lea    -0x420(%rbp),%rdi
lea    0xb80(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xb55(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xbe7(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19ee <main+0x7ee>
mov    -0x8b0(%rbp),%rdi
lea    0xb6a(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    15f2 <main+0x3f2>
lea    -0x420(%rbp),%rdi
lea    0xb20(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xaf5(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xb87(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19e9 <main+0x7e9>
mov    -0x8b0(%rbp),%rdi
lea    0xb0f(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1652 <main+0x452>
lea    -0x420(%rbp),%rdi
lea    0xac0(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xa95(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xb27(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19e4 <main+0x7e4>
mov    -0x8b0(%rbp),%rdi
lea    0xab4(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    16b2 <main+0x4b2>
lea    -0x420(%rbp),%rdi
lea    0xa60(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xa35(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xac7(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19df <main+0x7df>
mov    -0x8b0(%rbp),%rdi
lea    0xa59(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1712 <main+0x512>
lea    -0x420(%rbp),%rdi
lea    0xa00(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x9d5(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xa67(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19da <main+0x7da>
mov    -0x8b0(%rbp),%rdi
lea    0x9fe(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1772 <main+0x572>
lea    -0x420(%rbp),%rdi
lea    0x974(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x975(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0xa07(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19d5 <main+0x7d5>
mov    -0x8b0(%rbp),%rdi
lea    0x9a3(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    17d2 <main+0x5d2>
lea    -0x420(%rbp),%rdi
lea    0x940(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x915(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0x9a7(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19d0 <main+0x7d0>
mov    -0x8b0(%rbp),%rdi
lea    0x947(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1832 <main+0x632>
lea    -0x420(%rbp),%rdi
lea    0x8b4(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x8b5(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0x947(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19cb <main+0x7cb>
mov    -0x8b0(%rbp),%rdi
lea    0x8eb(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     1876 <main+0x676>
mov    -0x8b0(%rbp),%rdi
lea    0x8ce(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    18b4 <main+0x6b4>
lea    -0x420(%rbp),%rdi
lea    0x8b1(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x8b2(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0x8be(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19c6 <main+0x7c6>
mov    -0x8b0(%rbp),%rdi
lea    0x8bb(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
je     18f8 <main+0x6f8>
mov    -0x8b0(%rbp),%rdi
lea    0x8a1(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1936 <main+0x736>
lea    -0x420(%rbp),%rdi
lea    0x887(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x888(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0x894(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19c1 <main+0x7c1>
mov    -0x8b0(%rbp),%rdi
lea    0x891(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1996 <main+0x796>
lea    -0x420(%rbp),%rdi
lea    0x874(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x875(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x8a0(%rbp),%rdi
lea    0x881(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19bc <main+0x7bc>
lea    -0x420(%rbp),%rdi
lea    0x712(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0x86b(%rip),%rsi
call   10e0 <strcat@plt>
jmp    19c1 <main+0x7c1>
jmp    19c6 <main+0x7c6>
jmp    19cb <main+0x7cb>
jmp    19d0 <main+0x7d0>
jmp    19d5 <main+0x7d5>
jmp    19da <main+0x7da>
jmp    19df <main+0x7df>
jmp    19e4 <main+0x7e4>
jmp    19e9 <main+0x7e9>
jmp    19ee <main+0x7ee>
jmp    19f3 <main+0x7f3>
jmp    19f8 <main+0x7f8>
jmp    19fd <main+0x7fd>
jmp    1a02 <main+0x802>
jmp    1a07 <main+0x807>
cmpq   $0x0,-0x8b8(%rbp)
je     1ab2 <main+0x8b2>
mov    -0x8b8(%rbp),%rdi
lea    0x813(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1ab2 <main+0x8b2>
mov    -0x8c0(%rbp),%rdi
lea    0x7f3(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1ab2 <main+0x8b2>
lea    -0x420(%rbp),%rdi
lea    0x7d5(%rip),%rsi
call   1120 <strstr@plt>
mov    %rax,-0x8b8(%rbp)
cmp    $0x0,%rax
je     1aad <main+0x8ad>
mov    -0x8b8(%rbp),%rdi
lea    0x7b8(%rip),%rsi
call   1050 <strcpy@plt>
mov    0x2549(%rip),%rax
mov    (%rax),%rdi
lea    -0x420(%rbp),%rdx
lea    0x7aa(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    1ab2 <main+0x8b2>
lea    -0x420(%rbp),%rdi
lea    0x79e(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1af5 <main+0x8f5>
lea    -0x420(%rbp),%rsi
lea    0x77e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1c77 <main+0xa77>
lea    -0x820(%rbp),%rdi
lea    0x772(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1b38 <main+0x938>
lea    -0x820(%rbp),%rsi
lea    0x752(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1c77 <main+0xa77>
mov    -0x20(%rbp),%rsi
lea    0x74f(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x73f(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x756(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x746(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rdi
lea    -0x8a0(%rbp),%rdx
lea    0x731(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1110 <getc@plt>
mov    %al,-0x8c5(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <feof@plt>
cmp    $0x0,%rax
je     1bb6 <main+0x9b6>
jmp    1c4e <main+0xa4e>
lea    -0x8c8(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10a0 <memset@plt>
cmpl   $0x10,-0x8c4(%rbp)
jl     1bf0 <main+0x9f0>
mov    -0x20(%rbp),%rsi
lea    0x6d8(%rip),%rdi
call   1090 <fputs@plt>
movl   $0x0,-0x8c4(%rbp)
mov    -0x20(%rbp),%rsi
lea    0x6d0(%rip),%rdi
call   1090 <fputs@plt>
lea    -0x8c8(%rbp),%rdi
lea    0x6c0(%rip),%rsi
movzbl -0x8c5(%rbp),%edx
call   10f0 <sprintf@plt>
lea    -0x8c8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <fputs@plt>
mov    -0x20(%rbp),%rsi
lea    0x69e(%rip),%rdi
call   1090 <fputs@plt>
mov    -0x8c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c4(%rbp)
jmp    1b8f <main+0x98f>
mov    -0x20(%rbp),%rsi
lea    0x67d(%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    $0x8d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x898,%rsp
lea    0x90(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10b0 <memset@plt>
lea    0x490(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10b0 <memset@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   10b0 <memset@plt>
lea    0xd7f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbp
lea    0xd7b(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xd74(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r15
lea    0xd75(%rip),%rdi
call   1030 <getenv@plt>
test   %rbp,%rbp
je     12d8 <main+0xa8>
test   %rbx,%rbx
je     12e1 <main+0xb1>
mov    %rax,%r14
mov    %rbp,%rdi
call   1080 <strlen@plt>
cmp    $0x39d,%eax
jb     1304 <main+0xd4>
lea    0xfd6(%rip),%rdi
jmp    12e8 <main+0xb8>
lea    0xf7a(%rip),%rdi
jmp    12e8 <main+0xb8>
lea    0xf9c(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%eax
add    $0x898,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x90(%rsp),%rdi
mov    %rbp,%rsi
call   1100 <strcat@plt>
lea    0x490(%rsp),%rdi
mov    %rbp,%rsi
call   1100 <strcat@plt>
lea    0xd04(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1553 <main+0x323>
lea    0xe74(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xd0f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1553 <main+0x323>
lea    0xcf7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xcdf(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xcc7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xcaf(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xc97(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xc7f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xc67(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xc4f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1553 <main+0x323>
lea    0xc37(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     155c <main+0x32c>
lea    0xc1e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1553 <main+0x323>
lea    0xc05(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1677 <main+0x447>
lea    0xbed(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1677 <main+0x447>
lea    0xc1d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     16ab <main+0x47b>
lea    0xc08(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     16ab <main+0x47b>
lea    0xc3b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     16df <main+0x4af>
lea    0xaff(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xc57(%rip),%rsi
lea    0x490(%rsp),%rdi
jmp    1590 <main+0x360>
lea    0xada(%rip),%rsi
jmp    1563 <main+0x333>
lea    0xafd(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xad1(%rip),%rsi
lea    0x490(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xb62(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1100 <strcat@plt>
test   %r15,%r15
je     1612 <main+0x3e2>
lea    0xc13(%rip),%rsi
mov    %r15,%rdi
mov    $0x1,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1612 <main+0x3e2>
lea    0xbfc(%rip),%rsi
mov    %r14,%rdi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1612 <main+0x3e2>
lea    0xbe7(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1150 <strstr@plt>
test   %rax,%rax
je     1612 <main+0x3e2>
lea    0xbd5(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
mov    0x29e5(%rip),%rax
mov    (%rax),%rdi
lea    0xbcb(%rip),%rsi
lea    0x90(%rsp),%rdx
call   10d0 <fprintf@plt>
lea    0xbc3(%rip),%rsi
lea    0x90(%rsp),%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     165c <main+0x42c>
mov    %rax,%rbx
lea    0xbbe(%rip),%rsi
lea    0x490(%rsp),%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
jne    1713 <main+0x4e3>
lea    0xba3(%rip),%rdi
lea    0x490(%rsp),%rsi
jmp    166b <main+0x43b>
lea    0xb7b(%rip),%rdi
lea    0x90(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    12ed <main+0xbd>
lea    0xa35(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xa35(%rip),%rsi
lea    0x490(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xa40(%rip),%rsi
jmp    158b <main+0x35b>
lea    0xa59(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xa59(%rip),%rsi
lea    0x490(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xa64(%rip),%rsi
jmp    158b <main+0x35b>
lea    0xa72(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xa72(%rip),%rsi
lea    0x490(%rsp),%rdi
call   1100 <strcat@plt>
lea    0xa7d(%rip),%rsi
jmp    158b <main+0x35b>
mov    %rax,%r14
lea    0xaf3(%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    0xad1(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %r14,%rdi
call   10d0 <fprintf@plt>
mov    %rbx,%rdi
call   1140 <getc@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   10e0 <feof@plt>
test   %rax,%rax
jne    1834 <main+0x604>
xor    %r13d,%r13d
lea    0xd(%rsp),%r15
lea    0xab1(%rip),%rbp
jmp    180a <main+0x5da>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xa96(%rip),%rdi
mov    %r14,%rcx
call   1130 <fwrite@plt>
movzbl %r12b,%edx
mov    %r15,%rdi
lea    0xa83(%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    1834 <main+0x604>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   10b0 <memset@plt>
cmp    $0x10,%r13d
jl     17a2 <main+0x572>
mov    $0xa,%edi
mov    %r14,%rsi
call   10c0 <fputc@plt>
xor    %r13d,%r13d
jmp    17a2 <main+0x572>
lea    0xa19(%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 = [20 x i8] c"/mcu/bin/rt2860.bin\00"
@.str.9 = [24 x i8] c"/include/mcu/firmware.h\00"
@.str.10 = [14 x i8] c"FirmwareImage\00"
@.str.11 = [5 x i8] c"2870\00"
@.str.12 = [20 x i8] c"/mcu/bin/rt2870.bin\00"
@.str.13 = [5 x i8] c"3090\00"
@.str.14 = [5 x i8] c"2070\00"
@.str.15 = [5 x i8] c"3070\00"
@.str.16 = [5 x i8] c"3572\00"
@.str.17 = [5 x i8] c"3573\00"
@.str.18 = [5 x i8] c"3370\00"
@.str.19 = [5 x i8] c"5370\00"
@.str.20 = [5 x i8] c"5572\00"
@.str.21 = [5 x i8] c"5592\00"
@.str.22 = [4 x i8] c"USB\00"
@.str.23 = [4 x i8] c"PCI\00"
@.str.24 = [5 x i8] c"6590\00"
@.str.25 = [5 x i8] c"6570\00"
@.str.26 = [20 x i8] c"/mcu/bin/MT7650.bin\00"
@.str.27 = [31 x i8] c"/include/mcu/MT7650_firmware.h\00"
@.str.28 = [21 x i8] c"MT7650_FirmwareImage\00"
@.str.29 = [8 x i8] c"MT7662E\00"
@.str.30 = [8 x i8] c"MT7662U\00"
@.str.31 = [20 x i8] c"/mcu/bin/MT7662.bin\00"
@.str.32 = [31 x i8] c"/include/mcu/MT7662_firmware.h\00"
@.str.33 = [21 x i8] c"MT7662_FirmwareImage\00"
@.str.34 = [5 x i8] c"7601\00"
@.str.35 = [20 x i8] c"/mcu/bin/MT7601.bin\00"
@.str.36 = [31 x i8] c"/include/mcu/MT7601_firmware.h\00"
@.str.37 = [21 x i8] c"MT7601_FirmwareImage\00"
@.str.38 = [20 x i8] c"/include/firmware.h\00"
@.str.39 = [2 x i8] c"y\00"
@.str.40 = [4 x i8] c"STA\00"
@.str.41 = [7 x i8] c"rt2870\00"
@.str.42 = [15 x i8] c"rt2870_wow.bin\00"
@stderr = global i32* null
@.str.43 = [12 x i8] c"infname %s\0A\00"
@.str.44 = [2 x i8] c"r\00"
@.str.45 = [21 x i8] c"Can't read file %s \0A\00"
@.str.46 = [2 x i8] c"w\00"
@.str.47 = [27 x i8] c"Can't open write file %s \0A\00"
@.str.48 = [41 x i8] c"/* AUTO GEN PLEASE DO NOT MODIFY IT */ \0A\00"
@.str.49 = [2 x i8] c"\0A\00"
@.str.50 = [16 x i8] c"UCHAR %s[] = {\0A\00"
@.str.51 = [3 x i8] c"0x\00"
@.str.52 = [5 x i8] c"%02x\00"
@.str.53 = [3 x i8] c", \00"
@.str.54 = [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 [128 x i8]
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i8
%17 = alloca [3 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %15
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 1024)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%21 = call i32 @memset(i8* %20, i32 0, i32 1024)
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%23 = call i32 @memset(i8* %22, i32 0, i32 128)
%24 = call i64 @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %11
%26 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %12
%28 = call i64 @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %13
%30 = call i64 @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %14
%32 = load i8*, i8** %11
%33 = icmp ne i8* %32, null
br i1 %33, label %36, label %34
34: ; preds = %2
%35 = 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 %344
36: ; preds = %2
%37 = load i8*, i8** %12
%38 = icmp ne i8* %37, null
br i1 %38, label %41, label %39
39: ; preds = %36
%40 = 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 %344
41: ; preds = %36
%42 = load i8*, i8** %11
%43 = call i32 @strlen(i8* %42)
%44 = sext i32 %43 to i64
%45 = icmp ugt i64 %44, 924
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = 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 %344
48: ; preds = %41
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%50 = load i8*, i8** %11
%51 = call i32 @strcat(i8* %49, i8* %50)
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%53 = load i8*, i8** %11
%54 = call i32 @strcat(i8* %52, i8* %53)
%55 = load i8*, i8** %12
%56 = call i64 @strncmp(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 4)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %65
58: ; preds = %48
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%60 = call i32 @strcat(i8* %59, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%62 = call i32 @strcat(i8* %61, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%63 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%64 = call i32 @strcat(i8* %63, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %258
65: ; preds = %48
%66 = load i8*, i8** %12
%67 = call i64 @strncmp(i8* %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %65
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%71 = call i32 @strcat(i8* %70, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%73 = call i32 @strcat(i8* %72, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%75 = call i32 @strcat(i8* %74, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %257
76: ; preds = %65
%77 = load i8*, i8** %12
%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 %87
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 ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%84 = call i32 @strcat(i8* %83, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%85 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%86 = call i32 @strcat(i8* %85, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %256
87: ; preds = %76
%88 = load i8*, i8** %12
%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 %98
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 ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%95 = call i32 @strcat(i8* %94, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%96 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%97 = call i32 @strcat(i8* %96, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %255
98: ; preds = %87
%99 = load i8*, i8** %12
%100 = call i64 @strncmp(i8* %99, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i32 4)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %109
102: ; preds = %98
%103 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%104 = call i32 @strcat(i8* %103, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%106 = call i32 @strcat(i8* %105, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%107 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%108 = call i32 @strcat(i8* %107, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %254
109: ; preds = %98
%110 = load i8*, i8** %12
%111 = call i64 @strncmp(i8* %110, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i32 4)
%112 = icmp eq i64 %111, 0
br i1 %112, label %113, label %120
113: ; preds = %109
%114 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%115 = call i32 @strcat(i8* %114, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%117 = call i32 @strcat(i8* %116, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%118 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%119 = call i32 @strcat(i8* %118, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %253
120: ; preds = %109
%121 = load i8*, i8** %12
%122 = call i64 @strncmp(i8* %121, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), i32 4)
%123 = icmp eq i64 %122, 0
br i1 %123, label %124, label %131
124: ; preds = %120
%125 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%126 = call i32 @strcat(i8* %125, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%128 = call i32 @strcat(i8* %127, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%129 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%130 = call i32 @strcat(i8* %129, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %252
131: ; preds = %120
%132 = load i8*, i8** %12
%133 = call i64 @strncmp(i8* %132, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i32 4)
%134 = icmp eq i64 %133, 0
br i1 %134, label %135, label %142
135: ; preds = %131
%136 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%137 = call i32 @strcat(i8* %136, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%138 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%139 = call i32 @strcat(i8* %138, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%140 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%141 = call i32 @strcat(i8* %140, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %251
142: ; preds = %131
%143 = load i8*, i8** %12
%144 = call i64 @strncmp(i8* %143, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 4)
%145 = icmp eq i64 %144, 0
br i1 %145, label %146, label %153
146: ; preds = %142
%147 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%148 = call i32 @strcat(i8* %147, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%150 = call i32 @strcat(i8* %149, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%151 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%152 = call i32 @strcat(i8* %151, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %250
153: ; preds = %142
%154 = load i8*, i8** %12
%155 = call i64 @strncmp(i8* %154, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 4)
%156 = icmp eq i64 %155, 0
br i1 %156, label %157, label %164
157: ; preds = %153
%158 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%159 = call i32 @strcat(i8* %158, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%160 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%161 = call i32 @strcat(i8* %160, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%162 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%163 = call i32 @strcat(i8* %162, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %249
164: ; preds = %153
%165 = load i8*, i8** %12
%166 = call i64 @strncmp(i8* %165, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i32 4)
%167 = icmp eq i64 %166, 0
br i1 %167, label %168, label %175
168: ; preds = %164
%169 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%170 = call i32 @strcat(i8* %169, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%171 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%172 = call i32 @strcat(i8* %171, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%173 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%174 = call i32 @strcat(i8* %173, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %248
175: ; preds = %164
%176 = load i8*, i8** %12
%177 = call i64 @strncmp(i8* %176, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i32 3)
%178 = icmp eq i64 %177, 0
br i1 %178, label %179, label %186
179: ; preds = %175
%180 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%181 = call i32 @strcat(i8* %180, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%182 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%183 = call i32 @strcat(i8* %182, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%184 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%185 = call i32 @strcat(i8* %184, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %247
186: ; preds = %175
%187 = load i8*, i8** %12
%188 = call i64 @strncmp(i8* %187, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i64 0, i64 0), i32 3)
%189 = icmp eq i64 %188, 0
br i1 %189, label %190, label %197
190: ; preds = %186
%191 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%192 = call i32 @strcat(i8* %191, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%193 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%194 = call i32 @strcat(i8* %193, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%195 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%196 = call i32 @strcat(i8* %195, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %246
197: ; preds = %186
%198 = load i8*, i8** %12
%199 = call i64 @strncmp(i8* %198, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i32 4)
%200 = icmp eq i64 %199, 0
br i1 %200, label %205, label %201
201: ; preds = %197
%202 = load i8*, i8** %12
%203 = call i64 @strncmp(i8* %202, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i64 0, i64 0), i32 4)
%204 = icmp eq i64 %203, 0
br i1 %204, label %205, label %212
205: ; preds = %201, %197
%206 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%207 = call i32 @strcat(i8* %206, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.26, i64 0, i64 0))
%208 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%209 = call i32 @strcat(i8* %208, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.27, i64 0, i64 0))
%210 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%211 = call i32 @strcat(i8* %210, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.28, i64 0, i64 0))
br label %245
212: ; preds = %201
%213 = load i8*, i8** %12
%214 = call i64 @strncmp(i8* %213, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.29, i64 0, i64 0), i32 7)
%215 = icmp eq i64 %214, 0
br i1 %215, label %220, label %216
216: ; preds = %212
%217 = load i8*, i8** %12
%218 = call i64 @strncmp(i8* %217, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.30, i64 0, i64 0), i32 7)
%219 = icmp eq i64 %218, 0
br i1 %219, label %220, label %227
220: ; preds = %216, %212
%221 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%222 = call i32 @strcat(i8* %221, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.31, i64 0, i64 0))
%223 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%224 = call i32 @strcat(i8* %223, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.32, i64 0, i64 0))
%225 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%226 = call i32 @strcat(i8* %225, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.33, i64 0, i64 0))
br label %244
227: ; preds = %216
%228 = load i8*, i8** %12
%229 = call i64 @strncmp(i8* %228, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.34, i64 0, i64 0), i32 4)
%230 = icmp eq i64 %229, 0
br i1 %230, label %231, label %238
231: ; preds = %227
%232 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%233 = call i32 @strcat(i8* %232, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.35, i64 0, i64 0))
%234 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%235 = call i32 @strcat(i8* %234, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.36, i64 0, i64 0))
%236 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%237 = call i32 @strcat(i8* %236, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.37, i64 0, i64 0))
br label %243
238: ; preds = %227
%239 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%240 = call i32 @strcat(i8* %239, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%241 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%242 = call i32 @strcat(i8* %241, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.38, i64 0, i64 0))
br label %243
243: ; preds = %238, %231
br label %244
244: ; preds = %243, %220
br label %245
245: ; preds = %244, %205
br label %246
246: ; preds = %245, %190
br label %247
247: ; preds = %246, %179
br label %248
248: ; preds = %247, %168
br label %249
249: ; preds = %248, %157
br label %250
250: ; preds = %249, %146
br label %251
251: ; preds = %250, %135
br label %252
252: ; preds = %251, %124
br label %253
253: ; preds = %252, %113
br label %254
254: ; preds = %253, %102
br label %255
255: ; preds = %254, %91
br label %256
256: ; preds = %255, %80
br label %257
257: ; preds = %256, %69
br label %258
258: ; preds = %257, %58
%259 = load i8*, i8** %13
%260 = icmp ne i8* %259, null
br i1 %260, label %261, label %280
261: ; preds = %258
%262 = load i8*, i8** %13
%263 = call i64 @strncmp(i8* %262, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.39, i64 0, i64 0), i32 1)
%264 = icmp eq i64 %263, 0
br i1 %264, label %265, label %280
265: ; preds = %261
%266 = load i8*, i8** %14
%267 = call i64 @strncmp(i8* %266, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.40, i64 0, i64 0), i32 3)
%268 = icmp eq i64 %267, 0
br i1 %268, label %269, label %280
269: ; preds = %265
%270 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%271 = call i8* @strstr(i8* %270, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.41, i64 0, i64 0))
store i8* %271, i8** %13
%272 = icmp ne i8* %271, null
br i1 %272, label %273, label %279
273: ; preds = %269
%274 = load i8*, i8** %13
%275 = call i32 @strcpy(i8* %274, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.42, i64 0, i64 0))
%276 = load i32*, i32** @stderr
%277 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%278 = call i32 @fprintf(i32* %276, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.43, i64 0, i64 0), i8* %277)
br label %279
279: ; preds = %273, %269
br label %280
280: ; preds = %279, %265, %261, %258
%281 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%282 = call i32* @fopen(i8* %281, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.44, i64 0, i64 0))
store i32* %282, i32** %6
%283 = load i32*, i32** %6
%284 = icmp eq i32* %283, null
br i1 %284, label %285, label %288
285: ; preds = %280
%286 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%287 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.45, i64 0, i64 0), i8* %286)
store i32 -1, i32* %3
br label %344
288: ; preds = %280
%289 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%290 = call i32* @fopen(i8* %289, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.46, i64 0, i64 0))
store i32* %290, i32** %7
%291 = load i32*, i32** %7
%292 = icmp eq i32* %291, null
br i1 %292, label %293, label %296
293: ; preds = %288
%294 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%295 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.47, i64 0, i64 0), i8* %294)
store i32 -1, i32* %3
br label %344
296: ; preds = %288
%297 = load i32*, i32** %7
%298 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.48, i64 0, i64 0), i32* %297)
%299 = load i32*, i32** %7
%300 = call i32 @fputs(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.48, i64 0, i64 0), i32* %299)
%301 = load i32*, i32** %7
%302 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.49, i64 0, i64 0), i32* %301)
%303 = load i32*, i32** %7
%304 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.49, i64 0, i64 0), i32* %303)
%305 = load i32*, i32** %7
%306 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%307 = call i32 @fprintf(i32* %305, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.50, i64 0, i64 0), i8* %306)
br label %308
308: ; preds = %296, %323
%309 = load i32*, i32** %6
%310 = call zeroext i8 @getc(i32* %309)
store i8 %310, i8* %16
%311 = load i32*, i32** %6
%312 = call i64 @feof(i32* %311)
%313 = icmp ne i64 %312, 0
br i1 %313, label %314, label %315
314: ; preds = %308
br label %336
315: ; preds = %308
%316 = getelementptr inbounds [3 x i8], [3 x i8]* %17, i64 0, i64 0
%317 = call i32 @memset(i8* %316, i32 0, i32 2)
%318 = load i32, i32* %15
%319 = icmp sge i32 %318, 16
br i1 %319, label %320, label %323
320: ; preds = %315
%321 = load i32*, i32** %7
%322 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.49, i64 0, i64 0), i32* %321)
store i32 0, i32* %15
br label %323
323: ; preds = %320, %315
%324 = load i32*, i32** %7
%325 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.51, i64 0, i64 0), i32* %324)
%326 = getelementptr inbounds [3 x i8], [3 x i8]* %17, i64 0, i64 0
%327 = load i8, i8* %16
%328 = call i32 @sprintf(i8* %326, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.52, i64 0, i64 0), i8 zeroext %327)
%329 = getelementptr inbounds [3 x i8], [3 x i8]* %17, i64 0, i64 0
%330 = load i32*, i32** %7
%331 = call i32 @fputs(i8* %329, i32* %330)
%332 = load i32*, i32** %7
%333 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.53, i64 0, i64 0), i32* %332)
%334 = load i32, i32* %15
%335 = add nsw i32 %334, 1
store i32 %335, i32* %15
br label %308
336: ; preds = %314
%337 = load i32*, i32** %7
%338 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.54, i64 0, i64 0), i32* %337)
%339 = load i32*, i32** %6
%340 = call i32 @fclose(i32* %339)
%341 = load i32*, i32** %7
%342 = call i32 @fclose(i32* %341)
%343 = call i32 @exit(i32 0)
unreachable
344: ; preds = %293, %285, %46, %39, %34
%345 = load i32, i32* %3
ret i32 %345
}

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