#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 scalar_t__ uint32_t;
struct stat {
  int st_size;
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int O_RDWR;
int O_SYNC;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ S_ISREG(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
scalar_t__ fstat(int /*<<< orphan*/, struct stat *);
scalar_t__ getenv(char *);
int htonl(unsigned int);
unsigned char *malloc(int);
void *mmap(int /*<<< orphan*/, int, int, int /*<<< orphan*/, int, scalar_t__);
int open(char *, int);
int /*<<< orphan*/ printf(char *, char *, long);
scalar_t__ spec_get_base();
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ sync();
int main(int argc, char **argv) {
  int i, fd;
  FILE *f;
  uint32_t base;
  struct stat stbuf;
  void *map_base;
  unsigned char *buf;
  unsigned int *ibuf;
  volatile uint32_t *p;
  if (argc != 2) {
    fprintf(stderr, "Use: \"%s <program>\"\n", argv[0]);
    exit(1);
  }
  if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) {
    fprintf(stderr, "%s: open(/dev/mem): %s\n", argv[0], strerror(errno));
    exit(1);
  }
  base = spec_get_base();
  if (base == (typeof(base))-1) {
    fprintf(stderr, "%s: spec_get_base(): %s\n", argv[0], strerror(errno));
    exit(1);
  }
  map_base = mmap(0, 1024 * 1024, PROT_READ | PROT_WRITE, MAP_SHARED, fd, base);
  if (map_base == (void *)-1) {
    fprintf(stderr, "%s: mmap(/dev/mem): %s\n", argv[0], strerror(errno));
    exit(1);
  }
  close(fd);
  f = fopen(argv[1], "r");
  if (!f) {
    fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno));
    exit(1);
  }
  if (fstat(fileno(f), &stbuf)) {
    fprintf(stderr, "%s: stat(%s): %s\n", argv[0], argv[1], strerror(errno));
    exit(1);
  }
  if (!S_ISREG(stbuf.st_mode)) {
    fprintf(stderr, "%s: %s: Not a regular file\n", argv[0], argv[1]);
    exit(1);
  }
  buf = malloc(stbuf.st_size);
  if (!buf) {
    fprintf(stderr, "%s: Can't allocate buffer (%li bytes): %s\n", argv[0],
            (long)stbuf.st_size, strerror(errno));
    exit(1);
  }
  i = fread(buf, 1, stbuf.st_size, f);
  if (i < 0) {
    fprintf(stderr, "%s: read(%s): %s\n", argv[0], argv[1], strerror(errno));
    exit(1);
  }
  if (i != stbuf.st_size) {
    fprintf(stderr, "%s: short read from %s\n", argv[0], argv[1]);
    exit(1);
  }
  ibuf = (void *)buf;
  *(volatile uint32_t *)(map_base + 0xA0400) = 0x1deadbee;
  while (!((*(volatile uint32_t *)(map_base + 0xA0400)) & (1 << 28)))
    ;
  p = map_base + 0x80000;
  for (i = 0; i < (stbuf.st_size + 3) / 4; i++) {
    p[i] = htonl(ibuf[i]);
    sync();
  }
  for (i = 0; i < (stbuf.st_size + 3) / 4; i++) {
    if (p[i] != htonl(ibuf[i]))
      fprintf(stderr,
              "programming error at %x "
              "(expected %08x, found %08x)\n",
              i * 4, htonl(ibuf[i]), p[i]);
  }
  *(volatile uint32_t *)(map_base + 0xA0400) = 0x0deadbee;
  if (getenv("VERBOSE"))
    printf("%s: Wrote %li bytes at offset 0x8000\n", argv[0],
           (long)stbuf.st_size);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     125b <main+0x4b>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2d76(%rip),%rax
