#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 off_t;

/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int O_RDWR;
int O_SYNC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(unsigned int *, void *, int);
void *mmap(int /*<<< orphan*/, int, int, int /*<<< orphan*/, int, int);
int munmap(void *, int);
int open(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int memfd;
  void *mapped_base, *mapped_dev_base;
  off_t dev_base = 0x7E200000;
  int memfd_1;
  void *mapped_base_1, *mapped_dev_base_1;
  off_t dev_base_1 = 0x20000000;
  int memfd_2;
  void *mapped_base_2, *mapped_dev_base_2;
  off_t dev_base_2 = 0x30000000;
  unsigned int TimeOut = 5;
  unsigned int ResetMask;
  unsigned int RegValue;
  unsigned int SrcArray[262144];
  unsigned int DestArray[262144];
  unsigned int Index;
  for (Index = 0; Index < (262144 / 2); Index++) {
    SrcArray[Index] = 0x5A5A5A5A;
    DestArray[Index] = 0;
  }
  memfd_1 = open("/dev/mem", O_RDWR | O_SYNC);
  if (memfd_1 == -1) {
    printf("Can't open /dev/mem.\n");
    exit(0);
  }
  printf("/dev/mem opened.\n");
  mapped_base_1 = mmap(0, 0x10000000, PROT_READ | PROT_WRITE, MAP_SHARED,
                       memfd_1, dev_base_1 & ~(0x10000000 - 1));
  if (mapped_base_1 == (void *)-1) {
    printf("Can't map the memory to user space.\n");
    exit(0);
  }
  printf("Memory mapped at address %p.\n", mapped_base_1);
  mapped_dev_base_1 = mapped_base_1 + (dev_base_1 & (0x10000000 - 1));
  memcpy(mapped_dev_base_1, SrcArray, (262144));
  if (munmap(mapped_base_1, 0x10000000) == -1) {
    printf("Can't unmap memory from user space.\n");
    exit(0);
  }
  close(memfd_1);
  memfd = open("/dev/mem", O_RDWR | O_SYNC);
  if (memfd == -1) {
    printf("Can't open /dev/mem.\n");
    exit(0);
  }
  printf("/dev/mem opened.\n");
  mapped_base = mmap(0, 4096UL, PROT_READ | PROT_WRITE, MAP_SHARED, memfd,
                     dev_base & ~(4096UL - 1));
  if (mapped_base == (void *)-1) {
    printf("Can't map the memory to user space.\n");
    exit(0);
  }
  mapped_dev_base = mapped_base + (dev_base & (4096UL - 1));
  do {
    ResetMask = (unsigned long)0x00000004;
    *((volatile unsigned long *)(mapped_dev_base + 0x00000000)) =
        (unsigned long)ResetMask;
    ResetMask = *((volatile unsigned long *)(mapped_dev_base + 0x00000000));
    if (!(ResetMask & 0x00000004)) {
      break;
    }
    TimeOut -= 1;
  } while (TimeOut);
  RegValue = *((volatile unsigned long *)(mapped_dev_base + 0x00000000));
  RegValue = (unsigned long)(RegValue | 0x00007000);
  *((volatile unsigned long *)(mapped_dev_base + 0x00000000)) =
      (unsigned long)RegValue;
  RegValue = *((volatile unsigned long *)(mapped_dev_base + 0x00000004));
  if (!(RegValue & 0x00000002)) {
    printf("BUS IS BUSY Error Condition \n\r");
    return 1;
  }
  RegValue = *((volatile unsigned long *)(mapped_dev_base + 0x00000000));
  if ((RegValue & 0x00000008)) {
    RegValue = (unsigned long)(RegValue & (~0x00000008));
    printf("Reading \n \r");
    *((volatile unsigned long *)(mapped_dev_base + 0x00000000)) =
        (unsigned long)RegValue;
  }
  *((volatile unsigned long *)(mapped_dev_base + 0x00000018)) =
      (unsigned long)0x20000000;
  *((volatile unsigned long *)(mapped_dev_base + 0x00000020)) =
      (unsigned long)0x30000000;
  RegValue = (unsigned long)(262144);
  *((volatile unsigned long *)(mapped_dev_base + 0x00000028)) =
      (unsigned long)RegValue;
  do {
    RegValue = *((volatile unsigned long *)(mapped_dev_base + 0x00000004));
  } while (!(RegValue & 0x00007000));
  if ((RegValue & 0x00001000)) {
    printf("Transfer Completed \n\r ");
  }
  if ((RegValue & 0x00002000)) {
    printf("IRQ Delay Interrupt\n\r ");
  }
  if ((RegValue & 0x00004000)) {
    printf(" Transfer Error Interrupt\n\r ");
  }
  if (munmap(mapped_base, 4096UL) == -1) {
    printf("Can't unmap memory from user space.\n");
    exit(0);
  }
  close(memfd);
  memfd_2 = open("/dev/mem", O_RDWR | O_SYNC);
  if (memfd_2 == -1) {
    printf("Can't open /dev/mem.\n");
    exit(0);
  }
  printf("/dev/mem opened.\n");
  mapped_base_2 = mmap(0, 0x10000000, PROT_READ | PROT_WRITE, MAP_SHARED,
                       memfd_2, dev_base_2 & ~(0x10000000 - 1));
  if (mapped_base_2 == (void *)-1) {
    printf("Can't map the memory to user space.\n");
    exit(0);
  }
  printf("Memory mapped at address %p.\n", mapped_base_2);
  mapped_dev_base_2 = mapped_base_2 + (dev_base_2 & (0x10000000 - 1));
  memcpy(DestArray, mapped_dev_base_2, (262144));
  if (munmap(mapped_base_2, 0x10000000) == -1) {
    printf("Can't unmap memory from user space.\n");
    exit(0);
  }
  close(memfd_2);
  for (Index = 0; Index < (262144 / 4); Index++) {
    if (SrcArray[Index] != DestArray[Index]) {
      printf("Error in the Data comparison \n \r");
      return 1;
    }
  }
  printf("DATA Transfer is Successful \n\r");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200070,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7e200000,-0x1c(%rbp)
movl   $0x20000000,-0x34(%rbp)
movl   $0x30000000,-0x4c(%rbp)
movl   $0x5,-0x50(%rbp)
movl   $0x0,-0x200064(%rbp)
cmpl   $0x20000,-0x200064(%rbp)
jae    11ee <main+0x7e>
mov    -0x200064(%rbp),%eax
movl   $0x5a5a5a5a,-0x100060(%rbp,%rax,4)
5a 5a 5a 5a
mov    -0x200064(%rbp),%eax
movl   $0x0,-0x200060(%rbp,%rax,4)
mov    -0x200064(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x200064(%rbp)
jmp    11a8 <main+0x38>
mov    0x2de3(%rip),%rax
mov    (%rax),%esi
mov    0x2dd2(%rip),%rax
or     (%rax),%esi
lea    0xdf9(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    122e <main+0xbe>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2db5(%rip),%rax
mov    (%rax),%edx
mov    0x2d74(%rip),%rax
or     (%rax),%edx
mov    0x2d93(%rip),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x34(%rbp),%r9d
and    $0xf0000000,%r9d
xor    %edi,%edi
mov    $0x10000000,%esi
call   1030 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x28(%rbp)
jne    129c <main+0x12c>
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x28(%rbp),%rsi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
and    $0xfffffff,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x100060(%rbp),%rsi
mov    $0x40000,%edx
call   1060 <memcpy@plt>
mov    -0x28(%rbp),%rdi
mov    $0x10000000,%esi
call   1070 <munmap@plt>
cmp    $0xffffffff,%eax
jne    1306 <main+0x196>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x20(%rbp),%edi
call   1050 <close@plt>
mov    0x2cc3(%rip),%rax
mov    (%rax),%esi
mov    0x2cb2(%rip),%rax
or     (%rax),%esi
lea    0xcd9(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    134e <main+0x1de>
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c95(%rip),%rax
mov    (%rax),%edx
mov    0x2c54(%rip),%rax
or     (%rax),%edx
mov    0x2c73(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%r8d
movslq -0x1c(%rbp),%rax
and    $0xfffffffffffff000,%rax
mov    %eax,%r9d
xor    %edi,%edi
mov    $0x1000,%esi
call   1030 <mmap@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x10(%rbp)
jne    13be <main+0x24e>
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
and    $0xfff,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1405 <main+0x295>
jmp    1418 <main+0x2a8>
mov    -0x50(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
jne    13d4 <main+0x264>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
or     $0x7000,%eax
mov    %eax,%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%rax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    146f <main+0x2ff>
lea    0xc3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    172f <main+0x5bf>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     14ad <main+0x33d>
mov    -0x58(%rbp),%eax
and    $0xfffffff7,%eax
mov    %eax,%eax
mov    %eax,-0x58(%rbp)
lea    0xc1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x58(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x20000000,0x18(%rax)
20
mov    -0x18(%rbp),%rax
movq   $0x30000000,0x20(%rax)
30
movl   $0x40000,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%rax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
and    $0x7000,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    14d9 <main+0x369>
mov    -0x58(%rbp),%eax
and    $0x1000,%eax
cmp    $0x0,%eax
je     151b <main+0x3ab>
lea    0xbb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x58(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     153a <main+0x3ca>
lea    0xba8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x58(%rbp),%eax
and    $0x4000,%eax
cmp    $0x0,%eax
je     1559 <main+0x3e9>
lea    0xba0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1000,%esi
call   1070 <munmap@plt>
cmp    $0xffffffff,%eax
jne    1585 <main+0x415>
lea    0xafd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x8(%rbp),%edi
call   1050 <close@plt>
mov    0x2a44(%rip),%rax
mov    (%rax),%esi
mov    0x2a33(%rip),%rax
or     (%rax),%esi
lea    0xa5a(%rip),%rdi
call   1080 <open@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    15cd <main+0x45d>
lea    0xa4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xa4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2a16(%rip),%rax
mov    (%rax),%edx
mov    0x29d5(%rip),%rax
or     (%rax),%edx
mov    0x29f4(%rip),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%r8d
mov    -0x4c(%rbp),%r9d
and    $0xf0000000,%r9d
xor    %edi,%edi
mov    $0x10000000,%esi
call   1030 <mmap@plt>
mov    %rax,-0x40(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x40(%rbp)
jne    163b <main+0x4cb>
lea    0xa04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x40(%rbp),%rsi
lea    0xa10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
and    $0xfffffff,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
lea    -0x200060(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    $0x40000,%edx
call   1060 <memcpy@plt>
mov    -0x40(%rbp),%rdi
mov    $0x10000000,%esi
call   1070 <munmap@plt>
cmp    $0xffffffff,%eax
jne    16a5 <main+0x535>
lea    0x9dd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x38(%rbp),%edi
call   1050 <close@plt>
movl   $0x0,-0x200064(%rbp)
cmpl   $0x10000,-0x200064(%rbp)
jae    171a <main+0x5aa>
mov    -0x200064(%rbp),%eax
mov    -0x100060(%rbp,%rax,4),%eax
mov    -0x200064(%rbp),%ecx
cmp    -0x200060(%rbp,%rcx,4),%eax
je     1701 <main+0x591>
lea    0xa21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    172f <main+0x5bf>
jmp    1706 <main+0x596>
mov    -0x200064(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x200064(%rbp)
jmp    16b7 <main+0x547>
lea    0xa0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x200070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200008,%rsp
lea    0x100000(%rsp),%rdi
mov    $0x80000,%edx
mov    $0x5a,%esi
call   1060 <memset@plt>
mov    %rsp,%rdi
mov    $0x80000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
mov    0x2e0a(%rip),%r14
mov    0x2dfb(%rip),%r15
mov    (%r15),%esi
or     (%r14),%esi
lea    0xe1e(%rip),%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
je     154f <main+0x3bf>
mov    %eax,%ebx
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
mov    0x2df3(%rip),%r13
mov    0x2db4(%rip),%rax
mov    (%rax),%edx
or     0x0(%r13),%edx
mov    0x2dcf(%rip),%r12
mov    (%r12),%ecx
xor    %edi,%edi
mov    $0x10000000,%esi
mov    %ebx,%r8d
mov    $0x20000000,%r9d
call   1040 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
je     1558 <main+0x3c8>
mov    %rax,%rbp
lea    0xdc3(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x100000(%rsp),%rsi
mov    %rbp,%rdi
mov    $0x40000,%edx
call   1080 <memcpy@plt>
mov    %rbp,%rdi
mov    $0x10000000,%esi
call   1090 <munmap@plt>
cmp    $0xffffffff,%eax
je     1561 <main+0x3d1>
mov    %ebx,%edi
call   1070 <close@plt>
mov    (%r15),%esi
or     (%r14),%esi
lea    0xd71(%rip),%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
je     154f <main+0x3bf>
mov    %eax,%r15d
lea    0xe36(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edx
or     0x0(%r13),%edx
mov    (%r12),%ecx
xor    %edi,%edi
mov    $0x1000,%esi
mov    %r15d,%r8d
mov    $0x7e200000,%r9d
call   1040 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
je     1558 <main+0x3c8>
mov    %rax,%rbx
movq   $0x4,(%rax)
testq  $0x4,(%rax)
je     1329 <main+0x199>
movq   $0x4,(%rbx)
testq  $0x4,(%rbx)
je     1329 <main+0x199>
movq   $0x4,(%rbx)
testq  $0x4,(%rbx)
je     1329 <main+0x199>
movq   $0x4,(%rbx)
testq  $0x4,(%rbx)
je     1329 <main+0x199>
movq   $0x4,(%rbx)
mov    (%rbx),%rax
mov    (%rbx),%rax
or     $0x7000,%eax
mov    %rax,(%rbx)
mov    $0x1,%r14d
testq  $0x2,0x4(%rbx)
jne    1350 <main+0x1c0>
lea    0xcdc(%rip),%rdi
jmp    14f8 <main+0x368>
mov    (%rbx),%rbp
test   $0x8,%bpl
je     136d <main+0x1dd>
and    $0xfffffff7,%ebp
lea    0xce3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,(%rbx)
movq   $0x20000000,0x18(%rbx)
20
movq   $0x30000000,0x20(%rbx)
30
movq   $0x40000,0x28(%rbx)
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x4(%rbx),%r13
test   $0x7000,%r13d
je     1390 <main+0x200>
test   $0x1000,%r13d
jne    1514 <main+0x384>
test   $0x2000,%r13d
jne    152f <main+0x39f>
test   $0x4000,%r13d
je     13ce <main+0x23e>
lea    0xcb9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
call   1090 <munmap@plt>
cmp    $0xffffffff,%eax
mov    0x2bf3(%rip),%rbx
mov    0x2c0c(%rip),%rbp
je     1561 <main+0x3d1>
mov    %r15d,%edi
call   1070 <close@plt>
mov    0x2bcf(%rip),%rax
mov    (%rax),%esi
or     (%rbx),%esi
lea    0xbf4(%rip),%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
je     154f <main+0x3bf>
mov    %eax,%ebx
lea    0xcba(%rip),%rdi
call   1030 <puts@plt>
mov    0x2b91(%rip),%rax
mov    (%rax),%edx
or     0x0(%rbp),%edx
mov    (%r12),%ecx
xor    %edi,%edi
mov    $0x10000000,%esi
mov    %ebx,%r8d
mov    $0x30000000,%r9d
call   1040 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
je     1558 <main+0x3c8>
mov    %rax,%rbp
lea    0xba8(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rdi
mov    %rbp,%rsi
mov    $0x40000,%edx
call   1080 <memcpy@plt>
mov    %rbp,%rdi
mov    $0x10000000,%esi
call   1090 <munmap@plt>
cmp    $0xffffffff,%eax
je     1561 <main+0x3d1>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %ecx,%ecx
lea    0xbfc(%rip),%rax
lea    0xc16(%rip),%rdi
nopl   0x0(%rax,%rax,1)
mov    0x100000(%rsp,%rcx,4),%edx
cmp    (%rsp,%rcx,4),%edx
jne    14f5 <main+0x365>
mov    0x100004(%rsp,%rcx,4),%edx
cmp    0x4(%rsp,%rcx,4),%edx
jne    14f5 <main+0x365>
mov    0x100008(%rsp,%rcx,4),%edx
cmp    0x8(%rsp,%rcx,4),%edx
jne    14f5 <main+0x365>
mov    0x10000c(%rsp,%rcx,4),%edx
cmp    0xc(%rsp,%rcx,4),%edx
jne    14f5 <main+0x365>
add    $0x4,%rcx
cmp    $0x10000,%rcx
jne    14b0 <main+0x320>
xor    %r14d,%r14d
jmp    14f8 <main+0x368>
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%eax
add    $0x200008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb37(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   $0x2000,%r13d
je     13b7 <main+0x227>
lea    0xb33(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   $0x4000,%r13d
jne    13c0 <main+0x230>
jmp    13ce <main+0x23e>
lea    0xbe0(%rip),%rdi
jmp    1568 <main+0x3d8>
lea    0xbb3(%rip),%rdi
jmp    1568 <main+0x3d8>
lea    0xb86(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@O_SYNC = global i32 0
@.str.1 = [22 x i8] c"Can't open /dev/mem.\0A\00"
@.str.2 = [18 x i8] c"/dev/mem opened.\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.3 = [37 x i8] c"Can't map the memory to user space.\0A\00"
@.str.4 = [30 x i8] c"Memory mapped at address %p.\0A\00"
@.str.5 = [37 x i8] c"Can't unmap memory from user space.\0A\00"
@.str.6 = [31 x i8] c"BUS IS BUSY Error Condition \0A\0D\00"
@.str.7 = [12 x i8] c"Reading \0A \0D\00"
@.str.8 = [23 x i8] c"Transfer Completed \0A\0D \00"
@.str.9 = [23 x i8] c"IRQ Delay Interrupt\0A\0D \00"
@.str.10 = [29 x i8] c" Transfer Error Interrupt\0A\0D \00"
@.str.11 = [33 x i8] c"Error in the Data comparison \0A \0D\00"
@.str.12 = [31 x i8] c"DATA Transfer is Successful \0A\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [262144 x i32]
%18 = alloca [262144 x i32]
%19 = alloca i32
store i32 0, i32* %1
store i32 2116026368, i32* %5
store i32 536870912, i32* %9
store i32 805306368, i32* %13
store i32 5, i32* %14
store i32 0, i32* %19
br label %20
20: ; preds = %30, %0
%21 = load i32, i32* %19
%22 = icmp ult i32 %21, 131072
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %19
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [262144 x i32], [262144 x i32]* %17, i64 0, i64 %25
store i32 1515870810, i32* %26
%27 = load i32, i32* %19
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds [262144 x i32], [262144 x i32]* %18, i64 0, i64 %28
store i32 0, i32* %29
br label %30
30: ; preds = %23
%31 = load i32, i32* %19
%32 = add i32 %31, 1
store i32 %32, i32* %19
br label %20
33: ; preds = %20
%34 = load i32, i32* @O_RDWR
%35 = load i32, i32* @O_SYNC
%36 = or i32 %34, %35
%37 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %36)
store i32 %37, i32* %6
%38 = load i32, i32* %6
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %43
40: ; preds = %33
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %33
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32, i32* @PROT_READ
%46 = load i32, i32* @PROT_WRITE
%47 = or i32 %45, %46
%48 = load i32, i32* @MAP_SHARED
%49 = load i32, i32* %6
%50 = load i32, i32* %9
%51 = and i32 %50, -268435456
%52 = call i8* @mmap(i32 0, i32 268435456, i32 %47, i32 %48, i32 %49, i32 %51)
store i8* %52, i8** %7
%53 = load i8*, i8** %7
%54 = icmp eq i8* %53, inttoptr (i64 -1 to i8*)
br i1 %54, label %55, label %58
55: ; preds = %43
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%57 = call i32 @exit(i32 0)
unreachable
58: ; preds = %43
%59 = load i8*, i8** %7
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %59)
%61 = load i8*, i8** %7
%62 = load i32, i32* %9
%63 = and i32 %62, 268435455
%64 = sext i32 %63 to i64
%65 = getelementptr i8, i8* %61, i64 %64
store i8* %65, i8** %8
%66 = load i8*, i8** %8
%67 = bitcast i8* %66 to i32*
%68 = getelementptr inbounds [262144 x i32], [262144 x i32]* %17, i64 0, i64 0
%69 = bitcast i32* %68 to i8*
%70 = call i32 @memcpy(i32* %67, i8* %69, i32 262144)
%71 = load i8*, i8** %7
%72 = call i32 @munmap(i8* %71, i32 268435456)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %77
74: ; preds = %58
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%76 = call i32 @exit(i32 0)
unreachable
77: ; preds = %58
%78 = load i32, i32* %6
%79 = call i32 @close(i32 %78)
%80 = load i32, i32* @O_RDWR
%81 = load i32, i32* @O_SYNC
%82 = or i32 %80, %81
%83 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %82)
store i32 %83, i32* %2
%84 = load i32, i32* %2
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %89
86: ; preds = %77
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%88 = call i32 @exit(i32 0)
unreachable
89: ; preds = %77
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%91 = load i32, i32* @PROT_READ
%92 = load i32, i32* @PROT_WRITE
%93 = or i32 %91, %92
%94 = load i32, i32* @MAP_SHARED
%95 = load i32, i32* %2
%96 = load i32, i32* %5
%97 = sext i32 %96 to i64
%98 = and i64 %97, -4096
%99 = trunc i64 %98 to i32
%100 = call i8* @mmap(i32 0, i32 4096, i32 %93, i32 %94, i32 %95, i32 %99)
store i8* %100, i8** %3
%101 = load i8*, i8** %3
%102 = icmp eq i8* %101, inttoptr (i64 -1 to i8*)
br i1 %102, label %103, label %106
103: ; preds = %89
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%105 = call i32 @exit(i32 0)
unreachable
106: ; preds = %89
%107 = load i8*, i8** %3
%108 = load i32, i32* %5
%109 = sext i32 %108 to i64
%110 = and i64 %109, 4095
%111 = getelementptr i8, i8* %107, i64 %110
store i8* %111, i8** %4
br label %112
112: ; preds = %130, %106
store i32 4, i32* %15
%113 = load i32, i32* %15
%114 = zext i32 %113 to i64
%115 = load i8*, i8** %4
%116 = getelementptr i8, i8* %115, i64 0
%117 = bitcast i8* %116 to i64*
store volatile i64 %114, i64* %117
%118 = load i8*, i8** %4
%119 = getelementptr i8, i8* %118, i64 0
%120 = bitcast i8* %119 to i64*
%121 = load volatile i64, i64* %120
%122 = trunc i64 %121 to i32
store i32 %122, i32* %15
%123 = load i32, i32* %15
%124 = and i32 %123, 4
%125 = icmp ne i32 %124, 0
br i1 %125, label %127, label %126
126: ; preds = %112
br label %133
127: ; preds = %112
%128 = load i32, i32* %14
%129 = sub i32 %128, 1
store i32 %129, i32* %14
br label %130
130: ; preds = %127
%131 = load i32, i32* %14
%132 = icmp ne i32 %131, 0
br i1 %132, label %112, label %133
133: ; preds = %130, %126
%134 = load i8*, i8** %4
%135 = getelementptr i8, i8* %134, i64 0
%136 = bitcast i8* %135 to i64*
%137 = load volatile i64, i64* %136
%138 = trunc i64 %137 to i32
store i32 %138, i32* %16
%139 = load i32, i32* %16
%140 = or i32 %139, 28672
%141 = zext i32 %140 to i64
%142 = trunc i64 %141 to i32
store i32 %142, i32* %16
%143 = load i32, i32* %16
%144 = zext i32 %143 to i64
%145 = load i8*, i8** %4
%146 = getelementptr i8, i8* %145, i64 0
%147 = bitcast i8* %146 to i64*
store volatile i64 %144, i64* %147
%148 = load i8*, i8** %4
%149 = getelementptr i8, i8* %148, i64 4
%150 = bitcast i8* %149 to i64*
%151 = load volatile i64, i64* %150
%152 = trunc i64 %151 to i32
store i32 %152, i32* %16
%153 = load i32, i32* %16
%154 = and i32 %153, 2
%155 = icmp ne i32 %154, 0
br i1 %155, label %158, label %156
156: ; preds = %133
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %1
br label %294
158: ; preds = %133
%159 = load i8*, i8** %4
%160 = getelementptr i8, i8* %159, i64 0
%161 = bitcast i8* %160 to i64*
%162 = load volatile i64, i64* %161
%163 = trunc i64 %162 to i32
store i32 %163, i32* %16
%164 = load i32, i32* %16
%165 = and i32 %164, 8
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %178
167: ; preds = %158
%168 = load i32, i32* %16
%169 = and i32 %168, -9
%170 = zext i32 %169 to i64
%171 = trunc i64 %170 to i32
store i32 %171, i32* %16
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%173 = load i32, i32* %16
%174 = zext i32 %173 to i64
%175 = load i8*, i8** %4
%176 = getelementptr i8, i8* %175, i64 0
%177 = bitcast i8* %176 to i64*
store volatile i64 %174, i64* %177
br label %178
178: ; preds = %167, %158
%179 = load i8*, i8** %4
%180 = getelementptr i8, i8* %179, i64 24
%181 = bitcast i8* %180 to i64*
store volatile i64 536870912, i64* %181
%182 = load i8*, i8** %4
%183 = getelementptr i8, i8* %182, i64 32
%184 = bitcast i8* %183 to i64*
store volatile i64 805306368, i64* %184
store i32 262144, i32* %16
%185 = load i32, i32* %16
%186 = zext i32 %185 to i64
%187 = load i8*, i8** %4
%188 = getelementptr i8, i8* %187, i64 40
%189 = bitcast i8* %188 to i64*
store volatile i64 %186, i64* %189
br label %190
190: ; preds = %196, %178
%191 = load i8*, i8** %4
%192 = getelementptr i8, i8* %191, i64 4
%193 = bitcast i8* %192 to i64*
%194 = load volatile i64, i64* %193
%195 = trunc i64 %194 to i32
store i32 %195, i32* %16
br label %196
196: ; preds = %190
%197 = load i32, i32* %16
%198 = and i32 %197, 28672
%199 = icmp ne i32 %198, 0
%200 = xor i1 %199, true
br i1 %200, label %190, label %201
201: ; preds = %196
%202 = load i32, i32* %16
%203 = and i32 %202, 4096
%204 = icmp ne i32 %203, 0
br i1 %204, label %205, label %207
205: ; preds = %201
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %207
207: ; preds = %205, %201
%208 = load i32, i32* %16
%209 = and i32 %208, 8192
%210 = icmp ne i32 %209, 0
br i1 %210, label %211, label %213
211: ; preds = %207
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %213
213: ; preds = %211, %207
%214 = load i32, i32* %16
%215 = and i32 %214, 16384
%216 = icmp ne i32 %215, 0
br i1 %216, label %217, label %219
217: ; preds = %213
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0))
br label %219
219: ; preds = %217, %213
%220 = load i8*, i8** %3
%221 = call i32 @munmap(i8* %220, i32 4096)
%222 = icmp eq i32 %221, -1
br i1 %222, label %223, label %226
223: ; preds = %219
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%225 = call i32 @exit(i32 0)
unreachable
226: ; preds = %219
%227 = load i32, i32* %2
%228 = call i32 @close(i32 %227)
%229 = load i32, i32* @O_RDWR
%230 = load i32, i32* @O_SYNC
%231 = or i32 %229, %230
%232 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %231)
store i32 %232, i32* %10
%233 = load i32, i32* %10
%234 = icmp eq i32 %233, -1
br i1 %234, label %235, label %238
235: ; preds = %226
%236 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%237 = call i32 @exit(i32 0)
unreachable
238: ; preds = %226
%239 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%240 = load i32, i32* @PROT_READ
%241 = load i32, i32* @PROT_WRITE
%242 = or i32 %240, %241
%243 = load i32, i32* @MAP_SHARED
%244 = load i32, i32* %10
%245 = load i32, i32* %13
%246 = and i32 %245, -268435456
%247 = call i8* @mmap(i32 0, i32 268435456, i32 %242, i32 %243, i32 %244, i32 %246)
store i8* %247, i8** %11
%248 = load i8*, i8** %11
%249 = icmp eq i8* %248, inttoptr (i64 -1 to i8*)
br i1 %249, label %250, label %253
250: ; preds = %238
%251 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%252 = call i32 @exit(i32 0)
unreachable
253: ; preds = %238
%254 = load i8*, i8** %11
%255 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %254)
%256 = load i8*, i8** %11
%257 = load i32, i32* %13
%258 = and i32 %257, 268435455
%259 = sext i32 %258 to i64
%260 = getelementptr i8, i8* %256, i64 %259
store i8* %260, i8** %12
%261 = getelementptr inbounds [262144 x i32], [262144 x i32]* %18, i64 0, i64 0
%262 = load i8*, i8** %12
%263 = call i32 @memcpy(i32* %261, i8* %262, i32 262144)
%264 = load i8*, i8** %11
%265 = call i32 @munmap(i8* %264, i32 268435456)
%266 = icmp eq i32 %265, -1
br i1 %266, label %267, label %270
267: ; preds = %253
%268 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%269 = call i32 @exit(i32 0)
unreachable
270: ; preds = %253
%271 = load i32, i32* %10
%272 = call i32 @close(i32 %271)
store i32 0, i32* %19
br label %273
273: ; preds = %289, %270
%274 = load i32, i32* %19
%275 = icmp ult i32 %274, 65536
br i1 %275, label %276, label %292
276: ; preds = %273
%277 = load i32, i32* %19
%278 = zext i32 %277 to i64
%279 = getelementptr inbounds [262144 x i32], [262144 x i32]* %17, i64 0, i64 %278
%280 = load i32, i32* %279
%281 = load i32, i32* %19
%282 = zext i32 %281 to i64
%283 = getelementptr inbounds [262144 x i32], [262144 x i32]* %18, i64 0, i64 %282
%284 = load i32, i32* %283
%285 = icmp ne i32 %280, %284
br i1 %285, label %286, label %288
286: ; preds = %276
%287 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %1
br label %294
288: ; preds = %276
br label %289
289: ; preds = %288
%290 = load i32, i32* %19
%291 = add i32 %290, 1
store i32 %291, i32* %19
br label %273
292: ; preds = %273
%293 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %1
br label %294
294: ; preds = %292, %286, %156
%295 = load i32, i32* %1
ret i32 %295
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@O_SYNC = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [30 x i8] c"Memory mapped at address %p.\0A\00"
@.str.6 = [31 x i8] c"BUS IS BUSY Error Condition \0A\0D\00"
@.str.7 = [12 x i8] c"Reading \0A \0D\00"
@.str.8 = [23 x i8] c"Transfer Completed \0A\0D \00"
@.str.9 = [23 x i8] c"IRQ Delay Interrupt\0A\0D \00"
@.str.10 = [29 x i8] c" Transfer Error Interrupt\0A\0D \00"
@.str.11 = [33 x i8] c"Error in the Data comparison \0A \0D\00"
@.str.12 = [31 x i8] c"DATA Transfer is Successful \0A\0D\00"
@str.14 = [17 x i8] c"/dev/mem opened.\00"
@str.21 = [36 x i8] c"Can't unmap memory from user space.\00"
@str.22 = [36 x i8] c"Can't map the memory to user space.\00"
@str.23 = [21 x i8] c"Can't open /dev/mem.\00"
define i32 @main() {
%1 = alloca [262144 x i32]
%2 = bitcast [262144 x i32]* %1 to i8*
%3 = alloca [262144 x i32]
%4 = bitcast [262144 x i32]* %3 to i8*
%5 = load i32, i32* @O_RDWR
%6 = load i32, i32* @O_SYNC
%7 = or i32 %6, %5
%8 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %0
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.14, i64 0, i64 0))
%15 = load i32, i32* @PROT_READ
%16 = load i32, i32* @PROT_WRITE
%17 = or i32 %16, %15
%18 = load i32, i32* @MAP_SHARED
%19 = tail call i8* @mmap(i32 0, i32 268435456, i32 %17, i32 %18, i32 %8, i32 536870912)
%20 = icmp eq i8* %19, inttoptr (i64 -1 to i8*)
br i1 %20, label %21, label %24
21: ; preds = %13
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.22, i64 0, i64 0))
%23 = tail call i32 @exit(i32 0)
unreachable
24: ; preds = %13
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%26 = bitcast i8* %19 to i32*
%27 = call i32 @memcpy(i32* %26, i8* %2, i32 262144)
%28 = call i32 @munmap(i8* %19, i32 268435456)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.21, i64 0, i64 0))
%32 = call i32 @exit(i32 0)
unreachable
33: ; preds = %24
%34 = call i32 @close(i32 %8)
%35 = load i32, i32* @O_RDWR
%36 = load i32, i32* @O_SYNC
%37 = or i32 %36, %35
%38 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %43
40: ; preds = %33
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %33
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.14, i64 0, i64 0))
%45 = load i32, i32* @PROT_READ
%46 = load i32, i32* @PROT_WRITE
%47 = or i32 %46, %45
%48 = load i32, i32* @MAP_SHARED
%49 = call i8* @mmap(i32 0, i32 4096, i32 %47, i32 %48, i32 %38, i32 2116026368)
%50 = icmp eq i8* %49, inttoptr (i64 -1 to i8*)
br i1 %50, label %56, label %51
51: ; preds = %43
%52 = bitcast i8* %49 to i64*
store volatile i64 4, i64* %52
%53 = load volatile i64, i64* %52
%54 = and i64 %53, 4
%55 = icmp eq i64 %54, 0
br i1 %55, label %73, label %59
56: ; preds = %43
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.22, i64 0, i64 0))
%58 = call i32 @exit(i32 0)
unreachable
59: ; preds = %51
store volatile i64 4, i64* %52
%60 = load volatile i64, i64* %52
%61 = and i64 %60, 4
%62 = icmp eq i64 %61, 0
br i1 %62, label %73, label %63
63: ; preds = %59
store volatile i64 4, i64* %52
%64 = load volatile i64, i64* %52
%65 = and i64 %64, 4
%66 = icmp eq i64 %65, 0
br i1 %66, label %73, label %67
67: ; preds = %63
store volatile i64 4, i64* %52
%68 = load volatile i64, i64* %52
%69 = and i64 %68, 4
%70 = icmp eq i64 %69, 0
br i1 %70, label %73, label %71
71: ; preds = %67
store volatile i64 4, i64* %52
%72 = load volatile i64, i64* %52
br label %73
73: ; preds = %71, %67, %63, %59, %51
%74 = load volatile i64, i64* %52
%75 = and i64 %74, 4294938623
%76 = or i64 %75, 28672
store volatile i64 %76, i64* %52
%77 = getelementptr i8, i8* %49, i64 4
%78 = bitcast i8* %77 to i64*
%79 = load volatile i64, i64* %78
%80 = and i64 %79, 2
%81 = icmp eq i64 %80, 0
br i1 %81, label %185, label %82
82: ; preds = %73
%83 = load volatile i64, i64* %52
%84 = and i64 %83, 8
%85 = icmp eq i64 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %82
%87 = and i64 %83, 4294967287
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
store volatile i64 %87, i64* %52
br label %89
89: ; preds = %86, %82
%90 = getelementptr i8, i8* %49, i64 24
%91 = bitcast i8* %90 to i64*
store volatile i64 536870912, i64* %91
%92 = getelementptr i8, i8* %49, i64 32
%93 = bitcast i8* %92 to i64*
store volatile i64 805306368, i64* %93
%94 = getelementptr i8, i8* %49, i64 40
%95 = bitcast i8* %94 to i64*
store volatile i64 262144, i64* %95
br label %96
96: ; preds = %96, %89
%97 = load volatile i64, i64* %78
%98 = and i64 %97, 28672
%99 = icmp eq i64 %98, 0
br i1 %99, label %96, label %100
100: ; preds = %96
%101 = trunc i64 %97 to i32
%102 = and i32 %101, 4096
%103 = icmp eq i32 %102, 0
br i1 %103, label %106, label %104
104: ; preds = %100
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %106
106: ; preds = %104, %100
%107 = and i32 %101, 8192
%108 = icmp eq i32 %107, 0
br i1 %108, label %111, label %109
109: ; preds = %106
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %111
111: ; preds = %109, %106
%112 = and i32 %101, 16384
%113 = icmp eq i32 %112, 0
br i1 %113, label %116, label %114
114: ; preds = %111
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0))
br label %116
116: ; preds = %114, %111
%117 = call i32 @munmap(i8* %49, i32 4096)
%118 = icmp eq i32 %117, -1
br i1 %118, label %119, label %122
119: ; preds = %116
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.21, i64 0, i64 0))
%121 = call i32 @exit(i32 0)
unreachable
122: ; preds = %116
%123 = call i32 @close(i32 %38)
%124 = load i32, i32* @O_RDWR
%125 = load i32, i32* @O_SYNC
%126 = or i32 %125, %124
%127 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %126)
%128 = icmp eq i32 %127, -1
br i1 %128, label %129, label %132
129: ; preds = %122
%130 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.23, i64 0, i64 0))
%131 = call i32 @exit(i32 0)
unreachable
132: ; preds = %122
%133 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.14, i64 0, i64 0))
%134 = load i32, i32* @PROT_READ
%135 = load i32, i32* @PROT_WRITE
%136 = or i32 %135, %134
%137 = load i32, i32* @MAP_SHARED
%138 = call i8* @mmap(i32 0, i32 268435456, i32 %136, i32 %137, i32 %127, i32 805306368)
%139 = icmp eq i8* %138, inttoptr (i64 -1 to i8*)
br i1 %139, label %140, label %143
140: ; preds = %132
%141 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.22, i64 0, i64 0))
%142 = call i32 @exit(i32 0)
unreachable
143: ; preds = %132
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %138)
%145 = getelementptr inbounds [262144 x i32], [262144 x i32]* %3, i64 0, i64 0
%146 = call i32 @memcpy(i32* %145, i8* %138, i32 262144)
%147 = call i32 @munmap(i8* %138, i32 268435456)
%148 = icmp eq i32 %147, -1
br i1 %148, label %149, label %152
149: ; preds = %143
%150 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.21, i64 0, i64 0))
%151 = call i32 @exit(i32 0)
unreachable
152: ; preds = %143
%153 = call i32 @close(i32 %127)
br label %178
154: ; preds = %178
%155 = or i64 %179, 1
%156 = getelementptr inbounds [262144 x i32], [262144 x i32]* %1, i64 0, i64 %155
%157 = load i32, i32* %156
%158 = getelementptr inbounds [262144 x i32], [262144 x i32]* %3, i64 0, i64 %155
%159 = load i32, i32* %158
%160 = icmp eq i32 %157, %159
br i1 %160, label %161, label %185
161: ; preds = %154
%162 = or i64 %179, 2
%163 = getelementptr inbounds [262144 x i32], [262144 x i32]* %1, i64 0, i64 %162
%164 = load i32, i32* %163
%165 = getelementptr inbounds [262144 x i32], [262144 x i32]* %3, i64 0, i64 %162
%166 = load i32, i32* %165
%167 = icmp eq i32 %164, %166
br i1 %167, label %168, label %185
168: ; preds = %161
%169 = or i64 %179, 3
%170 = getelementptr inbounds [262144 x i32], [262144 x i32]* %1, i64 0, i64 %169
%171 = load i32, i32* %170
%172 = getelementptr inbounds [262144 x i32], [262144 x i32]* %3, i64 0, i64 %169
%173 = load i32, i32* %172
%174 = icmp eq i32 %171, %173
br i1 %174, label %175, label %185
175: ; preds = %168
%176 = add nuw nsw i64 %179, 4
%177 = icmp eq i64 %176, 65536
br i1 %177, label %185, label %178
178: ; preds = %175, %152
%179 = phi i64 [ 0, %152 ], [ %176, %175 ]
%180 = getelementptr inbounds [262144 x i32], [262144 x i32]* %1, i64 0, i64 %179
%181 = load i32, i32* %180
%182 = getelementptr inbounds [262144 x i32], [262144 x i32]* %3, i64 0, i64 %179
%183 = load i32, i32* %182
%184 = icmp eq i32 %181, %183
br i1 %184, label %154, label %185
185: ; preds = %178, %154, %161, %168, %175, %73
%186 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), %73 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), %178 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), %154 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), %161 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), %168 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), %175 ]
%187 = phi i32 [ 1, %73 ], [ 1, %178 ], [ 1, %154 ], [ 1, %161 ], [ 1, %168 ], [ 0, %175 ]
%188 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %186)
ret i32 %187
}