#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*/ FILE;

/* Variables and functions */
int errno;
int escape_string(int, char *, char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(unsigned char *, int, unsigned int, int /*<<< orphan*/ *);
scalar_t__ memcmp(unsigned char *, char *, int);
int /*<<< orphan*/ memcpy(char *, unsigned char *, unsigned int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int);
int strlen(char const *);
int dump_file(int escape_mode, int file_format, const char *filename) {
  if (!filename || (strlen(filename) == 0)) {
    fprintf(stderr, "dump_file: No filename given\n");
    return 1;
  }
  FILE *f = fopen(filename, "rb");
  if (!f) {
    int code = errno;
    char *errstr = strerror(code);
    fprintf(stderr, "dump_file: Error opening %s: %s\n", filename, errstr);
    return 1;
  }
  static unsigned char buffer[65536];
  size_t read_bytes, read_size, len_size, i;
  if (file_format == 1) {
    read_bytes = fread(buffer, sizeof(char), 4, f);
    if (read_bytes != 4) {
      fprintf(stderr,
              "dump_file: File %s: Error reading header and record count\n",
              filename);
      fclose(f);
      return 1;
    }
  } else {
    read_bytes = fread(buffer, sizeof(char), 8, f);
    if (read_bytes != 8 || memcmp(buffer, "DD-WRT", 6)) {
      fprintf(stderr,
              "dump_file: File %s: Error reading header and record count\n",
              filename);
      fclose(f);
      return 1;
    }
  }
  unsigned int record_count = 0;
  unsigned int name_len, value_len;
  static char name[257], value[65537];
  unsigned int record = 0;
  if (file_format == 1)
    record_count = buffer[1] * 256 + buffer[0];
  else
    record_count = buffer[7] * 256 + buffer[6];
  while (record < record_count) {
    record++;
    read_bytes = fread(buffer, sizeof(char), 1, f);
    if (read_bytes != 1) {
      fprintf(stderr,
              "dump_file: File %s: Error reading name length from record %u\n",
              filename, record);
      fclose(f);
      return 1;
    }
    name_len = buffer[0];
    read_bytes = fread(buffer, sizeof(char), name_len, f);
    if (read_bytes != name_len) {
      fprintf(stderr, "dump_file: File %s: Error reading name from record %u\n",
              filename, record);
      fclose(f);
      return 1;
    }
    memcpy(name, buffer, name_len);
    name[name_len] = 0;
    len_size = (file_format == 1) ? 1 : 2;
    read_bytes = fread(buffer, sizeof(char), len_size, f);
    if (read_bytes != len_size) {
      fprintf(stderr,
              "dump_file: File %s: Error reading value length from record %u\n",
              filename, record);
      fclose(f);
      return 1;
    }
    value_len = 0;
    for (i = 1; i <= len_size; i++)
      value_len = (value_len * 256) + buffer[len_size - i];
    if (value_len > 0) {
      read_bytes = fread(buffer, sizeof(char), value_len, f);
      if (read_bytes != value_len) {
        fprintf(stderr,
                "dump_file: File %s: Error reading value from record %u\n",
                filename, record);
        fclose(f);
        return 1;
      }
      memcpy(value, buffer, value_len);
      value[value_len] = 0;
    } else {
      value[0] = 0;
    }
    if ((strlen(name) == 0) && (strlen(value) == 0))
      continue;
    static char esc_name[513], esc_value[65536 * 2 + 1];
    int copied;
    esc_name[0] = 0;
    esc_value[0] = 0;
    copied = escape_string(0, name, esc_name, 513);
    if (copied < strlen(name))
      fprintf(stderr,
              "dump_file: File %s: Record %u: cannot copy entire name %s\n",
              filename, record, name);
    else if (strlen(name) < strlen(esc_name))
      fprintf(stderr,
              "dump_file: File %s: Record %u: Name %s: contains non-printable "
              "characters\n",
              filename, record, esc_name);
    copied = escape_string(escape_mode, value, esc_value, 65536 * 2 + 1);
    if (copied < strlen(value))
      fprintf(
          stderr,
          "dump_file: File %s: Record %u: Name %s: cannot copy entire value\n",
          filename, record, esc_name);
    fprintf(stdout, "%s=%s\n", esc_name, esc_value);
    fflush(stdout);
  }
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<dump_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11cf <dump_file+0x2f>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    11f2 <dump_file+0x52>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
mov    -0x18(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1254 <dump_file+0xb4>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   10b0 <strerror@plt>
mov    %rax,-0x30(%rbp)
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
cmpl   $0x1,-0xc(%rbp)
jne    12bc <dump_file+0x11c>
mov    -0x20(%rbp),%rcx
lea    0x2e27(%rip),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x4,-0x38(%rbp)
je     12b7 <dump_file+0x117>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xda7(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
jmp    133c <dump_file+0x19c>
mov    -0x20(%rbp),%rcx
lea    0x2dc9(%rip),%rdi
mov    $0x1,%esi
mov    $0x8,%edx
call   1030 <fread@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x8,-0x38(%rbp)
jne    1307 <dump_file+0x167>
lea    0x2da4(%rip),%rdi
lea    0xd8a(%rip),%rsi
mov    $0x6,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     1337 <dump_file+0x197>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xd27(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
jmp    133c <dump_file+0x19c>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x60(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    136f <dump_file+0x1cf>
movzbl 0x2d36(%rip),%eax
shl    $0x8,%eax
movzbl 0x2d2b(%rip),%ecx
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
jmp    1385 <dump_file+0x1e5>
movzbl 0x2d21(%rip),%eax
shl    $0x8,%eax
movzbl 0x2d16(%rip),%ecx
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
jmp    138a <dump_file+0x1ea>
mov    -0x60(%rbp),%eax
cmp    -0x54(%rbp),%eax
jae    1776 <dump_file+0x5d6>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x20(%rbp),%rcx
lea    0x2ce6(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x1,-0x38(%rbp)
je     13f8 <dump_file+0x258>
mov    0x2c14(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xca8(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
movzbl 0x2c91(%rip),%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0x2c80(%rip),%rdi
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x58(%rbp),%ecx
cmp    %rcx,%rax
je     1461 <dump_file+0x2c1>
mov    0x2bab(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xc7d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
mov    -0x58(%rbp),%edx
lea    0x12c25(%rip),%rdi
lea    0x2c1e(%rip),%rsi
call   1080 <memcpy@plt>
mov    -0x58(%rbp),%eax
mov    %eax,%ecx
lea    0x12c0d(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%edx
mov    $0x2,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
cltq
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %eax,%edx
mov    -0x20(%rbp),%rcx
lea    0x2bdf(%rip),%rdi
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x48(%rbp),%rax
je     1500 <dump_file+0x360>
mov    0x2b0c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xc15(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
movl   $0x0,-0x5c(%rbp)
movq   $0x1,-0x50(%rbp)
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
ja     154c <dump_file+0x3ac>
mov    -0x5c(%rbp),%eax
shl    $0x8,%eax
mov    -0x48(%rbp),%rdx
sub    -0x50(%rbp),%rdx
lea    0x2b5e(%rip),%rcx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    150f <dump_file+0x36f>
cmpl   $0x0,-0x5c(%rbp)
jbe    15e0 <dump_file+0x440>
mov    -0x5c(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0x2b2c(%rip),%rdi
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x5c(%rbp),%ecx
cmp    %rcx,%rax
je     15b5 <dump_file+0x415>
mov    0x2a57(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xb9f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1786 <dump_file+0x5e6>
mov    -0x5c(%rbp),%edx
lea    0x12be1(%rip),%rdi
lea    0x2aca(%rip),%rsi
call   1080 <memcpy@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,%ecx
lea    0x12bc9(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    15e7 <dump_file+0x447>
movb   $0x0,0x12bb9(%rip)
lea    0x12aa2(%rip),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1616 <dump_file+0x476>
lea    0x12b9d(%rip),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1616 <dump_file+0x476>
jmp    138a <dump_file+0x1ea>
movb   $0x0,0x22b93(%rip)
movb   $0x0,0x22d9c(%rip)
xor    %edi,%edi
lea    0x12a63(%rip),%rsi
lea    0x22b7c(%rip),%rdx
mov    $0x201,%ecx
call   10c0 <escape_string@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x68(%rbp)
lea    0x12a42(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
cmp    %ecx,%eax
jge    168a <dump_file+0x4ea>
mov    0x2979(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xaf9(%rip),%rsi
lea    0x12a12(%rip),%r8
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    16dc <dump_file+0x53c>
lea    0x129ff(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x6c(%rbp)
lea    0x22b10(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
cmp    %ecx,%eax
jge    16d7 <dump_file+0x537>
mov    0x2927(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xae2(%rip),%rsi
lea    0x22ae0(%rip),%r8
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    16dc <dump_file+0x53c>
mov    -0x8(%rbp),%edi
lea    0x12aba(%rip),%rsi
lea    0x22cd3(%rip),%rdx
mov    $0x20001,%ecx
call   10c0 <escape_string@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x70(%rbp)
lea    0x12a99(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%eax
cmp    %ecx,%eax
jge    173e <dump_file+0x59e>
mov    0x28c0(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x60(%rbp),%ecx
lea    0xac6(%rip),%rsi
lea    0x22a79(%rip),%r8
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x288b(%rip),%rax
mov    (%rax),%edi
lea    0xaea(%rip),%rsi
lea    0x22a5b(%rip),%rdx
lea    0x22c64(%rip),%rcx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2866(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
jmp    138a <dump_file+0x1ea>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %rdx,%rdx
je     122a <dump_file+0x8a>
mov    %rdx,%r13
mov    %esi,%r14d
mov    %edi,%r12d
mov    %rdx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     122a <dump_file+0x8a>
lea    0xe4f(%rip),%rsi
mov    %r13,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1257 <dump_file+0xb7>
mov    %rax,%rbx
cmp    $0x1,%r14d
mov    %rax,0x8(%rsp)
jne    1284 <dump_file+0xe4>
lea    0x2e9b(%rip),%r15
mov    $0x1,%ebp
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmp    $0x4,%rax
jne    12c5 <dump_file+0x125>
mov    %r12d,0x14(%rsp)
lea    0x2e6c(%rip),%rax
jmp    12ff <dump_file+0x15f>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
lea    0xdc6(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    0x2d74(%rip),%rcx
mov    (%rcx),%edi
lea    0xdac(%rip),%rsi
mov    %r13,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1241 <dump_file+0xa1>
lea    0x2e05(%rip),%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
mov    $0x8,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
cmp    $0x8,%rax
jne    12c5 <dump_file+0x125>
lea    0x2de1(%rip),%rdi
lea    0xdc7(%rip),%rsi
mov    $0x6,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
je     12ec <dump_file+0x14c>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
lea    0xd6d(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    1246 <dump_file+0xa6>
mov    %r12d,0x14(%rsp)
lea    0x2d9f(%rip),%rax
lea    0x2d97(%rip),%r15
movzbl (%rax),%eax
shl    $0x8,%eax
movzbl (%r15),%ecx
or     %eax,%ecx
mov    %ecx,0x24(%rsp)
mov    0x8(%rsp),%r12
je     15a1 <dump_file+0x401>
xor    %eax,%eax
cmp    $0x1,%r14d
sete   %al
mov    $0x2,%ecx
sub    %eax,%ecx
mov    %rcx,0x28(%rsp)
lea    -0x1(%rcx),%rax
mov    %rax,0x30(%rsp)
lea    0x2d51(%rip),%r14
xor    %ebp,%ebp
mov    %r13,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
cmp    $0x1,%rax
jne    15b2 <dump_file+0x412>
mov    %ebp,0x4(%rsp)
mov    0x28(%rsp),%r15
movzbl 0x2d0e(%rip),%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
mov    %r12,%r13
cmp    %rbp,%rax
jne    15d3 <dump_file+0x433>
mov    %rax,%rbx
lea    0x12ce6(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1080 <memcpy@plt>
movb   $0x0,(%rbx,%r12,1)
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r15d,%edx
mov    %r13,%rcx
call   1030 <fread@plt>
cmp    %r15,%rax
jne    15e5 <dump_file+0x445>
cmpq   $0x2,0x30(%rsp)
ja     15b0 <dump_file+0x410>
xor    %r15d,%r15d
mov    0x28(%rsp),%rax
nopl   0x0(%rax)
shl    $0x8,%r15d
movzbl -0x1(%rax,%r14,1),%ecx
or     %rcx,%r15
add    $0xffffffffffffffff,%rax
jne    13f0 <dump_file+0x250>
test   %r15d,%r15d
mov    0x18(%rsp),%r13
je     1449 <dump_file+0x2a9>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r15d,%edx
mov    0x8(%rsp),%rcx
call   1030 <fread@plt>
cmp    %r15,%rax
jne    160a <dump_file+0x46a>
mov    %rax,%rbx
lea    0x12d6b(%rip),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1080 <memcpy@plt>
movb   $0x0,(%rbx,%rbp,1)
jmp    1450 <dump_file+0x2b0>
movb   $0x0,0x12d50(%rip)
mov    0x8(%rsp),%r12
mov    0x4(%rsp),%ebp
lea    0x12c30(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jne    1480 <dump_file+0x2e0>
lea    0x12d2d(%rip),%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     1597 <dump_file+0x3f7>
movb   $0x0,0x22d29(%rip)
movb   $0x0,0x22f32(%rip)
xor    %edi,%edi
mov    %rbx,%rsi
lea    0x22d16(%rip),%r15
mov    %r15,%rdx
mov    $0x201,%ecx
call   10c0 <escape_string@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    %eax,%r12d
jge    14df <dump_file+0x33f>
mov    0x2b22(%rip),%rax
mov    (%rax),%edi
lea    0xca9(%rip),%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
mov    %rbx,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0x22ee3(%rip),%r15
jmp    151f <dump_file+0x37f>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    %eax,%ebx
lea    0x22ec6(%rip),%r15
jge    151f <dump_file+0x37f>
mov    0x2add(%rip),%rax
mov    (%rax),%edi
lea    0xc9f(%rip),%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
lea    0x22c98(%rip),%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x14(%rsp),%edi
lea    0x12c76(%rip),%r12
mov    %r12,%rsi
mov    %r15,%rdx
mov    $0x20001,%ecx
call   10c0 <escape_string@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1050 <strlen@plt>
cmp    %eax,%ebx
lea    0x22c63(%rip),%r12
jge    156e <dump_file+0x3ce>
mov    0x2a8a(%rip),%rax
mov    (%rax),%edi
lea    0xc97(%rip),%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
mov    %r12,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2a5b(%rip),%rbx
mov    (%rbx),%edi
lea    0xcba(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rbx),%edi
call   1090 <fflush@plt>
mov    0x8(%rsp),%r12
cmp    0x24(%rsp),%ebp
jne    1350 <dump_file+0x1b0>
mov    %r12,%rdi
call   1040 <fclose@plt>
xor    %ebp,%ebp
jmp    1246 <dump_file+0xa6>
jmp    15b0 <dump_file+0x410>
mov    0x2a27(%rip),%rax
mov    (%rax),%edi
lea    0xac2(%rip),%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r12,%rdi
jmp    162d <dump_file+0x48d>
mov    0x2a06(%rip),%rax
mov    (%rax),%edi
lea    0xadf(%rip),%rsi
jmp    15f5 <dump_file+0x455>
mov    0x29f4(%rip),%rax
mov    (%rax),%edi
lea    0xb04(%rip),%rsi
mov    0x18(%rsp),%rdx
mov    0x4(%rsp),%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
jmp    162d <dump_file+0x48d>
mov    0x29cf(%rip),%rax
mov    (%rax),%edi
lea    0xb1e(%rip),%rsi
mov    %r13,%rdx
mov    0x4(%rsp),%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
jmp    1241 <dump_file+0xa1>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"dump_file: No filename given\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@errno = global i32 0
@.str.2 = [33 x i8] c"dump_file: Error opening %s: %s\0A\00"
@dump_file.buffer = internal global [65536 x i8] zeroinitializer
@.str.3 = [59 x i8] c"dump_file: File %s: Error reading header and record count\0A\00"
@.str.4 = [7 x i8] c"DD-WRT\00"
@dump_file.name = internal global [257 x i8] zeroinitializer
@dump_file.value = internal global [65537 x i8] zeroinitializer
@.str.5 = [62 x i8] c"dump_file: File %s: Error reading name length from record %u\0A\00"
@.str.6 = [55 x i8] c"dump_file: File %s: Error reading name from record %u\0A\00"
@.str.7 = [63 x i8] c"dump_file: File %s: Error reading value length from record %u\0A\00"
@.str.8 = [56 x i8] c"dump_file: File %s: Error reading value from record %u\0A\00"
@dump_file.esc_name = internal global [513 x i8] zeroinitializer
@dump_file.esc_value = internal global [131073 x i8] zeroinitializer
@.str.9 = [59 x i8] c"dump_file: File %s: Record %u: cannot copy entire name %s\0A\00"
@.str.10 = [75 x i8] c"dump_file: File %s: Record %u: Name %s: contains non-printable characters\0A\00"
@.str.11 = [66 x i8] c"dump_file: File %s: Record %u: Name %s: cannot copy entire value\0A\00"
@stdout = global i32 0
@.str.12 = [7 x i8] c"%s=%s\0A\00"
define i32 @dump_file(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%20 = load i8*, i8** %7
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %26
22: ; preds = %3
%23 = load i8*, i8** %7
%24 = call i32 @strlen(i8* %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22, %3
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %239
29: ; preds = %22
%30 = load i8*, i8** %7
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %8
%32 = load i32*, i32** %8
%33 = icmp ne i32* %32, null
br i1 %33, label %42, label %34
34: ; preds = %29
%35 = load i32, i32* @errno
store i32 %35, i32* %9
%36 = load i32, i32* %9
%37 = call i8* @strerror(i32 %36)
store i8* %37, i8** %10
%38 = load i32, i32* @stderr
%39 = load i8*, i8** %7
%40 = load i8*, i8** %10
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %39, i8* %40)
store i32 1, i32* %4
br label %239
42: ; preds = %29
%43 = load i32, i32* %6
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %57
45: ; preds = %42
%46 = load i32*, i32** %8
%47 = call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 4, i32* %46)
store i64 %47, i64* %11
%48 = load i64, i64* %11
%49 = icmp ne i64 %48, 4
br i1 %49, label %50, label %56
50: ; preds = %45
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %7
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %52)
%54 = load i32*, i32** %8
%55 = call i32 @fclose(i32* %54)
store i32 1, i32* %4
br label %239
56: ; preds = %45
br label %72
57: ; preds = %42
%58 = load i32*, i32** %8
%59 = call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 8, i32* %58)
store i64 %59, i64* %11
%60 = load i64, i64* %11
%61 = icmp ne i64 %60, 8
br i1 %61, label %65, label %62
62: ; preds = %57
%63 = call i64 @memcmp(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %62, %57
%66 = load i32, i32* @stderr
%67 = load i8*, i8** %7
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %67)
%69 = load i32*, i32** %8
%70 = call i32 @fclose(i32* %69)
store i32 1, i32* %4
br label %239
71: ; preds = %62
br label %72
72: ; preds = %71, %56
store i32 0, i32* %15
store i32 0, i32* %18
%73 = load i32, i32* %6
%74 = icmp eq i32 %73, 1
br i1 %74, label %75, label %82
75: ; preds = %72
%76 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 1)
%77 = zext i8 %76 to i32
%78 = mul nsw i32 %77, 256
%79 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0)
%80 = zext i8 %79 to i32
%81 = add nsw i32 %78, %80
store i32 %81, i32* %15
br label %89
82: ; preds = %72
%83 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 7)
%84 = zext i8 %83 to i32
%85 = mul nsw i32 %84, 256
%86 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 6)
%87 = zext i8 %86 to i32
%88 = add nsw i32 %85, %87
store i32 %88, i32* %15
br label %89
89: ; preds = %82, %75
br label %90
90: ; preds = %231, %199, %89
%91 = load i32, i32* %18
%92 = load i32, i32* %15
%93 = icmp ult i32 %91, %92
br i1 %93, label %94, label %236
94: ; preds = %90
%95 = load i32, i32* %18
%96 = add i32 %95, 1
store i32 %96, i32* %18
%97 = load i32*, i32** %8
%98 = call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 1, i32* %97)
store i64 %98, i64* %11
%99 = load i64, i64* %11
%100 = icmp ne i64 %99, 1
br i1 %100, label %101, label %108
101: ; preds = %94
%102 = load i32, i32* @stderr
%103 = load i8*, i8** %7
%104 = load i32, i32* %18
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %102, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i8* %103, i32 %104)
%106 = load i32*, i32** %8
%107 = call i32 @fclose(i32* %106)
store i32 1, i32* %4
br label %239
108: ; preds = %94
%109 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0)
%110 = zext i8 %109 to i32
store i32 %110, i32* %16
%111 = load i32, i32* %16
%112 = load i32*, i32** %8
%113 = call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 %111, i32* %112)
store i64 %113, i64* %11
%114 = load i64, i64* %11
%115 = load i32, i32* %16
%116 = zext i32 %115 to i64
%117 = icmp ne i64 %114, %116
br i1 %117, label %118, label %125
118: ; preds = %108
%119 = load i32, i32* @stderr
%120 = load i8*, i8** %7
%121 = load i32, i32* %18
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i8* %120, i32 %121)
%123 = load i32*, i32** %8
%124 = call i32 @fclose(i32* %123)
store i32 1, i32* %4
br label %239
125: ; preds = %108
%126 = load i32, i32* %16
%127 = call i32 @memcpy(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0), i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 %126)
%128 = load i32, i32* %16
%129 = zext i32 %128 to i64
%130 = getelementptr inbounds [257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 %129
store i8 0, i8* %130
%131 = load i32, i32* %6
%132 = icmp eq i32 %131, 1
%133 = zext i1 %132 to i64
%134 = select i1 %132, i32 1, i32 2
%135 = sext i32 %134 to i64
store i64 %135, i64* %13
%136 = load i64, i64* %13
%137 = trunc i64 %136 to i32
%138 = load i32*, i32** %8
%139 = call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 %137, i32* %138)
store i64 %139, i64* %11
%140 = load i64, i64* %11
%141 = load i64, i64* %13
%142 = icmp ne i64 %140, %141
br i1 %142, label %143, label %150
143: ; preds = %125
%144 = load i32, i32* @stderr
%145 = load i8*, i8** %7
%146 = load i32, i32* %18
%147 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0), i8* %145, i32 %146)
%148 = load i32*, i32** %8
%149 = call i32 @fclose(i32* %148)
store i32 1, i32* %4
br label %239
150: ; preds = %125
store i32 0, i32* %17
store i64 1, i64* %14
br label %151
151: ; preds = %165, %150
%152 = load i64, i64* %14
%153 = load i64, i64* %13
%154 = icmp ule i64 %152, %153
br i1 %154, label %155, label %168
155: ; preds = %151
%156 = load i32, i32* %17
%157 = mul i32 %156, 256
%158 = load i64, i64* %13
%159 = load i64, i64* %14
%160 = sub i64 %158, %159
%161 = getelementptr inbounds [65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 %160
%162 = load i8, i8* %161
%163 = zext i8 %162 to i32
%164 = add i32 %157, %163
store i32 %164, i32* %17
br label %165
165: ; preds = %155
%166 = load i64, i64* %14
%167 = add i64 %166, 1
store i64 %167, i64* %14
br label %151
168: ; preds = %151
%169 = load i32, i32* %17
%170 = icmp ugt i32 %169, 0
br i1 %170, label %171, label %192
171: ; preds = %168
%172 = load i32, i32* %17
%173 = load i32*, i32** %8
%174 = call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 %172, i32* %173)
store i64 %174, i64* %11
%175 = load i64, i64* %11
%176 = load i32, i32* %17
%177 = zext i32 %176 to i64
%178 = icmp ne i64 %175, %177
br i1 %178, label %179, label %186
179: ; preds = %171
%180 = load i32, i32* @stderr
%181 = load i8*, i8** %7
%182 = load i32, i32* %18
%183 = call i32 (i32, i8*, ...) @fprintf(i32 %180, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i8* %181, i32 %182)
%184 = load i32*, i32** %8
%185 = call i32 @fclose(i32* %184)
store i32 1, i32* %4
br label %239
186: ; preds = %171
%187 = load i32, i32* %17
%188 = call i32 @memcpy(i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0), i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 %187)
%189 = load i32, i32* %17
%190 = zext i32 %189 to i64
%191 = getelementptr inbounds [65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 %190
store i8 0, i8* %191
br label %193
192: ; preds = %168
store i8 0, i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0)
br label %193
193: ; preds = %192, %186
%194 = call i32 @strlen(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
%195 = icmp eq i32 %194, 0
br i1 %195, label %196, label %200
196: ; preds = %193
%197 = call i32 @strlen(i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0))
%198 = icmp eq i32 %197, 0
br i1 %198, label %199, label %200
199: ; preds = %196
br label %90
200: ; preds = %196, %193
store i8 0, i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([131073 x i8], [131073 x i8]* @dump_file.esc_value, i64 0, i64 0)
%201 = call i32 @escape_string(i32 0, i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0), i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0), i32 513)
store i32 %201, i32* %19
%202 = load i32, i32* %19
%203 = call i32 @strlen(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
%204 = icmp slt i32 %202, %203
br i1 %204, label %205, label %210
205: ; preds = %200
%206 = load i32, i32* @stderr
%207 = load i8*, i8** %7
%208 = load i32, i32* %18
%209 = call i32 (i32, i8*, ...) @fprintf(i32 %206, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0), i8* %207, i32 %208, i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
br label %220
210: ; preds = %200
%211 = call i32 @strlen(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
%212 = call i32 @strlen(i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0))
%213 = icmp slt i32 %211, %212
br i1 %213, label %214, label %219
214: ; preds = %210
%215 = load i32, i32* @stderr
%216 = load i8*, i8** %7
%217 = load i32, i32* %18
%218 = call i32 (i32, i8*, ...) @fprintf(i32 %215, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.10, i64 0, i64 0), i8* %216, i32 %217, i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0))
br label %219
219: ; preds = %214, %210
br label %220
220: ; preds = %219, %205
%221 = load i32, i32* %5
%222 = call i32 @escape_string(i32 %221, i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0), i8* getelementptr inbounds ([131073 x i8], [131073 x i8]* @dump_file.esc_value, i64 0, i64 0), i32 131073)
store i32 %222, i32* %19
%223 = load i32, i32* %19
%224 = call i32 @strlen(i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0))
%225 = icmp slt i32 %223, %224
br i1 %225, label %226, label %231
226: ; preds = %220
%227 = load i32, i32* @stderr
%228 = load i8*, i8** %7
%229 = load i32, i32* %18
%230 = call i32 (i32, i8*, ...) @fprintf(i32 %227, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.11, i64 0, i64 0), i8* %228, i32 %229, i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0))
br label %231
231: ; preds = %226, %220
%232 = load i32, i32* @stdout
%233 = call i32 (i32, i8*, ...) @fprintf(i32 %232, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0), i8* getelementptr inbounds ([131073 x i8], [131073 x i8]* @dump_file.esc_value, i64 0, i64 0))
%234 = load i32, i32* @stdout
%235 = call i32 @fflush(i32 %234)
br label %90
236: ; preds = %90
%237 = load i32*, i32** %8
%238 = call i32 @fclose(i32* %237)
store i32 0, i32* %4
br label %239
239: ; preds = %236, %179, %143, %118, %101, %65, %50, %34, %26
%240 = load i32, i32* %4
ret i32 %240
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"dump_file: No filename given\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@errno = global i32 0
@.str.2 = [33 x i8] c"dump_file: Error opening %s: %s\0A\00"
@dump_file.buffer = internal global [65536 x i8] zeroinitializer
@.str.3 = [59 x i8] c"dump_file: File %s: Error reading header and record count\0A\00"
@.str.4 = [7 x i8] c"DD-WRT\00"
@dump_file.name = internal global [257 x i8] zeroinitializer
@dump_file.value = internal global [65537 x i8] zeroinitializer
@.str.5 = [62 x i8] c"dump_file: File %s: Error reading name length from record %u\0A\00"
@.str.6 = [55 x i8] c"dump_file: File %s: Error reading name from record %u\0A\00"
@.str.7 = [63 x i8] c"dump_file: File %s: Error reading value length from record %u\0A\00"
@.str.8 = [56 x i8] c"dump_file: File %s: Error reading value from record %u\0A\00"
@dump_file.esc_name = internal global [513 x i8] zeroinitializer
@dump_file.esc_value = internal global [131073 x i8] zeroinitializer
@.str.9 = [59 x i8] c"dump_file: File %s: Record %u: cannot copy entire name %s\0A\00"
@.str.10 = [75 x i8] c"dump_file: File %s: Record %u: Name %s: contains non-printable characters\0A\00"
@.str.11 = [66 x i8] c"dump_file: File %s: Record %u: Name %s: cannot copy entire value\0A\00"
@stdout = global i32 0
@.str.12 = [7 x i8] c"%s=%s\0A\00"
define i32 @dump_file(i32 %0, i32 %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @strlen(i8* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5, %3
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %146
11: ; preds = %5
%12 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* @errno
%16 = tail call i8* @strerror(i32 %15)
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* %16)
br label %146
19: ; preds = %11
%20 = icmp eq i32 %1, 1
br i1 %20, label %21, label %28
21: ; preds = %19
%22 = tail call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 4, i32* %12)
%23 = icmp eq i64 %22, 4
br i1 %23, label %38, label %24
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%27 = tail call i32 @fclose(i32* %12)
br label %146
28: ; preds = %19
%29 = tail call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 8, i32* %12)
%30 = icmp eq i64 %29, 8
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = tail call i64 @memcmp(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 6)
%33 = icmp eq i64 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %31, %28
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%37 = tail call i32 @fclose(i32* %12)
br label %146
38: ; preds = %31, %21
%39 = phi i8* [ getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), %21 ], [ getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 6), %31 ]
%40 = phi i8* [ getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 1), %21 ], [ getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 7), %31 ]
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = shl nuw nsw i32 %42, 8
%44 = load i8, i8* %39
%45 = zext i8 %44 to i32
%46 = or i32 %43, %45
%47 = icmp eq i32 %46, 0
br i1 %47, label %144, label %48
48: ; preds = %38
%49 = select i1 %20, i32 1, i32 2
%50 = zext i32 %49 to i64
%51 = add nsw i64 %50, -1
%52 = icmp ult i64 %51, 3
br label %53
53: ; preds = %48, %142
%54 = phi i32 [ 0, %48 ], [ %55, %142 ]
%55 = add nuw nsw i32 %54, 1
%56 = tail call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 1, i32* %12)
%57 = icmp eq i64 %56, 1
br i1 %57, label %62, label %58
58: ; preds = %53
%59 = load i32, i32* @stderr
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i8* %2, i32 %55)
%61 = tail call i32 @fclose(i32* %12)
br label %146
62: ; preds = %53
%63 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0)
%64 = zext i8 %63 to i32
%65 = tail call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 %64, i32* %12)
%66 = zext i8 %63 to i64
%67 = icmp eq i64 %65, %66
br i1 %67, label %72, label %68
68: ; preds = %62
%69 = load i32, i32* @stderr
%70 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i8* %2, i32 %55)
%71 = tail call i32 @fclose(i32* %12)
br label %146
72: ; preds = %62
%73 = tail call i32 @memcpy(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0), i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 %64)
%74 = getelementptr inbounds [257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 %65
store i8 0, i8* %74
%75 = tail call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 %49, i32* %12)
%76 = icmp eq i64 %75, %50
br i1 %76, label %77, label %78
77: ; preds = %72
br i1 %52, label %83, label %82
78: ; preds = %72
%79 = load i32, i32* @stderr
%80 = tail call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0), i8* %2, i32 %55)
%81 = tail call i32 @fclose(i32* %12)
br label %146
82: ; preds = %77, %82
br label %82
83: ; preds = %77, %83
%84 = phi i32 [ %92, %83 ], [ 0, %77 ]
%85 = phi i64 [ %93, %83 ], [ 1, %77 ]
%86 = phi i64 [ %94, %83 ], [ 0, %77 ]
%87 = shl i32 %84, 8
%88 = sub nsw i64 %50, %85
%89 = getelementptr inbounds [65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = or i32 %87, %91
%93 = add nuw nsw i64 %85, 1
%94 = add i64 %86, 1
%95 = icmp eq i64 %94, %50
br i1 %95, label %96, label %83
96: ; preds = %83
%97 = icmp eq i32 %92, 0
br i1 %97, label %109, label %98
98: ; preds = %96
%99 = tail call i64 @fread(i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 1, i32 %92, i32* %12)
%100 = zext i32 %92 to i64
%101 = icmp eq i64 %99, %100
br i1 %101, label %106, label %102
102: ; preds = %98
%103 = load i32, i32* @stderr
%104 = tail call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i8* %2, i32 %55)
%105 = tail call i32 @fclose(i32* %12)
br label %146
106: ; preds = %98
%107 = tail call i32 @memcpy(i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0), i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dump_file.buffer, i64 0, i64 0), i32 %92)
%108 = getelementptr inbounds [65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 %99
store i8 0, i8* %108
br label %110
109: ; preds = %96
store i8 0, i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0)
br label %110
110: ; preds = %109, %106
%111 = tail call i32 @strlen(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %116
113: ; preds = %110
%114 = tail call i32 @strlen(i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0))
%115 = icmp eq i32 %114, 0
br i1 %115, label %142, label %116
116: ; preds = %113, %110
store i8 0, i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([131073 x i8], [131073 x i8]* @dump_file.esc_value, i64 0, i64 0)
%117 = tail call i32 @escape_string(i32 0, i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0), i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0), i32 513)
%118 = tail call i32 @strlen(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %123
120: ; preds = %116
%121 = load i32, i32* @stderr
%122 = tail call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0), i8* %2, i32 %55, i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
br label %130
123: ; preds = %116
%124 = tail call i32 @strlen(i8* getelementptr inbounds ([257 x i8], [257 x i8]* @dump_file.name, i64 0, i64 0))
%125 = tail call i32 @strlen(i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0))
%126 = icmp slt i32 %124, %125
br i1 %126, label %127, label %130
127: ; preds = %123
%128 = load i32, i32* @stderr
%129 = tail call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.10, i64 0, i64 0), i8* %2, i32 %55, i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0))
br label %130
130: ; preds = %123, %127, %120
%131 = tail call i32 @escape_string(i32 %0, i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0), i8* getelementptr inbounds ([131073 x i8], [131073 x i8]* @dump_file.esc_value, i64 0, i64 0), i32 131073)
%132 = tail call i32 @strlen(i8* getelementptr inbounds ([65537 x i8], [65537 x i8]* @dump_file.value, i64 0, i64 0))
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %137
134: ; preds = %130
%135 = load i32, i32* @stderr
%136 = tail call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.11, i64 0, i64 0), i8* %2, i32 %55, i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0))
br label %137
137: ; preds = %134, %130
%138 = load i32, i32* @stdout
%139 = tail call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([513 x i8], [513 x i8]* @dump_file.esc_name, i64 0, i64 0), i8* getelementptr inbounds ([131073 x i8], [131073 x i8]* @dump_file.esc_value, i64 0, i64 0))
%140 = load i32, i32* @stdout
%141 = tail call i32 @fflush(i32 %140)
br label %142
142: ; preds = %137, %113
%143 = icmp eq i32 %55, %46
br i1 %143, label %144, label %53
144: ; preds = %142, %38
%145 = tail call i32 @fclose(i32* %12)
br label %146
146: ; preds = %14, %58, %68, %78, %102, %144, %34, %24, %8
%147 = phi i32 [ 1, %8 ], [ 1, %14 ], [ 1, %24 ], [ 1, %34 ], [ 1, %58 ], [ 1, %68 ], [ 1, %78 ], [ 1, %102 ], [ 0, %144 ]
ret i32 %147
}