mov    (%rax),%esi
mov    0x2d65(%rip),%rax
or     (%rax),%esi
lea    0xda1(%rip),%rdi
call   10f0 <open@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    12cc <main+0xbc>
mov    0x2d34(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xd63(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    $0x0,%al
call   10a0 <spec_get_base@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0xffffffffffffffff,-0x28(%rbp)
jne    1329 <main+0x119>
mov    0x2cd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
lea    0xd1e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edx
mov    0x2c77(%rip),%rax
or     (%rax),%edx
mov    0x2ca6(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x28(%rbp),%r9
xor    %edi,%edi
mov    $0x100000,%esi
call   1050 <mmap@plt>
mov    %rax,-0x38(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x38(%rbp)
jne    13b4 <main+0x1a4>
mov    0x2c4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xcac(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x18(%rbp),%edi
call   1080 <close@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc9c(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1448 <main+0x238>
mov    0x2bda(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    0x2ba6(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%rdx
mov    -0x88(%rbp),%rcx
mov    %rax,%r8
lea    0xc32(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x20(%rbp),%rdi
call   10b0 <fileno@plt>
mov    %eax,%edi
lea    -0x30(%rbp),%rsi
call   1130 <fstat@plt>
cmp    $0x0,%rax
je     14cf <main+0x2bf>
mov    0x2b53(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2b1f(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    -0xac(%rbp),%edi
mov    -0xa8(%rbp),%rdx
mov    -0xa0(%rbp),%rcx
mov    %rax,%r8
lea    0xbb7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x2c(%rbp),%edi
call   10c0 <S_ISREG@plt>
cmp    $0x0,%eax
jne    1510 <main+0x300>
mov    0x2ad9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xb88(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x30(%rbp),%edi
call   10e0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    158c <main+0x37c>
mov    0x2a92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xc0(%rbp)
movslq -0x30(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    0x2a62(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    -0xc4(%rbp),%edi
mov    -0xc0(%rbp),%rdx
mov    -0xb8(%rbp),%rcx
mov    %rax,%r8
lea    0xb28(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1617 <main+0x407>
mov    0x2a0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xdc(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xd0(%rbp)
mov    0x29d7(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    -0xdc(%rbp),%edi
mov    -0xd8(%rbp),%rdx
mov    -0xd0(%rbp),%rcx
mov    %rax,%r8
lea    0xac8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x14(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     1653 <main+0x443>
mov    0x2996(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xa9e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
movq   $0x1deadbee,0xa0400(%rax)
ee db ea 1d
mov    -0x38(%rbp),%rax
mov    0xa0400(%rax),%rax
and    $0x10000000,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1691 <main+0x481>
jmp    1696 <main+0x486>
jmp    166a <main+0x45a>
mov    -0x38(%rbp),%rax
add    $0x80000,%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0x30(%rbp),%eax
add    $0x3,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xe0(%rbp),%eax
cmp    %ecx,%eax
jge    1706 <main+0x4f6>
mov    -0x48(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1070 <htonl@plt>
movslq %eax,%rdx
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    $0x0,%al
call   10d0 <sync@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    16ab <main+0x49b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0x30(%rbp),%eax
add    $0x3,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xe4(%rbp),%eax
cmp    %ecx,%eax
jge    17d2 <main+0x5c2>
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x48(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1070 <htonl@plt>
mov    %eax,%ecx
mov    -0xf0(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
je     17bf <main+0x5af>
mov    0x284d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf8(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0xf4(%rbp)
mov    -0x48(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1070 <htonl@plt>
mov    -0xf8(%rbp),%edi
mov    -0xf4(%rbp),%edx
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq -0x14(%rbp),%rsi
mov    (%rax,%rsi,8),%r8
lea    0x940(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    17c4 <main+0x5b4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    170d <main+0x4fd>
mov    -0x38(%rbp),%rax
movq   $0xdeadbee,0xa0400(%rax)
ee db ea 0d
lea    0x945(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     180e <main+0x5fe>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
movslq -0x30(%rbp),%rdx
lea    0x92c(%rip),%rdi
call   1060 <printf@plt>
xor    %edi,%edi
call   1110 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
cmp    $0x2,%edi
jne    126e <main+0x5e>
mov    0x2dab(%rip),%rax
mov    0x2d9c(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xdd6(%rip),%rdi
call   10f0 <open@plt>
test   %eax,%eax
jns    1292 <main+0x82>
mov    0x2d71(%rip),%rax
mov    (%rax),%ebx
mov    (%r15),%rbp
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xdb5(%rip),%rsi
jmp    1318 <main+0x108>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xd7f(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10a0 <spec_get_base@plt>
cmp    $0xffffffffffffffff,%rax
jne    12c4 <main+0xb4>
mov    0x2d18(%rip),%rax
mov    (%rax),%ebx
mov    (%r15),%rbp
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xd74(%rip),%rsi
jmp    1318 <main+0x108>
mov    0x2d2d(%rip),%rcx
mov    0x2cde(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2d0b(%rip),%rcx
mov    (%rcx),%ecx
xor    %edi,%edi
mov    $0x100000,%esi
mov    %ebp,%r8d
mov    %rax,%r9
call   1050 <mmap@plt>
cmp    $0xffffffffffffffff,%rax
jne    1331 <main+0x121>
mov    0x2cc2(%rip),%rax
mov    (%rax),%ebx
mov    (%r15),%rbp
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xd37(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1080 <close@plt>
mov    0x8(%r15),%rdi
lea    0xd21(%rip),%rsi
call   1100 <fopen@plt>
test   %rax,%rax
jne    1377 <main+0x167>
mov    0x2c69(%rip),%rax
mov    (%rax),%ebx
mov    (%r15),%rbp
mov    0x8(%r15),%r14
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xcf4(%rip),%rsi
jmp    13df <main+0x1cf>
mov    %rax,%rbp
mov    %rax,%rdi
call   10b0 <fileno@plt>
mov    %rsp,%rsi
mov    %eax,%edi
call   1130 <fstat@plt>
test   %rax,%rax
jne    13ba <main+0x1aa>
mov    0x4(%rsp),%edi
call   10c0 <S_ISREG@plt>
test   %eax,%eax
jne    13fb <main+0x1eb>
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
mov    0x8(%r15),%rcx
lea    0xcd2(%rip),%rsi
jmp    1320 <main+0x110>
mov    0x2bff(%rip),%rax
mov    (%rax),%ebx
mov    (%r15),%rbp
mov    0x8(%r15),%r14
mov    0x2be7(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc96(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    (%rsp),%r13d
movslq %r13d,%rbx
mov    %ebx,%edi
call   10e0 <malloc@plt>
test   %rax,%rax
jne    1434 <main+0x224>
mov    0x2bab(%rip),%rax
mov    %rbx,%r14
mov    (%rax),%ebx
mov    (%r15),%rbp
mov    0x2b94(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc71(%rip),%rsi
jmp    13df <main+0x1cf>
mov    %rax,%r12
mov    %rax,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
call   1040 <fread@plt>
test   %eax,%eax
jns    1478 <main+0x268>
mov    0x2b6b(%rip),%rax
mov    (%rax),%ebx
mov    (%r15),%rbp
mov    0x8(%r15),%r14
mov    0x2b53(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc5b(%rip),%rsi
jmp    13df <main+0x1cf>
cmp    %ebx,%eax
jne    1563 <main+0x353>
mov    %r15,0x10(%rsp)
movq   $0x1deadbee,0xa0400(%r14)
ee db ea 1d
testq  $0x10000000,0xa0400(%r14)
je     1490 <main+0x280>
lea    0x3(%rbx),%eax
mov    %rbx,0x8(%rsp)
lea    0x6(%rbx),%r15d
test   %eax,%eax
cmovns %eax,%r15d
test   %r13d,%r13d
jle    157f <main+0x36f>
sar    $0x2,%r15d
cmp    $0x2,%r15d
mov    $0x1,%ebp
cmovge %r15d,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%edi
call   1070 <htonl@plt>
cltq
mov    %rax,0x80000(%r14,%rbx,8)
xor    %eax,%eax
call   10d0 <sync@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    14d0 <main+0x2c0>
test   %r13d,%r13d
jle    157f <main+0x36f>
cmp    $0x2,%r15d
mov    %r15d,%eax
mov    $0x1,%r15d
cmovge %eax,%r15d
shl    $0x2,%r15
lea    0xbe0(%rip),%r13
xor    %ebp,%ebp
jmp    1529 <main+0x319>
nopl   0x0(%rax)
add    $0x4,%rbp
cmp    %rbp,%r15
je     157f <main+0x36f>
mov    0x80000(%r14,%rbp,2),%rbx
mov    (%r12,%rbp,1),%edi
call   1070 <htonl@plt>
movslq %eax,%rcx
cmp    %rcx,%rbx
je     1520 <main+0x310>
mov    0x2a77(%rip),%rcx
mov    (%rcx),%edi
mov    0x80000(%r14,%rbp,2),%r8
mov    %r13,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1520 <main+0x310>
mov    0x2a56(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
mov    0x8(%r15),%rcx
lea    0xb66(%rip),%rsi
jmp    1320 <main+0x110>
movq   $0xdeadbee,0xa0400(%r14)
ee db ea 0d
lea    0xb9c(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     15b4 <main+0x3a4>
mov    0x10(%rsp),%rax
mov    (%rax),%rsi
lea    0xb8b(%rip),%rdi
mov    0x8(%rsp),%rdx
call   1060 <printf@plt>
xor    %edi,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
@stderr = global i32 0
@.str = [21 x i8] c"Use: \22%s <program>\22\0A\00"
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@O_SYNC = global i32 0
@.str.2 = [24 x i8] c"%s: open(/dev/mem): %s\0A\00"
@errno = global i32 0
@.str.3 = [25 x i8] c"%s: spec_get_base(): %s\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [24 x i8] c"%s: mmap(/dev/mem): %s\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.7 = [18 x i8] c"%s: stat(%s): %s\0A\00"
@.str.8 = [28 x i8] c"%s: %s: Not a regular file\0A\00"
@.str.9 = [43 x i8] c"%s: Can't allocate buffer (%li bytes): %s\0A\00"
@.str.10 = [18 x i8] c"%s: read(%s): %s\0A\00"
@.str.11 = [24 x i8] c"%s: short read from %s\0A\00"
@.str.12 = [53 x i8] c"programming error at %x (expected %08x, found %08x)\0A\00"
@.str.13 = [8 x i8] c"VERBOSE\00"
@.str.14 = [38 x i8] c"%s: Wrote %li bytes at offset 0x8000\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i64
%10 = alloca %struct.stat
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i64*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i32, i32* @O_RDWR
%26 = load i32, i32* @O_SYNC
%27 = or i32 %25, %26
%28 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 %28, i32* %7
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %34, i8* %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %24
%40 = call i64 (...) @spec_get_base()
store i64 %40, i64* %9
%41 = load i64, i64* %9
%42 = icmp eq i64 %41, -1
br i1 %42, label %43, label %52
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %47, i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %39
%53 = load i32, i32* @PROT_READ
%54 = load i32, i32* @PROT_WRITE
%55 = or i32 %53, %54
%56 = load i32, i32* @MAP_SHARED
%57 = load i32, i32* %7
%58 = load i64, i64* %9
%59 = call i8* @mmap(i32 0, i32 1048576, i32 %55, i32 %56, i32 %57, i64 %58)
store i8* %59, i8** %11
%60 = load i8*, i8** %11
%61 = icmp eq i8* %60, inttoptr (i64 -1 to i8*)
br i1 %61, label %62, label %71
62: ; preds = %52
%63 = load i32, i32* @stderr
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 0
%66 = load i8*, i8** %65
%67 = load i32, i32* @errno
%68 = call i8* @strerror(i32 %67)
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %66, i8* %68)
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %52
%72 = load i32, i32* %7
%73 = call i32 @close(i32 %72)
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 1
%76 = load i8*, i8** %75
%77 = call i32* @fopen(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %77, i32** %8
%78 = load i32*, i32** %8
%79 = icmp ne i32* %78, null
br i1 %79, label %92, label %80
80: ; preds = %71
%81 = load i32, i32* @stderr
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 0
%84 = load i8*, i8** %83
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 1
%87 = load i8*, i8** %86
%88 = load i32, i32* @errno
%89 = call i8* @strerror(i32 %88)
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %84, i8* %87, i8* %89)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %71
%93 = load i32*, i32** %8
%94 = call i32 @fileno(i32* %93)
%95 = call i64 @fstat(i32 %94, %struct.stat* %10)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %109
97: ; preds = %92
%98 = load i32, i32* @stderr
%99 = load i8**, i8*** %5
%100 = getelementptr inbounds i8*, i8** %99, i64 0
%101 = load i8*, i8** %100
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 1
%104 = load i8*, i8** %103
%105 = load i32, i32* @errno
%106 = call i8* @strerror(i32 %105)
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %101, i8* %104, i8* %106)
%108 = call i32 @exit(i32 1)
unreachable
109: ; preds = %92
%110 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 1
%111 = load i32, i32* %110
%112 = call i32 @S_ISREG(i32 %111)
%113 = icmp ne i32 %112, 0
br i1 %113, label %124, label %114
114: ; preds = %109
%115 = load i32, i32* @stderr
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 0
%118 = load i8*, i8** %117
%119 = load i8**, i8*** %5
%120 = getelementptr inbounds i8*, i8** %119, i64 1
%121 = load i8*, i8** %120
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %118, i8* %121)
%123 = call i32 @exit(i32 1)
unreachable
124: ; preds = %109
%125 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%126 = load i32, i32* %125
%127 = call i8* @malloc(i32 %126)
store i8* %127, i8** %12
%128 = load i8*, i8** %12
%129 = icmp ne i8* %128, null
br i1 %129, label %142, label %130
130: ; preds = %124
%131 = load i32, i32* @stderr
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 0
%134 = load i8*, i8** %133
%135 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%136 = load i32, i32* %135
%137 = sext i32 %136 to i64
%138 = load i32, i32* @errno
%139 = call i8* @strerror(i32 %138)
%140 = call i32 (i32, i8*, ...) @fprintf(i32 %131, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i8* %134, i64 %137, i8* %139)
%141 = call i32 @exit(i32 1)
unreachable
142: ; preds = %124
%143 = load i8*, i8** %12
%144 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%145 = load i32, i32* %144
%146 = load i32*, i32** %8
%147 = call i32 @fread(i8* %143, i32 1, i32 %145, i32* %146)
store i32 %147, i32* %6
%148 = load i32, i32* %6
%149 = icmp slt i32 %148, 0
br i1 %149, label %150, label %162
150: ; preds = %142
%151 = load i32, i32* @stderr
%152 = load i8**, i8*** %5
%153 = getelementptr inbounds i8*, i8** %152, i64 0
%154 = load i8*, i8** %153
%155 = load i8**, i8*** %5
%156 = getelementptr inbounds i8*, i8** %155, i64 1
%157 = load i8*, i8** %156
%158 = load i32, i32* @errno
%159 = call i8* @strerror(i32 %158)
%160 = call i32 (i32, i8*, ...) @fprintf(i32 %151, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %154, i8* %157, i8* %159)
%161 = call i32 @exit(i32 1)
unreachable
162: ; preds = %142
%163 = load i32, i32* %6
%164 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%165 = load i32, i32* %164
%166 = icmp ne i32 %163, %165
br i1 %166, label %167, label %177
167: ; preds = %162
%168 = load i32, i32* @stderr
%169 = load i8**, i8*** %5
%170 = getelementptr inbounds i8*, i8** %169, i64 0
%171 = load i8*, i8** %170
%172 = load i8**, i8*** %5
%173 = getelementptr inbounds i8*, i8** %172, i64 1
%174 = load i8*, i8** %173
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %168, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %171, i8* %174)
%176 = call i32 @exit(i32 1)
unreachable
177: ; preds = %162
%178 = load i8*, i8** %12
%179 = bitcast i8* %178 to i32*
store i32* %179, i32** %13
%180 = load i8*, i8** %11
%181 = getelementptr i8, i8* %180, i64 656384
%182 = bitcast i8* %181 to i64*
store volatile i64 501930990, i64* %182
br label %183
183: ; preds = %191, %177
%184 = load i8*, i8** %11
%185 = getelementptr i8, i8* %184, i64 656384
%186 = bitcast i8* %185 to i64*
%187 = load volatile i64, i64* %186
%188 = and i64 %187, 268435456
%189 = icmp ne i64 %188, 0
%190 = xor i1 %189, true
br i1 %190, label %191, label %192
191: ; preds = %183
br label %183
192: ; preds = %183
%193 = load i8*, i8** %11
%194 = getelementptr i8, i8* %193, i64 524288
%195 = bitcast i8* %194 to i64*
store i64* %195, i64** %14
store i32 0, i32* %6
br label %196
196: ; preds = %216, %192
%197 = load i32, i32* %6
%198 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%199 = load i32, i32* %198
%200 = add nsw i32 %199, 3
%201 = sdiv i32 %200, 4
%202 = icmp slt i32 %197, %201
br i1 %202, label %203, label %219
203: ; preds = %196
%204 = load i32*, i32** %13
%205 = load i32, i32* %6
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds i32, i32* %204, i64 %206
%208 = load i32, i32* %207
%209 = call i32 @htonl(i32 %208)
%210 = sext i32 %209 to i64
%211 = load i64*, i64** %14
%212 = load i32, i32* %6
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds i64, i64* %211, i64 %213
store volatile i64 %210, i64* %214
%215 = call i32 (...) @sync()
br label %216
216: ; preds = %203
%217 = load i32, i32* %6
%218 = add nsw i32 %217, 1
store i32 %218, i32* %6
br label %196
219: ; preds = %196
store i32 0, i32* %6
br label %220
220: ; preds = %258, %219
%221 = load i32, i32* %6
%222 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%223 = load i32, i32* %222
%224 = add nsw i32 %223, 3
%225 = sdiv i32 %224, 4
%226 = icmp slt i32 %221, %225
br i1 %226, label %227, label %261
227: ; preds = %220
%228 = load i64*, i64** %14
%229 = load i32, i32* %6
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds i64, i64* %228, i64 %230
%232 = load volatile i64, i64* %231
%233 = load i32*, i32** %13
%234 = load i32, i32* %6
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds i32, i32* %233, i64 %235
%237 = load i32, i32* %236
%238 = call i32 @htonl(i32 %237)
%239 = sext i32 %238 to i64
%240 = icmp ne i64 %232, %239
br i1 %240, label %241, label %257
241: ; preds = %227
%242 = load i32, i32* @stderr
%243 = load i32, i32* %6
%244 = mul nsw i32 %243, 4
%245 = load i32*, i32** %13
%246 = load i32, i32* %6
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds i32, i32* %245, i64 %247
%249 = load i32, i32* %248
%250 = call i32 @htonl(i32 %249)
%251 = load i64*, i64** %14
%252 = load i32, i32* %6
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds i64, i64* %251, i64 %253
%255 = load volatile i64, i64* %254
%256 = call i32 (i32, i8*, ...) @fprintf(i32 %242, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.12, i64 0, i64 0), i32 %244, i32 %250, i64 %255)
br label %257
257: ; preds = %241, %227
br label %258
258: ; preds = %257
%259 = load i32, i32* %6
%260 = add nsw i32 %259, 1
store i32 %260, i32* %6
br label %220
261: ; preds = %220
%262 = load i8*, i8** %11
%263 = getelementptr i8, i8* %262, i64 656384
%264 = bitcast i8* %263 to i64*
store volatile i64 233495534, i64* %264
%265 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%266 = icmp ne i64 %265, 0
br i1 %266, label %267, label %275
267: ; preds = %261
%268 = load i8**, i8*** %5
%269 = getelementptr inbounds i8*, i8** %268, i64 0
%270 = load i8*, i8** %269
%271 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%272 = load i32, i32* %271
%273 = sext i32 %272 to i64
%274 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), i8* %270, i64 %273)
br label %275
275: ; preds = %267, %261
%276 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
@stderr = global i32 0
@.str = [21 x i8] c"Use: \22%s <program>\22\0A\00"
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@O_SYNC = global i32 0
@.str.2 = [24 x i8] c"%s: open(/dev/mem): %s\0A\00"
@errno = global i32 0
@.str.3 = [25 x i8] c"%s: spec_get_base(): %s\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.4 = [24 x i8] c"%s: mmap(/dev/mem): %s\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [12 x i8] c"%s: %s: %s\0A\00"
@.str.7 = [18 x i8] c"%s: stat(%s): %s\0A\00"
@.str.8 = [28 x i8] c"%s: %s: Not a regular file\0A\00"
@.str.9 = [43 x i8] c"%s: Can't allocate buffer (%li bytes): %s\0A\00"
@.str.10 = [18 x i8] c"%s: read(%s): %s\0A\00"
@.str.11 = [24 x i8] c"%s: short read from %s\0A\00"
@.str.12 = [53 x i8] c"programming error at %x (expected %08x, found %08x)\0A\00"
@.str.13 = [8 x i8] c"VERBOSE\00"
@.str.14 = [38 x i8] c"%s: Wrote %li bytes at offset 0x8000\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = load i32, i32* @O_RDWR
%13 = load i32, i32* @O_SYNC
%14 = or i32 %13, %12
%15 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %1
%20 = load i32, i32* @errno
%21 = tail call i8* @strerror(i32 %20)
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %19, i8* %21)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %11
%25 = tail call i64 (...) @spec_get_base()
%26 = icmp eq i64 %25, -1
br i1 %26, label %27, label %34
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %1
%30 = load i32, i32* @errno
%31 = tail call i8* @strerror(i32 %30)
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %29, i8* %31)
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %24
%35 = load i32, i32* @PROT_READ
%36 = load i32, i32* @PROT_WRITE
%37 = or i32 %36, %35
%38 = load i32, i32* @MAP_SHARED
%39 = tail call i8* @mmap(i32 0, i32 1048576, i32 %37, i32 %38, i32 %15, i64 %25)
%40 = icmp eq i8* %39, inttoptr (i64 -1 to i8*)
br i1 %40, label %41, label %48
41: ; preds = %34
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %1
%44 = load i32, i32* @errno
%45 = tail call i8* @strerror(i32 %44)
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %43, i8* %45)
%47 = tail call i32 @exit(i32 1)
unreachable
48: ; preds = %34
%49 = tail call i32 @close(i32 %15)
%50 = getelementptr inbounds i8*, i8** %1, i64 1
%51 = load i8*, i8** %50
%52 = tail call i32* @fopen(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%53 = icmp eq i32* %52, null
br i1 %53, label %54, label %62
54: ; preds = %48
%55 = load i32, i32* @stderr
%56 = load i8*, i8** %1
%57 = load i8*, i8** %50
%58 = load i32, i32* @errno
%59 = tail call i8* @strerror(i32 %58)
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %56, i8* %57, i8* %59)
%61 = tail call i32 @exit(i32 1)
unreachable
62: ; preds = %48
%63 = tail call i32 @fileno(i32* %52)
%64 = call i64 @fstat(i32 %63, %struct.stat* %3)
%65 = icmp eq i64 %64, 0
br i1 %65, label %74, label %66
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = load i8*, i8** %1
%69 = load i8*, i8** %50
%70 = load i32, i32* @errno
%71 = tail call i8* @strerror(i32 %70)
%72 = tail call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %68, i8* %69, i8* %71)
%73 = tail call i32 @exit(i32 1)
unreachable
74: ; preds = %62
%75 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%76 = load i32, i32* %75
%77 = tail call i32 @S_ISREG(i32 %76)
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %85
79: ; preds = %74
%80 = load i32, i32* @stderr
%81 = load i8*, i8** %1
%82 = load i8*, i8** %50
%83 = tail call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %81, i8* %82)
%84 = tail call i32 @exit(i32 1)
unreachable
85: ; preds = %74
%86 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%87 = load i32, i32* %86
%88 = tail call i8* @malloc(i32 %87)
%89 = icmp eq i8* %88, null
br i1 %89, label %90, label %98
90: ; preds = %85
%91 = load i32, i32* @stderr
%92 = load i8*, i8** %1
%93 = sext i32 %87 to i64
%94 = load i32, i32* @errno
%95 = tail call i8* @strerror(i32 %94)
%96 = tail call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), i8* %92, i64 %93, i8* %95)
%97 = tail call i32 @exit(i32 1)
unreachable
98: ; preds = %85
%99 = tail call i32 @fread(i8* %88, i32 1, i32 %87, i32* %52)
%100 = icmp slt i32 %99, 0
br i1 %100, label %101, label %109
101: ; preds = %98
%102 = load i32, i32* @stderr
%103 = load i8*, i8** %1
%104 = load i8*, i8** %50
%105 = load i32, i32* @errno
%106 = tail call i8* @strerror(i32 %105)
%107 = tail call i32 (i32, i8*, ...) @fprintf(i32 %102, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i8* %103, i8* %104, i8* %106)
%108 = tail call i32 @exit(i32 1)
unreachable
109: ; preds = %98
%110 = icmp eq i32 %99, %87
br i1 %110, label %117, label %111
111: ; preds = %109
%112 = load i32, i32* @stderr
%113 = load i8*, i8** %1
%114 = load i8*, i8** %50
%115 = tail call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %113, i8* %114)
%116 = tail call i32 @exit(i32 1)
unreachable
117: ; preds = %109
%118 = getelementptr i8, i8* %39, i64 656384
%119 = bitcast i8* %118 to i64*
store volatile i64 501930990, i64* %119
br label %120
120: ; preds = %120, %117
%121 = load volatile i64, i64* %119
%122 = and i64 %121, 268435456
%123 = icmp eq i64 %122, 0
br i1 %123, label %120, label %124
124: ; preds = %120
%125 = bitcast i8* %88 to i32*
%126 = getelementptr i8, i8* %39, i64 524288
%127 = bitcast i8* %126 to i64*
%128 = add nsw i32 %87, 3
%129 = sdiv i32 %128, 4
%130 = icmp sgt i32 %87, 0
br i1 %130, label %131, label %166
131: ; preds = %124
%132 = call i32 @llvm.smax.i32(i32 %129, i32 1)
%133 = zext i32 %132 to i64
br label %138
134: ; preds = %138
br i1 %130, label %135, label %166
135: ; preds = %134
%136 = call i32 @llvm.smax.i32(i32 %129, i32 1)
%137 = zext i32 %136 to i64
br label %148
138: ; preds = %131, %138
%139 = phi i64 [ 0, %131 ], [ %146, %138 ]
%140 = getelementptr inbounds i32, i32* %125, i64 %139
%141 = load i32, i32* %140
%142 = tail call i32 @htonl(i32 %141)
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i64, i64* %127, i64 %139
store volatile i64 %143, i64* %144
%145 = tail call i32 (...) @sync()
%146 = add nuw nsw i64 %139, 1
%147 = icmp eq i64 %146, %133
br i1 %147, label %134, label %138
148: ; preds = %135, %163
%149 = phi i64 [ 0, %135 ], [ %164, %163 ]
%150 = getelementptr inbounds i64, i64* %127, i64 %149
%151 = load volatile i64, i64* %150
%152 = getelementptr inbounds i32, i32* %125, i64 %149
%153 = load i32, i32* %152
%154 = tail call i32 @htonl(i32 %153)
%155 = sext i32 %154 to i64
%156 = icmp eq i64 %151, %155
br i1 %156, label %163, label %157
157: ; preds = %148
%158 = load i32, i32* @stderr
%159 = load volatile i64, i64* %150
%160 = trunc i64 %149 to i32
%161 = shl i32 %160, 2
%162 = tail call i32 (i32, i8*, ...) @fprintf(i32 %158, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.12, i64 0, i64 0), i32 %161, i32 %154, i64 %159)
br label %163
163: ; preds = %148, %157
%164 = add nuw nsw i64 %149, 1
%165 = icmp eq i64 %164, %137
br i1 %165, label %166, label %148
166: ; preds = %163, %124, %134
store volatile i64 233495534, i64* %119
%167 = tail call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%168 = icmp eq i64 %167, 0
br i1 %168, label %173, label %169
169: ; preds = %166
%170 = load i8*, i8** %1
%171 = sext i32 %87 to i64
%172 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), i8* %170, i64 %171)
br label %173
173: ; preds = %169, %166
%174 = tail call i32 @exit(i32 0)
unreachable
}