#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 */
struct stat {
  int st_size;
};

/* Variables and functions */
unsigned char *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ MS_SYNC;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ SEEK_SET;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ exit(int);
scalar_t__ fstat(int, struct stat *);
int lseek(int, int, int /*<<< orphan*/);
unsigned char *mmap(int /*<<< orphan*/, int, int, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ msync(unsigned char *, int, int /*<<< orphan*/);
int open(char *, int, ...);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int fdin, fdout;
  unsigned char *src, *dst;
  struct stat statbuf;
  int i, j, size, offset;
  long long pos;
  int map_size;
  if (argc != 6) {
    printf("usage: %s <fromfile> <tofile> <offset> <original fs> <size>\n",
           argv[0]);
    exit(1);
  }
  if ((fdin = open(argv[1], O_RDONLY)) < 0) {
    printf("can't open %s for reading", argv[1]);
    exit(1);
  }
  if ((fdout = open(argv[2], O_RDWR | O_CREAT,
                    (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) {
    printf("can't creat %s for writing", argv[2]);
    exit(1);
  }
  if (fstat(fdin, &statbuf) < 0) {
    printf("fstat error");
    exit(1);
  }
  offset = strtoul(argv[3], NULL, 0);
  if (offset % 2048) {
    printf("offset not a multiple of 2048 bytes\n");
    exit(1);
  }
  offset = offset / 2048 * 2112;
  int cap = strtoul(argv[5], NULL, 0);
  int rem;
  size = cap / 2048 * 2112 + offset;
  if (lseek(fdout, size - 1, SEEK_SET) == -1) {
    printf("lseek error");
    exit(1);
  }
  if (write(fdout, "", 1) != 1) {
    printf("write error");
    exit(1);
  }
  if ((src = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fdin, 0)) ==
      MAP_FAILED) {
    printf("mmap error for input");
    exit(1);
  }
  map_size = cap / 2048 * 2112;
  if ((dst = mmap(0, map_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdout,
                  offset)) == MAP_FAILED) {
    printf("mmap error for output");
    exit(1);
  }
  if (argv[4] != NULL && strcmp(argv[4], "yaffs") == 0) {
    printf("yaffs write at offset 0x%x\n", offset);
    for (i = 0; i < statbuf.st_size; i++) {
      *(dst + i) = *(src + i);
    }
    pos = i;
    rem = cap / 2048 * 2112 - pos;
    for (i = 0; i < rem; i++) {
      *(dst + pos + i) = 0xff;
    }
  } else {
    for (i = 0; i < statbuf.st_size; i++, pos++) {
      if ((i % 2048) == 0 && i)
        for (j = 0; j < 64; j++) {
          *(dst + pos) = 0xFF;
          pos++;
        }
      *(dst + pos) = *(src + i);
    }
  }
  msync(dst, map_size, MS_SYNC);
  printf("finish\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x6,-0x8(%rbp)
je     11df <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dda(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1223 <main+0x83>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%esi
mov    0x2dbd(%rip),%rax
or     (%rax),%esi
mov    0x2d44(%rip),%rax
mov    (%rax),%edx
mov    0x2d73(%rip),%rax
or     (%rax),%edx
mov    0x2d52(%rip),%rax
or     (%rax),%edx
mov    0x2d41(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1294 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   10c0 <fstat@plt>
cmp    $0x0,%rax
jge    12c2 <main+0x122>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10a0 <strtoul@plt>
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1304 <main+0x164>
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x40(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
imul   $0x840,%eax,%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10a0 <strtoul@plt>
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
imul   $0x840,%eax,%eax
add    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x3c(%rbp),%esi
sub    $0x1,%esi
mov    0x2c5b(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0xffffffff,%eax
jne    137d <main+0x1dd>
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%edi
lea    0xcb5(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
je     13b2 <main+0x212>
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x30(%rbp),%esi
mov    0x2c34(%rip),%rax
mov    (%rax),%edx
mov    0x2c1b(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %r9d,%r9d
mov    %r9d,%edi
call   1050 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    0x2b9f(%rip),%rcx
cmp    (%rcx),%rax
jne    1402 <main+0x262>
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x50(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
imul   $0x840,%eax,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
mov    0x2bd0(%rip),%rax
mov    (%rax),%edx
mov    0x2b67(%rip),%rax
or     (%rax),%edx
mov    0x2bae(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x40(%rbp),%r9d
xor    %edi,%edi
call   1050 <mmap@plt>
mov    %rax,-0x28(%rbp)
mov    0x2b32(%rip),%rcx
cmp    (%rcx),%rax
jne    146f <main+0x2cf>
lea    0xc72(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x20(%rax)
je     153c <main+0x39c>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xc59(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    153c <main+0x39c>
mov    -0x40(%rbp),%esi
lea    0xc46(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    14e4 <main+0x344>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14b4 <main+0x314>
movslq -0x34(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
imul   $0x840,%eax,%eax
cltq
sub    -0x48(%rbp),%rax
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1537 <main+0x397>
mov    -0x28(%rbp),%rax
add    -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    150d <main+0x36d>
jmp    15de <main+0x43e>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    15d9 <main+0x439>
mov    -0x34(%rbp),%eax
mov    $0x800,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    15a9 <main+0x409>
cmpl   $0x0,-0x34(%rbp)
je     15a9 <main+0x409>
movl   $0x0,-0x38(%rbp)
cmpl   $0x40,-0x38(%rbp)
jge    15a4 <main+0x404>
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1574 <main+0x3d4>
jmp    15a9 <main+0x409>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1543 <main+0x3a3>
jmp    15de <main+0x43e>
mov    -0x28(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    0x29ac(%rip),%rax
mov    (%rax),%edx
call   1040 <msync@plt>
lea    0xb0e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
cmp    $0x6,%edi
jne    11fb <main+0x3b>
mov    0x8(%r13),%rdi
mov    0x2de7(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
jns    1217 <main+0x57>
mov    0x8(%r13),%rsi
lea    0xe44(%rip),%rdi
jmp    1206 <main+0x46>
mov    0x0(%r13),%rsi
lea    0xdfa(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    %eax,%ebx
mov    0x2db0(%rip),%rax
mov    0x2dd1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d56(%rip),%rax
mov    0x2d87(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d64(%rip),%rax
or     (%rax),%edx
mov    0x10(%r13),%rdi
mov    0x2d4f(%rip),%rax
or     (%rax),%edx
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
jns    126b <main+0xab>
mov    0x10(%r13),%rsi
lea    0xdee(%rip),%rdi
jmp    1206 <main+0x46>
mov    %eax,%ebp
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
call   10e0 <fstat@plt>
test   %rax,%rax
jns    1296 <main+0xd6>
lea    0xded(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x18(%r13),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
test   $0x7ff,%eax
jne    1309 <main+0x149>
lea    0x7ff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0xb,%ecx
imul   $0x840,%ecx,%r14d
mov    0x28(%r13),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
lea    0x7ff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0xb,%ecx
imul   $0x840,%ecx,%r15d
lea    (%r14,%r15,1),%esi
add    $0xffffffff,%esi
mov    0x2cc1(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
call   1080 <lseek@plt>
cmp    $0xffffffff,%eax
jne    131f <main+0x15f>
lea    0xd7a(%rip),%rdi
jmp    1285 <main+0xc5>
lea    0xdda(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xd16(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x1,%eax
jne    137e <main+0x1be>
mov    %r15,0x8(%rsp)
mov    0x10(%rsp),%r12d
mov    0x2ca8(%rip),%rax
mov    (%rax),%edx
mov    0x2c8f(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %r12d,%esi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1060 <mmap@plt>
mov    %rax,%r15
mov    0x2c13(%rip),%rax
cmp    (%rax),%r15
jne    138a <main+0x1ca>
lea    0xd1d(%rip),%rdi
jmp    1285 <main+0xc5>
lea    0xd05(%rip),%rdi
jmp    1285 <main+0xc5>
mov    0x2bff(%rip),%rax
mov    (%rax),%edx
mov    0x2c56(%rip),%rax
or     (%rax),%edx
mov    0x2c3d(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    0x8(%rsp),%rsi
mov    %ebp,%r8d
mov    %r14d,%r9d
call   1060 <mmap@plt>
mov    %rax,%rbx
mov    0x2bbf(%rip),%rax
cmp    (%rax),%rbx
jne    13d2 <main+0x212>
lea    0xcde(%rip),%rdi
jmp    1285 <main+0xc5>
mov    0x20(%r13),%rdi
test   %rdi,%rdi
je     14ce <main+0x30e>
lea    0xcdb(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    14ce <main+0x30e>
lea    0xccc(%rip),%rdi
xor    %ebp,%ebp
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
test   %r12d,%r12d
jle    14a2 <main+0x2e2>
cmp    $0x8,%r12d
jb     1430 <main+0x270>
lea    (%r15,%r12,1),%rax
cmp    %rax,%rbx
jae    15a2 <main+0x3e2>
lea    (%rbx,%r12,1),%rax
cmp    %rax,%r15
jae    15a2 <main+0x3e2>
xor    %eax,%eax
mov    %rax,%rsi
not    %rsi
add    %r12,%rsi
mov    %r12,%rdx
and    $0x3,%rdx
je     1462 <main+0x2a2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r15,%rax,1),%ecx
mov    %cl,(%rbx,%rax,1)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    1450 <main+0x290>
cmp    $0x3,%rsi
jb     149f <main+0x2df>
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rax,1),%ecx
mov    %cl,(%rbx,%rax,1)
movzbl 0x1(%r15,%rax,1),%ecx
mov    %cl,0x1(%rbx,%rax,1)
movzbl 0x2(%r15,%rax,1),%ecx
mov    %cl,0x2(%rbx,%rax,1)
movzbl 0x3(%r15,%rax,1),%ecx
mov    %cl,0x3(%rbx,%rax,1)
add    $0x4,%rax
cmp    %rax,%r12
jne    1470 <main+0x2b0>
mov    %r12d,%ebp
mov    0x8(%rsp),%rax
sub    %ebp,%eax
test   %eax,%eax
jle    1519 <main+0x359>
mov    %ebp,%eax
mov    %rbx,%rdi
add    %rax,%rdi
not    %ebp
add    0x8(%rsp),%ebp
add    $0x1,%rbp
mov    $0xff,%esi
mov    %rbp,%rdx
call   1090 <memset@plt>
jmp    1519 <main+0x359>
test   %r12d,%r12d
jle    1519 <main+0x359>
cmp    $0x1,%r12d
jne    1542 <main+0x382>
xor    %eax,%eax
test   $0x1,%r12b
je     1519 <main+0x359>
test   %rax,%rax
je     1512 <main+0x352>
mov    %eax,%edx
and    $0x7ff,%edx
test   %rdx,%rdx
jne    1512 <main+0x352>
pcmpeqd %xmm0,%xmm0
movdqu %xmm0,0x30(%rbx,%rcx,1)
movdqu %xmm0,0x20(%rbx,%rcx,1)
movdqu %xmm0,0x10(%rbx,%rcx,1)
movdqu %xmm0,(%rbx,%rcx,1)
add    $0x40,%rcx
mov    (%r15,%rax,1),%al
mov    %al,(%rbx,%rcx,1)
mov    0x2a78(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
call   1050 <msync@plt>
lea    0xbad(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    %r12d,%edi
and    $0xfffffffe,%edi
xor    %eax,%eax
pcmpeqd %xmm0,%xmm0
jmp    1573 <main+0x3b3>
movzbl (%r15,%rax,1),%edx
mov    %dl,(%rbx,%rcx,1)
movzbl 0x1(%r15,%rax,1),%edx
mov    %dl,0x1(%rbx,%rcx,1)
add    $0x2,%rax
add    $0x2,%rcx
cmp    %rax,%rdi
je     14db <main+0x31b>
test   %rax,%rax
je     1550 <main+0x390>
mov    %eax,%esi
and    $0x7fe,%esi
test   %rsi,%rsi
jne    1550 <main+0x390>
movdqu %xmm0,0x30(%rbx,%rcx,1)
movdqu %xmm0,0x20(%rbx,%rcx,1)
movdqu %xmm0,0x10(%rbx,%rcx,1)
movdqu %xmm0,(%rbx,%rcx,1)
add    $0x40,%rcx
jmp    1550 <main+0x390>
cmp    $0x20,%r12d
jae    15af <main+0x3ef>
xor    %eax,%eax
jmp    1690 <main+0x4d0>
mov    %r12d,%eax
and    $0xffffffe0,%eax
lea    -0x20(%rax),%rsi
mov    %rsi,%rdx
shr    $0x5,%rdx
add    $0x1,%rdx
mov    %edx,%ecx
and    $0x3,%ecx
cmp    $0x60,%rsi
jae    15d3 <main+0x413>
xor    %esi,%esi
jmp    1642 <main+0x482>
and    $0xfffffffffffffffc,%rdx
xor    %esi,%esi
nopl   0x0(%rax)
movups (%r15,%rsi,1),%xmm0
movups 0x10(%r15,%rsi,1),%xmm1
movups %xmm0,(%rbx,%rsi,1)
movups %xmm1,0x10(%rbx,%rsi,1)
movups 0x20(%r15,%rsi,1),%xmm0
movups 0x30(%r15,%rsi,1),%xmm1
movups %xmm0,0x20(%rbx,%rsi,1)
movups %xmm1,0x30(%rbx,%rsi,1)
movups 0x40(%r15,%rsi,1),%xmm0
movups 0x50(%r15,%rsi,1),%xmm1
movups %xmm0,0x40(%rbx,%rsi,1)
movups %xmm1,0x50(%rbx,%rsi,1)
movdqu 0x60(%r15,%rsi,1),%xmm0
movups 0x70(%r15,%rsi,1),%xmm1
movdqu %xmm0,0x60(%rbx,%rsi,1)
movups %xmm1,0x70(%rbx,%rsi,1)
sub    $0xffffffffffffff80,%rsi
add    $0xfffffffffffffffc,%rdx
jne    15e0 <main+0x420>
test   %rcx,%rcx
je     167d <main+0x4bd>
lea    (%rbx,%rsi,1),%rdx
add    $0x10,%rdx
add    %r15,%rsi
add    $0x10,%rsi
shl    $0x5,%rcx
xor    %edi,%edi
nopl   0x0(%rax)
movdqu -0x10(%rsi,%rdi,1),%xmm0
movups (%rsi,%rdi,1),%xmm1
movdqu %xmm0,-0x10(%rdx,%rdi,1)
movups %xmm1,(%rdx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rcx
jne    1660 <main+0x4a0>
cmp    %r12,%rax
je     149f <main+0x2df>
test   $0x18,%r12b
je     1432 <main+0x272>
mov    %rax,%rcx
mov    %r12d,%eax
and    $0xfffffff8,%eax
nopl   0x0(%rax)
mov    (%r15,%rcx,1),%rdx
mov    %rdx,(%rbx,%rcx,1)
add    $0x8,%rcx
cmp    %rcx,%rax
jne    16a0 <main+0x4e0>
cmp    %r12,%rax
je     149f <main+0x2df>
jmp    1432 <main+0x272>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [61 x i8] c"usage: %s <fromfile> <tofile> <offset> <original fs> <size>\0A\00"
@O_RDONLY = global i32 0
@.str.1 = [26 x i8] c"can't open %s for reading\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.2 = [27 x i8] c"can't creat %s for writing\00"
@.str.3 = [12 x i8] c"fstat error\00"
@.str.4 = [37 x i8] c"offset not a multiple of 2048 bytes\0A\00"
@SEEK_SET = global i32 0
@.str.5 = [12 x i8] c"lseek error\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [12 x i8] c"write error\00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.8 = [21 x i8] c"mmap error for input\00"
@PROT_WRITE = global i32 0
@.str.9 = [22 x i8] c"mmap error for output\00"
@.str.10 = [6 x i8] c"yaffs\00"
@.str.11 = [28 x i8] c"yaffs write at offset 0x%x\0A\00"
@MS_SYNC = global i32 0
@.str.12 = [8 x i8] c"finish\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 i8*
%9 = alloca i8*
%10 = alloca %struct.stat
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i64
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 6
br i1 %20, label %21, label %27
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i32, i32* @O_RDONLY
%32 = call i32 (i8*, i32, ...) @open(i8* %30, i32 %31)
store i32 %32, i32* %6
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %27
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %27
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = load i32, i32* @O_RDWR
%45 = load i32, i32* @O_CREAT
%46 = or i32 %44, %45
%47 = load i32, i32* @S_IRUSR
%48 = load i32, i32* @S_IWUSR
%49 = or i32 %47, %48
%50 = load i32, i32* @S_IRGRP
%51 = or i32 %49, %50
%52 = load i32, i32* @S_IROTH
%53 = or i32 %51, %52
%54 = call i32 (i8*, i32, ...) @open(i8* %43, i32 %46, i32 %53)
store i32 %54, i32* %7
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %62
56: ; preds = %40
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %59)
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %40
%63 = load i32, i32* %6
%64 = call i64 @fstat(i32 %63, %struct.stat* %10)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %62
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 3
%72 = load i8*, i8** %71
%73 = call i32 @strtoul(i8* %72, i32* null, i32 0)
store i32 %73, i32* %14
%74 = load i32, i32* %14
%75 = srem i32 %74, 2048
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %69
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %69
%81 = load i32, i32* %14
%82 = sdiv i32 %81, 2048
%83 = mul nsw i32 %82, 2112
store i32 %83, i32* %14
%84 = load i8**, i8*** %5
%85 = getelementptr inbounds i8*, i8** %84, i64 5
%86 = load i8*, i8** %85
%87 = call i32 @strtoul(i8* %86, i32* null, i32 0)
store i32 %87, i32* %17
%88 = load i32, i32* %17
%89 = sdiv i32 %88, 2048
%90 = mul nsw i32 %89, 2112
%91 = load i32, i32* %14
%92 = add nsw i32 %90, %91
store i32 %92, i32* %13
%93 = load i32, i32* %7
%94 = load i32, i32* %13
%95 = sub nsw i32 %94, 1
%96 = load i32, i32* @SEEK_SET
%97 = call i32 @lseek(i32 %93, i32 %95, i32 %96)
%98 = icmp eq i32 %97, -1
br i1 %98, label %99, label %102
99: ; preds = %80
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %80
%103 = load i32, i32* %7
%104 = call i32 @write(i32 %103, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32 1)
%105 = icmp ne i32 %104, 1
br i1 %105, label %106, label %109
106: ; preds = %102
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%108 = call i32 @exit(i32 1)
unreachable
109: ; preds = %102
%110 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%111 = load i32, i32* %110
%112 = load i32, i32* @PROT_READ
%113 = load i32, i32* @MAP_SHARED
%114 = load i32, i32* %6
%115 = call i8* @mmap(i32 0, i32 %111, i32 %112, i32 %113, i32 %114, i32 0)
store i8* %115, i8** %8
%116 = load i8*, i8** @MAP_FAILED
%117 = icmp eq i8* %115, %116
br i1 %117, label %118, label %121
118: ; preds = %109
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%120 = call i32 @exit(i32 1)
unreachable
121: ; preds = %109
%122 = load i32, i32* %17
%123 = sdiv i32 %122, 2048
%124 = mul nsw i32 %123, 2112
store i32 %124, i32* %16
%125 = load i32, i32* %16
%126 = load i32, i32* @PROT_READ
%127 = load i32, i32* @PROT_WRITE
%128 = or i32 %126, %127
%129 = load i32, i32* @MAP_SHARED
%130 = load i32, i32* %7
%131 = load i32, i32* %14
%132 = call i8* @mmap(i32 0, i32 %125, i32 %128, i32 %129, i32 %130, i32 %131)
store i8* %132, i8** %9
%133 = load i8*, i8** @MAP_FAILED
%134 = icmp eq i8* %132, %133
br i1 %134, label %135, label %138
135: ; preds = %121
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %121
%139 = load i8**, i8*** %5
%140 = getelementptr inbounds i8*, i8** %139, i64 4
%141 = load i8*, i8** %140
%142 = icmp ne i8* %141, null
br i1 %142, label %143, label %195
143: ; preds = %138
%144 = load i8**, i8*** %5
%145 = getelementptr inbounds i8*, i8** %144, i64 4
%146 = load i8*, i8** %145
%147 = call i64 @strcmp(i8* %146, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%148 = icmp eq i64 %147, 0
br i1 %148, label %149, label %195
149: ; preds = %143
%150 = load i32, i32* %14
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %150)
store i32 0, i32* %11
br label %152
152: ; preds = %167, %149
%153 = load i32, i32* %11
%154 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%155 = load i32, i32* %154
%156 = icmp slt i32 %153, %155
br i1 %156, label %157, label %170
157: ; preds = %152
%158 = load i8*, i8** %8
%159 = load i32, i32* %11
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8, i8* %158, i64 %160
%162 = load i8, i8* %161
%163 = load i8*, i8** %9
%164 = load i32, i32* %11
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8, i8* %163, i64 %165
store i8 %162, i8* %166
br label %167
167: ; preds = %157
%168 = load i32, i32* %11
%169 = add nsw i32 %168, 1
store i32 %169, i32* %11
br label %152
170: ; preds = %152
%171 = load i32, i32* %11
%172 = sext i32 %171 to i64
store i64 %172, i64* %15
%173 = load i32, i32* %17
%174 = sdiv i32 %173, 2048
%175 = mul nsw i32 %174, 2112
%176 = sext i32 %175 to i64
%177 = load i64, i64* %15
%178 = sub nsw i64 %176, %177
%179 = trunc i64 %178 to i32
store i32 %179, i32* %18
store i32 0, i32* %11
br label %180
180: ; preds = %191, %170
%181 = load i32, i32* %11
%182 = load i32, i32* %18
%183 = icmp slt i32 %181, %182
br i1 %183, label %184, label %194
184: ; preds = %180
%185 = load i8*, i8** %9
%186 = load i64, i64* %15
%187 = getelementptr inbounds i8, i8* %185, i64 %186
%188 = load i32, i32* %11
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i8, i8* %187, i64 %189
store i8 -1, i8* %190
br label %191
191: ; preds = %184
%192 = load i32, i32* %11
%193 = add nsw i32 %192, 1
store i32 %193, i32* %11
br label %180
194: ; preds = %180
br label %237
195: ; preds = %143, %138
store i32 0, i32* %11
br label %196
196: ; preds = %231, %195
%197 = load i32, i32* %11
%198 = getelementptr inbounds %struct.stat, %struct.stat* %10, i32 0, i32 0
%199 = load i32, i32* %198
%200 = icmp slt i32 %197, %199
br i1 %200, label %201, label %236
201: ; preds = %196
%202 = load i32, i32* %11
%203 = srem i32 %202, 2048
%204 = icmp eq i32 %203, 0
br i1 %204, label %205, label %222
205: ; preds = %201
%206 = load i32, i32* %11
%207 = icmp ne i32 %206, 0
br i1 %207, label %208, label %222
208: ; preds = %205
store i32 0, i32* %12
br label %209
209: ; preds = %218, %208
%210 = load i32, i32* %12
%211 = icmp slt i32 %210, 64
br i1 %211, label %212, label %221
212: ; preds = %209
%213 = load i8*, i8** %9
%214 = load i64, i64* %15
%215 = getelementptr inbounds i8, i8* %213, i64 %214
store i8 -1, i8* %215
%216 = load i64, i64* %15
%217 = add nsw i64 %216, 1
store i64 %217, i64* %15
br label %218
218: ; preds = %212
%219 = load i32, i32* %12
%220 = add nsw i32 %219, 1
store i32 %220, i32* %12
br label %209
221: ; preds = %209
br label %222
222: ; preds = %221, %205, %201
%223 = load i8*, i8** %8
%224 = load i32, i32* %11
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds i8, i8* %223, i64 %225
%227 = load i8, i8* %226
%228 = load i8*, i8** %9
%229 = load i64, i64* %15
%230 = getelementptr inbounds i8, i8* %228, i64 %229
store i8 %227, i8* %230
br label %231
231: ; preds = %222
%232 = load i32, i32* %11
%233 = add nsw i32 %232, 1
store i32 %233, i32* %11
%234 = load i64, i64* %15
%235 = add nsw i64 %234, 1
store i64 %235, i64* %15
br label %196
236: ; preds = %196
br label %237
237: ; preds = %236, %194
%238 = load i8*, i8** %9
%239 = load i32, i32* %16
%240 = load i32, i32* @MS_SYNC
%241 = call i32 @msync(i8* %238, i32 %239, i32 %240)
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%243 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [61 x i8] c"usage: %s <fromfile> <tofile> <offset> <original fs> <size>\0A\00"
@O_RDONLY = global i32 0
@.str.1 = [26 x i8] c"can't open %s for reading\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.2 = [27 x i8] c"can't creat %s for writing\00"
@.str.3 = [12 x i8] c"fstat error\00"
@SEEK_SET = global i32 0
@.str.5 = [12 x i8] c"lseek error\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [12 x i8] c"write error\00"
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.8 = [21 x i8] c"mmap error for input\00"
@PROT_WRITE = global i32 0
@.str.9 = [22 x i8] c"mmap error for output\00"
@.str.10 = [6 x i8] c"yaffs\00"
@.str.11 = [28 x i8] c"yaffs write at offset 0x%x\0A\00"
@MS_SYNC = global i32 0
@str = [7 x i8] c"finish\00"
@str.13 = [36 x i8] c"offset not a multiple of 2048 bytes\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, 6
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @O_RDONLY
%14 = tail call i32 (i8*, i32, ...) @open(i8* %12, i32 %13)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = load i8*, i8** %11
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %10
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = load i32, i32* @O_RDWR
%24 = load i32, i32* @O_CREAT
%25 = or i32 %24, %23
%26 = load i32, i32* @S_IRUSR
%27 = load i32, i32* @S_IWUSR
%28 = or i32 %27, %26
%29 = load i32, i32* @S_IRGRP
%30 = or i32 %28, %29
%31 = load i32, i32* @S_IROTH
%32 = or i32 %30, %31
%33 = tail call i32 (i8*, i32, ...) @open(i8* %22, i32 %25, i32 %32)
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %20
%36 = load i8*, i8** %21
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = tail call i32 @exit(i32 1)
unreachable
39: ; preds = %20
%40 = call i64 @fstat(i32 %14, %struct.stat* %3)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%44 = tail call i32 @exit(i32 1)
unreachable
45: ; preds = %39
%46 = getelementptr inbounds i8*, i8** %1, i64 3
%47 = load i8*, i8** %46
%48 = tail call i32 @strtoul(i8* nocapture %47, i32* null, i32 0)
%49 = and i32 %48, 2047
%50 = icmp eq i32 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %45
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.13, i64 0, i64 0))
%53 = tail call i32 @exit(i32 1)
unreachable
54: ; preds = %45
%55 = sdiv i32 %48, 2048
%56 = mul nsw i32 %55, 2112
%57 = getelementptr inbounds i8*, i8** %1, i64 5
%58 = load i8*, i8** %57
%59 = tail call i32 @strtoul(i8* nocapture %58, i32* null, i32 0)
%60 = sdiv i32 %59, 2048
%61 = mul nsw i32 %60, 2112
%62 = add i32 %56, -1
%63 = add i32 %62, %61
%64 = load i32, i32* @SEEK_SET
%65 = tail call i32 @lseek(i32 %33, i32 %63, i32 %64)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %70
67: ; preds = %54
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%69 = tail call i32 @exit(i32 1)
unreachable
70: ; preds = %54
%71 = tail call i32 @write(i32 %33, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32 1)
%72 = icmp eq i32 %71, 1
br i1 %72, label %76, label %73
73: ; preds = %70
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%75 = tail call i32 @exit(i32 1)
unreachable
76: ; preds = %70
%77 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%78 = load i32, i32* %77
%79 = load i32, i32* @PROT_READ
%80 = load i32, i32* @MAP_SHARED
%81 = tail call i8* @mmap(i32 0, i32 %78, i32 %79, i32 %80, i32 %14, i32 0)
%82 = load i8*, i8** @MAP_FAILED
%83 = icmp eq i8* %81, %82
br i1 %83, label %84, label %87
84: ; preds = %76
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%86 = tail call i32 @exit(i32 1)
unreachable
87: ; preds = %76
%88 = load i32, i32* @PROT_READ
%89 = load i32, i32* @PROT_WRITE
%90 = or i32 %89, %88
%91 = load i32, i32* @MAP_SHARED
%92 = tail call i8* @mmap(i32 0, i32 %61, i32 %90, i32 %91, i32 %33, i32 %56)
%93 = load i8*, i8** @MAP_FAILED
%94 = icmp eq i8* %92, %93
br i1 %94, label %95, label %98
95: ; preds = %87
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%97 = tail call i32 @exit(i32 1)
unreachable
98: ; preds = %87
%99 = getelementptr inbounds i8*, i8** %1, i64 4
%100 = load i8*, i8** %99
%101 = icmp eq i8* %100, null
br i1 %101, label %263, label %102
102: ; preds = %98
%103 = tail call i64 @strcmp(i8* %100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %263
105: ; preds = %102
%106 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %56)
%107 = icmp sgt i32 %78, 0
br i1 %107, label %108, label %252
108: ; preds = %105
%109 = zext i32 %78 to i64
%110 = icmp ult i32 %78, 8
br i1 %110, label %215, label %111
111: ; preds = %108
%112 = getelementptr i8, i8* %92, i64 %109
%113 = getelementptr i8, i8* %81, i64 %109
%114 = icmp ult i8* %92, %113
%115 = icmp ult i8* %81, %112
%116 = and i1 %114, %115
br i1 %116, label %215, label %117
117: ; preds = %111
%118 = icmp ult i32 %78, 32
br i1 %118, label %201, label %119
119: ; preds = %117
%120 = and i64 %109, 4294967264
%121 = add nsw i64 %120, -32
%122 = lshr exact i64 %121, 5
%123 = add nuw nsw i64 %122, 1
%124 = and i64 %123, 3
%125 = icmp ult i64 %121, 96
br i1 %125, label %177, label %126
126: ; preds = %119
%127 = and i64 %123, 1152921504606846972
br label %128
128: ; preds = %128, %126
%129 = phi i64 [ 0, %126 ], [ %174, %128 ]
%130 = phi i64 [ 0, %126 ], [ %175, %128 ]
%131 = getelementptr inbounds i8, i8* %81, i64 %129
%132 = bitcast i8* %131 to <16 x i8>*
%133 = load <16 x i8>, <16 x i8>* %132
%134 = getelementptr inbounds i8, i8* %131, i64 16
%135 = bitcast i8* %134 to <16 x i8>*
%136 = load <16 x i8>, <16 x i8>* %135
%137 = getelementptr inbounds i8, i8* %92, i64 %129
%138 = bitcast i8* %137 to <16 x i8>*
store <16 x i8> %133, <16 x i8>* %138
%139 = getelementptr inbounds i8, i8* %137, i64 16
%140 = bitcast i8* %139 to <16 x i8>*
store <16 x i8> %136, <16 x i8>* %140
%141 = or i64 %129, 32
%142 = getelementptr inbounds i8, i8* %81, i64 %141
%143 = bitcast i8* %142 to <16 x i8>*
%144 = load <16 x i8>, <16 x i8>* %143
%145 = getelementptr inbounds i8, i8* %142, i64 16
%146 = bitcast i8* %145 to <16 x i8>*
%147 = load <16 x i8>, <16 x i8>* %146
%148 = getelementptr inbounds i8, i8* %92, i64 %141
%149 = bitcast i8* %148 to <16 x i8>*
store <16 x i8> %144, <16 x i8>* %149
%150 = getelementptr inbounds i8, i8* %148, i64 16
%151 = bitcast i8* %150 to <16 x i8>*
store <16 x i8> %147, <16 x i8>* %151
%152 = or i64 %129, 64
%153 = getelementptr inbounds i8, i8* %81, i64 %152
%154 = bitcast i8* %153 to <16 x i8>*
%155 = load <16 x i8>, <16 x i8>* %154
%156 = getelementptr inbounds i8, i8* %153, i64 16
%157 = bitcast i8* %156 to <16 x i8>*
%158 = load <16 x i8>, <16 x i8>* %157
%159 = getelementptr inbounds i8, i8* %92, i64 %152
%160 = bitcast i8* %159 to <16 x i8>*
store <16 x i8> %155, <16 x i8>* %160
%161 = getelementptr inbounds i8, i8* %159, i64 16
%162 = bitcast i8* %161 to <16 x i8>*
store <16 x i8> %158, <16 x i8>* %162
%163 = or i64 %129, 96
%164 = getelementptr inbounds i8, i8* %81, i64 %163
%165 = bitcast i8* %164 to <16 x i8>*
%166 = load <16 x i8>, <16 x i8>* %165
%167 = getelementptr inbounds i8, i8* %164, i64 16
%168 = bitcast i8* %167 to <16 x i8>*
%169 = load <16 x i8>, <16 x i8>* %168
%170 = getelementptr inbounds i8, i8* %92, i64 %163
%171 = bitcast i8* %170 to <16 x i8>*
store <16 x i8> %166, <16 x i8>* %171
%172 = getelementptr inbounds i8, i8* %170, i64 16
%173 = bitcast i8* %172 to <16 x i8>*
store <16 x i8> %169, <16 x i8>* %173
%174 = add nuw i64 %129, 128
%175 = add i64 %130, 4
%176 = icmp eq i64 %175, %127
br i1 %176, label %177, label %128
177: ; preds = %128, %119
%178 = phi i64 [ 0, %119 ], [ %174, %128 ]
%179 = icmp eq i64 %124, 0
br i1 %179, label %196, label %180
180: ; preds = %177, %180
%181 = phi i64 [ %193, %180 ], [ %178, %177 ]
%182 = phi i64 [ %194, %180 ], [ 0, %177 ]
%183 = getelementptr inbounds i8, i8* %81, i64 %181
%184 = bitcast i8* %183 to <16 x i8>*
%185 = load <16 x i8>, <16 x i8>* %184
%186 = getelementptr inbounds i8, i8* %183, i64 16
%187 = bitcast i8* %186 to <16 x i8>*
%188 = load <16 x i8>, <16 x i8>* %187
%189 = getelementptr inbounds i8, i8* %92, i64 %181
%190 = bitcast i8* %189 to <16 x i8>*
store <16 x i8> %185, <16 x i8>* %190
%191 = getelementptr inbounds i8, i8* %189, i64 16
%192 = bitcast i8* %191 to <16 x i8>*
store <16 x i8> %188, <16 x i8>* %192
%193 = add nuw i64 %181, 32
%194 = add i64 %182, 1
%195 = icmp eq i64 %194, %124
br i1 %195, label %196, label %180
196: ; preds = %180, %177
%197 = icmp eq i64 %120, %109
br i1 %197, label %252, label %198
198: ; preds = %196
%199 = and i64 %109, 24
%200 = icmp eq i64 %199, 0
br i1 %200, label %215, label %201
201: ; preds = %117, %198
%202 = phi i64 [ %120, %198 ], [ 0, %117 ]
%203 = and i64 %109, 4294967288
br label %204
204: ; preds = %204, %201
%205 = phi i64 [ %202, %201 ], [ %211, %204 ]
%206 = getelementptr inbounds i8, i8* %81, i64 %205
%207 = bitcast i8* %206 to <8 x i8>*
%208 = load <8 x i8>, <8 x i8>* %207
%209 = getelementptr inbounds i8, i8* %92, i64 %205
%210 = bitcast i8* %209 to <8 x i8>*
store <8 x i8> %208, <8 x i8>* %210
%211 = add nuw i64 %205, 8
%212 = icmp eq i64 %211, %203
br i1 %212, label %213, label %204
213: ; preds = %204
%214 = icmp eq i64 %203, %109
br i1 %214, label %252, label %215
215: ; preds = %111, %108, %198, %213
%216 = phi i64 [ 0, %108 ], [ 0, %111 ], [ %120, %198 ], [ %203, %213 ]
%217 = xor i64 %216, -1
%218 = add nsw i64 %217, %109
%219 = and i64 %109, 3
%220 = icmp eq i64 %219, 0
br i1 %220, label %230, label %221
221: ; preds = %215, %221
%222 = phi i64 [ %227, %221 ], [ %216, %215 ]
%223 = phi i64 [ %228, %221 ], [ 0, %215 ]
%224 = getelementptr inbounds i8, i8* %81, i64 %222
%225 = load i8, i8* %224
%226 = getelementptr inbounds i8, i8* %92, i64 %222
store i8 %225, i8* %226
%227 = add nuw nsw i64 %222, 1
%228 = add i64 %223, 1
%229 = icmp eq i64 %228, %219
br i1 %229, label %230, label %221
230: ; preds = %221, %215
%231 = phi i64 [ %216, %215 ], [ %227, %221 ]
%232 = icmp ult i64 %218, 3
br i1 %232, label %252, label %233
233: ; preds = %230, %233
%234 = phi i64 [ %250, %233 ], [ %231, %230 ]
%235 = getelementptr inbounds i8, i8* %81, i64 %234
%236 = load i8, i8* %235
%237 = getelementptr inbounds i8, i8* %92, i64 %234
store i8 %236, i8* %237
%238 = add nuw nsw i64 %234, 1
%239 = getelementptr inbounds i8, i8* %81, i64 %238
%240 = load i8, i8* %239
%241 = getelementptr inbounds i8, i8* %92, i64 %238
store i8 %240, i8* %241
%242 = add nuw nsw i64 %234, 2
%243 = getelementptr inbounds i8, i8* %81, i64 %242
%244 = load i8, i8* %243
%245 = getelementptr inbounds i8, i8* %92, i64 %242
store i8 %244, i8* %245
%246 = add nuw nsw i64 %234, 3
%247 = getelementptr inbounds i8, i8* %81, i64 %246
%248 = load i8, i8* %247
%249 = getelementptr inbounds i8, i8* %92, i64 %246
store i8 %248, i8* %249
%250 = add nuw nsw i64 %234, 4
%251 = icmp eq i64 %250, %109
br i1 %251, label %252, label %233
252: ; preds = %230, %233, %196, %213, %105
%253 = phi i32 [ 0, %105 ], [ %78, %213 ], [ %78, %196 ], [ %78, %233 ], [ %78, %230 ]
%254 = sub i32 %61, %253
%255 = icmp sgt i32 %254, 0
br i1 %255, label %256, label %313
256: ; preds = %252
%257 = zext i32 %253 to i64
%258 = getelementptr inbounds i8, i8* %92, i64 %257
%259 = xor i32 %253, -1
%260 = add i32 %61, %259
%261 = zext i32 %260 to i64
%262 = add nuw nsw i64 %261, 1
br label %313
263: ; preds = %102, %98
%264 = icmp sgt i32 %78, 0
br i1 %264, label %265, label %313
265: ; preds = %263
%266 = zext i32 %78 to i64
%267 = and i64 %266, 1
%268 = icmp eq i32 %78, 1
br i1 %268, label %296, label %269
269: ; preds = %265
%270 = and i64 %266, 4294967294
br label %271
271: ; preds = %282, %269
%272 = phi i64 [ 0, %269 ], [ %292, %282 ]
%273 = phi i64 [ undef, %269 ], [ %293, %282 ]
%274 = phi i64 [ 0, %269 ], [ %294, %282 ]
%275 = and i64 %272, 2046
%276 = icmp eq i64 %275, 0
%277 = icmp ne i64 %272, 0
%278 = and i1 %277, %276
br i1 %278, label %279, label %282
279: ; preds = %271
%280 = getelementptr i8, i8* %92, i64 %273
%281 = add i64 %273, 64
br label %282
282: ; preds = %279, %271
%283 = phi i64 [ %273, %271 ], [ %281, %279 ]
%284 = getelementptr inbounds i8, i8* %81, i64 %272
%285 = load i8, i8* %284
%286 = getelementptr inbounds i8, i8* %92, i64 %283
store i8 %285, i8* %286
%287 = or i64 %272, 1
%288 = add nsw i64 %283, 1
%289 = getelementptr inbounds i8, i8* %81, i64 %287
%290 = load i8, i8* %289
%291 = getelementptr inbounds i8, i8* %92, i64 %288
store i8 %290, i8* %291
%292 = add nuw nsw i64 %272, 2
%293 = add nsw i64 %283, 2
%294 = add i64 %274, 2
%295 = icmp eq i64 %294, %270
br i1 %295, label %296, label %271
296: ; preds = %282, %265
%297 = phi i64 [ 0, %265 ], [ %292, %282 ]
%298 = phi i64 [ undef, %265 ], [ %293, %282 ]
%299 = icmp eq i64 %267, 0
br i1 %299, label %313, label %300
300: ; preds = %296
%301 = and i64 %297, 2047
%302 = icmp eq i64 %301, 0
%303 = icmp ne i64 %297, 0
%304 = and i1 %303, %302
br i1 %304, label %305, label %308
305: ; preds = %300
%306 = getelementptr i8, i8* %92, i64 %298
%307 = add i64 %298, 64
br label %308
308: ; preds = %305, %300
%309 = phi i64 [ %298, %300 ], [ %307, %305 ]
%310 = getelementptr inbounds i8, i8* %81, i64 %297
%311 = load i8, i8* %310
%312 = getelementptr inbounds i8, i8* %92, i64 %309
store i8 %311, i8* %312
br label %313
313: ; preds = %308, %296, %256, %252, %263
%314 = load i32, i32* @MS_SYNC
%315 = tail call i32 @msync(i8* %92, i32 %61, i32 %314)
%316 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%317 = tail call i32 @exit(i32 0)
unreachable
}