#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*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
unsigned long fwrite(void *, int, int, int /*<<< orphan*/ *);
int getopt(int, char **, char *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ optarg;
scalar_t__ optind;
int /*<<< orphan*/ readFile(char *, int *, char **);
int /*<<< orphan*/ stderr;
scalar_t__ strtol(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  FILE *file = NULL;
  char *textName = NULL;
  char *dataName = NULL;
  char *outName = NULL;
  int textSize = 0;
  int dataSize = 0;
  char *textBuffer = NULL;
  char *dataBuffer = NULL;
  int dataStartAddress = 0;
  int option = 0;
  int dataPad = 0;
  while ((option = getopt(argc, argv, "d:")) != -1) {
    switch (option) {
    case 'd':
      dataStartAddress = (int)strtol(optarg, NULL, 10);
      break;
    default:
      help();
    }
  }
  argc -= optind;
  argv += optind;
  if (argc != 3) {
    help();
  }
  textName = argv[0];
  dataName = argv[1];
  outName = argv[2];
  readFile(textName, &textSize, &textBuffer);
  readFile(dataName, &dataSize, &dataBuffer);
  file = fopen(outName, "wb+");
  if (file == NULL) {
    fprintf(stderr, "Error: Can not open \"%s\" for writing.\n", outName);
    exit(1);
  }
  if (fwrite((void *)textBuffer, 1, textSize, file) !=
      (unsigned long)textSize) {
    fprintf(stderr, "Error writing text segment to output file.\n");
    exit(1);
  }
  textBuffer[0] = 0;
  while (textSize < dataStartAddress) {
    if (fwrite((void *)textBuffer, 1, 1, file) != 1) {
      fprintf(stderr, "Error writing 0 (pad to data seg) to output file.\n");
      exit(1);
    }
    textSize++;
  }
  if (fwrite((void *)dataBuffer, 1, dataSize, file) !=
      (unsigned long)dataSize) {
    fprintf(stderr, "Error writing data segment to output file.\n");
    exit(1);
  }
  dataPad = ((dataSize % 4) != 0) ? 4 - (dataSize % 4) : 0;
  if (dataPad != 0) {
    memset((void *)dataBuffer, 0, 4);
    if (fwrite((void *)dataBuffer, 1, dataPad, file) !=
        (unsigned long)dataPad) {
      fprintf(stderr, "Error writing 0 (pad to end) to output file.\n");
      exit(1);
    }
  }
  return 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)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdf9(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x50(%rbp)
cmp    $0xffffffff,%eax
je     1254 <main+0xc4>
mov    -0x50(%rbp),%eax
sub    $0x64,%eax
jne    1248 <main+0xb8>
jmp    1229 <main+0x99>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x4c(%rbp)
jmp    124f <main+0xbf>
mov    $0x0,%al
call   1080 <help@plt>
jmp    11f9 <main+0x69>
mov    0x2d85(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2d71(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     128f <main+0xff>
mov    $0x0,%al
call   1080 <help@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   10b0 <readFile@plt>
mov    -0x28(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x48(%rbp),%rdx
call   10b0 <readFile@plt>
mov    -0x30(%rbp),%rdi
lea    0xd24(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1318 <main+0x188>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xd00(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10a0 <fwrite@plt>
movslq -0x34(%rbp),%rcx
cmp    %rcx,%rax
je     135b <main+0x1cb>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
lea    0xce4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x34(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    13bb <main+0x22b>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   10a0 <fwrite@plt>
cmp    $0x1,%rax
je     13ad <main+0x21d>
mov    0x2c3d(%rip),%rax
mov    (%rax),%edi
lea    0xcbe(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1362 <main+0x1d2>
mov    -0x48(%rbp),%rdi
mov    -0x38(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10a0 <fwrite@plt>
movslq -0x38(%rbp),%rcx
cmp    %rcx,%rax
je     13fe <main+0x26e>
mov    0x2bec(%rip),%rax
mov    (%rax),%edi
lea    0xca0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x38(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     142c <main+0x29c>
mov    -0x38(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x4,%eax
sub    %edx,%eax
mov    %eax,-0x58(%rbp)
jmp    1436 <main+0x2a6>
xor    %eax,%eax
mov    %eax,-0x58(%rbp)
jmp    1436 <main+0x2a6>
mov    -0x58(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
je     149e <main+0x30e>
mov    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    -0x48(%rbp),%rdi
mov    -0x54(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   10a0 <fwrite@plt>
movslq -0x54(%rbp),%rcx
cmp    %rcx,%rax
je     1499 <main+0x309>
mov    0x2b51(%rip),%rax
mov    (%rax),%edi
lea    0xc31(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    149e <main+0x30e>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe36(%rip),%r15
mov    0x2e27(%rip),%r12
xor    %r14d,%r14d
jmp    11e7 <main+0x57>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <help@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
je     1213 <main+0x83>
cmp    $0x64,%eax
jne    11e0 <main+0x50>
mov    (%r12),%edi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %rax,%r14
jmp    11e7 <main+0x57>
mov    0x2dc6(%rip),%rax
mov    (%rax),%r15
sub    %r15d,%ebp
cmp    $0x3,%ebp
je     122c <main+0x9c>
xor    %eax,%eax
call   1080 <help@plt>
mov    (%rbx,%r15,8),%rdi
mov    0x8(%rbx,%r15,8),%rbp
mov    0x10(%rbx,%r15,8),%r15
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
call   10b0 <readFile@plt>
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %rbp,%rdi
call   10b0 <readFile@plt>
lea    0xda1(%rip),%rsi
mov    %r15,%rdi
call   1060 <fopen@plt>
test   %rax,%rax
je     1377 <main+0x1e7>
mov    %rax,%rbx
mov    0x18(%rsp),%rdi
mov    0x8(%rsp),%edx
mov    $0x1,%esi
mov    %rax,%rcx
call   10a0 <fwrite@plt>
movslq 0x8(%rsp),%rcx
cmp    %rcx,%rax
jne    139b <main+0x20b>
mov    0x18(%rsp),%rax
movb   $0x0,(%rax)
cmp    %r14d,0x8(%rsp)
jge    12e1 <main+0x151>
nopl   0x0(%rax)
mov    0x18(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
cmp    $0x1,%rax
jne    1356 <main+0x1c6>
mov    0x8(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x8(%rsp)
cmp    %r14d,%eax
jl     12b0 <main+0x120>
mov    0x10(%rsp),%rdi
mov    0xc(%rsp),%edx
mov    $0x1,%esi
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
movslq 0xc(%rsp),%rcx
cmp    %rcx,%rax
jne    13ad <main+0x21d>
lea    0x3(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
and    $0xfffffffc,%eax
sub    %eax,%ecx
je     1347 <main+0x1b7>
mov    $0x4,%ebp
sub    %ecx,%ebp
mov    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    %ebp,%ecx
cmp    %rcx,%rax
jne    13bf <main+0x22f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c73(%rip),%rax
mov    (%rax),%edi
lea    0xcf4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
lea    0xc80(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2c2e(%rip),%rax
mov    (%rax),%edi
lea    0xc83(%rip),%rsi
jmp    1366 <main+0x1d6>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xcd0(%rip),%rsi
jmp    1366 <main+0x1d6>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
lea    0xcea(%rip),%rsi
jmp    1366 <main+0x1d6>

LLVM IR (-O0):
@.str = [3 x i8] c"d:\00"
@optarg = global i32 0
@optind = global i64 0
@.str.1 = [4 x i8] c"wb+\00"
@stderr = global i32 0
@.str.2 = [39 x i8] c"Error: Can not open \22%s\22 for writing.\0A\00"
@.str.3 = [44 x i8] c"Error writing text segment to output file.\0A\00"
@.str.4 = [51 x i8] c"Error writing 0 (pad to data seg) to output file.\0A\00"
@.str.5 = [44 x i8] c"Error writing data segment to output file.\0A\00"
@.str.6 = [46 x i8] c"Error writing 0 (pad to end) to output file.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
store i8* null, i8** %12
store i8* null, i8** %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
br label %17
17: ; preds = %30, %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @getopt(i32 %18, i8** %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %20, i32* %15
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %31
22: ; preds = %17
%23 = load i32, i32* %15
switch i32 %23, label %28 [
i32 100, label %24
]
24: ; preds = %22
%25 = load i32, i32* @optarg
%26 = call i64 @strtol(i32 %25, i32* null, i32 10)
%27 = trunc i64 %26 to i32
store i32 %27, i32* %14
br label %30
28: ; preds = %22
%29 = call i32 (...) @help()
br label %30
30: ; preds = %28, %24
br label %17
31: ; preds = %17
%32 = load i64, i64* @optind
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = sub nsw i64 %34, %32
%36 = trunc i64 %35 to i32
store i32 %36, i32* %4
%37 = load i64, i64* @optind
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 %37
store i8** %39, i8*** %5
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, 3
br i1 %41, label %42, label %44
42: ; preds = %31
%43 = call i32 (...) @help()
br label %44
44: ; preds = %42, %31
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
store i8* %47, i8** %7
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
store i8* %50, i8** %8
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
store i8* %53, i8** %9
%54 = load i8*, i8** %7
%55 = call i32 @readFile(i8* %54, i32* %10, i8** %12)
%56 = load i8*, i8** %8
%57 = call i32 @readFile(i8* %56, i32* %11, i8** %13)
%58 = load i8*, i8** %9
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32* %59, i32** %6
%60 = load i32*, i32** %6
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %67
62: ; preds = %44
%63 = load i32, i32* @stderr
%64 = load i8*, i8** %9
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %64)
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %44
%68 = load i8*, i8** %12
%69 = load i32, i32* %10
%70 = load i32*, i32** %6
%71 = call i64 @fwrite(i8* %68, i32 1, i32 %69, i32* %70)
%72 = load i32, i32* %10
%73 = sext i32 %72 to i64
%74 = icmp ne i64 %71, %73
br i1 %74, label %75, label %79
75: ; preds = %67
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %67
%80 = load i8*, i8** %12
%81 = getelementptr inbounds i8, i8* %80, i64 0
store i8 0, i8* %81
br label %82
82: ; preds = %95, %79
%83 = load i32, i32* %10
%84 = load i32, i32* %14
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %98
86: ; preds = %82
%87 = load i8*, i8** %12
%88 = load i32*, i32** %6
%89 = call i64 @fwrite(i8* %87, i32 1, i32 1, i32* %88)
%90 = icmp ne i64 %89, 1
br i1 %90, label %91, label %95
91: ; preds = %86
%92 = load i32, i32* @stderr
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %86
%96 = load i32, i32* %10
%97 = add nsw i32 %96, 1
store i32 %97, i32* %10
br label %82
98: ; preds = %82
%99 = load i8*, i8** %13
%100 = load i32, i32* %11
%101 = load i32*, i32** %6
%102 = call i64 @fwrite(i8* %99, i32 1, i32 %100, i32* %101)
%103 = load i32, i32* %11
%104 = sext i32 %103 to i64
%105 = icmp ne i64 %102, %104
br i1 %105, label %106, label %110
106: ; preds = %98
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %98
%111 = load i32, i32* %11
%112 = srem i32 %111, 4
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %118
114: ; preds = %110
%115 = load i32, i32* %11
%116 = srem i32 %115, 4
%117 = sub nsw i32 4, %116
br label %119
118: ; preds = %110
br label %119
119: ; preds = %118, %114
%120 = phi i32 [ %117, %114 ], [ 0, %118 ]
store i32 %120, i32* %16
%121 = load i32, i32* %16
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %138
123: ; preds = %119
%124 = load i8*, i8** %13
%125 = call i32 @memset(i8* %124, i32 0, i32 4)
%126 = load i8*, i8** %13
%127 = load i32, i32* %16
%128 = load i32*, i32** %6
%129 = call i64 @fwrite(i8* %126, i32 1, i32 %127, i32* %128)
%130 = load i32, i32* %16
%131 = sext i32 %130 to i64
%132 = icmp ne i64 %129, %131
br i1 %132, label %133, label %137
133: ; preds = %123
%134 = load i32, i32* @stderr
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%136 = call i32 @exit(i32 1)
unreachable
137: ; preds = %123
br label %138
138: ; preds = %137, %119
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"d:\00"
@optarg = global i32 0
@optind = global i64 0
@.str.1 = [4 x i8] c"wb+\00"
@stderr = global i32 0
@.str.2 = [39 x i8] c"Error: Can not open \22%s\22 for writing.\0A\00"
@.str.3 = [44 x i8] c"Error writing text segment to output file.\0A\00"
@.str.4 = [51 x i8] c"Error writing 0 (pad to data seg) to output file.\0A\00"
@.str.5 = [44 x i8] c"Error writing data segment to output file.\0A\00"
@.str.6 = [46 x i8] c"Error writing 0 (pad to end) to output file.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%10 = bitcast i8** %6 to i8*
store i8* null, i8** %6
br label %11
11: ; preds = %15, %2
%12 = phi i32 [ %18, %15 ], [ 0, %2 ]
br label %13
13: ; preds = %11, %19
%14 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %14, label %19 [
i32 -1, label %21
i32 100, label %15
]
15: ; preds = %13
%16 = load i32, i32* @optarg
%17 = tail call i64 @strtol(i32 %16, i32* null, i32 10)
%18 = trunc i64 %17 to i32
br label %11
19: ; preds = %13
%20 = tail call i32 (...) @help()
br label %13
21: ; preds = %13
%22 = load i64, i64* @optind
%23 = trunc i64 %22 to i32
%24 = sub i32 %0, %23
%25 = getelementptr inbounds i8*, i8** %1, i64 %22
%26 = icmp eq i32 %24, 3
br i1 %26, label %29, label %27
27: ; preds = %21
%28 = tail call i32 (...) @help()
br label %29
29: ; preds = %27, %21
%30 = load i8*, i8** %25
%31 = getelementptr inbounds i8*, i8** %25, i64 1
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8*, i8** %25, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @readFile(i8* %30, i32* %3, i8** %5)
%36 = call i32 @readFile(i8* %32, i32* %4, i8** %6)
%37 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %43
39: ; preds = %29
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %29
%44 = load i8*, i8** %5
%45 = load i32, i32* %3
%46 = call i64 @fwrite(i8* %44, i32 1, i32 %45, i32* %37)
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = icmp eq i64 %46, %48
br i1 %49, label %54, label %50
50: ; preds = %43
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %43
%55 = load i8*, i8** %5
store i8 0, i8* %55
%56 = load i32, i32* %3
%57 = icmp slt i32 %56, %12
br i1 %57, label %58, label %70
58: ; preds = %54, %66
%59 = load i8*, i8** %5
%60 = call i64 @fwrite(i8* %59, i32 1, i32 1, i32* %37)
%61 = icmp eq i64 %60, 1
br i1 %61, label %66, label %62
62: ; preds = %58
%63 = load i32, i32* @stderr
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58
%67 = load i32, i32* %3
%68 = add nsw i32 %67, 1
store i32 %68, i32* %3
%69 = icmp slt i32 %68, %12
br i1 %69, label %58, label %70
70: ; preds = %66, %54
%71 = load i8*, i8** %6
%72 = load i32, i32* %4
%73 = call i64 @fwrite(i8* %71, i32 1, i32 %72, i32* %37)
%74 = load i32, i32* %4
%75 = sext i32 %74 to i64
%76 = icmp eq i64 %73, %75
br i1 %76, label %81, label %77
77: ; preds = %70
%78 = load i32, i32* @stderr
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %70
%82 = srem i32 %74, 4
%83 = icmp eq i32 %82, 0
%84 = sub nsw i32 4, %82
br i1 %83, label %96, label %85
85: ; preds = %81
%86 = load i8*, i8** %6
%87 = call i32 @memset(i8* %86, i32 0, i32 4)
%88 = load i8*, i8** %6
%89 = call i64 @fwrite(i8* %88, i32 1, i32 %84, i32* %37)
%90 = zext i32 %84 to i64
%91 = icmp eq i64 %89, %90
br i1 %91, label %96, label %92
92: ; preds = %85
%93 = load i32, i32* @stderr
%94 = call i32 (i32, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %85, %81
ret i32 0
}