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

/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
unsigned char *mmap(int /*<<< orphan*/, int, int, int /*<<< orphan*/, int,
                    int /*<<< orphan*/);
int /*<<< orphan*/ munmap(unsigned char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncmp(char *, char *, int);
int strtoul(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int memfd;
  __u32 i;
  __u32 addr = 0;
  __u32 len = 0x01000000;
  __u32 value = 0x0;
  __u32 valsize = 4;
  unsigned char *memspace;
  unsigned short *smspace;
  __u32 *lmspace;
  if (argc > 5 || (argc >= 2 && !strncmp(argv[1], "--help", 6))) {
    printf("Writes repeated values to TL880 RAM\n");
    printf("Usage: %s [value(hex) [addr [len [nbytes(1 to 4)]]]]\n", argv[0]);
    return -1;
  }
  if (argc >= 2) {
    value = strtoul(argv[1], NULL, 16);
  }
  if (argc >= 3) {
    addr = strtoul(argv[2], NULL, 16);
  }
  if (argc >= 4) {
    len = strtoul(argv[3], NULL, 16);
  }
  if (argc >= 5) {
    valsize = strtoul(argv[4], NULL, 10);
    if (valsize < 1) {
      valsize = 1;
    } else if (valsize > 4) {
      valsize = 4;
    }
  }
  addr &= 0xfffffffc;
  len &= 0xfffffffc;
  if (addr >= 0x01000000) {
    addr = 0;
  }
  if (addr + len >= 0x01000000) {
    len = 0x01000000 - addr;
  }
  if ((memfd = open("/dev/tl880/mem0", O_RDWR)) < 0) {
    perror("Unable to open /dev/tl880/mem0");
    return -1;
  }
  printf("Mapping memory space\n");
  if (!(memspace = mmap(0, 0x01000000, PROT_READ | PROT_WRITE, MAP_SHARED,
                        memfd, 0))) {
    perror("Failed to mmap region 1 (mem)");
    close(memfd);
    return -1;
  }
  smspace = (unsigned short *)memspace;
  lmspace = (__u32 *)memspace;
  printf("Writing value %08x from %x to %x\n", value, addr, addr + len);
  switch (valsize) {
  default:
    fprintf(stderr, "Broken valsize %d\n", valsize);
    break;
  case 1:
    for (i = addr; i < addr + len; i += valsize) {
      memspace[i] = value & 0xff;
      fprintf(stderr, "uchar mem[%x] = %08x\r", i, value & 0xff);
    }
    break;
  case 2:
    for (i = addr; i < addr + len; i += valsize) {
      smspace[i / 2] = value & 0xffff;
      fprintf(stderr, "ushort mem[%x] = %04x\r", i, value & 0xffff);
    }
    break;
  case 3:
    for (i = addr; i < addr + len; i += valsize) {
      memspace[i] = (value >> 16) & 0xff;
      memspace[i + 1] = (value >> 8) & 0xff;
      memspace[i + 2] = value & 0xff;
      fprintf(stderr, "uchar mem[%x-%x] = %06x\r", i, i + 2, value & 0xffffff);
    }
    break;
  case 4:
    for (i = addr; i < addr + len; i += valsize) {
      lmspace[i / 4] = value;
      fprintf(stderr, "ushort mem[%x] = %08x\r", i, value);
    }
    break;
  }
  fprintf(stderr, "\n");
  printf("Unmapping memory space\n");
  munmap(memspace, 0x01000000);
  close(memfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1000000,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x4,-0x28(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     11f8 <main+0x68>
cmpl   $0x2,-0x8(%rbp)
jl     1227 <main+0x97>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2b(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1227 <main+0x97>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1671 <main+0x4e1>
cmpl   $0x2,-0x8(%rbp)
jl     124a <main+0xba>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10b0 <strtoul@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     126d <main+0xdd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10b0 <strtoul@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     1290 <main+0x100>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10b0 <strtoul@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x5,-0x8(%rbp)
jl     12e4 <main+0x154>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10b0 <strtoul@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
jge    12c9 <main+0x139>
movl   $0x1,-0x28(%rbp)
jmp    12df <main+0x14f>
cmpl   $0x4,-0x28(%rbp)
jle    12da <main+0x14a>
movl   $0x4,-0x28(%rbp)
jmp    12df <main+0x14f>
jmp    12e4 <main+0x154>
mov    -0x1c(%rbp),%eax
and    $0xfffffffc,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
and    $0xfffffffc,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x1000000,-0x1c(%rbp)
jl     130a <main+0x17a>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cmp    $0x1000000,%eax
jl     1326 <main+0x196>
mov    $0x1000000,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2cab(%rip),%rax
mov    (%rax),%esi
lea    0xd4b(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    135f <main+0x1cf>
lea    0xd24(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1671 <main+0x4e1>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c84(%rip),%rax
mov    (%rax),%edx
mov    0x2c43(%rip),%rax
or     (%rax),%edx
mov    0x2c62(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %r9d,%r9d
mov    $0x1000000,%esi
mov    %r9d,%edi
call   1040 <mmap@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    13ca <main+0x23a>
lea    0xcf6(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1671 <main+0x4e1>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%eax
mov    %edx,%ecx
add    %eax,%ecx
lea    0xcd7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x3,%eax
ja     141e <main+0x28e>
mov    -0x48(%rbp),%rax
lea    0xbeb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2ba3(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
lea    0xcb6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    162f <main+0x49f>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    149a <main+0x30a>
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    0x2b58(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x24(%rbp),%ecx
and    $0xff,%ecx
lea    0xc75(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1443 <main+0x2b3>
jmp    162f <main+0x49f>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1517 <main+0x387>
mov    -0x24(%rbp),%eax
and    $0xffff,%eax
mov    %ax,-0x52(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x52(%rbp),%dx
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
mov    %dx,(%rax,%rcx,2)
mov    0x2adb(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x24(%rbp),%ecx
and    $0xffff,%ecx
lea    0xc0e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    14a5 <main+0x315>
jmp    162f <main+0x49f>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    15bb <main+0x42b>
mov    -0x24(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    0x2a3f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
mov    -0x24(%rbp),%r8d
and    $0xffffff,%r8d
lea    0xb81(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1522 <main+0x392>
jmp    162f <main+0x49f>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    162a <main+0x49a>
mov    -0x24(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x64(%rbp),%edx
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x29c2(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xb2b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    15c6 <main+0x436>
jmp    162f <main+0x49f>
mov    0x2992(%rip),%rax
mov    (%rax),%edi
lea    0x9fb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
lea    0xb0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    $0x1000000,%esi
call   1080 <munmap@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x5,%edi
jle    11da <main+0x3a>
lea    0xf8e(%rip),%rdi
call   1040 <puts@plt>
mov    (%r14),%rsi
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebx
jmp    1525 <main+0x385>
mov    %edi,%ebp
mov    $0x1000000,%r12d
movl   $0x0,(%rsp)
mov    $0x4,%r15d
cmp    $0x2,%edi
jl     1294 <main+0xf4>
mov    0x8(%r14),%rdi
lea    0xe0d(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11b3 <main+0x13>
mov    0x8(%r14),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0x10,%edx
call   10c0 <strtoul@plt>
mov    %eax,(%rsp)
cmp    $0x3,%ebp
jb     129e <main+0xfe>
mov    0x10(%r14),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0x10,%edx
call   10c0 <strtoul@plt>
and    $0xfffffffc,%eax
mov    $0x4,%r15d
mov    $0x1000000,%r13d
cmp    $0x3,%ebp
je     12b8 <main+0x118>
mov    %eax,0x4(%rsp)
mov    0x18(%r14),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10c0 <strtoul@plt>
mov    %eax,%r13d
and    $0xfffffffc,%r13d
cmp    $0x5,%ebp
jb     12a6 <main+0x106>
mov    0x20(%r14),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10c0 <strtoul@plt>
test   %eax,%eax
jle    12ae <main+0x10e>
cmp    $0x4,%eax
mov    $0x4,%r15d
cmovb  %eax,%r15d
jmp    12b4 <main+0x114>
mov    $0x1000000,%r13d
xor    %ebx,%ebx
jmp    12c0 <main+0x120>
mov    $0x1000000,%r13d
jmp    12c0 <main+0x120>
mov    $0x4,%r15d
jmp    12b4 <main+0x114>
mov    $0x1,%r15d
mov    0x4(%rsp),%eax
cmp    $0x1000000,%eax
cmovl  %eax,%ebx
lea    (%rbx,%r13,1),%eax
sub    %ebx,%r12d
cmp    $0x1000000,%eax
cmovl  %r13d,%r12d
mov    0x2d01(%rip),%rax
mov    (%rax),%esi
lea    0xd7c(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     1536 <main+0x396>
mov    %eax,%ebp
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
mov    0x2cf6(%rip),%rax
mov    0x2cb7(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2cd4(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    $0x1000000,%esi
mov    %ebp,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
test   %rax,%rax
je     1549 <main+0x3a9>
mov    %rax,%r14
lea    (%r12,%rbx,1),%r13d
lea    0xd4b(%rip),%rdi
mov    (%rsp),%esi
mov    %ebx,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
lea    -0x1(%r15),%eax
cmp    $0x3,%eax
mov    %ebp,0x4(%rsp)
ja     13b4 <main+0x214>
lea    0xc9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
test   %r12d,%r12d
mov    (%rsp),%r15d
jle    14ea <main+0x34a>
movzbl %r15b,%ebp
movslq %ebx,%rbx
movslq %r13d,%r12
mov    0x2c3f(%rip),%r13
lea    0xd2f(%rip),%r15
mov    %bpl,(%r14,%rbx,1)
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%rbx
cmp    %r12,%rbx
jl     1390 <main+0x1f0>
jmp    14ea <main+0x34a>
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
lea    0xce8(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    14ea <main+0x34a>
test   %r12d,%r12d
mov    (%rsp),%r15d
jle    14ea <main+0x34a>
movzwl %r15w,%ebp
mov    0x2bdd(%rip),%r12
lea    0xce3(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
sar    %eax
cltq
mov    %bp,(%r14,%rax,2)
mov    (%r12),%edi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x2,%ebx
cmp    %r13d,%ebx
jl     1400 <main+0x260>
jmp    14ea <main+0x34a>
test   %r12d,%r12d
jle    14ea <main+0x34a>
mov    (%rsp),%r12d
mov    %r12d,%r15d
shr    $0x10,%r15d
mov    %r12d,%ebp
shr    $0x8,%ebp
and    $0xffffff,%r12d
movslq %ebx,%rbx
movslq %r13d,%r13
cs nopw 0x0(%rax,%rax,1)
mov    %r15b,(%r14,%rbx,1)
mov    %bpl,0x1(%r14,%rbx,1)
lea    0x2(%rbx),%ecx
mov    (%rsp),%eax
mov    %al,0x2(%r14,%rbx,1)
mov    0x2b4d(%rip),%rax
mov    (%rax),%edi
lea    0xc68(%rip),%rsi
mov    %ebx,%edx
mov    %r12d,%r8d
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x3,%rbx
cmp    %r13,%rbx
jl     1460 <main+0x2c0>
jmp    14ea <main+0x34a>
test   %r12d,%r12d
mov    (%rsp),%ebp
jle    14ea <main+0x34a>
mov    0x2b1e(%rip),%r15
lea    0xc54(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x3(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
sar    $0x2,%eax
cltq
mov    %ebp,(%r14,%rax,4)
mov    (%r15),%edi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x4,%ebx
cmp    %r13d,%ebx
jl     14c0 <main+0x320>
mov    0x2ad7(%rip),%rax
mov    (%rax),%edi
lea    0xb51(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xc27(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    $0x1000000,%esi
call   1090 <munmap@plt>
mov    0x4(%rsp),%edi
call   1070 <close@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb10(%rip),%rdi
call   10b0 <perror@plt>
mov    $0xffffffff,%ebx
jmp    1525 <main+0x385>
lea    0xb1c(%rip),%rdi
call   10b0 <perror@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    $0xffffffff,%ebx
jmp    1525 <main+0x385>

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [37 x i8] c"Writes repeated values to TL880 RAM\0A\00"
@.str.2 = [54 x i8] c"Usage: %s [value(hex) [addr [len [nbytes(1 to 4)]]]]\0A\00"
@.str.3 = [16 x i8] c"/dev/tl880/mem0\00"
@O_RDWR = global i32 0
@.str.4 = [31 x i8] c"Unable to open /dev/tl880/mem0\00"
@.str.5 = [22 x i8] c"Mapping memory space\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.6 = [30 x i8] c"Failed to mmap region 1 (mem)\00"
@.str.7 = [34 x i8] c"Writing value %08x from %x to %x\0A\00"
@stderr = global i32 0
@.str.8 = [19 x i8] c"Broken valsize %d\0A\00"
@.str.9 = [22 x i8] c"uchar mem[%x] = %08x\0D\00"
@.str.10 = [23 x i8] c"ushort mem[%x] = %04x\0D\00"
@.str.11 = [25 x i8] c"uchar mem[%x-%x] = %06x\0D\00"
@.str.12 = [23 x i8] c"ushort mem[%x] = %08x\0D\00"
@.str.13 = [2 x i8] c"\0A\00"
@.str.14 = [24 x i8] c"Unmapping memory space\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 i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i16*
%14 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 16777216, i32* %9
store i32 0, i32* %10
store i32 4, i32* %11
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 5
br i1 %16, label %26, label %17
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp sge i32 %18, 2
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strncmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%25 = icmp ne i32 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %20, %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i8* %30)
store i32 -1, i32* %3
br label %255
32: ; preds = %20, %17
%33 = load i32, i32* %4
%34 = icmp sge i32 %33, 2
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @strtoul(i8* %38, i32* null, i32 16)
store i32 %39, i32* %10
br label %40
40: ; preds = %35, %32
%41 = load i32, i32* %4
%42 = icmp sge i32 %41, 3
br i1 %42, label %43, label %48
43: ; preds = %40
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @strtoul(i8* %46, i32* null, i32 16)
store i32 %47, i32* %8
br label %48
48: ; preds = %43, %40
%49 = load i32, i32* %4
%50 = icmp sge i32 %49, 4
br i1 %50, label %51, label %56
51: ; preds = %48
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
%55 = call i32 @strtoul(i8* %54, i32* null, i32 16)
store i32 %55, i32* %9
br label %56
56: ; preds = %51, %48
%57 = load i32, i32* %4
%58 = icmp sge i32 %57, 5
br i1 %58, label %59, label %73
59: ; preds = %56
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 4
%62 = load i8*, i8** %61
%63 = call i32 @strtoul(i8* %62, i32* null, i32 10)
store i32 %63, i32* %11
%64 = load i32, i32* %11
%65 = icmp slt i32 %64, 1
br i1 %65, label %66, label %67
66: ; preds = %59
store i32 1, i32* %11
br label %72
67: ; preds = %59
%68 = load i32, i32* %11
%69 = icmp sgt i32 %68, 4
br i1 %69, label %70, label %71
70: ; preds = %67
store i32 4, i32* %11
br label %71
71: ; preds = %70, %67
br label %72
72: ; preds = %71, %66
br label %73
73: ; preds = %72, %56
%74 = load i32, i32* %8
%75 = and i32 %74, -4
store i32 %75, i32* %8
%76 = load i32, i32* %9
%77 = and i32 %76, -4
store i32 %77, i32* %9
%78 = load i32, i32* %8
%79 = icmp sge i32 %78, 16777216
br i1 %79, label %80, label %81
80: ; preds = %73
store i32 0, i32* %8
br label %81
81: ; preds = %80, %73
%82 = load i32, i32* %8
%83 = load i32, i32* %9
%84 = add nsw i32 %82, %83
%85 = icmp sge i32 %84, 16777216
br i1 %85, label %86, label %89
86: ; preds = %81
%87 = load i32, i32* %8
%88 = sub nsw i32 16777216, %87
store i32 %88, i32* %9
br label %89
89: ; preds = %86, %81
%90 = load i32, i32* @O_RDWR
%91 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %90)
store i32 %91, i32* %6
%92 = icmp slt i32 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %89
%94 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %255
95: ; preds = %89
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%97 = load i32, i32* @PROT_READ
%98 = load i32, i32* @PROT_WRITE
%99 = or i32 %97, %98
%100 = load i32, i32* @MAP_SHARED
%101 = load i32, i32* %6
%102 = call i8* @mmap(i32 0, i32 16777216, i32 %99, i32 %100, i32 %101, i32 0)
store i8* %102, i8** %12
%103 = icmp ne i8* %102, null
br i1 %103, label %108, label %104
104: ; preds = %95
%105 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%106 = load i32, i32* %6
%107 = call i32 @close(i32 %106)
store i32 -1, i32* %3
br label %255
108: ; preds = %95
%109 = load i8*, i8** %12
%110 = bitcast i8* %109 to i16*
store i16* %110, i16** %13
%111 = load i8*, i8** %12
%112 = bitcast i8* %111 to i32*
store i32* %112, i32** %14
%113 = load i32, i32* %10
%114 = load i32, i32* %8
%115 = load i32, i32* %8
%116 = load i32, i32* %9
%117 = add nsw i32 %115, %116
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %113, i32 %114, i32 %117)
%119 = load i32, i32* %11
switch i32 %119, label %120 [
i32 1, label %124
i32 2, label %150
i32 3, label %177
i32 4, label %223
]
120: ; preds = %108
%121 = load i32, i32* @stderr
%122 = load i32, i32* %11
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %122)
br label %247
124: ; preds = %108
%125 = load i32, i32* %8
store i32 %125, i32* %7
br label %126
126: ; preds = %145, %124
%127 = load i32, i32* %7
%128 = load i32, i32* %8
%129 = load i32, i32* %9
%130 = add nsw i32 %128, %129
%131 = icmp slt i32 %127, %130
br i1 %131, label %132, label %149
132: ; preds = %126
%133 = load i32, i32* %10
%134 = and i32 %133, 255
%135 = trunc i32 %134 to i8
%136 = load i8*, i8** %12
%137 = load i32, i32* %7
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds i8, i8* %136, i64 %138
store i8 %135, i8* %139
%140 = load i32, i32* @stderr
%141 = load i32, i32* %7
%142 = load i32, i32* %10
%143 = and i32 %142, 255
%144 = call i32 (i32, i8*, ...) @fprintf(i32 %140, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %141, i32 %143)
br label %145
145: ; preds = %132
%146 = load i32, i32* %11
%147 = load i32, i32* %7
%148 = add nsw i32 %147, %146
store i32 %148, i32* %7
br label %126
149: ; preds = %126
br label %247
150: ; preds = %108
%151 = load i32, i32* %8
store i32 %151, i32* %7
br label %152
152: ; preds = %172, %150
%153 = load i32, i32* %7
%154 = load i32, i32* %8
%155 = load i32, i32* %9
%156 = add nsw i32 %154, %155
%157 = icmp slt i32 %153, %156
br i1 %157, label %158, label %176
158: ; preds = %152
%159 = load i32, i32* %10
%160 = and i32 %159, 65535
%161 = trunc i32 %160 to i16
%162 = load i16*, i16** %13
%163 = load i32, i32* %7
%164 = sdiv i32 %163, 2
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i16, i16* %162, i64 %165
store i16 %161, i16* %166
%167 = load i32, i32* @stderr
%168 = load i32, i32* %7
%169 = load i32, i32* %10
%170 = and i32 %169, 65535
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %168, i32 %170)
br label %172
172: ; preds = %158
%173 = load i32, i32* %11
%174 = load i32, i32* %7
%175 = add nsw i32 %174, %173
store i32 %175, i32* %7
br label %152
176: ; preds = %152
br label %247
177: ; preds = %108
%178 = load i32, i32* %8
store i32 %178, i32* %7
br label %179
179: ; preds = %218, %177
%180 = load i32, i32* %7
%181 = load i32, i32* %8
%182 = load i32, i32* %9
%183 = add nsw i32 %181, %182
%184 = icmp slt i32 %180, %183
br i1 %184, label %185, label %222
185: ; preds = %179
%186 = load i32, i32* %10
%187 = ashr i32 %186, 16
%188 = and i32 %187, 255
%189 = trunc i32 %188 to i8
%190 = load i8*, i8** %12
%191 = load i32, i32* %7
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds i8, i8* %190, i64 %192
store i8 %189, i8* %193
%194 = load i32, i32* %10
%195 = ashr i32 %194, 8
%196 = and i32 %195, 255
%197 = trunc i32 %196 to i8
%198 = load i8*, i8** %12
%199 = load i32, i32* %7
%200 = add nsw i32 %199, 1
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds i8, i8* %198, i64 %201
store i8 %197, i8* %202
%203 = load i32, i32* %10
%204 = and i32 %203, 255
%205 = trunc i32 %204 to i8
%206 = load i8*, i8** %12
%207 = load i32, i32* %7
%208 = add nsw i32 %207, 2
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds i8, i8* %206, i64 %209
store i8 %205, i8* %210
%211 = load i32, i32* @stderr
%212 = load i32, i32* %7
%213 = load i32, i32* %7
%214 = add nsw i32 %213, 2
%215 = load i32, i32* %10
%216 = and i32 %215, 16777215
%217 = call i32 (i32, i8*, ...) @fprintf(i32 %211, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %212, i32 %214, i32 %216)
br label %218
218: ; preds = %185
%219 = load i32, i32* %11
%220 = load i32, i32* %7
%221 = add nsw i32 %220, %219
store i32 %221, i32* %7
br label %179
222: ; preds = %179
br label %247
223: ; preds = %108
%224 = load i32, i32* %8
store i32 %224, i32* %7
br label %225
225: ; preds = %242, %223
%226 = load i32, i32* %7
%227 = load i32, i32* %8
%228 = load i32, i32* %9
%229 = add nsw i32 %227, %228
%230 = icmp slt i32 %226, %229
br i1 %230, label %231, label %246
231: ; preds = %225
%232 = load i32, i32* %10
%233 = load i32*, i32** %14
%234 = load i32, i32* %7
%235 = sdiv i32 %234, 4
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds i32, i32* %233, i64 %236
store i32 %232, i32* %237
%238 = load i32, i32* @stderr
%239 = load i32, i32* %7
%240 = load i32, i32* %10
%241 = call i32 (i32, i8*, ...) @fprintf(i32 %238, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i32 %239, i32 %240)
br label %242
242: ; preds = %231
%243 = load i32, i32* %11
%244 = load i32, i32* %7
%245 = add nsw i32 %244, %243
store i32 %245, i32* %7
br label %225
246: ; preds = %225
br label %247
247: ; preds = %246, %222, %176, %149, %120
%248 = load i32, i32* @stderr
%249 = call i32 (i32, i8*, ...) @fprintf(i32 %248, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%250 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0))
%251 = load i8*, i8** %12
%252 = call i32 @munmap(i8* %251, i32 16777216)
%253 = load i32, i32* %6
%254 = call i32 @close(i32 %253)
store i32 0, i32* %3
br label %255
255: ; preds = %247, %104, %93, %26
%256 = load i32, i32* %3
ret i32 %256
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.2 = [54 x i8] c"Usage: %s [value(hex) [addr [len [nbytes(1 to 4)]]]]\0A\00"
@.str.3 = [16 x i8] c"/dev/tl880/mem0\00"
@O_RDWR = global i32 0
@.str.4 = [31 x i8] c"Unable to open /dev/tl880/mem0\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.6 = [30 x i8] c"Failed to mmap region 1 (mem)\00"
@.str.7 = [34 x i8] c"Writing value %08x from %x to %x\0A\00"
@stderr = global i32 0
@.str.8 = [19 x i8] c"Broken valsize %d\0A\00"
@.str.9 = [22 x i8] c"uchar mem[%x] = %08x\0D\00"
@.str.10 = [23 x i8] c"ushort mem[%x] = %04x\0D\00"
@.str.11 = [25 x i8] c"uchar mem[%x-%x] = %06x\0D\00"
@.str.12 = [23 x i8] c"ushort mem[%x] = %08x\0D\00"
@.str.13 = [2 x i8] c"\0A\00"
@str = [21 x i8] c"Mapping memory space\00"
@str.15 = [23 x i8] c"Unmapping memory space\00"
@str.16 = [36 x i8] c"Writes repeated values to TL880 RAM\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 5
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %44
6: ; preds = %4
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strncmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6, %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.16, i64 0, i64 0))
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %147
15: ; preds = %6
%16 = load i8*, i8** %7
%17 = tail call i32 @strtoul(i8* nocapture %16, i32* null, i32 16)
%18 = icmp ugt i32 %0, 2
br i1 %18, label %19, label %44
19: ; preds = %15
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32 @strtoul(i8* nocapture %21, i32* null, i32 16)
%23 = and i32 %22, -4
%24 = icmp eq i32 %0, 3
br i1 %24, label %39, label %25
25: ; preds = %19
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = tail call i32 @strtoul(i8* nocapture %27, i32* null, i32 16)
%29 = and i32 %28, -4
%30 = icmp ugt i32 %0, 4
br i1 %30, label %31, label %39
31: ; preds = %25
%32 = getelementptr inbounds i8*, i8** %1, i64 4
%33 = load i8*, i8** %32
%34 = tail call i32 @strtoul(i8* nocapture %33, i32* null, i32 10)
%35 = icmp slt i32 %34, 1
br i1 %35, label %39, label %36
36: ; preds = %31
%37 = icmp ult i32 %34, 4
%38 = select i1 %37, i32 %34, i32 4
br label %39
39: ; preds = %19, %31, %36, %25
%40 = phi i32 [ %29, %36 ], [ %29, %25 ], [ %29, %31 ], [ 16777216, %19 ]
%41 = phi i32 [ %38, %36 ], [ 4, %25 ], [ 1, %31 ], [ 4, %19 ]
%42 = icmp sgt i32 %23, 16777215
%43 = select i1 %42, i32 0, i32 %23
br label %44
44: ; preds = %39, %4, %15
%45 = phi i32 [ 4, %15 ], [ 4, %4 ], [ %41, %39 ]
%46 = phi i32 [ %17, %15 ], [ 0, %4 ], [ %17, %39 ]
%47 = phi i32 [ 16777216, %15 ], [ 16777216, %4 ], [ %40, %39 ]
%48 = phi i32 [ 0, %15 ], [ 0, %4 ], [ %43, %39 ]
%49 = add nsw i32 %48, %47
%50 = icmp sgt i32 %49, 16777215
%51 = sub nsw i32 16777216, %48
%52 = select i1 %50, i32 %51, i32 %47
%53 = load i32, i32* @O_RDWR
%54 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %53)
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %44
%57 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
br label %147
58: ; preds = %44
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%60 = load i32, i32* @PROT_READ
%61 = load i32, i32* @PROT_WRITE
%62 = or i32 %61, %60
%63 = load i32, i32* @MAP_SHARED
%64 = tail call i8* @mmap(i32 0, i32 16777216, i32 %62, i32 %63, i32 %54, i32 0)
%65 = icmp eq i8* %64, null
br i1 %65, label %66, label %69
66: ; preds = %58
%67 = tail call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%68 = tail call i32 @close(i32 %54)
br label %147
69: ; preds = %58
%70 = bitcast i8* %64 to i16*
%71 = bitcast i8* %64 to i32*
%72 = add nsw i32 %52, %48
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %46, i32 %48, i32 %72)
switch i32 %45, label %99 [
i32 1, label %92
i32 2, label %87
i32 3, label %76
i32 4, label %74
]
74: ; preds = %69
%75 = icmp sgt i32 %52, 0
br i1 %75, label %132, label %141
76: ; preds = %69
%77 = icmp sgt i32 %52, 0
br i1 %77, label %78, label %141
78: ; preds = %76
%79 = lshr i32 %46, 16
%80 = trunc i32 %79 to i8
%81 = lshr i32 %46, 8
%82 = trunc i32 %81 to i8
%83 = trunc i32 %46 to i8
%84 = and i32 %46, 16777215
%85 = sext i32 %48 to i64
%86 = sext i32 %72 to i64
br label %119
87: ; preds = %69
%88 = icmp sgt i32 %52, 0
br i1 %88, label %89, label %141
89: ; preds = %87
%90 = and i32 %46, 65535
%91 = trunc i32 %46 to i16
br label %110
92: ; preds = %69
%93 = icmp sgt i32 %52, 0
br i1 %93, label %94, label %141
94: ; preds = %92
%95 = and i32 %46, 255
%96 = trunc i32 %46 to i8
%97 = sext i32 %48 to i64
%98 = sext i32 %72 to i64
br label %102
99: ; preds = %69
%100 = load i32, i32* @stderr
%101 = tail call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %45)
br label %141
102: ; preds = %94, %102
%103 = phi i64 [ %97, %94 ], [ %108, %102 ]
%104 = getelementptr inbounds i8, i8* %64, i64 %103
store i8 %96, i8* %104
%105 = load i32, i32* @stderr
%106 = trunc i64 %103 to i32
%107 = tail call i32 (i32, i8*, ...) @fprintf(i32 %105, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %106, i32 %95)
%108 = add nsw i64 %103, 1
%109 = icmp slt i64 %108, %98
br i1 %109, label %102, label %141
110: ; preds = %89, %110
%111 = phi i32 [ %48, %89 ], [ %117, %110 ]
%112 = sdiv i32 %111, 2
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i16, i16* %70, i64 %113
store i16 %91, i16* %114
%115 = load i32, i32* @stderr
%116 = tail call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %111, i32 %90)
%117 = add nsw i32 %111, 2
%118 = icmp slt i32 %117, %72
br i1 %118, label %110, label %141
119: ; preds = %78, %119
%120 = phi i64 [ %85, %78 ], [ %130, %119 ]
%121 = trunc i64 %120 to i32
%122 = getelementptr inbounds i8, i8* %64, i64 %120
store i8 %80, i8* %122
%123 = add nsw i64 %120, 1
%124 = getelementptr inbounds i8, i8* %64, i64 %123
store i8 %82, i8* %124
%125 = add nsw i64 %120, 2
%126 = add nsw i32 %121, 2
%127 = getelementptr inbounds i8, i8* %64, i64 %125
store i8 %83, i8* %127
%128 = load i32, i32* @stderr
%129 = tail call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %121, i32 %126, i32 %84)
%130 = add i64 %120, 3
%131 = icmp slt i64 %130, %86
br i1 %131, label %119, label %141
132: ; preds = %74, %132
%133 = phi i32 [ %139, %132 ], [ %48, %74 ]
%134 = sdiv i32 %133, 4
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i32, i32* %71, i64 %135
store i32 %46, i32* %136
%137 = load i32, i32* @stderr
%138 = tail call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i32 %133, i32 %46)
%139 = add nsw i32 %133, 4
%140 = icmp slt i32 %139, %72
br i1 %140, label %132, label %141
141: ; preds = %132, %119, %110, %102, %74, %76, %87, %92, %99
%142 = load i32, i32* @stderr
%143 = tail call i32 (i32, i8*, ...) @fprintf(i32 %142, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%144 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
%145 = tail call i32 @munmap(i8* %64, i32 16777216)
%146 = tail call i32 @close(i32 %54)
br label %147
147: ; preds = %141, %66, %56, %11
%148 = phi i32 [ -1, %11 ], [ -1, %56 ], [ 0, %141 ], [ -1, %66 ]
ret i32 %148
}