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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned int *, int);
int open(char *, int, ...);
int /*<<< orphan*/ printf(char *, int);
unsigned int read(int, unsigned char *, unsigned int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int write(int, unsigned char *, int);
int main(int argc, char **argv) {
  int i, len;
  unsigned char buffer[(16 * 1024)] = {0};
  int ifd, ofd;
  unsigned int checksum = 0, count;
  if (argc != 3) {
    printf(" %d Wrong number of arguments\n", argc);
    exit(EXIT_FAILURE);
  }
  ifd = open(argv[1], O_RDONLY);
  if (ifd < 0) {
    fprintf(stderr, "%s: Can't open %s: %s\n", argv[0], argv[1],
            strerror(errno));
    exit(EXIT_FAILURE);
  }
  ofd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC,
             (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH));
  if (ifd < 0) {
    fprintf(stderr, "%s: Can't open %s: %s\n", argv[0], argv[2],
            strerror(errno));
    if (ifd)
      close(ifd);
    exit(EXIT_FAILURE);
  }
  len = lseek(ifd, 0, SEEK_END);
  lseek(ifd, 0, SEEK_SET);
  count = (len < (14 * 1024 - 4)) ? len : (14 * 1024 - 4);
  if (read(ifd, buffer, count) != count) {
    fprintf(stderr, "%s: Can't read %s: %s\n", argv[0], argv[1],
            strerror(errno));
    if (ifd)
      close(ifd);
    if (ofd)
      close(ofd);
    exit(EXIT_FAILURE);
  }
  for (i = 0, checksum = 0; i < (14 * 1024 - 4); i++)
    checksum += buffer[i];
  memcpy(&buffer[(14 * 1024 - 4)], &checksum, sizeof(checksum));
  if (write(ofd, buffer, (16 * 1024)) != (16 * 1024)) {
    fprintf(stderr, "%s: Can't write %s: %s\n", argv[0], argv[2],
            strerror(errno));
    if (ifd)
      close(ifd);
    if (ofd)
      close(ofd);
    exit(EXIT_FAILURE);
  }
  if (ifd)
    close(ifd);
  if (ofd)
    close(ofd);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4090,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x4020(%rbp),%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1060 <memset@plt>
movl   $0x0,-0x402c(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     120d <main+0x5d>
mov    -0x8(%rbp),%esi
lea    0xe06(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x4024(%rbp)
cmpl   $0x0,-0x4024(%rbp)
jge    12a3 <main+0xf3>
mov    0x2d71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4044(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x4040(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x4038(%rbp)
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x4044(%rbp),%edi
mov    -0x4040(%rbp),%rdx
mov    -0x4038(%rbp),%rcx
mov    %rax,%r8
lea    0xd8f(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2cec(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2cb6(%rip),%rax
mov    (%rax),%esi
mov    0x2d3d(%rip),%rax
or     (%rax),%esi
mov    0x2d2c(%rip),%rax
or     (%rax),%esi
mov    0x2cb3(%rip),%rax
mov    (%rax),%edx
mov    0x2cea(%rip),%rax
or     (%rax),%edx
mov    0x2cb9(%rip),%rax
or     (%rax),%edx
mov    0x2ce0(%rip),%rax
or     (%rax),%edx
mov    0x2c9f(%rip),%rax
or     (%rax),%edx
mov    0x2c66(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   10b0 <open@plt>
mov    %eax,-0x4028(%rbp)
cmpl   $0x0,-0x4024(%rbp)
jge    1399 <main+0x1e9>
mov    0x2c93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x405c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x4058(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x4050(%rbp)
mov    0x2c5f(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x405c(%rbp),%edi
mov    -0x4058(%rbp),%rdx
mov    -0x4050(%rbp),%rcx
mov    %rax,%r8
lea    0xcb1(%rip),%rsi
call   1090 <fprintf@plt>
cmpl   $0x0,-0x4024(%rbp)
je     138b <main+0x1db>
mov    -0x4024(%rbp),%edi
call   1070 <close@plt>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x4024(%rbp),%edi
mov    0x2c32(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4024(%rbp),%edi
mov    0x2be1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
cmpl   $0x37fc,-0x18(%rbp)
jge    13e3 <main+0x233>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4060(%rbp)
jmp    13f3 <main+0x243>
mov    $0x37fc,%eax
mov    %eax,-0x4060(%rbp)
jmp    13f3 <main+0x243>
mov    -0x4060(%rbp),%eax
mov    %eax,-0x4030(%rbp)
mov    -0x4024(%rbp),%edi
lea    -0x4020(%rbp),%rsi
mov    -0x4030(%rbp),%edx
call   1080 <read@plt>
cmp    -0x4030(%rbp),%eax
je     14be <main+0x30e>
mov    0x2b86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4074(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x4070(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x4068(%rbp)
mov    0x2b52(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x4074(%rbp),%edi
mov    -0x4070(%rbp),%rdx
mov    -0x4068(%rbp),%rcx
mov    %rax,%r8
lea    0xbbb(%rip),%rsi
call   1090 <fprintf@plt>
cmpl   $0x0,-0x4024(%rbp)
je     1498 <main+0x2e8>
mov    -0x4024(%rbp),%edi
call   1070 <close@plt>
cmpl   $0x0,-0x4028(%rbp)
je     14b0 <main+0x300>
mov    -0x4028(%rbp),%edi
call   1070 <close@plt>
mov    0x2ad1(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x402c(%rbp)
cmpl   $0x37fc,-0x14(%rbp)
jge    1502 <main+0x352>
movslq -0x14(%rbp),%rax
movzbl -0x4020(%rbp,%rax,1),%eax
ff
add    -0x402c(%rbp),%eax
mov    %eax,-0x402c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    14cf <main+0x31f>
lea    -0x4020(%rbp),%rdi
add    $0x37fc,%rdi
lea    -0x402c(%rbp),%rsi
mov    $0x4,%edx
call   10a0 <memcpy@plt>
mov    -0x4028(%rbp),%edi
lea    -0x4020(%rbp),%rsi
mov    $0x4000,%edx
call   1030 <write@plt>
cmp    $0x4000,%eax
je     15de <main+0x42e>
mov    0x2a66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x408c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x4088(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x4080(%rbp)
mov    0x2a32(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x408c(%rbp),%edi
mov    -0x4088(%rbp),%rdx
mov    -0x4080(%rbp),%rcx
mov    %rax,%r8
lea    0xab2(%rip),%rsi
call   1090 <fprintf@plt>
cmpl   $0x0,-0x4024(%rbp)
je     15b8 <main+0x408>
mov    -0x4024(%rbp),%edi
call   1070 <close@plt>
cmpl   $0x0,-0x4028(%rbp)
je     15d0 <main+0x420>
mov    -0x4028(%rbp),%edi
call   1070 <close@plt>
mov    0x29b1(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x4024(%rbp)
je     15f6 <main+0x446>
mov    -0x4024(%rbp),%edi
call   1070 <close@plt>
cmpl   $0x0,-0x4028(%rbp)
je     160e <main+0x45e>
mov    -0x4028(%rbp),%edi
call   1070 <close@plt>
mov    0x2963(%rip),%rax
mov    (%rax),%eax
add    $0x4090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x4010,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0x10(%rsp),%rdi
mov    $0x4000,%edx
xor    %esi,%esi
call   1060 <memset@plt>
cmp    $0x3,%ebx
jne    13e4 <main+0x234>
mov    0x8(%r14),%rdi
mov    0x2de7(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   10b0 <open@plt>
test   %eax,%eax
js     13f7 <main+0x247>
mov    %eax,%r12d
mov    0x2d64(%rip),%rax
mov    0x2ded(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dda(%rip),%rax
or     (%rax),%esi
mov    0x2d61(%rip),%rax
mov    0x2d9a(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2d67(%rip),%rax
or     (%rax),%edx
mov    0x2d8e(%rip),%rax
or     (%rax),%edx
mov    0x2d4d(%rip),%rax
or     (%rax),%edx
mov    0x10(%r14),%rdi
mov    0x2d10(%rip),%rax
or     (%rax),%edx
xor    %eax,%eax
call   10b0 <open@plt>
mov    %eax,%r15d
mov    0x2d75(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %eax,%ebp
mov    0x2d28(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
cmp    $0x37fc,%ebp
mov    $0x37fc,%ebx
cmovl  %ebp,%ebx
lea    0x10(%rsp),%rsi
mov    %r12d,%edi
mov    %ebx,%edx
call   1080 <read@plt>
cmp    %ebx,%eax
jne    142e <main+0x27e>
pxor   %xmm0,%xmm0
mov    $0x14,%eax
pxor   %xmm2,%xmm2
pxor   %xmm1,%xmm1
nopw   0x0(%rax,%rax,1)
movq   -0x4(%rsp,%rax,1),%xmm4
movd   (%rsp,%rax,1),%xmm3
punpcklbw %xmm0,%xmm4
punpcklwd %xmm0,%xmm4
paddd  %xmm2,%xmm4
punpcklbw %xmm0,%xmm3
punpcklwd %xmm0,%xmm3
paddd  %xmm1,%xmm3
movq   0x4(%rsp,%rax,1),%xmm5
movd   0x8(%rsp,%rax,1),%xmm6
punpcklbw %xmm0,%xmm5
punpcklwd %xmm0,%xmm5
punpcklbw %xmm0,%xmm6
punpcklwd %xmm0,%xmm6
movq   0xc(%rsp,%rax,1),%xmm2
movd   0x10(%rsp,%rax,1),%xmm1
punpcklbw %xmm0,%xmm2
punpcklwd %xmm0,%xmm2
paddd  %xmm5,%xmm2
paddd  %xmm4,%xmm2
punpcklbw %xmm0,%xmm1
punpcklwd %xmm0,%xmm1
paddd  %xmm6,%xmm1
paddd  %xmm3,%xmm1
add    $0x18,%rax
cmp    $0x380c,%rax
jne    12c0 <main+0x110>
paddd  %xmm2,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
movzbl 0x3808(%rsp),%ecx
add    %eax,%ecx
movzbl 0x3809(%rsp),%eax
add    %ecx,%eax
movzbl 0x380a(%rsp),%ecx
add    %eax,%ecx
movzbl 0x380b(%rsp),%eax
add    %ecx,%eax
mov    %eax,0xc(%rsp)
lea    0x380c(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   10a0 <memcpy@plt>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x4000,%edx
call   1030 <write@plt>
cmp    $0x4000,%eax
jne    1455 <main+0x2a5>
test   %r12d,%r12d
je     13be <main+0x20e>
mov    %r12d,%edi
call   1070 <close@plt>
test   %r15d,%r15d
je     13cb <main+0x21b>
mov    %r15d,%edi
call   1070 <close@plt>
mov    0x2ba6(%rip),%rax
mov    (%rax),%eax
add    $0x4010,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc15(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    14a4 <main+0x2f4>
mov    0x2bb2(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rbp
mov    0x8(%r14),%r14
mov    0x2b9a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xc03(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %rax,%r8
call   1090 <fprintf@plt>
jmp    14a4 <main+0x2f4>
mov    0x2b7b(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rbp
mov    0x8(%r14),%r14
mov    0x2b63(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xbe3(%rip),%rsi
jmp    147a <main+0x2ca>
mov    0x2b54(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rbp
mov    0x10(%r14),%r14
mov    0x2b3c(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xbd3(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %rax,%r8
call   1090 <fprintf@plt>
test   %r12d,%r12d
je     1497 <main+0x2e7>
mov    %r12d,%edi
call   1070 <close@plt>
test   %r15d,%r15d
je     14a4 <main+0x2f4>
mov    %r15d,%edi
call   1070 <close@plt>
mov    0x2add(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c" %d Wrong number of arguments\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"%s: Can't open %s: %s\0A\00"
@errno = global i32 0
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [23 x i8] c"%s: Can't read %s: %s\0A\00"
@.str.3 = [24 x i8] c"%s: Can't write %s: %s\0A\00"
@EXIT_SUCCESS = 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 [16384 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [16384 x i8]* %8 to i8*
store i32 0, i32* %11
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i32, i32* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i32, i32* @O_RDONLY
%26 = call i32 (i8*, i32, ...) @open(i8* %24, i32 %25)
store i32 %26, i32* %9
%27 = load i32, i32* %9
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %42
29: ; preds = %21
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = load i32, i32* @errno
%38 = call i8* @strerror(i32 %37)
%39 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %33, i8* %36, i8* %38)
%40 = load i32, i32* @EXIT_FAILURE
%41 = call i32 @exit(i32 %40)
unreachable
42: ; preds = %21
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = load i32, i32* @O_WRONLY
%47 = load i32, i32* @O_CREAT
%48 = or i32 %46, %47
%49 = load i32, i32* @O_TRUNC
%50 = or i32 %48, %49
%51 = load i32, i32* @S_IRUSR
%52 = load i32, i32* @S_IWUSR
%53 = or i32 %51, %52
%54 = load i32, i32* @S_IRGRP
%55 = or i32 %53, %54
%56 = load i32, i32* @S_IWGRP
%57 = or i32 %55, %56
%58 = load i32, i32* @S_IROTH
%59 = or i32 %57, %58
%60 = load i32, i32* @S_IWOTH
%61 = or i32 %59, %60
%62 = call i32 (i8*, i32, ...) @open(i8* %45, i32 %50, i32 %61)
store i32 %62, i32* %10
%63 = load i32, i32* %9
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %84
65: ; preds = %42
%66 = load i32, i32* @stderr
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 0
%69 = load i8*, i8** %68
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = load i32, i32* @errno
%74 = call i8* @strerror(i32 %73)
%75 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %69, i8* %72, i8* %74)
%76 = load i32, i32* %9
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %65
%79 = load i32, i32* %9
%80 = call i32 @close(i32 %79)
br label %81
81: ; preds = %78, %65
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %42
%85 = load i32, i32* %9
%86 = load i32, i32* @SEEK_END
%87 = call i32 @lseek(i32 %85, i32 0, i32 %86)
store i32 %87, i32* %7
%88 = load i32, i32* %9
%89 = load i32, i32* @SEEK_SET
%90 = call i32 @lseek(i32 %88, i32 0, i32 %89)
%91 = load i32, i32* %7
%92 = icmp slt i32 %91, 14332
br i1 %92, label %93, label %95
93: ; preds = %84
%94 = load i32, i32* %7
br label %96
95: ; preds = %84
br label %96
96: ; preds = %95, %93
%97 = phi i32 [ %94, %93 ], [ 14332, %95 ]
store i32 %97, i32* %12
%98 = load i32, i32* %9
%99 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 0
%100 = load i32, i32* %12
%101 = call i32 @read(i32 %98, i8* %99, i32 %100)
%102 = load i32, i32* %12
%103 = icmp ne i32 %101, %102
br i1 %103, label %104, label %129
104: ; preds = %96
%105 = load i32, i32* @stderr
%106 = load i8**, i8*** %5
%107 = getelementptr inbounds i8*, i8** %106, i64 0
%108 = load i8*, i8** %107
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 1
%111 = load i8*, i8** %110
%112 = load i32, i32* @errno
%113 = call i8* @strerror(i32 %112)
%114 = call i32 @fprintf(i32 %105, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %108, i8* %111, i8* %113)
%115 = load i32, i32* %9
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %120
117: ; preds = %104
%118 = load i32, i32* %9
%119 = call i32 @close(i32 %118)
br label %120
120: ; preds = %117, %104
%121 = load i32, i32* %10
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %126
123: ; preds = %120
%124 = load i32, i32* %10
%125 = call i32 @close(i32 %124)
br label %126
126: ; preds = %123, %120
%127 = load i32, i32* @EXIT_FAILURE
%128 = call i32 @exit(i32 %127)
unreachable
129: ; preds = %96
store i32 0, i32* %6
store i32 0, i32* %11
br label %130
130: ; preds = %141, %129
%131 = load i32, i32* %6
%132 = icmp slt i32 %131, 14332
br i1 %132, label %133, label %144
133: ; preds = %130
%134 = load i32, i32* %6
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 %135
%137 = load i8, i8* %136
%138 = zext i8 %137 to i32
%139 = load i32, i32* %11
%140 = add i32 %139, %138
store i32 %140, i32* %11
br label %141
141: ; preds = %133
%142 = load i32, i32* %6
%143 = add nsw i32 %142, 1
store i32 %143, i32* %6
br label %130
144: ; preds = %130
%145 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 14332
%146 = call i32 @memcpy(i8* %145, i32* %11, i32 4)
%147 = load i32, i32* %10
%148 = getelementptr inbounds [16384 x i8], [16384 x i8]* %8, i64 0, i64 0
%149 = call i32 @write(i32 %147, i8* %148, i32 16384)
%150 = icmp ne i32 %149, 16384
br i1 %150, label %151, label %176
151: ; preds = %144
%152 = load i32, i32* @stderr
%153 = load i8**, i8*** %5
%154 = getelementptr inbounds i8*, i8** %153, i64 0
%155 = load i8*, i8** %154
%156 = load i8**, i8*** %5
%157 = getelementptr inbounds i8*, i8** %156, i64 2
%158 = load i8*, i8** %157
%159 = load i32, i32* @errno
%160 = call i8* @strerror(i32 %159)
%161 = call i32 @fprintf(i32 %152, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %155, i8* %158, i8* %160)
%162 = load i32, i32* %9
%163 = icmp ne i32 %162, 0
br i1 %163, label %164, label %167
164: ; preds = %151
%165 = load i32, i32* %9
%166 = call i32 @close(i32 %165)
br label %167
167: ; preds = %164, %151
%168 = load i32, i32* %10
%169 = icmp ne i32 %168, 0
br i1 %169, label %170, label %173
170: ; preds = %167
%171 = load i32, i32* %10
%172 = call i32 @close(i32 %171)
br label %173
173: ; preds = %170, %167
%174 = load i32, i32* @EXIT_FAILURE
%175 = call i32 @exit(i32 %174)
unreachable
176: ; preds = %144
%177 = load i32, i32* %9
%178 = icmp ne i32 %177, 0
br i1 %178, label %179, label %182
179: ; preds = %176
%180 = load i32, i32* %9
%181 = call i32 @close(i32 %180)
br label %182
182: ; preds = %179, %176
%183 = load i32, i32* %10
%184 = icmp ne i32 %183, 0
br i1 %184, label %185, label %188
185: ; preds = %182
%186 = load i32, i32* %10
%187 = call i32 @close(i32 %186)
br label %188
188: ; preds = %185, %182
%189 = load i32, i32* @EXIT_SUCCESS
ret i32 %189
}

LLVM IR (-O2):
@.str = [31 x i8] c" %d Wrong number of arguments\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"%s: Can't open %s: %s\0A\00"
@errno = global i32 0
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [23 x i8] c"%s: Can't read %s: %s\0A\00"
@.str.3 = [24 x i8] c"%s: Can't write %s: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16384 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %0)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = load i32, i32* @O_RDONLY
%16 = tail call i32 (i8*, i32, ...) @open(i8* %14, i32 %15)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %12
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = load i8*, i8** %13
%22 = load i32, i32* @errno
%23 = tail call i8* @strerror(i32 %22)
%24 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21, i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
%26 = tail call i32 @exit(i32 %25)
unreachable
27: ; preds = %12
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = load i32, i32* @O_WRONLY
%31 = load i32, i32* @O_CREAT
%32 = or i32 %31, %30
%33 = load i32, i32* @O_TRUNC
%34 = or i32 %32, %33
%35 = load i32, i32* @S_IRUSR
%36 = load i32, i32* @S_IWUSR
%37 = or i32 %36, %35
%38 = load i32, i32* @S_IRGRP
%39 = or i32 %37, %38
%40 = load i32, i32* @S_IWGRP
%41 = or i32 %39, %40
%42 = load i32, i32* @S_IROTH
%43 = or i32 %41, %42
%44 = load i32, i32* @S_IWOTH
%45 = or i32 %43, %44
%46 = tail call i32 (i8*, i32, ...) @open(i8* %29, i32 %34, i32 %45)
%47 = load i32, i32* @SEEK_END
%48 = tail call i32 @lseek(i32 %16, i32 0, i32 %47)
%49 = load i32, i32* @SEEK_SET
%50 = tail call i32 @lseek(i32 %16, i32 0, i32 %49)
%51 = icmp slt i32 %48, 14332
%52 = select i1 %51, i32 %48, i32 14332
%53 = call i32 @read(i32 %16, i8* %5, i32 %52)
%54 = icmp eq i32 %53, %52
br i1 %54, label %55, label %93
55: ; preds = %27, %55
%56 = phi i64 [ %91, %55 ], [ 0, %27 ]
%57 = phi <4 x i32> [ %89, %55 ], [ zeroinitializer, %27 ]
%58 = phi <4 x i32> [ %90, %55 ], [ zeroinitializer, %27 ]
%59 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 %56
%60 = bitcast i8* %59 to <4 x i8>*
%61 = load <4 x i8>, <4 x i8>* %60
%62 = getelementptr inbounds i8, i8* %59, i64 4
%63 = bitcast i8* %62 to <4 x i8>*
%64 = load <4 x i8>, <4 x i8>* %63
%65 = zext <4 x i8> %61 to <4 x i32>
%66 = zext <4 x i8> %64 to <4 x i32>
%67 = add <4 x i32> %57, %65
%68 = add <4 x i32> %58, %66
%69 = add nuw nsw i64 %56, 8
%70 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 %69
%71 = bitcast i8* %70 to <4 x i8>*
%72 = load <4 x i8>, <4 x i8>* %71
%73 = getelementptr inbounds i8, i8* %70, i64 4
%74 = bitcast i8* %73 to <4 x i8>*
%75 = load <4 x i8>, <4 x i8>* %74
%76 = zext <4 x i8> %72 to <4 x i32>
%77 = zext <4 x i8> %75 to <4 x i32>
%78 = add <4 x i32> %67, %76
%79 = add <4 x i32> %68, %77
%80 = add nuw nsw i64 %56, 16
%81 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 %80
%82 = bitcast i8* %81 to <4 x i8>*
%83 = load <4 x i8>, <4 x i8>* %82
%84 = getelementptr inbounds i8, i8* %81, i64 4
%85 = bitcast i8* %84 to <4 x i8>*
%86 = load <4 x i8>, <4 x i8>* %85
%87 = zext <4 x i8> %83 to <4 x i32>
%88 = zext <4 x i8> %86 to <4 x i32>
%89 = add <4 x i32> %78, %87
%90 = add <4 x i32> %79, %88
%91 = add nuw nsw i64 %56, 24
%92 = icmp eq i64 %91, 14328
br i1 %92, label %110, label %55
93: ; preds = %27
%94 = load i32, i32* @stderr
%95 = load i8*, i8** %1
%96 = load i8*, i8** %13
%97 = load i32, i32* @errno
%98 = tail call i8* @strerror(i32 %97)
%99 = tail call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %95, i8* %96, i8* %98)
%100 = icmp eq i32 %16, 0
br i1 %100, label %103, label %101
101: ; preds = %93
%102 = tail call i32 @close(i32 %16)
br label %103
103: ; preds = %101, %93
%104 = icmp eq i32 %46, 0
br i1 %104, label %107, label %105
105: ; preds = %103
%106 = tail call i32 @close(i32 %46)
br label %107
107: ; preds = %105, %103
%108 = load i32, i32* @EXIT_FAILURE
%109 = tail call i32 @exit(i32 %108)
unreachable
110: ; preds = %55
%111 = add <4 x i32> %90, %89
%112 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %111)
%113 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 14328
%114 = load i8, i8* %113
%115 = zext i8 %114 to i32
%116 = add i32 %112, %115
%117 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 14329
%118 = load i8, i8* %117
%119 = zext i8 %118 to i32
%120 = add i32 %116, %119
%121 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 14330
%122 = load i8, i8* %121
%123 = zext i8 %122 to i32
%124 = add i32 %120, %123
%125 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 14331
%126 = load i8, i8* %125
%127 = zext i8 %126 to i32
%128 = add i32 %124, %127
store i32 %128, i32* %4
%129 = getelementptr inbounds [16384 x i8], [16384 x i8]* %3, i64 0, i64 14332
%130 = call i32 @memcpy(i8* %129, i32* %4, i32 4)
%131 = call i32 @write(i32 %46, i8* %5, i32 16384)
%132 = icmp eq i32 %131, 16384
br i1 %132, label %150, label %133
133: ; preds = %110
%134 = load i32, i32* @stderr
%135 = load i8*, i8** %1
%136 = load i8*, i8** %28
%137 = load i32, i32* @errno
%138 = call i8* @strerror(i32 %137)
%139 = call i32 @fprintf(i32 %134, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %135, i8* %136, i8* %138)
%140 = icmp eq i32 %16, 0
br i1 %140, label %143, label %141
141: ; preds = %133
%142 = call i32 @close(i32 %16)
br label %143
143: ; preds = %141, %133
%144 = icmp eq i32 %46, 0
br i1 %144, label %147, label %145
145: ; preds = %143
%146 = call i32 @close(i32 %46)
br label %147
147: ; preds = %145, %143
%148 = load i32, i32* @EXIT_FAILURE
%149 = call i32 @exit(i32 %148)
unreachable
150: ; preds = %110
%151 = icmp eq i32 %16, 0
br i1 %151, label %154, label %152
152: ; preds = %150
%153 = call i32 @close(i32 %16)
br label %154
154: ; preds = %152, %150
%155 = icmp eq i32 %46, 0
br i1 %155, label %158, label %156
156: ; preds = %154
%157 = call i32 @close(i32 %46)
br label %158
158: ; preds = %156, %154
%159 = load i32, i32* @EXIT_SUCCESS
ret i32 %159
}