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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
char *strstr(char *, char *);
int system(char *);
int import(char *filename, int offset, int len) {
  int ret = 0;
  char data;
  FILE *fp, *src;
  char buf[4096];
  char *p;
  char q[2];
  FILE *fprod;
  char cmd[1024];
  if (!(fp = fopen("/var/uploadCfg", "w+"))) {
    return 1;
  }
  if (!(src = fopen(filename, "r"))) {
    fclose(fp);
    return 1;
  }
  if (fseek(src, offset + 33, SEEK_SET) == -1) {
    printf("fseek error\n");
  }
  while (len - 33 > 0) {
    if (!fread(&data, 1, 1, src))
      break;
    fwrite(&data, 1, 1, fp);
    len--;
  }
  fclose(fp);
  fclose(src);
  if (!(fp = fopen("/var/uploadCfg.md5", "w+"))) {
    return 1;
  }
  if (!(src = fopen(filename, "r"))) {
    fclose(fp);
    return 1;
  }
  if (fseek(src, offset, SEEK_SET) == -1) {
    printf("fseek error\n");
  }
  len = 33;
  while (len > 0) {
    if (!fread(&data, 1, 1, src))
      break;
    fwrite(&data, 1, 1, fp);
    len--;
  }
  fclose(fp);
  fclose(src);
  char upload_md5[64] = {0};
  char config_md5[64] = {0};
  system("md5sum /var/uploadCfg | cut -d' ' -f 1 > /var/config.md5");
  if ((fp = fopen("/var/uploadCfg.md5", "r")) == NULL) {
    return 1;
  } else {
    fscanf(fp, "%s\n", upload_md5);
    close(fp);
    system("rm -rf /var/uploadCfg.md5");
  }
  if ((fp = fopen("/var/config.md5", "r")) == NULL) {
    return 1;
  } else {
    fscanf(fp, "%s\n", config_md5);
    close(fp);
    system("rm -rf /var/config.md5");
  }
  if (strncmp(config_md5, upload_md5, 32)) {
    return 1;
  }
  if ((fp = fopen("/var/uploadCfg", "r")) == NULL) {
    return 1;
  } else {
    fgets(buf, sizeof(buf), fp);
    fclose(fp);
    if ((p = strstr(buf, "EZP_LOG")) == NULL) {
      system("rm -rf /var/uploadCfg");
      return 1;
    }
    if ((p = strstr(p + strlen("EZP_LOG"), "EZP_")) == NULL) {
      system("rm -rf /var/uploadCfg");
      return 1;
    }
    p += strlen("EZP_");
    system("nvram get prod_cat > /var/prod_cat");
    if ((fprod = fopen("/var/prod_cat", "r")) == NULL) {
      return 1;
    } else {
      fgets(q, 2, fprod);
    }
    fclose(fprod);
    system("rm -rf /var/prod_cat");
    if (p[0] != q[0]) {
      system("rm -rf /var/uploadCfg");
      return 1;
    }
    system("nvram get prod_subcat > /var/prod_subcat");
    if ((fprod = fopen("/var/prod_subcat", "r")) == NULL) {
      return 1;
    } else {
      fgets(q, 2, fprod);
    }
    fclose(fprod);
    system("rm -rf /var/prod_subcat");
    if (p[1] != q[0]) {
      system("rm -rf /var/uploadCfg");
      return 1;
    }
  }
  ret = system("nvram import /var/uploadCfg");
  if (ret) {
    return 1;
  }
  ret = system("nvram commit");
  if (ret) {
    return 1;
  }
  system("rm -rf /var/uploadCfg");
  snprintf(cmd, 1024, "logger EZP_USR  %s\n ",
           "restore configuration successful");
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<import>:
push   %rbp
mov    %rsp,%rbp
sub    $0x14e0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe7c(%rip),%rdi
lea    0xde6(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1239 <import+0x49>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
mov    -0x10(%rbp),%rdi
lea    0xdbf(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    126c <import+0x7c>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x21,%esi
mov    0x2d63(%rip),%rax
mov    (%rax),%edx
call   10e0 <fseek@plt>
cmp    $0xffffffff,%eax
jne    1299 <import+0xa9>
lea    0xd71(%rip),%rdi
call   1080 <printf@plt>
jmp    129e <import+0xae>
mov    -0x18(%rbp),%eax
sub    $0x21,%eax
cmp    $0x0,%eax
jle    12f1 <import+0x101>
mov    -0x30(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
cmp    $0x0,%eax
jne    12cf <import+0xdf>
jmp    12f1 <import+0x101>
mov    -0x28(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1100 <fwrite@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    129e <import+0xae>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xd4c(%rip),%rdi
lea    0xcef(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1330 <import+0x140>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
mov    -0x10(%rbp),%rdi
lea    0xcc8(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1363 <import+0x173>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2c6f(%rip),%rax
mov    (%rax),%edx
call   10e0 <fseek@plt>
cmp    $0xffffffff,%eax
jne    138d <import+0x19d>
lea    0xc7d(%rip),%rdi
call   1080 <printf@plt>
movl   $0x21,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    13e2 <import+0x1f2>
mov    -0x30(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
cmp    $0x0,%eax
jne    13c0 <import+0x1d0>
jmp    13e2 <import+0x1f2>
mov    -0x28(%rbp),%rcx
lea    -0x1d(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1100 <fwrite@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1394 <import+0x1a4>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x1490(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   10a0 <memset@plt>
lea    -0x14d0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   10a0 <memset@plt>
lea    0xbf1(%rip),%rdi
call   1070 <system@plt>
lea    0xc29(%rip),%rdi
lea    0xbcf(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1453 <import+0x263>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
mov    -0x28(%rbp),%rdi
lea    -0x1490(%rbp),%rdx
lea    0xbe6(%rip),%rsi
call   10b0 <fscanf@plt>
mov    -0x28(%rbp),%rdi
call   10c0 <close@plt>
lea    0xbd5(%rip),%rdi
call   1070 <system@plt>
lea    0xbb5(%rip),%rdi
lea    0xb76(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    14ac <import+0x2bc>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
mov    -0x28(%rbp),%rdi
lea    -0x14d0(%rbp),%rdx
lea    0xb8d(%rip),%rsi
call   10b0 <fscanf@plt>
mov    -0x28(%rbp),%rdi
call   10c0 <close@plt>
lea    0xb96(%rip),%rdi
call   1070 <system@plt>
lea    -0x14d0(%rbp),%rdi
lea    -0x1490(%rbp),%rsi
mov    $0x20,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1506 <import+0x316>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    0xb82(%rip),%rdi
lea    0xaef(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1533 <import+0x343>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    -0x1030(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x1000,%esi
call   10d0 <fgets@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x1030(%rbp),%rdi
lea    0xb21(%rip),%rsi
call   1110 <strstr@plt>
mov    %rax,-0x1038(%rbp)
cmp    $0x0,%rax
jne    158d <import+0x39d>
lea    0xb0c(%rip),%rdi
call   1070 <system@plt>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
mov    -0x1038(%rbp),%rax
mov    %rax,-0x14d8(%rbp)
lea    0xade(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x14d8(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xae4(%rip),%rsi
call   1110 <strstr@plt>
mov    %rax,-0x1038(%rbp)
cmp    $0x0,%rax
jne    15e8 <import+0x3f8>
lea    0xab1(%rip),%rdi
call   1070 <system@plt>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    0xaaf(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x1038(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1038(%rbp)
lea    0xa92(%rip),%rdi
call   1070 <system@plt>
lea    0xa9b(%rip),%rdi
lea    0x9df(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x1048(%rbp)
cmp    $0x0,%rax
jne    1646 <import+0x456>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    -0x103a(%rbp),%rdi
mov    -0x1048(%rbp),%rdx
mov    $0x2,%esi
call   10d0 <fgets@plt>
mov    -0x1048(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xa55(%rip),%rdi
call   1070 <system@plt>
mov    -0x1038(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x103a(%rbp),%ecx
cmp    %ecx,%eax
je     16a7 <import+0x4b7>
lea    0x9f2(%rip),%rdi
call   1070 <system@plt>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    0xa2d(%rip),%rdi
call   1070 <system@plt>
lea    0xa39(%rip),%rdi
lea    0x942(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x1048(%rbp)
cmp    $0x0,%rax
jne    16e3 <import+0x4f3>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    -0x103a(%rbp),%rdi
mov    -0x1048(%rbp),%rdx
mov    $0x2,%esi
call   10d0 <fgets@plt>
mov    -0x1048(%rbp),%rdi
call   1050 <fclose@plt>
lea    0x9f6(%rip),%rdi
call   1070 <system@plt>
mov    -0x1038(%rbp),%rax
movsbl 0x1(%rax),%eax
movsbl -0x103a(%rbp),%ecx
cmp    %ecx,%eax
je     1745 <import+0x555>
lea    0x954(%rip),%rdi
call   1070 <system@plt>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
jmp    174a <import+0x55a>
lea    0x9cb(%rip),%rdi
call   1070 <system@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     176f <import+0x57f>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    0x9c2(%rip),%rdi
call   1070 <system@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1794 <import+0x5a4>
movl   $0x1,-0x4(%rbp)
jmp    17d2 <import+0x5e2>
lea    0x8ed(%rip),%rdi
call   1070 <system@plt>
lea    -0x1450(%rbp),%rdi
mov    $0x400,%esi
lea    0x992(%rip),%rdx
lea    0x9a0(%rip),%rcx
call   1090 <snprintf@plt>
lea    -0x1450(%rbp),%rdi
call   1070 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x14e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<import>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1498,%rsp
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r12
lea    0xe80(%rip),%rdi
lea    0xdf9(%rip),%rsi
call   10f0 <fopen@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     162a <import+0x44a>
mov    %rax,%r13
lea    0xf51(%rip),%rsi
mov    %r12,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     160e <import+0x42e>
mov    %rax,%rbp
lea    0x21(%r15),%esi
mov    0x2d9c(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
call   10e0 <fseek@plt>
cmp    $0xffffffff,%eax
je     125a <import+0x7a>
cmp    $0x22,%ebx
jge    126b <import+0x8b>
jmp    12ae <import+0xce>
lea    0xf0b(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x22,%ebx
jl     12ae <import+0xce>
add    $0x1,%ebx
lea    0xd(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
test   %eax,%eax
je     12ae <import+0xce>
movsbl 0xd(%rsp),%edi
mov    %r13,%rsi
call   10c0 <fputc@plt>
add    $0xffffffff,%ebx
cmp    $0x22,%ebx
jg     1280 <import+0xa0>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
lea    0xd82(%rip),%rdi
lea    0xd34(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1624 <import+0x444>
mov    %rax,%r13
lea    0xe92(%rip),%rsi
mov    %r12,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
mov    $0x1,%r14d
je     160e <import+0x42e>
mov    %rax,%rbp
mov    0x2cdb(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    %r15d,%esi
call   10e0 <fseek@plt>
cmp    $0xffffffff,%eax
jne    1323 <import+0x143>
lea    0xe4e(%rip),%rdi
call   1040 <puts@plt>
mov    $0x22,%ebx
lea    0xd(%rsp),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
test   %eax,%eax
je     135e <import+0x17e>
movsbl 0xd(%rsp),%edi
mov    %r13,%rsi
call   10c0 <fputc@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1330 <import+0x150>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
lea    0xc60(%rip),%rdi
call   1080 <system@plt>
lea    0xc98(%rip),%rdi
lea    0xdc0(%rip),%rsi
call   10f0 <fopen@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     162a <import+0x44a>
mov    %rax,%rbx
lea    0xc68(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rax,%rdi
call   10a0 <fscanf@plt>
mov    %rbx,%rdi
call   10b0 <close@plt>
lea    0xc50(%rip),%rdi
call   1080 <system@plt>
lea    0xc30(%rip),%rdi
lea    0xd73(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     162a <import+0x44a>
mov    %rax,%rbx
lea    0xc21(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rax,%rdi
mov    %rbp,%rdx
call   10a0 <fscanf@plt>
mov    %rbx,%rdi
call   10b0 <close@plt>
lea    0xc20(%rip),%rdi
call   1080 <system@plt>
lea    0x10(%rsp),%rsi
mov    %rbp,%rdi
mov    $0x20,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    162a <import+0x44a>
lea    0xc1f(%rip),%rdi
lea    0xd0e(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     162a <import+0x44a>
mov    %rax,%rbx
lea    0x490(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   10d0 <fgets@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xbd1(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strstr@plt>
test   %rax,%rax
je     163f <import+0x45f>
mov    %rax,%rbx
lea    0xbb6(%rip),%rdi
call   1070 <strlen@plt>
cltq
add    %rax,%rbx
lea    0xbc3(%rip),%rsi
mov    %rbx,%rdi
call   1100 <strstr@plt>
test   %rax,%rax
je     1618 <import+0x438>
mov    %rax,%r14
lea    0xba8(%rip),%rdi
call   1070 <strlen@plt>
mov    %eax,%ebp
lea    0xb9f(%rip),%rdi
call   1080 <system@plt>
lea    0xba8(%rip),%rdi
lea    0xc6e(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1624 <import+0x444>
mov    %rax,%rbx
movslq %ebp,%rbp
lea    0xe(%rsp),%rdi
mov    $0x2,%esi
mov    %rax,%rdx
call   10d0 <fgets@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xb7a(%rip),%rdi
call   1080 <system@plt>
mov    (%r14,%rbp,1),%al
cmp    0xe(%rsp),%al
jne    1618 <import+0x438>
lea    0xb75(%rip),%rdi
call   1080 <system@plt>
lea    0xb81(%rip),%rdi
lea    0xc0c(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1624 <import+0x444>
mov    %rax,%rbx
lea    0xe(%rsp),%rdi
mov    $0x2,%esi
mov    %rax,%rdx
call   10d0 <fgets@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xb59(%rip),%rdi
call   1080 <system@plt>
mov    0x1(%r14,%rbp,1),%al
cmp    0xe(%rsp),%al
jne    1618 <import+0x438>
lea    0xb5a(%rip),%rdi
call   1080 <system@plt>
test   %eax,%eax
mov    $0x1,%r14d
jne    162a <import+0x44a>
lea    0xb60(%rip),%rdi
call   1080 <system@plt>
test   %eax,%eax
jne    162a <import+0x44a>
lea    0xaa0(%rip),%rdi
call   1080 <system@plt>
lea    0xb51(%rip),%rdx
lea    0xb5f(%rip),%rcx
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   1080 <system@plt>
xor    %r14d,%r14d
jmp    162a <import+0x44a>
mov    %r13,%rdi
call   1060 <fclose@plt>
jmp    162a <import+0x44a>
lea    0xa5a(%rip),%rdi
call   1080 <system@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x1498,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa33(%rip),%rdi
call   1080 <system@plt>
jmp    162a <import+0x44a>

LLVM IR (-O0):
@.str = [15 x i8] c"/var/uploadCfg\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [2 x i8] c"r\00"
@SEEK_SET = global i32 0
@.str.3 = [13 x i8] c"fseek error\0A\00"
@.str.4 = [19 x i8] c"/var/uploadCfg.md5\00"
@.str.5 = [57 x i8] c"md5sum /var/uploadCfg | cut -d' ' -f 1 > /var/config.md5\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [26 x i8] c"rm -rf /var/uploadCfg.md5\00"
@.str.8 = [16 x i8] c"/var/config.md5\00"
@.str.9 = [23 x i8] c"rm -rf /var/config.md5\00"
@.str.10 = [8 x i8] c"EZP_LOG\00"
@.str.11 = [22 x i8] c"rm -rf /var/uploadCfg\00"
@.str.12 = [5 x i8] c"EZP_\00"
@.str.13 = [35 x i8] c"nvram get prod_cat > /var/prod_cat\00"
@.str.14 = [14 x i8] c"/var/prod_cat\00"
@.str.15 = [21 x i8] c"rm -rf /var/prod_cat\00"
@.str.16 = [41 x i8] c"nvram get prod_subcat > /var/prod_subcat\00"
@.str.17 = [17 x i8] c"/var/prod_subcat\00"
@.str.18 = [24 x i8] c"rm -rf /var/prod_subcat\00"
@.str.19 = [28 x i8] c"nvram import /var/uploadCfg\00"
@.str.20 = [13 x i8] c"nvram commit\00"
@.str.21 = [21 x i8] c"logger EZP_USR %s\0A \00"
@.str.22 = [33 x i8] c"restore configuration successful\00"
define i32 @import(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca [4096 x i8]
%13 = alloca i8*
%14 = alloca [2 x i8]
%15 = alloca i32*
%16 = alloca [1024 x i8]
%17 = alloca [64 x i8]
%18 = alloca [64 x i8]
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 0, i32* %8
%19 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %10
%20 = icmp ne i32* %19, null
br i1 %20, label %22, label %21
21: ; preds = %3
store i32 1, i32* %4
br label %216
22: ; preds = %3
%23 = load i8*, i8** %5
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %11
%25 = icmp ne i32* %24, null
br i1 %25, label %29, label %26
26: ; preds = %22
%27 = load i32*, i32** %10
%28 = call i32 @fclose(i32* %27)
store i32 1, i32* %4
br label %216
29: ; preds = %22
%30 = load i32*, i32** %11
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 33
%33 = load i32, i32* @SEEK_SET
%34 = call i32 @fseek(i32* %30, i32 %32, i32 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %38
36: ; preds = %29
%37 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %29
br label %39
39: ; preds = %48, %38
%40 = load i32, i32* %7
%41 = sub nsw i32 %40, 33
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load i32*, i32** %11
%45 = call i32 @fread(i8* %9, i32 1, i32 1, i32* %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %43
br label %53
48: ; preds = %43
%49 = load i32*, i32** %10
%50 = call i32 @fwrite(i8* %9, i32 1, i32 1, i32* %49)
%51 = load i32, i32* %7
%52 = add nsw i32 %51, -1
store i32 %52, i32* %7
br label %39
53: ; preds = %47, %39
%54 = load i32*, i32** %10
%55 = call i32 @fclose(i32* %54)
%56 = load i32*, i32** %11
%57 = call i32 @fclose(i32* %56)
%58 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %58, i32** %10
%59 = icmp ne i32* %58, null
br i1 %59, label %61, label %60
60: ; preds = %53
store i32 1, i32* %4
br label %216
61: ; preds = %53
%62 = load i8*, i8** %5
%63 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %63, i32** %11
%64 = icmp ne i32* %63, null
br i1 %64, label %68, label %65
65: ; preds = %61
%66 = load i32*, i32** %10
%67 = call i32 @fclose(i32* %66)
store i32 1, i32* %4
br label %216
68: ; preds = %61
%69 = load i32*, i32** %11
%70 = load i32, i32* %6
%71 = load i32, i32* @SEEK_SET
%72 = call i32 @fseek(i32* %69, i32 %70, i32 %71)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %76
74: ; preds = %68
%75 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %76
76: ; preds = %74, %68
store i32 33, i32* %7
br label %77
77: ; preds = %85, %76
%78 = load i32, i32* %7
%79 = icmp sgt i32 %78, 0
br i1 %79, label %80, label %90
80: ; preds = %77
%81 = load i32*, i32** %11
%82 = call i32 @fread(i8* %9, i32 1, i32 1, i32* %81)
%83 = icmp ne i32 %82, 0
br i1 %83, label %85, label %84
84: ; preds = %80
br label %90
85: ; preds = %80
%86 = load i32*, i32** %10
%87 = call i32 @fwrite(i8* %9, i32 1, i32 1, i32* %86)
%88 = load i32, i32* %7
%89 = add nsw i32 %88, -1
store i32 %89, i32* %7
br label %77
90: ; preds = %84, %77
%91 = load i32*, i32** %10
%92 = call i32 @fclose(i32* %91)
%93 = load i32*, i32** %11
%94 = call i32 @fclose(i32* %93)
%95 = bitcast [64 x i8]* %17 to i8*
%96 = bitcast [64 x i8]* %18 to i8*
%97 = call i32 @system(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0))
%98 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %98, i32** %10
%99 = icmp eq i32* %98, null
br i1 %99, label %100, label %101
100: ; preds = %90
store i32 1, i32* %4
br label %216
101: ; preds = %90
%102 = load i32*, i32** %10
%103 = getelementptr inbounds [64 x i8], [64 x i8]* %17, i64 0, i64 0
%104 = call i32 @fscanf(i32* %102, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %103)
%105 = load i32*, i32** %10
%106 = call i32 @close(i32* %105)
%107 = call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
br label %108
108: ; preds = %101
%109 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %109, i32** %10
%110 = icmp eq i32* %109, null
br i1 %110, label %111, label %112
111: ; preds = %108
store i32 1, i32* %4
br label %216
112: ; preds = %108
%113 = load i32*, i32** %10
%114 = getelementptr inbounds [64 x i8], [64 x i8]* %18, i64 0, i64 0
%115 = call i32 @fscanf(i32* %113, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %114)
%116 = load i32*, i32** %10
%117 = call i32 @close(i32* %116)
%118 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %119
119: ; preds = %112
%120 = getelementptr inbounds [64 x i8], [64 x i8]* %18, i64 0, i64 0
%121 = getelementptr inbounds [64 x i8], [64 x i8]* %17, i64 0, i64 0
%122 = call i64 @strncmp(i8* %120, i8* %121, i32 32)
%123 = icmp ne i64 %122, 0
br i1 %123, label %124, label %125
124: ; preds = %119
store i32 1, i32* %4
br label %216
125: ; preds = %119
%126 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %126, i32** %10
%127 = icmp eq i32* %126, null
br i1 %127, label %128, label %129
128: ; preds = %125
store i32 1, i32* %4
br label %216
129: ; preds = %125
%130 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%131 = load i32*, i32** %10
%132 = call i32 @fgets(i8* %130, i32 4096, i32* %131)
%133 = load i32*, i32** %10
%134 = call i32 @fclose(i32* %133)
%135 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%136 = call i8* @strstr(i8* %135, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
store i8* %136, i8** %13
%137 = icmp eq i8* %136, null
br i1 %137, label %138, label %140
138: ; preds = %129
%139 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %4
br label %216
140: ; preds = %129
%141 = load i8*, i8** %13
%142 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %141, i64 %143
%145 = call i8* @strstr(i8* %144, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
store i8* %145, i8** %13
%146 = icmp eq i8* %145, null
br i1 %146, label %147, label %149
147: ; preds = %140
%148 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %4
br label %216
149: ; preds = %140
%150 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%151 = load i8*, i8** %13
%152 = sext i32 %150 to i64
%153 = getelementptr inbounds i8, i8* %151, i64 %152
store i8* %153, i8** %13
%154 = call i32 @system(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
%155 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %155, i32** %15
%156 = icmp eq i32* %155, null
br i1 %156, label %157, label %158
157: ; preds = %149
store i32 1, i32* %4
br label %216
158: ; preds = %149
%159 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 0
%160 = load i32*, i32** %15
%161 = call i32 @fgets(i8* %159, i32 2, i32* %160)
br label %162
162: ; preds = %158
%163 = load i32*, i32** %15
%164 = call i32 @fclose(i32* %163)
%165 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%166 = load i8*, i8** %13
%167 = getelementptr inbounds i8, i8* %166, i64 0
%168 = load i8, i8* %167
%169 = sext i8 %168 to i32
%170 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 0
%171 = load i8, i8* %170
%172 = sext i8 %171 to i32
%173 = icmp ne i32 %169, %172
br i1 %173, label %174, label %176
174: ; preds = %162
%175 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %4
br label %216
176: ; preds = %162
%177 = call i32 @system(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0))
%178 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %178, i32** %15
%179 = icmp eq i32* %178, null
br i1 %179, label %180, label %181
180: ; preds = %176
store i32 1, i32* %4
br label %216
181: ; preds = %176
%182 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 0
%183 = load i32*, i32** %15
%184 = call i32 @fgets(i8* %182, i32 2, i32* %183)
br label %185
185: ; preds = %181
%186 = load i32*, i32** %15
%187 = call i32 @fclose(i32* %186)
%188 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
%189 = load i8*, i8** %13
%190 = getelementptr inbounds i8, i8* %189, i64 1
%191 = load i8, i8* %190
%192 = sext i8 %191 to i32
%193 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 0
%194 = load i8, i8* %193
%195 = sext i8 %194 to i32
%196 = icmp ne i32 %192, %195
br i1 %196, label %197, label %199
197: ; preds = %185
%198 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %4
br label %216
199: ; preds = %185
br label %200
200: ; preds = %199
%201 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.19, i64 0, i64 0))
store i32 %201, i32* %8
%202 = load i32, i32* %8
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %205
204: ; preds = %200
store i32 1, i32* %4
br label %216
205: ; preds = %200
%206 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0))
store i32 %206, i32* %8
%207 = load i32, i32* %8
%208 = icmp ne i32 %207, 0
br i1 %208, label %209, label %210
209: ; preds = %205
store i32 1, i32* %4
br label %216
210: ; preds = %205
%211 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%212 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%213 = call i32 @snprintf(i8* %212, i32 1024, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0))
%214 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%215 = call i32 @system(i8* %214)
store i32 0, i32* %4
br label %216
216: ; preds = %210, %209, %204, %197, %180, %174, %157, %147, %138, %128, %124, %111, %100, %65, %60, %26, %21
%217 = load i32, i32* %4
ret i32 %217
}

LLVM IR (-O2):
@.str = [15 x i8] c"/var/uploadCfg\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [2 x i8] c"r\00"
@SEEK_SET = global i32 0
@.str.4 = [19 x i8] c"/var/uploadCfg.md5\00"
@.str.5 = [57 x i8] c"md5sum /var/uploadCfg | cut -d' ' -f 1 > /var/config.md5\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [26 x i8] c"rm -rf /var/uploadCfg.md5\00"
@.str.8 = [16 x i8] c"/var/config.md5\00"
@.str.9 = [23 x i8] c"rm -rf /var/config.md5\00"
@.str.10 = [8 x i8] c"EZP_LOG\00"
@.str.11 = [22 x i8] c"rm -rf /var/uploadCfg\00"
@.str.12 = [5 x i8] c"EZP_\00"
@.str.13 = [35 x i8] c"nvram get prod_cat > /var/prod_cat\00"
@.str.14 = [14 x i8] c"/var/prod_cat\00"
@.str.15 = [21 x i8] c"rm -rf /var/prod_cat\00"
@.str.16 = [41 x i8] c"nvram get prod_subcat > /var/prod_subcat\00"
@.str.17 = [17 x i8] c"/var/prod_subcat\00"
@.str.18 = [24 x i8] c"rm -rf /var/prod_subcat\00"
@.str.19 = [28 x i8] c"nvram import /var/uploadCfg\00"
@.str.20 = [13 x i8] c"nvram commit\00"
@.str.21 = [21 x i8] c"logger EZP_USR %s\0A \00"
@.str.22 = [33 x i8] c"restore configuration successful\00"
@str.23 = [12 x i8] c"fseek error\00"
define i32 @import(i8* nocapture %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca [4096 x i8]
%6 = alloca [2 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [64 x i8]
%9 = alloca [64 x i8]
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%13 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %146, label %15
15: ; preds = %3
%16 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @fclose(i32* %13)
br label %146
20: ; preds = %15
%21 = add nsw i32 %1, 33
%22 = load i32, i32* @SEEK_SET
%23 = tail call i32 @fseek(i32* %16, i32 %21, i32 %22)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.23, i64 0, i64 0))
br label %27
27: ; preds = %25, %20
%28 = icmp sgt i32 %2, 33
br i1 %28, label %29, label %39
29: ; preds = %27, %33
%30 = phi i32 [ %37, %33 ], [ %2, %27 ]
%31 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %16)
%32 = icmp eq i32 %31, 0
br i1 %32, label %39, label %33
33: ; preds = %29
%34 = load i8, i8* %4
%35 = sext i8 %34 to i32
%36 = tail call i32 @fputc(i32 %35, i32* %13)
%37 = add nsw i32 %30, -1
%38 = icmp sgt i32 %30, 34
br i1 %38, label %29, label %39
39: ; preds = %33, %29, %27
%40 = tail call i32 @fclose(i32* %13)
%41 = tail call i32 @fclose(i32* %16)
%42 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %146, label %44
44: ; preds = %39
%45 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = tail call i32 @fclose(i32* %42)
br label %146
49: ; preds = %44
%50 = load i32, i32* @SEEK_SET
%51 = tail call i32 @fseek(i32* %45, i32 %1, i32 %50)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.23, i64 0, i64 0))
br label %55
55: ; preds = %53, %49
br label %56
56: ; preds = %55, %60
%57 = phi i32 [ %64, %60 ], [ 33, %55 ]
%58 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %45)
%59 = icmp eq i32 %58, 0
br i1 %59, label %66, label %60
60: ; preds = %56
%61 = load i8, i8* %4
%62 = sext i8 %61 to i32
%63 = tail call i32 @fputc(i32 %62, i32* %42)
%64 = add nsw i32 %57, -1
%65 = icmp ugt i32 %57, 1
br i1 %65, label %56, label %66
66: ; preds = %56, %60
%67 = tail call i32 @fclose(i32* %42)
%68 = tail call i32 @fclose(i32* %45)
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%70 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%71 = tail call i32 @system(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0))
%72 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%73 = icmp eq i32* %72, null
br i1 %73, label %144, label %74
74: ; preds = %66
%75 = call i32 @fscanf(i32* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %69)
%76 = call i32 @close(i32* %72)
%77 = call i32 @system(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%78 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%79 = icmp eq i32* %78, null
br i1 %79, label %144, label %80
80: ; preds = %74
%81 = call i32 @fscanf(i32* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %70)
%82 = call i32 @close(i32* %78)
%83 = call i32 @system(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%84 = call i64 @strncmp(i8* %70, i8* %69, i32 32)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %144
86: ; preds = %80
%87 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%88 = icmp eq i32* %87, null
br i1 %88, label %144, label %89
89: ; preds = %86
%90 = call i32 @fgets(i8* %10, i32 4096, i32* %87)
%91 = call i32 @fclose(i32* %87)
%92 = call i8* @strstr(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%93 = icmp eq i8* %92, null
br i1 %93, label %94, label %96
94: ; preds = %89
%95 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %144
96: ; preds = %89
%97 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %92, i64 %98
%100 = call i8* @strstr(i8* %99, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%101 = icmp eq i8* %100, null
br i1 %101, label %102, label %104
102: ; preds = %96
%103 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %144
104: ; preds = %96
%105 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %100, i64 %106
%108 = call i32 @system(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
%109 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%110 = icmp eq i32* %109, null
br i1 %110, label %144, label %111
111: ; preds = %104
%112 = call i32 @fgets(i8* %11, i32 2, i32* %109)
%113 = call i32 @fclose(i32* %109)
%114 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0))
%115 = load i8, i8* %107
%116 = load i8, i8* %11
%117 = icmp eq i8 %115, %116
br i1 %117, label %120, label %118
118: ; preds = %111
%119 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %144
120: ; preds = %111
%121 = call i32 @system(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0))
%122 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%123 = icmp eq i32* %122, null
br i1 %123, label %144, label %124
124: ; preds = %120
%125 = call i32 @fgets(i8* %11, i32 2, i32* %122)
%126 = call i32 @fclose(i32* %122)
%127 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
%128 = getelementptr inbounds i8, i8* %107, i64 1
%129 = load i8, i8* %128
%130 = load i8, i8* %11
%131 = icmp eq i8 %129, %130
br i1 %131, label %134, label %132
132: ; preds = %124
%133 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %144
134: ; preds = %124
%135 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.19, i64 0, i64 0))
%136 = icmp eq i32 %135, 0
br i1 %136, label %137, label %144
137: ; preds = %134
%138 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0))
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %144
140: ; preds = %137
%141 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
%142 = call i32 @snprintf(i8* %12, i32 1024, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0))
%143 = call i32 @system(i8* %12)
br label %144
144: ; preds = %137, %134, %120, %104, %86, %80, %74, %66, %140, %132, %118, %102, %94
%145 = phi i32 [ 1, %94 ], [ 1, %102 ], [ 1, %118 ], [ 1, %132 ], [ 0, %140 ], [ 1, %66 ], [ 1, %74 ], [ 1, %80 ], [ 1, %86 ], [ 1, %104 ], [ 1, %120 ], [ 1, %134 ], [ 1, %137 ]
br label %146
146: ; preds = %39, %3, %144, %47, %18
%147 = phi i32 [ %145, %144 ], [ 1, %47 ], [ 1, %18 ], [ 1, %3 ], [ 1, %39 ]
ret i32 %147
}