#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 /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
int S_IXGRP;
int S_IXOTH;
int S_IXUSR;
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
unsigned long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ get4k(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ put4k(int /*<<< orphan*/ *, char *);
int main(int argc, char **argv) {
  char inbuf[4096];
  FILE *ramDisk = NULL;
  FILE *inputVmlinux = NULL;
  FILE *outputVmlinux = NULL;
  unsigned i = 0;
  unsigned long ramFileLen = 0;
  unsigned long ramLen = 0;
  unsigned long roundR = 0;
  unsigned long kernelLen = 0;
  unsigned long actualKernelLen = 0;
  unsigned long round = 0;
  unsigned long roundedKernelLen = 0;
  unsigned long ramStartOffs = 0;
  unsigned long ramPages = 0;
  unsigned long roundedKernelPages = 0;
  if (argc < 2) {
    printf("Name of System Map file missing.\n");
    exit(1);
  }
  if (argc < 3) {
    printf("Name of vmlinux file missing.\n");
    exit(1);
  }
  if (argc < 4) {
    printf("Name of vmlinux output file missing.\n");
    exit(1);
  }
  ramDisk = fopen(argv[1], "r");
  if (!ramDisk) {
    printf("System Map file \"%s\" failed to open.\n", argv[1]);
    exit(1);
  }
  inputVmlinux = fopen(argv[2], "r");
  if (!inputVmlinux) {
    printf("vmlinux file \"%s\" failed to open.\n", argv[2]);
    exit(1);
  }
  outputVmlinux = fopen(argv[3], "w");
  if (!outputVmlinux) {
    printf("output vmlinux file \"%s\" failed to open.\n", argv[3]);
    exit(1);
  }
  fseek(ramDisk, 0, SEEK_END);
  ramFileLen = ftell(ramDisk);
  fseek(ramDisk, 0, SEEK_SET);
  printf("%s file size = %ld\n", argv[1], ramFileLen);
  ramLen = ramFileLen;
  roundR = 4096 - (ramLen % 4096);
  if (roundR) {
    printf("Rounding System Map file up to a multiple of 4096, adding %ld\n",
           roundR);
    ramLen += roundR;
  }
  printf("Rounded System Map size is %ld\n", ramLen);
  fseek(inputVmlinux, 0, SEEK_END);
  kernelLen = ftell(inputVmlinux);
  fseek(inputVmlinux, 0, SEEK_SET);
  printf("kernel file size = %ld\n", kernelLen);
  if (kernelLen == 0) {
    printf("You must have a linux kernel specified as argv[2]\n");
    exit(1);
  }
  actualKernelLen = kernelLen - (64 * 1024);
  printf("actual kernel length (minus ELF header) = %ld\n", actualKernelLen);
  round = actualKernelLen % 4096;
  roundedKernelLen = actualKernelLen;
  if (round)
    roundedKernelLen += (4096 - round);
  printf("actual kernel length rounded up to a 4k multiple = %ld\n",
         roundedKernelLen);
  ramStartOffs = roundedKernelLen;
  ramPages = ramLen / 4096;
  printf("System map pages to copy = %ld\n", ramPages);
  for (i = 0; i < (((64 * 1024) / 4096)); ++i) {
    get4k(inputVmlinux, inbuf);
    put4k(outputVmlinux, inbuf);
  }
  roundedKernelPages = roundedKernelLen / 4096;
  fseek(inputVmlinux, (64 * 1024), SEEK_SET);
  {
    for (i = 0; i < roundedKernelPages; ++i) {
      get4k(inputVmlinux, inbuf);
      if (i == 0) {
        unsigned long *p;
        printf("Storing embedded_sysmap_start at 0x3c\n");
        p = (unsigned long *)(inbuf + 0x3c);
        *p = ramStartOffs;
        printf("Storing embedded_sysmap_end at 0x44\n");
        p = (unsigned long *)(inbuf + 0x44);
        *p = ramStartOffs + ramFileLen;
      }
      put4k(outputVmlinux, inbuf);
    }
  }
  {
    for (i = 0; i < ramPages; ++i) {
      get4k(ramDisk, inbuf);
      put4k(outputVmlinux, inbuf);
    }
  }
  fclose(ramDisk);
  fclose(inputVmlinux);
  fclose(outputVmlinux);
  chmod(argv[3],
        S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1090,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x1018(%rbp)
movq   $0x0,-0x1020(%rbp)
movq   $0x0,-0x1028(%rbp)
movl   $0x0,-0x102c(%rbp)
movq   $0x0,-0x1038(%rbp)
movq   $0x0,-0x1040(%rbp)
movq   $0x0,-0x1048(%rbp)
movq   $0x0,-0x1050(%rbp)
movq   $0x0,-0x1058(%rbp)
movq   $0x0,-0x1060(%rbp)
movq   $0x0,-0x1068(%rbp)
movq   $0x0,-0x1070(%rbp)
movq   $0x0,-0x1078(%rbp)
movq   $0x0,-0x1080(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1264 <main+0xd4>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1286 <main+0xf6>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0x4,-0x8(%rbp)
jge    12a8 <main+0x118>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb0(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x1018(%rbp)
cmpq   $0x0,-0x1018(%rbp)
jne    12f1 <main+0x161>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd67(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x1020(%rbp)
cmpq   $0x0,-0x1020(%rbp)
jne    133a <main+0x1aa>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd46(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x1028(%rbp)
cmpq   $0x0,-0x1028(%rbp)
jne    1383 <main+0x1f3>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x1018(%rbp),%rdi
mov    0x2c4f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x1018(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,-0x1038(%rbp)
mov    -0x1018(%rbp),%rdi
mov    0x2bfd(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x1038(%rbp),%rdx
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1038(%rbp),%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rcx
and    $0xfff,%rcx
mov    $0x1000,%eax
sub    %rcx,%rax
mov    %rax,-0x1048(%rbp)
cmpq   $0x0,-0x1048(%rbp)
je     1444 <main+0x2b4>
mov    -0x1048(%rbp),%rsi
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1048(%rbp),%rax
add    -0x1040(%rbp),%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rsi
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1020(%rbp),%rdi
mov    0x2b79(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x1020(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,-0x1050(%rbp)
mov    -0x1020(%rbp),%rdi
mov    0x2b27(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x1050(%rbp),%rsi
lea    0xc86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x1050(%rbp)
jne    14d5 <main+0x345>
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x1050(%rbp),%rax
sub    $0x10000,%rax
mov    %rax,-0x1058(%rbp)
mov    -0x1058(%rbp),%rsi
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1058(%rbp),%rax
and    $0xfff,%rax
mov    %rax,-0x1060(%rbp)
mov    -0x1058(%rbp),%rax
mov    %rax,-0x1068(%rbp)
cmpq   $0x0,-0x1060(%rbp)
je     1548 <main+0x3b8>
mov    $0x1000,%eax
sub    -0x1060(%rbp),%rax
add    -0x1068(%rbp),%rax
mov    %rax,-0x1068(%rbp)
mov    -0x1068(%rbp),%rsi
lea    0xc52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1068(%rbp),%rax
mov    %rax,-0x1070(%rbp)
mov    -0x1040(%rbp),%rax
shr    $0xc,%rax
mov    %rax,-0x1078(%rbp)
mov    -0x1078(%rbp),%rsi
lea    0xc55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x102c(%rbp)
cmpl   $0x10,-0x102c(%rbp)
jae    15e3 <main+0x453>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
call   1060 <get4k@plt>
mov    -0x1028(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
call   10b0 <put4k@plt>
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x102c(%rbp)
jmp    159c <main+0x40c>
mov    -0x1068(%rbp),%rax
shr    $0xc,%rax
mov    %rax,-0x1080(%rbp)
mov    -0x1020(%rbp),%rdi
mov    0x29b5(%rip),%rax
mov    (%rax),%edx
mov    $0x10000,%esi
call   1070 <fseek@plt>
movl   $0x0,-0x102c(%rbp)
mov    -0x102c(%rbp),%eax
cmp    -0x1080(%rbp),%rax
jae    16dc <main+0x54c>
mov    -0x1020(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
call   1060 <get4k@plt>
cmpl   $0x0,-0x102c(%rbp)
jne    16b5 <main+0x525>
lea    0xbad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1010(%rbp),%rax
add    $0x3c,%rax
mov    %rax,-0x1088(%rbp)
mov    -0x1070(%rbp),%rcx
mov    -0x1088(%rbp),%rax
mov    %rcx,(%rax)
lea    0xba3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1010(%rbp),%rax
add    $0x44,%rax
mov    %rax,-0x1088(%rbp)
mov    -0x1070(%rbp),%rcx
add    -0x1038(%rbp),%rcx
mov    -0x1088(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1028(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
call   10b0 <put4k@plt>
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x102c(%rbp)
jmp    1619 <main+0x489>
movl   $0x0,-0x102c(%rbp)
mov    -0x102c(%rbp),%eax
cmp    -0x1078(%rbp),%rax
jae    1733 <main+0x5a3>
mov    -0x1018(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
call   1060 <get4k@plt>
mov    -0x1028(%rbp),%rdi
lea    -0x1010(%rbp),%rsi
call   10b0 <put4k@plt>
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x102c(%rbp)
jmp    16e6 <main+0x556>
mov    -0x1018(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1020(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1028(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0x283a(%rip),%rax
mov    (%rax),%esi
mov    0x2861(%rip),%rax
or     (%rax),%esi
mov    0x2860(%rip),%rax
or     (%rax),%esi
mov    0x282f(%rip),%rax
or     (%rax),%esi
mov    0x283e(%rip),%rax
or     (%rax),%esi
mov    0x2815(%rip),%rax
or     (%rax),%esi
mov    0x284c(%rip),%rax
or     (%rax),%esi
call   1080 <chmod@plt>
xor    %eax,%eax
add    $0x1090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1038,%rsp
cmp    $0x1,%edi
jle    1634 <main+0x494>
cmp    $0x2,%edi
je     163d <main+0x49d>
cmp    $0x3,%edi
jbe    1646 <main+0x4a6>
mov    %rsi,%r13
mov    0x8(%rsi),%rdi
lea    0xe26(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     164f <main+0x4af>
mov    %rax,%rbp
mov    0x10(%r13),%rdi
lea    0xe0a(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     165c <main+0x4bc>
mov    %rax,%r15
mov    0x18(%r13),%rdi
lea    0xe16(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1669 <main+0x4c9>
mov    %rax,%r12
mov    0x2db6(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %rbp,%rdi
call   1060 <ftell@plt>
mov    %rax,%r14
mov    0x2d70(%rip),%rax
mov    (%rax),%edx
mov    %rbp,0x20(%rsp)
mov    %rbp,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %r13,0x28(%rsp)
mov    0x8(%r13),%rsi
lea    0xdeb(%rip),%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%eax
and    $0xfff,%eax
mov    $0x1000,%ebx
sub    %rax,%rbx
lea    0xdde(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,0x18(%rsp)
add    %r14,%rbx
lea    0xe04(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %r15,%rdi
call   1060 <ftell@plt>
mov    %rax,%rbp
mov    0x2ce6(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
lea    0xde2(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
test   %rbp,%rbp
je     1685 <main+0x4e5>
lea    -0x10000(%rbp),%r14
lea    0xdd9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rsi
add    $0xffffffffffff1000,%rsi
and    $0xfffffffffffff000,%rsi
test   $0xfff,%ebp
cmove  %r14,%rsi
lea    0xddc(%rip),%rdi
mov    %rsi,%rbp
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,0x10(%rsp)
shr    $0xc,%rbx
lea    0xdfa(%rip),%rdi
mov    %rbx,0x8(%rsp)
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x30(%rsp),%r13
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <get4k@plt>
mov    %r15,%rbx
mov    %r12,%r15
mov    %r12,%rdi
mov    %r13,%rsi
call   10c0 <put4k@plt>
mov    0x2aeb(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%r12
mov    %rbx,%rdi
mov    $0x10000,%esi
call   1080 <fseek@plt>
mov    %rbp,(%rsp)
cmp    $0x1000,%rbp
mov    0x18(%rsp),%rbx
jae    15b9 <main+0x419>
cmpq   $0x1000,0x10(%rsp)
mov    0x20(%rsp),%r14
mov    0x8(%rsp),%r13
jb     1540 <main+0x3a0>
mov    $0x1,%ebx
lea    0x30(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbp,%rsi
call   1070 <get4k@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10c0 <put4k@plt>
mov    %ebx,%eax
add    $0x1,%ebx
cmp    %rax,%r13
ja     1520 <main+0x380>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    0x2a41(%rip),%rax
mov    0x2a6a(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2a67(%rip),%rax
or     (%rax),%esi
mov    0x2a36(%rip),%rax
or     (%rax),%esi
mov    0x2a45(%rip),%rax
or     (%rax),%esi
mov    0x2a1c(%rip),%rax
or     (%rax),%esi
mov    0x28(%rsp),%rax
mov    0x18(%rax),%rdi
mov    0x2a4a(%rip),%rax
or     (%rax),%esi
call   1090 <chmod@plt>
xor    %eax,%eax
add    $0x1038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rsp),%rax
mov    %rax,%r14
shr    $0xc,%r14
add    %rax,%rbx
mov    $0x1,%r13d
lea    0x30(%rsp),%rbp
jmp    15fb <main+0x45b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbp,%rsi
call   10c0 <put4k@plt>
mov    %r13d,%eax
add    $0x1,%r13d
cmp    %rax,%r14
jbe    14f5 <main+0x355>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1070 <get4k@plt>
cmp    $0x1,%r13d
jne    15e0 <main+0x440>
lea    0xb53(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rax
mov    %rax,0x6c(%rsp)
lea    0xb64(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,0x74(%rsp)
jmp    15e0 <main+0x440>
lea    0xbea(%rip),%rdi
jmp    168c <main+0x4ec>
lea    0xbc3(%rip),%rdi
jmp    168c <main+0x4ec>
lea    0xb95(%rip),%rdi
jmp    168c <main+0x4ec>
mov    0x8(%r13),%rsi
lea    0x9a8(%rip),%rdi
jmp    1674 <main+0x4d4>
mov    0x10(%r13),%rsi
lea    0x9ca(%rip),%rdi
jmp    1674 <main+0x4d4>
mov    0x18(%r13),%rsi
lea    0x9b6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xb24(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Name of System Map file missing.\0A\00"
@.str.1 = [31 x i8] c"Name of vmlinux file missing.\0A\00"
@.str.2 = [38 x i8] c"Name of vmlinux output file missing.\0A\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [38 x i8] c"System Map file \22%s\22 failed to open.\0A\00"
@.str.5 = [35 x i8] c"vmlinux file \22%s\22 failed to open.\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [42 x i8] c"output vmlinux file \22%s\22 failed to open.\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.8 = [20 x i8] c"%s file size = %ld\0A\00"
@.str.9 = [63 x i8] c"Rounding System Map file up to a multiple of 4096, adding %ld\0A\00"
@.str.10 = [32 x i8] c"Rounded System Map size is %ld\0A\00"
@.str.11 = [24 x i8] c"kernel file size = %ld\0A\00"
@.str.12 = [51 x i8] c"You must have a linux kernel specified as argv[2]\0A\00"
@.str.13 = [47 x i8] c"actual kernel length (minus ELF header) = %ld\0A\00"
@.str.14 = [56 x i8] c"actual kernel length rounded up to a 4k multiple = %ld\0A\00"
@.str.15 = [32 x i8] c"System map pages to copy = %ld\0A\00"
@.str.16 = [39 x i8] c"Storing embedded_sysmap_start at 0x3c\0A\00"
@.str.17 = [37 x i8] c"Storing embedded_sysmap_end at 0x44\0A\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %7
store i32* null, i32** %8
store i32* null, i32** %9
store i32 0, i32* %10
store i64 0, i64* %11
store i64 0, i64* %12
store i64 0, i64* %13
store i64 0, i64* %14
store i64 0, i64* %15
store i64 0, i64* %16
store i64 0, i64* %17
store i64 0, i64* %18
store i64 0, i64* %19
store i64 0, i64* %20
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 2
br i1 %23, label %24, label %27
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %27
%34 = load i32, i32* %4
%35 = icmp slt i32 %34, 4
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %33
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %43, i32** %7
%44 = load i32*, i32** %7
%45 = icmp ne i32* %44, null
br i1 %45, label %52, label %46
46: ; preds = %39
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %39
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %56, i32** %8
%57 = load i32*, i32** %8
%58 = icmp ne i32* %57, null
br i1 %58, label %65, label %59
59: ; preds = %52
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i8* %62)
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %52
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 3
%68 = load i8*, i8** %67
%69 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %69, i32** %9
%70 = load i32*, i32** %9
%71 = icmp ne i32* %70, null
br i1 %71, label %78, label %72
72: ; preds = %65
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 3
%75 = load i8*, i8** %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %75)
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %65
%79 = load i32*, i32** %7
%80 = load i32, i32* @SEEK_END
%81 = call i32 @fseek(i32* %79, i32 0, i32 %80)
%82 = load i32*, i32** %7
%83 = call i64 @ftell(i32* %82)
store i64 %83, i64* %11
%84 = load i32*, i32** %7
%85 = load i32, i32* @SEEK_SET
%86 = call i32 @fseek(i32* %84, i32 0, i32 %85)
%87 = load i8**, i8*** %5
%88 = getelementptr inbounds i8*, i8** %87, i64 1
%89 = load i8*, i8** %88
%90 = load i64, i64* %11
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %89, i64 %90)
%92 = load i64, i64* %11
store i64 %92, i64* %12
%93 = load i64, i64* %12
%94 = urem i64 %93, 4096
%95 = sub i64 4096, %94
store i64 %95, i64* %13
%96 = load i64, i64* %13
%97 = icmp ne i64 %96, 0
br i1 %97, label %98, label %104
98: ; preds = %78
%99 = load i64, i64* %13
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.9, i64 0, i64 0), i64 %99)
%101 = load i64, i64* %13
%102 = load i64, i64* %12
%103 = add i64 %102, %101
store i64 %103, i64* %12
br label %104
104: ; preds = %98, %78
%105 = load i64, i64* %12
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i64 %105)
%107 = load i32*, i32** %8
%108 = load i32, i32* @SEEK_END
%109 = call i32 @fseek(i32* %107, i32 0, i32 %108)
%110 = load i32*, i32** %8
%111 = call i64 @ftell(i32* %110)
store i64 %111, i64* %14
%112 = load i32*, i32** %8
%113 = load i32, i32* @SEEK_SET
%114 = call i32 @fseek(i32* %112, i32 0, i32 %113)
%115 = load i64, i64* %14
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i64 %115)
%117 = load i64, i64* %14
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %104
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0))
%121 = call i32 @exit(i32 1)
unreachable
122: ; preds = %104
%123 = load i64, i64* %14
%124 = sub i64 %123, 65536
store i64 %124, i64* %15
%125 = load i64, i64* %15
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.13, i64 0, i64 0), i64 %125)
%127 = load i64, i64* %15
%128 = urem i64 %127, 4096
store i64 %128, i64* %16
%129 = load i64, i64* %15
store i64 %129, i64* %17
%130 = load i64, i64* %16
%131 = icmp ne i64 %130, 0
br i1 %131, label %132, label %137
132: ; preds = %122
%133 = load i64, i64* %16
%134 = sub i64 4096, %133
%135 = load i64, i64* %17
%136 = add i64 %135, %134
store i64 %136, i64* %17
br label %137
137: ; preds = %132, %122
%138 = load i64, i64* %17
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i64 %138)
%140 = load i64, i64* %17
store i64 %140, i64* %18
%141 = load i64, i64* %12
%142 = udiv i64 %141, 4096
store i64 %142, i64* %19
%143 = load i64, i64* %19
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i64 %143)
store i32 0, i32* %10
br label %145
145: ; preds = %155, %137
%146 = load i32, i32* %10
%147 = icmp ult i32 %146, 16
br i1 %147, label %148, label %158
148: ; preds = %145
%149 = load i32*, i32** %8
%150 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%151 = call i32 @get4k(i32* %149, i8* %150)
%152 = load i32*, i32** %9
%153 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%154 = call i32 @put4k(i32* %152, i8* %153)
br label %155
155: ; preds = %148
%156 = load i32, i32* %10
%157 = add i32 %156, 1
store i32 %157, i32* %10
br label %145
158: ; preds = %145
%159 = load i64, i64* %17
%160 = udiv i64 %159, 4096
store i64 %160, i64* %20
%161 = load i32*, i32** %8
%162 = load i32, i32* @SEEK_SET
%163 = call i32 @fseek(i32* %161, i32 65536, i32 %162)
store i32 0, i32* %10
br label %164
164: ; preds = %194, %158
%165 = load i32, i32* %10
%166 = zext i32 %165 to i64
%167 = load i64, i64* %20
%168 = icmp ult i64 %166, %167
br i1 %168, label %169, label %197
169: ; preds = %164
%170 = load i32*, i32** %8
%171 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%172 = call i32 @get4k(i32* %170, i8* %171)
%173 = load i32, i32* %10
%174 = icmp eq i32 %173, 0
br i1 %174, label %175, label %190
175: ; preds = %169
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.16, i64 0, i64 0))
%177 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%178 = getelementptr inbounds i8, i8* %177, i64 60
%179 = bitcast i8* %178 to i64*
store i64* %179, i64** %21
%180 = load i64, i64* %18
%181 = load i64*, i64** %21
store i64 %180, i64* %181
%182 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.17, i64 0, i64 0))
%183 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%184 = getelementptr inbounds i8, i8* %183, i64 68
%185 = bitcast i8* %184 to i64*
store i64* %185, i64** %21
%186 = load i64, i64* %18
%187 = load i64, i64* %11
%188 = add i64 %186, %187
%189 = load i64*, i64** %21
store i64 %188, i64* %189
br label %190
190: ; preds = %175, %169
%191 = load i32*, i32** %9
%192 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%193 = call i32 @put4k(i32* %191, i8* %192)
br label %194
194: ; preds = %190
%195 = load i32, i32* %10
%196 = add i32 %195, 1
store i32 %196, i32* %10
br label %164
197: ; preds = %164
store i32 0, i32* %10
br label %198
198: ; preds = %210, %197
%199 = load i32, i32* %10
%200 = zext i32 %199 to i64
%201 = load i64, i64* %19
%202 = icmp ult i64 %200, %201
br i1 %202, label %203, label %213
203: ; preds = %198
%204 = load i32*, i32** %7
%205 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%206 = call i32 @get4k(i32* %204, i8* %205)
%207 = load i32*, i32** %9
%208 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%209 = call i32 @put4k(i32* %207, i8* %208)
br label %210
210: ; preds = %203
%211 = load i32, i32* %10
%212 = add i32 %211, 1
store i32 %212, i32* %10
br label %198
213: ; preds = %198
%214 = load i32*, i32** %7
%215 = call i32 @fclose(i32* %214)
%216 = load i32*, i32** %8
%217 = call i32 @fclose(i32* %216)
%218 = load i32*, i32** %9
%219 = call i32 @fclose(i32* %218)
%220 = load i8**, i8*** %5
%221 = getelementptr inbounds i8*, i8** %220, i64 3
%222 = load i8*, i8** %221
%223 = load i32, i32* @S_IRUSR
%224 = load i32, i32* @S_IWUSR
%225 = or i32 %223, %224
%226 = load i32, i32* @S_IXUSR
%227 = or i32 %225, %226
%228 = load i32, i32* @S_IRGRP
%229 = or i32 %227, %228
%230 = load i32, i32* @S_IXGRP
%231 = or i32 %229, %230
%232 = load i32, i32* @S_IROTH
%233 = or i32 %231, %232
%234 = load i32, i32* @S_IXOTH
%235 = or i32 %233, %234
%236 = call i32 @chmod(i8* %222, i32 %235)
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [38 x i8] c"System Map file \22%s\22 failed to open.\0A\00"
@.str.5 = [35 x i8] c"vmlinux file \22%s\22 failed to open.\0A\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [42 x i8] c"output vmlinux file \22%s\22 failed to open.\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.8 = [20 x i8] c"%s file size = %ld\0A\00"
@.str.9 = [63 x i8] c"Rounding System Map file up to a multiple of 4096, adding %ld\0A\00"
@.str.10 = [32 x i8] c"Rounded System Map size is %ld\0A\00"
@.str.11 = [24 x i8] c"kernel file size = %ld\0A\00"
@.str.13 = [47 x i8] c"actual kernel length (minus ELF header) = %ld\0A\00"
@.str.14 = [56 x i8] c"actual kernel length rounded up to a 4k multiple = %ld\0A\00"
@.str.15 = [32 x i8] c"System map pages to copy = %ld\0A\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
@S_IRGRP = global i32 0
@S_IXGRP = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@str = [38 x i8] c"Storing embedded_sysmap_start at 0x3c\00"
@str.18 = [36 x i8] c"Storing embedded_sysmap_end at 0x44\00"
@str.19 = [50 x i8] c"You must have a linux kernel specified as argv[2]\00"
@str.20 = [37 x i8] c"Name of vmlinux output file missing.\00"
@str.21 = [30 x i8] c"Name of vmlinux file missing.\00"
@str.22 = [33 x i8] c"Name of System Map file missing.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.22, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = icmp eq i32 %0, 2
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.21, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %9
%15 = icmp ult i32 %0, 4
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.20, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %14
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i8*, i8** %20
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %19
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = tail call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i8*, i8** %29
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%36 = tail call i32 @exit(i32 1)
unreachable
37: ; preds = %28
%38 = getelementptr inbounds i8*, i8** %1, i64 3
%39 = load i8*, i8** %38
%40 = tail call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %46
42: ; preds = %37
%43 = load i8*, i8** %38
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %43)
%45 = tail call i32 @exit(i32 1)
unreachable
46: ; preds = %37
%47 = load i32, i32* @SEEK_END
%48 = tail call i32 @fseek(i32* %22, i32 0, i32 %47)
%49 = tail call i64 @ftell(i32* %22)
%50 = load i32, i32* @SEEK_SET
%51 = tail call i32 @fseek(i32* %22, i32 0, i32 %50)
%52 = load i8*, i8** %20
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %52, i64 %49)
%54 = and i64 %49, 4095
%55 = sub nuw nsw i64 4096, %54
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.9, i64 0, i64 0), i64 %55)
%57 = add i64 %55, %49
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i64 %57)
%59 = load i32, i32* @SEEK_END
%60 = tail call i32 @fseek(i32* %31, i32 0, i32 %59)
%61 = tail call i64 @ftell(i32* %31)
%62 = load i32, i32* @SEEK_SET
%63 = tail call i32 @fseek(i32* %31, i32 0, i32 %62)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i64 %61)
%65 = icmp eq i64 %61, 0
br i1 %65, label %66, label %69
66: ; preds = %46
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.19, i64 0, i64 0))
%68 = tail call i32 @exit(i32 1)
unreachable
69: ; preds = %46
%70 = add i64 %61, -65536
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.13, i64 0, i64 0), i64 %70)
%72 = and i64 %61, 4095
%73 = icmp eq i64 %72, 0
%74 = add i64 %61, -61440
%75 = and i64 %74, -4096
%76 = select i1 %73, i64 %70, i64 %75
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.14, i64 0, i64 0), i64 %76)
%78 = lshr i64 %57, 12
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i64 %78)
%80 = call i32 @get4k(i32* %31, i8* %4)
%81 = call i32 @put4k(i32* %40, i8* %4)
%82 = call i32 @get4k(i32* %31, i8* %4)
%83 = call i32 @put4k(i32* %40, i8* %4)
%84 = call i32 @get4k(i32* %31, i8* %4)
%85 = call i32 @put4k(i32* %40, i8* %4)
%86 = call i32 @get4k(i32* %31, i8* %4)
%87 = call i32 @put4k(i32* %40, i8* %4)
%88 = call i32 @get4k(i32* %31, i8* %4)
%89 = call i32 @put4k(i32* %40, i8* %4)
%90 = call i32 @get4k(i32* %31, i8* %4)
%91 = call i32 @put4k(i32* %40, i8* %4)
%92 = call i32 @get4k(i32* %31, i8* %4)
%93 = call i32 @put4k(i32* %40, i8* %4)
%94 = call i32 @get4k(i32* %31, i8* %4)
%95 = call i32 @put4k(i32* %40, i8* %4)
%96 = call i32 @get4k(i32* %31, i8* %4)
%97 = call i32 @put4k(i32* %40, i8* %4)
%98 = call i32 @get4k(i32* %31, i8* %4)
%99 = call i32 @put4k(i32* %40, i8* %4)
%100 = call i32 @get4k(i32* %31, i8* %4)
%101 = call i32 @put4k(i32* %40, i8* %4)
%102 = call i32 @get4k(i32* %31, i8* %4)
%103 = call i32 @put4k(i32* %40, i8* %4)
%104 = call i32 @get4k(i32* %31, i8* %4)
%105 = call i32 @put4k(i32* %40, i8* %4)
%106 = call i32 @get4k(i32* %31, i8* %4)
%107 = call i32 @put4k(i32* %40, i8* %4)
%108 = call i32 @get4k(i32* %31, i8* %4)
%109 = call i32 @put4k(i32* %40, i8* %4)
%110 = call i32 @get4k(i32* %31, i8* %4)
%111 = call i32 @put4k(i32* %40, i8* %4)
%112 = lshr i64 %76, 12
%113 = load i32, i32* @SEEK_SET
%114 = call i32 @fseek(i32* %31, i32 65536, i32 %113)
%115 = icmp ult i64 %76, 4096
br i1 %115, label %122, label %116
116: ; preds = %69
%117 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 60
%118 = bitcast i8* %117 to i64*
%119 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 68
%120 = bitcast i8* %119 to i64*
%121 = add i64 %76, %49
br label %124
122: ; preds = %131, %69
%123 = icmp ult i64 %57, 4096
br i1 %123, label %143, label %136
124: ; preds = %116, %131
%125 = phi i32 [ 0, %116 ], [ %133, %131 ]
%126 = call i32 @get4k(i32* %31, i8* %4)
%127 = icmp eq i32 %125, 0
br i1 %127, label %128, label %131
128: ; preds = %124
%129 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
store i64 %76, i64* %118
%130 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.18, i64 0, i64 0))
store i64 %121, i64* %120
br label %131
131: ; preds = %128, %124
%132 = call i32 @put4k(i32* %40, i8* %4)
%133 = add i32 %125, 1
%134 = zext i32 %133 to i64
%135 = icmp ugt i64 %112, %134
br i1 %135, label %124, label %122
136: ; preds = %122, %136
%137 = phi i32 [ %140, %136 ], [ 0, %122 ]
%138 = call i32 @get4k(i32* %22, i8* %4)
%139 = call i32 @put4k(i32* %40, i8* %4)
%140 = add i32 %137, 1
%141 = zext i32 %140 to i64
%142 = icmp ugt i64 %78, %141
br i1 %142, label %136, label %143
143: ; preds = %136, %122
%144 = call i32 @fclose(i32* %22)
%145 = call i32 @fclose(i32* %31)
%146 = call i32 @fclose(i32* %40)
%147 = load i8*, i8** %38
%148 = load i32, i32* @S_IRUSR
%149 = load i32, i32* @S_IWUSR
%150 = or i32 %149, %148
%151 = load i32, i32* @S_IXUSR
%152 = or i32 %150, %151
%153 = load i32, i32* @S_IRGRP
%154 = or i32 %152, %153
%155 = load i32, i32* @S_IXGRP
%156 = or i32 %154, %155
%157 = load i32, i32* @S_IROTH
%158 = or i32 %156, %157
%159 = load i32, i32* @S_IXOTH
%160 = or i32 %158, %159
%161 = call i32 @chmod(i8* %147, i32 %160)
ret i32 0
}