#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 {
  size_t st_blksize;
  size_t st_size;
};
typedef size_t off_t;
typedef size_t blksize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ F_OK;
int /*<<< orphan*/ MAP_SHARED;
int O_CREAT;
int O_RDWR;
int PROT_READ;
int PROT_WRITE;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fread(char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(char *, char *, size_t);
char *mmap(int /*<<< orphan*/ *, size_t, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
int /*<<< orphan*/ munmap(char *, size_t);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
size_t strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ write(int, char *, size_t);
int main(int argc, char **argv) {
  int fd, n;
  FILE *f;
  size_t textl, hiddenl, argoff = 0;
  off_t ind;
  char *file;
  blksize_t page;
  struct stat s;
  if (argc < 4) {
    puts("Usage: hwrite [-b] FILE VISIBLE HIDDEN...");
    return EXIT_SUCCESS;
  }
  if (!strncmp(argv[1], "-b", 2)) {
    argoff = 1;
  }
  if (!access(argv[1 + argoff], F_OK)) {
    fprintf(stderr, "File '%s' already exists!\n", argv[1 + argoff]);
    return EXIT_FAILURE;
  }
  if (!strlen(argv[2 + argoff])) {
    fputs("You must provide a non-null string to write as visible data!\n",
          stderr);
    return EXIT_FAILURE;
  }
  if ((fd = open(argv[1 + argoff], O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) ==
      -1) {
    perror("open");
    return EXIT_FAILURE;
  }
  stat(argv[1 + argoff], &s);
  page = s.st_blksize;
  ind = textl = strlen(argv[2 + argoff]);
  write(fd, argv[2 + argoff], textl);
  file = mmap(NULL, textl, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
  if (argoff) {
    for (n = 3 + argoff; n < argc; n++) {
      stat(argv[n], &s);
      if ((ind % page) + s.st_size + 1 > page) {
        goto OVERFLOW;
      }
      fread(&file[ind], sizeof(char), s.st_size, f = fopen(argv[n], "r"));
      fclose(f);
      ind += s.st_size;
    }
  } else {
    file[ind] = (unsigned char)(argc - (3 + argoff));
    ind += sizeof(unsigned char);
    for (n = 3 + argoff; n < argc - argoff; n++) {
      hiddenl = strlen(argv[n]);
      if ((ind % page) + hiddenl + 1 > page) {
        goto OVERFLOW;
      }
      memcpy(&file[ind], argv[n + argoff], hiddenl);
      file[ind + hiddenl] = 0;
      ind += hiddenl + 1;
    }
  }
  munmap(file, textl);
  close(fd);
  return EXIT_SUCCESS;
OVERFLOW:
  fputs("Data exceeds the page size!\n", stderr);
  munmap(file, textl);
  unlink(argv[1 + argoff]);
  return EXIT_FAILURE;
}


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)
movq   $0x0,-0x38(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1265 <main+0x45>
lea    0xdb1(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    162a <main+0x40a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb6(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    128f <main+0x6f>
movq   $0x1,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x1,%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
call   1120 <access@plt>
cmp    $0x0,%eax
jne    12ec <main+0xcc>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x1,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd57(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x2cce(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    162a <main+0x40a>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x2,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <strlen@plt>
cmp    $0x0,%rax
jne    1331 <main+0x111>
mov    0x2ca6(%rip),%rax
mov    (%rax),%esi
lea    0xd2d(%rip),%rdi
call   10b0 <fputs@plt>
mov    0x2c89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    162a <main+0x40a>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x1,%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2c88(%rip),%rax
mov    (%rax),%esi
mov    0x2ca7(%rip),%rax
or     (%rax),%esi
mov    0x2c46(%rip),%rax
mov    (%rax),%edx
mov    0x2c65(%rip),%rax
or     (%rax),%edx
call   1110 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1393 <main+0x173>
lea    0xd09(%rip),%rdi
call   1140 <perror@plt>
mov    0x2c27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    162a <main+0x40a>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x1,%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x60(%rbp),%rsi
call   10e0 <stat@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x2,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x2,%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x28(%rbp),%rdx
call   1070 <write@plt>
mov    -0x28(%rbp),%rsi
mov    0x2bf8(%rip),%rax
mov    (%rax),%edx
mov    0x2ba7(%rip),%rax
or     (%rax),%edx
mov    0x2bd6(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   10a0 <mmap@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     14ea <main+0x2ca>
mov    -0x38(%rbp),%rax
add    $0x3,%rax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14e5 <main+0x2c5>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x60(%rbp),%rsi
call   10e0 <stat@plt>
mov    -0x40(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x50(%rbp)
mov    %rdx,%rax
add    -0x58(%rbp),%rax
add    $0x1,%rax
cmp    -0x50(%rbp),%rax
jbe    147d <main+0x25d>
jmp    15e7 <main+0x3c7>
mov    -0x48(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xbe7(%rip),%rsi
call   1130 <fopen@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
mov    %rcx,-0x20(%rbp)
mov    $0x1,%esi
call   1060 <fread@plt>
mov    -0x20(%rbp),%rdi
call   1080 <fclose@plt>
mov    -0x58(%rbp),%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1436 <main+0x216>
jmp    15c1 <main+0x3a1>
movslq -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x3,%rcx
sub    %rcx,%rax
mov    %al,%dl
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
add    $0x3,%rax
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
sub    -0x38(%rbp),%rcx
cmp    %rcx,%rax
jae    15bc <main+0x39c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x40(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x50(%rbp)
mov    %rdx,%rax
add    -0x30(%rbp),%rax
add    $0x1,%rax
cmp    -0x50(%rbp),%rax
jbe    156d <main+0x34d>
jmp    15e7 <main+0x3c7>
mov    -0x48(%rbp),%rdi
add    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
add    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x30(%rbp),%rdx
call   10f0 <memcpy@plt>
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
add    -0x30(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    151d <main+0x2fd>
jmp    15c1 <main+0x3a1>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1100 <munmap@plt>
mov    -0x14(%rbp),%edi
call   10c0 <close@plt>
mov    0x29bb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    162a <main+0x40a>
mov    0x29ca(%rip),%rax
mov    (%rax),%esi
lea    0xa96(%rip),%rdi
call   10b0 <fputs@plt>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1100 <munmap@plt>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
add    $0x1,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <unlink@plt>
mov    0x298b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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
sub    $0x48,%rsp
cmp    $0x3,%edi
jg     124b <main+0x2b>
lea    0xdc6(%rip),%rdi
call   1050 <puts@plt>
mov    0x2d52(%rip),%rax
jmp    1547 <main+0x327>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    0x8(%rsi),%rdi
lea    0xdce(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
mov    %eax,%r15d
cmp    $0x1,%eax
mov    $0x1,%ebp
adc    $0x0,%rbp
mov    (%rbx,%rbp,8),%rdi
mov    0x2d08(%rip),%rax
mov    (%rax),%esi
call   1120 <access@plt>
test   %eax,%eax
je     13ef <main+0x1cf>
xor    %r13d,%r13d
test   %r15d,%r15d
sete   %r13b
mov    0x10(%rbx,%r13,8),%rax
cmpb   $0x0,(%rax)
je     140d <main+0x1ed>
mov    (%rbx,%rbp,8),%rdi
mov    0x2d1e(%rip),%rax
mov    0x2d3f(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2cdc(%rip),%rax
mov    0x2cfd(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
call   1110 <open@plt>
cmp    $0xffffffff,%eax
je     1558 <main+0x338>
or     $0x2,%r13
mov    %rbp,0x30(%rsp)
mov    %eax,0xc(%rsp)
mov    (%rbx,%rbp,8),%rdi
lea    0x38(%rsp),%rsi
call   10e0 <stat@plt>
mov    0x38(%rsp),%r14
mov    %rbx,0x18(%rsp)
mov    (%rbx,%r13,8),%rbp
mov    %rbp,%rdi
call   1090 <strlen@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%r13d
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1070 <write@plt>
mov    0x2cc5(%rip),%rax
mov    0x2c76(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2ca3(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %rbx,%rsi
mov    %r13d,%r8d
xor    %r9d,%r9d
call   10a0 <mmap@plt>
test   %r15d,%r15d
mov    %rax,0x10(%rsp)
mov    %rbx,0x20(%rsp)
je     1427 <main+0x207>
lea    -0x3(%r12),%ecx
mov    %cl,(%rax,%rbx,1)
mov    %r12d,%eax
mov    %rax,0x28(%rsp)
mov    $0x3,%ebp
mov    0x10(%rsp),%r12
nopl   0x0(%rax)
add    $0x1,%rbx
mov    0x18(%rsp),%rax
mov    (%rax,%rbp,8),%r15
mov    %r15,%rdi
call   1090 <strlen@plt>
mov    %rax,%r13
mov    %rbx,%rax
or     %r14,%rax
shr    $0x20,%rax
je     13b0 <main+0x190>
mov    %rbx,%rax
xor    %edx,%edx
div    %r14
jmp    13b7 <main+0x197>
xchg   %ax,%ax
mov    %ebx,%eax
xor    %edx,%edx
div    %r14d
lea    (%rdx,%r13,1),%rax
add    $0x1,%rax
cmp    %r14,%rax
ja     1509 <main+0x2e9>
lea    (%r12,%rbx,1),%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   10f0 <memcpy@plt>
add    %r13,%rbx
movb   $0x0,(%r12,%rbx,1)
add    $0x1,%rbp
cmp    %rbp,0x28(%rsp)
jne    1380 <main+0x160>
jmp    14e8 <main+0x2c8>
mov    0x2bc2(%rip),%rax
mov    (%rax),%edi
mov    (%rbx,%rbp,8),%rdx
lea    0xc2a(%rip),%rsi
call   10d0 <fprintf@plt>
jmp    1540 <main+0x320>
mov    0x2ba4(%rip),%rax
mov    (%rax),%esi
lea    0xc2b(%rip),%rdi
call   10b0 <fputs@plt>
jmp    1540 <main+0x320>
cmp    $0x5,%r12d
jb     14e8 <main+0x2c8>
mov    %r12d,%eax
mov    %rax,0x28(%rsp)
mov    $0x4,%r13d
mov    0x20(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rax
mov    (%rax,%r13,8),%rdi
lea    0x38(%rsp),%rsi
call   10e0 <stat@plt>
mov    %r15,%rax
or     %r14,%rax
shr    $0x20,%rax
je     1480 <main+0x260>
mov    %r15,%rax
xor    %edx,%edx
div    %r14
jmp    1488 <main+0x268>
nopl   0x0(%rax)
mov    %r15d,%eax
xor    %edx,%edx
div    %r14d
mov    0x40(%rsp),%rbp
lea    (%rdx,%rbp,1),%rax
add    $0x1,%rax
cmp    %r14,%rax
ja     1509 <main+0x2e9>
mov    0x10(%rsp),%rax
lea    (%rax,%r15,1),%rbx
mov    0x18(%rsp),%rax
mov    (%rax,%r13,8),%rdi
lea    0xbd8(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %rax,%rcx
call   1060 <fread@plt>
mov    %r12,%rdi
call   1080 <fclose@plt>
add    %rbp,%r15
add    $0x1,%r13
cmp    %r13,0x28(%rsp)
jne    1450 <main+0x230>
mov    0x10(%rsp),%rdi
mov    0x20(%rsp),%rsi
call   1100 <munmap@plt>
mov    0xc(%rsp),%edi
call   10c0 <close@plt>
mov    0x2a91(%rip),%rax
jmp    1547 <main+0x327>
mov    0x2aa8(%rip),%rax
mov    (%rax),%esi
lea    0xb74(%rip),%rdi
call   10b0 <fputs@plt>
mov    0x10(%rsp),%rdi
mov    0x20(%rsp),%rsi
call   1100 <munmap@plt>
mov    0x18(%rsp),%rax
mov    0x30(%rsp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <unlink@plt>
mov    0x2a69(%rip),%rax
mov    (%rax),%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb27(%rip),%rdi
call   1140 <perror@plt>
jmp    1540 <main+0x320>

LLVM IR (-O0):
%struct.stat = type { i64, i64 }
@.str = [42 x i8] c"Usage: hwrite [-b] FILE VISIBLE HIDDEN...\00"
@EXIT_SUCCESS = global i32 0
@.str.1 = [3 x i8] c"-b\00"
@F_OK = global i32 0
@stderr = global i32 0
@.str.2 = [27 x i8] c"File '%s' already exists!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [62 x i8] c"You must provide a non-null string to write as visible data!\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.4 = [5 x i8] c"open\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [29 x i8] c"Data exceeds the page size!\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 i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i64
%15 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %11
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_SUCCESS
store i32 %20, i32* %3
br label %240
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strncmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %21
store i64 1, i64* %11
br label %28
28: ; preds = %27, %21
%29 = load i8**, i8*** %5
%30 = load i64, i64* %11
%31 = add i64 1, %30
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = load i32, i32* @F_OK
%35 = call i32 @access(i8* %33, i32 %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %46, label %37
37: ; preds = %28
%38 = load i32, i32* @stderr
%39 = load i8**, i8*** %5
%40 = load i64, i64* %11
%41 = add i64 1, %40
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @EXIT_FAILURE
store i32 %45, i32* %3
br label %240
46: ; preds = %28
%47 = load i8**, i8*** %5
%48 = load i64, i64* %11
%49 = add i64 2, %48
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i64 @strlen(i8* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %58, label %54
54: ; preds = %46
%55 = load i32, i32* @stderr
%56 = call i32 @fputs(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = load i32, i32* @EXIT_FAILURE
store i32 %57, i32* %3
br label %240
58: ; preds = %46
%59 = load i8**, i8*** %5
%60 = load i64, i64* %11
%61 = add i64 1, %60
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = load i32, i32* @O_RDWR
%65 = load i32, i32* @O_CREAT
%66 = or i32 %64, %65
%67 = load i32, i32* @S_IRUSR
%68 = load i32, i32* @S_IWUSR
%69 = or i32 %67, %68
%70 = call i32 @open(i8* %63, i32 %66, i32 %69)
store i32 %70, i32* %6
%71 = icmp eq i32 %70, -1
br i1 %71, label %72, label %75
72: ; preds = %58
%73 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%74 = load i32, i32* @EXIT_FAILURE
store i32 %74, i32* %3
br label %240
75: ; preds = %58
%76 = load i8**, i8*** %5
%77 = load i64, i64* %11
%78 = add i64 1, %77
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
%80 = load i8*, i8** %79
%81 = call i32 @stat(i8* %80, %struct.stat* %15)
%82 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%83 = load i64, i64* %82
store i64 %83, i64* %14
%84 = load i8**, i8*** %5
%85 = load i64, i64* %11
%86 = add i64 2, %85
%87 = getelementptr inbounds i8*, i8** %84, i64 %86
%88 = load i8*, i8** %87
%89 = call i64 @strlen(i8* %88)
store i64 %89, i64* %9
store i64 %89, i64* %12
%90 = load i32, i32* %6
%91 = load i8**, i8*** %5
%92 = load i64, i64* %11
%93 = add i64 2, %92
%94 = getelementptr inbounds i8*, i8** %91, i64 %93
%95 = load i8*, i8** %94
%96 = load i64, i64* %9
%97 = call i32 @write(i32 %90, i8* %95, i64 %96)
%98 = load i64, i64* %9
%99 = load i32, i32* @PROT_READ
%100 = load i32, i32* @PROT_WRITE
%101 = or i32 %99, %100
%102 = load i32, i32* @MAP_SHARED
%103 = load i32, i32* %6
%104 = call i8* @mmap(i32* null, i64 %98, i32 %101, i32 %102, i32 %103, i32 0)
store i8* %104, i8** %13
%105 = load i64, i64* %11
%106 = icmp ne i64 %105, 0
br i1 %106, label %107, label %155
107: ; preds = %75
%108 = load i64, i64* %11
%109 = add i64 3, %108
%110 = trunc i64 %109 to i32
store i32 %110, i32* %7
br label %111
111: ; preds = %151, %107
%112 = load i32, i32* %7
%113 = load i32, i32* %4
%114 = icmp slt i32 %112, %113
br i1 %114, label %115, label %154
115: ; preds = %111
%116 = load i8**, i8*** %5
%117 = load i32, i32* %7
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8*, i8** %116, i64 %118
%120 = load i8*, i8** %119
%121 = call i32 @stat(i8* %120, %struct.stat* %15)
%122 = load i64, i64* %12
%123 = load i64, i64* %14
%124 = urem i64 %122, %123
%125 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 1
%126 = load i64, i64* %125
%127 = add i64 %124, %126
%128 = add i64 %127, 1
%129 = load i64, i64* %14
%130 = icmp ugt i64 %128, %129
br i1 %130, label %131, label %132
131: ; preds = %115
br label %227
132: ; preds = %115
%133 = load i8*, i8** %13
%134 = load i64, i64* %12
%135 = getelementptr inbounds i8, i8* %133, i64 %134
%136 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 1
%137 = load i64, i64* %136
%138 = load i8**, i8*** %5
%139 = load i32, i32* %7
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8*, i8** %138, i64 %140
%142 = load i8*, i8** %141
%143 = call i32* @fopen(i8* %142, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %143, i32** %8
%144 = call i32 @fread(i8* %135, i32 1, i64 %137, i32* %143)
%145 = load i32*, i32** %8
%146 = call i32 @fclose(i32* %145)
%147 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 1
%148 = load i64, i64* %147
%149 = load i64, i64* %12
%150 = add i64 %149, %148
store i64 %150, i64* %12
br label %151
151: ; preds = %132
%152 = load i32, i32* %7
%153 = add nsw i32 %152, 1
store i32 %153, i32* %7
br label %111
154: ; preds = %111
br label %220
155: ; preds = %75
%156 = load i32, i32* %4
%157 = sext i32 %156 to i64
%158 = load i64, i64* %11
%159 = add i64 3, %158
%160 = sub i64 %157, %159
%161 = trunc i64 %160 to i8
%162 = load i8*, i8** %13
%163 = load i64, i64* %12
%164 = getelementptr inbounds i8, i8* %162, i64 %163
store i8 %161, i8* %164
%165 = load i64, i64* %12
%166 = add i64 %165, 1
store i64 %166, i64* %12
%167 = load i64, i64* %11
%168 = add i64 3, %167
%169 = trunc i64 %168 to i32
store i32 %169, i32* %7
br label %170
170: ; preds = %216, %155
%171 = load i32, i32* %7
%172 = sext i32 %171 to i64
%173 = load i32, i32* %4
%174 = sext i32 %173 to i64
%175 = load i64, i64* %11
%176 = sub i64 %174, %175
%177 = icmp ult i64 %172, %176
br i1 %177, label %178, label %219
178: ; preds = %170
%179 = load i8**, i8*** %5
%180 = load i32, i32* %7
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds i8*, i8** %179, i64 %181
%183 = load i8*, i8** %182
%184 = call i64 @strlen(i8* %183)
store i64 %184, i64* %10
%185 = load i64, i64* %12
%186 = load i64, i64* %14
%187 = urem i64 %185, %186
%188 = load i64, i64* %10
%189 = add i64 %187, %188
%190 = add i64 %189, 1
%191 = load i64, i64* %14
%192 = icmp ugt i64 %190, %191
br i1 %192, label %193, label %194
193: ; preds = %178
br label %227
194: ; preds = %178
%195 = load i8*, i8** %13
%196 = load i64, i64* %12
%197 = getelementptr inbounds i8, i8* %195, i64 %196
%198 = load i8**, i8*** %5
%199 = load i32, i32* %7
%200 = sext i32 %199 to i64
%201 = load i64, i64* %11
%202 = add i64 %200, %201
%203 = getelementptr inbounds i8*, i8** %198, i64 %202
%204 = load i8*, i8** %203
%205 = load i64, i64* %10
%206 = call i32 @memcpy(i8* %197, i8* %204, i64 %205)
%207 = load i8*, i8** %13
%208 = load i64, i64* %12
%209 = load i64, i64* %10
%210 = add i64 %208, %209
%211 = getelementptr inbounds i8, i8* %207, i64 %210
store i8 0, i8* %211
%212 = load i64, i64* %10
%213 = add i64 %212, 1
%214 = load i64, i64* %12
%215 = add i64 %214, %213
store i64 %215, i64* %12
br label %216
216: ; preds = %194
%217 = load i32, i32* %7
%218 = add nsw i32 %217, 1
store i32 %218, i32* %7
br label %170
219: ; preds = %170
br label %220
220: ; preds = %219, %154
%221 = load i8*, i8** %13
%222 = load i64, i64* %9
%223 = call i32 @munmap(i8* %221, i64 %222)
%224 = load i32, i32* %6
%225 = call i32 @close(i32 %224)
%226 = load i32, i32* @EXIT_SUCCESS
store i32 %226, i32* %3
br label %240
227: ; preds = %193, %131
%228 = load i32, i32* @stderr
%229 = call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %228)
%230 = load i8*, i8** %13
%231 = load i64, i64* %9
%232 = call i32 @munmap(i8* %230, i64 %231)
%233 = load i8**, i8*** %5
%234 = load i64, i64* %11
%235 = add i64 1, %234
%236 = getelementptr inbounds i8*, i8** %233, i64 %235
%237 = load i8*, i8** %236
%238 = call i32 @unlink(i8* %237)
%239 = load i32, i32* @EXIT_FAILURE
store i32 %239, i32* %3
br label %240
240: ; preds = %227, %220, %72, %54, %37, %18
%241 = load i32, i32* %3
ret i32 %241
}

LLVM IR (-O2):
%struct.stat = type { i64, i64 }
@.str = [42 x i8] c"Usage: hwrite [-b] FILE VISIBLE HIDDEN...\00"
@EXIT_SUCCESS = global i32 0
@.str.1 = [3 x i8] c"-b\00"
@F_OK = global i32 0
@stderr = global i32 0
@.str.2 = [27 x i8] c"File '%s' already exists!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [62 x i8] c"You must provide a non-null string to write as visible data!\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.4 = [5 x i8] c"open\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [29 x i8] c"Data exceeds the page size!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp slt i32 %0, 4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %115
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i64 2, i64 1
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = load i32, i32* @F_OK
%17 = tail call i32 @access(i8* %15, i32 %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %8
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %14
%22 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %115
23: ; preds = %8
%24 = zext i1 %12 to i64
%25 = or i64 %24, 2
%26 = getelementptr inbounds i8*, i8** %1, i64 %25
%27 = load i8*, i8** %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %23
%31 = load i32, i32* @stderr
%32 = tail call i32 @fputs(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %115
33: ; preds = %23
%34 = load i8*, i8** %14
%35 = load i32, i32* @O_RDWR
%36 = load i32, i32* @O_CREAT
%37 = or i32 %36, %35
%38 = load i32, i32* @S_IRUSR
%39 = load i32, i32* @S_IWUSR
%40 = or i32 %39, %38
%41 = tail call i32 @open(i8* %34, i32 %37, i32 %40)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %45
43: ; preds = %33
%44 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %115
45: ; preds = %33
%46 = load i8*, i8** %14
%47 = call i32 @stat(i8* %46, %struct.stat* %3)
%48 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%49 = load i64, i64* %48
%50 = load i8*, i8** %26
%51 = tail call i64 @strlen(i8* dereferenceable(1) %50)
%52 = tail call i32 @write(i32 %41, i8* %50, i64 %51)
%53 = load i32, i32* @PROT_READ
%54 = load i32, i32* @PROT_WRITE
%55 = or i32 %54, %53
%56 = load i32, i32* @MAP_SHARED
%57 = tail call i8* @mmap(i32* null, i64 %51, i32 %55, i32 %56, i32 %41, i32 0)
br i1 %12, label %58, label %83
58: ; preds = %45
%59 = icmp ugt i32 %0, 4
br i1 %59, label %60, label %106
60: ; preds = %58
%61 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%62 = zext i32 %0 to i64
br label %63
63: ; preds = %60, %74
%64 = phi i64 [ 4, %60 ], [ %81, %74 ]
%65 = phi i64 [ %51, %60 ], [ %80, %74 ]
%66 = getelementptr inbounds i8*, i8** %1, i64 %64
%67 = load i8*, i8** %66
%68 = call i32 @stat(i8* %67, %struct.stat* %3)
%69 = urem i64 %65, %49
%70 = load i64, i64* %61
%71 = add nuw i64 %69, 1
%72 = add i64 %71, %70
%73 = icmp ugt i64 %72, %49
br i1 %73, label %109, label %74
74: ; preds = %63
%75 = getelementptr inbounds i8, i8* %57, i64 %65
%76 = load i8*, i8** %66
%77 = tail call i32* @fopen(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%78 = tail call i32 @fread(i8* %75, i32 1, i64 %70, i32* %77)
%79 = tail call i32 @fclose(i32* %77)
%80 = add i64 %70, %65
%81 = add nuw nsw i64 %64, 1
%82 = icmp eq i64 %81, %62
br i1 %82, label %106, label %63
83: ; preds = %45
%84 = trunc i32 %0 to i8
%85 = add i8 %84, -3
%86 = getelementptr inbounds i8, i8* %57, i64 %51
store i8 %85, i8* %86
%87 = zext i32 %0 to i64
br label %88
88: ; preds = %83, %99
%89 = phi i64 [ 3, %83 ], [ %104, %99 ]
%90 = phi i64 [ %51, %83 ], [ %102, %99 ]
%91 = add i64 %90, 1
%92 = getelementptr inbounds i8*, i8** %1, i64 %89
%93 = load i8*, i8** %92
%94 = tail call i64 @strlen(i8* dereferenceable(1) %93)
%95 = urem i64 %91, %49
%96 = add i64 %94, 1
%97 = add i64 %96, %95
%98 = icmp ugt i64 %97, %49
br i1 %98, label %109, label %99
99: ; preds = %88
%100 = getelementptr inbounds i8, i8* %57, i64 %91
%101 = tail call i32 @memcpy(i8* %100, i8* %93, i64 %94)
%102 = add i64 %94, %91
%103 = getelementptr inbounds i8, i8* %57, i64 %102
store i8 0, i8* %103
%104 = add nuw nsw i64 %89, 1
%105 = icmp eq i64 %104, %87
br i1 %105, label %106, label %88
106: ; preds = %99, %74, %58
%107 = tail call i32 @munmap(i8* %57, i64 %51)
%108 = tail call i32 @close(i32 %41)
br label %115
109: ; preds = %88, %63
%110 = load i32, i32* @stderr
%111 = tail call i32 @fputs(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %110)
%112 = tail call i32 @munmap(i8* %57, i64 %51)
%113 = load i8*, i8** %14
%114 = tail call i32 @unlink(i8* %113)
br label %115
115: ; preds = %109, %106, %43, %30, %19, %6
%116 = phi i32* [ @EXIT_SUCCESS, %6 ], [ @EXIT_FAILURE, %43 ], [ @EXIT_FAILURE, %109 ], [ @EXIT_SUCCESS, %106 ], [ @EXIT_FAILURE, %30 ], [ @EXIT_FAILURE, %19 ]
%117 = load i32, i32* %116
ret i32 %117
}