#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ append_contents(char *, int, char *, int *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
char *malloc(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *dest;
  FILE *src;
  int i;
  char *contents_buffer;
  int contents_size = 0;
  char *data_buffer;
  int data_size = 0;
  int data_offset = 0;
  char temp_path[1024];
  char system_command[1024];
  if (argc < 3) {
    fprintf(stderr, "Need 2 arguments you MOR-ON!\n");
    exit(1);
  }
  strcpy(temp_path, argv[1]);
  if (!(dest = fopen(temp_path, "w"))) {
    fprintf(stderr, "Couldn't open dest file %s. %s\n", temp_path,
            strerror(errno));
    exit(1);
  }
  if (!(data_buffer = malloc(0x1000000))) {
    fprintf(stderr, "Not enough memory to allocate data buffer.\n");
    exit(1);
  }
  if (!(contents_buffer = malloc(0x100000))) {
    fprintf(stderr, "Not enough memory to allocate contents buffer.\n");
    exit(1);
  }
  contents_size = sizeof(int);
  for (i = 2; i < argc; i++) {
    char *path = argv[i];
    if (!(src = fopen(path, "r"))) {
      fprintf(stderr, "%s while opening %s\n", strerror(errno), path);
      exit(1);
    } else {
      int size;
      fseek(src, 0, SEEK_END);
      size = ftell(src);
      fseek(src, 0, SEEK_SET);
      data_offset = data_size;
      *(data_buffer + data_size) = (size & 0xff000000) >> 24;
      data_size++;
      *(data_buffer + data_size) = (size & 0xff0000) >> 16;
      data_size++;
      *(data_buffer + data_size) = (size & 0xff00) >> 8;
      data_size++;
      *(data_buffer + data_size) = size & 0xff;
      data_size++;
      fread(data_buffer + data_size, 1, size, src);
      data_size += size;
      fclose(src);
      append_contents(path, data_offset, contents_buffer, &contents_size);
    }
  }
  *(int *)(contents_buffer) = contents_size;
  fwrite(contents_buffer, 1, contents_size, dest);
  fwrite(data_buffer, 1, data_size, dest);
  fclose(dest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x870,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1219 <main+0x59>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xdf8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    -0x450(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x450(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12a1 <main+0xe1>
mov    0x2d83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x86c(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x868(%rbp)
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x86c(%rbp),%edi
mov    -0x868(%rbp),%rdx
mov    %rax,%rcx
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    $0x1000000,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    12da <main+0x11a>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xd77(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    $0x100000,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1313 <main+0x153>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
lea    0xd6a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movl   $0x4,-0x34(%rbp)
movl   $0x2,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14ce <main+0x30e>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x858(%rbp)
mov    -0x858(%rbp),%rdi
lea    0xd4e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    13a6 <main+0x1e6>
mov    0x2c70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x870(%rbp)
mov    0x2c59(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x870(%rbp),%edi
mov    %rax,%rdx
mov    -0x858(%rbp),%rcx
lea    0xd09(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    0x2c37(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0x85c(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2bf4(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x85c(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x85c(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x85c(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x85c(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rdi
movslq -0x44(%rbp),%rax
add    %rax,%rdi
mov    -0x85c(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    -0x85c(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x858(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
call   10a0 <append_contents@plt>
jmp    14c0 <main+0x300>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1321 <main+0x161>
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10d0 <fwrite@plt>
mov    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10d0 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
cmp    $0x2,%edi
jle    1392 <main+0x1d2>
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x8(%rsi),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe26(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13a4 <main+0x1e4>
mov    %rax,%rbx
mov    $0x1000000,%edi
call   1080 <malloc@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     13ce <main+0x20e>
mov    %rbx,0x18(%rsp)
mov    $0x100000,%edi
call   1080 <malloc@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     13e0 <main+0x220>
movl   $0x4,0x4(%rsp)
mov    %r14d,%eax
mov    %rax,0x20(%rsp)
xor    %ebp,%ebp
mov    $0x2,%ebx
mov    %r15,0x28(%rsp)
nopl   (%rax)
mov    (%r15,%rbx,8),%r13
mov    %r13,%rdi
lea    0xe2e(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     135b <main+0x19b>
mov    %rax,%r14
mov    0x2d62(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1090 <fseek@plt>
mov    %r14,%rdi
call   1070 <ftell@plt>
mov    %eax,%r15d
mov    0x2d24(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1090 <fseek@plt>
movslq %ebp,%r12
mov    %r15d,%eax
bswap  %eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx,%r12,1)
lea    0x4(%rcx,%r12,1),%rdi
mov    $0x1,%esi
mov    %r15d,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
lea    (%r12,%r15,1),%ebp
add    $0x4,%ebp
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %r13,%rdi
mov    %r12d,%esi
mov    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   10a0 <append_contents@plt>
add    $0x1,%rbx
cmp    %rbx,0x20(%rsp)
mov    0x28(%rsp),%r15
jne    1260 <main+0xa0>
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%rdi
mov    %edx,(%rdi)
mov    $0x1,%esi
mov    0x18(%rsp),%rbx
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c76(%rip),%rax
mov    (%rax),%ebx
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd25(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2c3f(%rip),%rax
mov    (%rax),%edi
lea    0xc5e(%rip),%rsi
jmp    13f0 <main+0x230>
mov    0x2c2d(%rip),%rax
mov    (%rax),%ebx
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc5e(%rip),%rsi
lea    0x30(%rsp),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
jmp    1381 <main+0x1c1>
mov    0x2c03(%rip),%rax
mov    (%rax),%edi
lea    0xc62(%rip),%rsi
jmp    13f0 <main+0x230>
mov    0x2bf1(%rip),%rax
mov    (%rax),%edi
lea    0xc7c(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Need 2 arguments you MOR-ON!\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [32 x i8] c"Couldn't open dest file %s. %s\0A\00"
@errno = global i32 0
@.str.3 = [44 x i8] c"Not enough memory to allocate data buffer.\0A\00"
@.str.4 = [48 x i8] c"Not enough memory to allocate contents buffer.\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [21 x i8] c"%s while opening %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
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 i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca [1024 x i8]
%15 = alloca [1024 x i8]
%16 = alloca i8*
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i32 0, i32* %12
store i32 0, i32* %13
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @strcpy(i8* %25, i8* %28)
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %6
%32 = icmp ne i32* %31, null
br i1 %32, label %40, label %33
33: ; preds = %24
%34 = load i32, i32* @stderr
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%36 = load i32, i32* @errno
%37 = call i8* @strerror(i32 %36)
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %35, i8* %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %24
%41 = call i8* @malloc(i32 16777216)
store i8* %41, i8** %11
%42 = icmp ne i8* %41, null
br i1 %42, label %47, label %43
43: ; preds = %40
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %40
%48 = call i8* @malloc(i32 1048576)
store i8* %48, i8** %9
%49 = icmp ne i8* %48, null
br i1 %49, label %54, label %50
50: ; preds = %47
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %47
store i32 4, i32* %10
store i32 2, i32* %8
br label %55
55: ; preds = %141, %54
%56 = load i32, i32* %8
%57 = load i32, i32* %4
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %144
59: ; preds = %55
%60 = load i8**, i8*** %5
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
store i8* %64, i8** %16
%65 = load i8*, i8** %16
%66 = call i32* @fopen(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %66, i32** %7
%67 = icmp ne i32* %66, null
br i1 %67, label %75, label %68
68: ; preds = %59
%69 = load i32, i32* @stderr
%70 = load i32, i32* @errno
%71 = call i8* @strerror(i32 %70)
%72 = load i8*, i8** %16
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %71, i8* %72)
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %59
%76 = load i32*, i32** %7
%77 = load i32, i32* @SEEK_END
%78 = call i32 @fseek(i32* %76, i32 0, i32 %77)
%79 = load i32*, i32** %7
%80 = call i32 @ftell(i32* %79)
store i32 %80, i32* %17
%81 = load i32*, i32** %7
%82 = load i32, i32* @SEEK_SET
%83 = call i32 @fseek(i32* %81, i32 0, i32 %82)
%84 = load i32, i32* %12
store i32 %84, i32* %13
%85 = load i32, i32* %17
%86 = and i32 %85, -16777216
%87 = lshr i32 %86, 24
%88 = trunc i32 %87 to i8
%89 = load i8*, i8** %11
%90 = load i32, i32* %12
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %89, i64 %91
store i8 %88, i8* %92
%93 = load i32, i32* %12
%94 = add nsw i32 %93, 1
store i32 %94, i32* %12
%95 = load i32, i32* %17
%96 = and i32 %95, 16711680
%97 = ashr i32 %96, 16
%98 = trunc i32 %97 to i8
%99 = load i8*, i8** %11
%100 = load i32, i32* %12
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %99, i64 %101
store i8 %98, i8* %102
%103 = load i32, i32* %12
%104 = add nsw i32 %103, 1
store i32 %104, i32* %12
%105 = load i32, i32* %17
%106 = and i32 %105, 65280
%107 = ashr i32 %106, 8
%108 = trunc i32 %107 to i8
%109 = load i8*, i8** %11
%110 = load i32, i32* %12
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %109, i64 %111
store i8 %108, i8* %112
%113 = load i32, i32* %12
%114 = add nsw i32 %113, 1
store i32 %114, i32* %12
%115 = load i32, i32* %17
%116 = and i32 %115, 255
%117 = trunc i32 %116 to i8
%118 = load i8*, i8** %11
%119 = load i32, i32* %12
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8, i8* %118, i64 %120
store i8 %117, i8* %121
%122 = load i32, i32* %12
%123 = add nsw i32 %122, 1
store i32 %123, i32* %12
%124 = load i8*, i8** %11
%125 = load i32, i32* %12
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8, i8* %124, i64 %126
%128 = load i32, i32* %17
%129 = load i32*, i32** %7
%130 = call i32 @fread(i8* %127, i32 1, i32 %128, i32* %129)
%131 = load i32, i32* %17
%132 = load i32, i32* %12
%133 = add nsw i32 %132, %131
store i32 %133, i32* %12
%134 = load i32*, i32** %7
%135 = call i32 @fclose(i32* %134)
%136 = load i8*, i8** %16
%137 = load i32, i32* %13
%138 = load i8*, i8** %9
%139 = call i32 @append_contents(i8* %136, i32 %137, i8* %138, i32* %10)
br label %140
140: ; preds = %75
br label %141
141: ; preds = %140
%142 = load i32, i32* %8
%143 = add nsw i32 %142, 1
store i32 %143, i32* %8
br label %55
144: ; preds = %55
%145 = load i32, i32* %10
%146 = load i8*, i8** %9
%147 = bitcast i8* %146 to i32*
store i32 %145, i32* %147
%148 = load i8*, i8** %9
%149 = load i32, i32* %10
%150 = load i32*, i32** %6
%151 = call i32 @fwrite(i8* %148, i32 1, i32 %149, i32* %150)
%152 = load i8*, i8** %11
%153 = load i32, i32* %12
%154 = load i32*, i32** %6
%155 = call i32 @fwrite(i8* %152, i32 1, i32 %153, i32* %154)
%156 = load i32*, i32** %6
%157 = call i32 @fclose(i32* %156)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Need 2 arguments you MOR-ON!\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [32 x i8] c"Couldn't open dest file %s. %s\0A\00"
@errno = global i32 0
@.str.3 = [44 x i8] c"Not enough memory to allocate data buffer.\0A\00"
@.str.4 = [48 x i8] c"Not enough memory to allocate contents buffer.\0A\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [21 x i8] c"%s while opening %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strcpy(i8* %6, i8* %14)
%16 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %24
18: ; preds = %12
%19 = load i32, i32* @stderr
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %21)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %12
%25 = call dereferenceable_or_null(16777216) i8* @malloc(i32 16777216)
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %24
%32 = call dereferenceable_or_null(1048576) i8* @malloc(i32 1048576)
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %31
store i32 4, i32* %3
%39 = zext i32 %0 to i64
br label %40
40: ; preds = %38, %53
%41 = phi i64 [ 2, %38 ], [ %84, %53 ]
%42 = phi i32 [ 0, %38 ], [ %81, %53 ]
%43 = getelementptr inbounds i8*, i8** %1, i64 %41
%44 = load i8*, i8** %43
%45 = call i32* @fopen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %53
47: ; preds = %40
%48 = load i32, i32* @stderr
%49 = load i32, i32* @errno
%50 = call i8* @strerror(i32 %49)
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %50, i8* %44)
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %40
%54 = load i32, i32* @SEEK_END
%55 = call i32 @fseek(i32* %45, i32 0, i32 %54)
%56 = call i32 @ftell(i32* %45)
%57 = load i32, i32* @SEEK_SET
%58 = call i32 @fseek(i32* %45, i32 0, i32 %57)
%59 = lshr i32 %56, 24
%60 = trunc i32 %59 to i8
%61 = sext i32 %42 to i64
%62 = getelementptr inbounds i8, i8* %25, i64 %61
store i8 %60, i8* %62
%63 = add nsw i32 %42, 1
%64 = lshr i32 %56, 16
%65 = trunc i32 %64 to i8
%66 = sext i32 %63 to i64
%67 = getelementptr inbounds i8, i8* %25, i64 %66
store i8 %65, i8* %67
%68 = add nsw i32 %42, 2
%69 = lshr i32 %56, 8
%70 = trunc i32 %69 to i8
%71 = sext i32 %68 to i64
%72 = getelementptr inbounds i8, i8* %25, i64 %71
store i8 %70, i8* %72
%73 = add nsw i32 %42, 3
%74 = trunc i32 %56 to i8
%75 = sext i32 %73 to i64
%76 = getelementptr inbounds i8, i8* %25, i64 %75
store i8 %74, i8* %76
%77 = add nsw i32 %42, 4
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %25, i64 %78
%80 = call i32 @fread(i8* %79, i32 1, i32 %56, i32* %45)
%81 = add nsw i32 %56, %77
%82 = call i32 @fclose(i32* %45)
%83 = call i32 @append_contents(i8* %44, i32 %42, i8* %32, i32* %3)
%84 = add nuw nsw i64 %41, 1
%85 = icmp eq i64 %84, %39
br i1 %85, label %86, label %40
86: ; preds = %53
%87 = load i32, i32* %3
%88 = bitcast i8* %32 to i32*
store i32 %87, i32* %88
%89 = call i32 @fwrite(i8* %32, i32 1, i32 %87, i32* %16)
%90 = call i32 @fwrite(i8* %25, i32 1, i32 %81, i32* %16)
%91 = call i32 @fclose(i32* %16)
ret i32 0
}