#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);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *in, *out;
  unsigned char buf[5120];
  int track;
  if (argc != 3) {
    fprintf(stderr, "%s: source dest.\n", argv[0]);
    exit(1);
  }
  in = fopen(argv[1], "r");
  if (in == NULL) {
    perror(argv[1]);
    exit(1);
  }
  out = fopen(argv[2], "w");
  if (out == NULL) {
    perror(argv[2]);
    exit(1);
  }
  for (track = 0; track < 80; track++) {
    if (fseek(in, track * 5120L, 0) == -1) {
      perror(argv[1]);
      exit(1);
    }
    if (fread(buf, 5120, 1, in) != 1) {
      perror(argv[1]);
      exit(1);
    }
    if (fwrite(buf, 5120, 1, out) != 1) {
      perror(argv[2]);
      exit(1);
    }
    if (fseek(in, (80 + track) * 5120L, 0) == -1) {
      perror(argv[1]);
      exit(1);
    }
    if (fread(buf, 5120, 1, in) != 1) {
      perror(argv[1]);
      exit(1);
    }
    if (fwrite(buf, 5120, 1, out) != 1) {
      perror(argv[2]);
      exit(1);
    }
  }
  if (fclose(in)) {
    perror(argv[1]);
    exit(1);
  }
  if (fclose(out)) {
    perror(argv[2]);
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11c9 <main+0x49>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe46(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1203 <main+0x83>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe02(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    123d <main+0xbd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0x0,-0x1424(%rbp)
cmpl   $0x50,-0x1424(%rbp)
jge    13cf <main+0x24f>
mov    -0x18(%rbp),%rdi
movslq -0x1424(%rbp),%rax
imul   $0x1400,%rax,%rax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <fseek@plt>
cmp    $0xffffffff,%eax
jne    128f <main+0x10f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    -0x1420(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1400,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     12c9 <main+0x149>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    -0x1420(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1400,%esi
mov    $0x1,%edx
call   10a0 <fwrite@plt>
cmp    $0x1,%eax
je     1303 <main+0x183>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1424(%rbp),%eax
add    $0x50,%eax
cltq
imul   $0x1400,%rax,%rax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <fseek@plt>
cmp    $0xffffffff,%eax
jne    1342 <main+0x1c2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    -0x1420(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1400,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     137c <main+0x1fc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
lea    -0x1420(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1400,%esi
mov    $0x1,%edx
call   10a0 <fwrite@plt>
cmp    $0x1,%eax
je     13b6 <main+0x236>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    13bb <main+0x23b>
mov    -0x1424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1424(%rbp)
jmp    1247 <main+0xc7>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     13f9 <main+0x279>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     1423 <main+0x2a3>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1400,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    11b3 <main+0x33>
mov    0x8(%r14),%rdi
lea    0xe6f(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    11d5 <main+0x55>
mov    0x8(%r14),%rdi
jmp    11f1 <main+0x71>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe3a(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %rax,%r12
mov    0x10(%r14),%rdi
lea    0xe31(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    1200 <main+0x80>
mov    0x10(%r14),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    %rax,%r15
xor    %ebx,%ebx
mov    %rsp,%r13
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %ebx,%esi
xor    %edx,%edx
call   1060 <fseek@plt>
cmp    $0xffffffff,%eax
je     11ad <main+0x2d>
mov    %r13,%rdi
mov    $0x1400,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    11ad <main+0x2d>
mov    %r13,%rdi
mov    $0x1400,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   10a0 <fwrite@plt>
cmp    $0x1,%eax
jne    11ed <main+0x6d>
lea    0x64000(%rbx),%esi
mov    %r12,%rdi
xor    %edx,%edx
call   1060 <fseek@plt>
cmp    $0xffffffff,%eax
je     11ad <main+0x2d>
mov    %r13,%rdi
mov    $0x1400,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    11ad <main+0x2d>
mov    %r13,%rdi
mov    $0x1400,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   10a0 <fwrite@plt>
cmp    $0x1,%eax
jne    11ed <main+0x6d>
add    $0x1400,%ebx
cmp    $0x64000,%ebx
jne    1210 <main+0x90>
mov    %r12,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    11ad <main+0x2d>
mov    %r15,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    11ed <main+0x6d>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"%s: source dest.\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\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 [5120 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %6
%24 = load i32*, i32** %6
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %32
26: ; preds = %19
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @perror(i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %19
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %36, i32** %7
%37 = load i32*, i32** %7
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %45
39: ; preds = %32
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32 @perror(i8* %42)
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %32
store i32 0, i32* %9
br label %46
46: ; preds = %123, %45
%47 = load i32, i32* %9
%48 = icmp slt i32 %47, 80
br i1 %48, label %49, label %126
49: ; preds = %46
%50 = load i32*, i32** %6
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = mul nsw i64 %52, 5120
%54 = trunc i64 %53 to i32
%55 = call i32 @fseek(i32* %50, i32 %54, i32 0)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %63
57: ; preds = %49
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 1
%60 = load i8*, i8** %59
%61 = call i32 @perror(i8* %60)
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %49
%64 = getelementptr inbounds [5120 x i8], [5120 x i8]* %8, i64 0, i64 0
%65 = load i32*, i32** %6
%66 = call i32 @fread(i8* %64, i32 5120, i32 1, i32* %65)
%67 = icmp ne i32 %66, 1
br i1 %67, label %68, label %74
68: ; preds = %63
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 1
%71 = load i8*, i8** %70
%72 = call i32 @perror(i8* %71)
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %63
%75 = getelementptr inbounds [5120 x i8], [5120 x i8]* %8, i64 0, i64 0
%76 = load i32*, i32** %7
%77 = call i32 @fwrite(i8* %75, i32 5120, i32 1, i32* %76)
%78 = icmp ne i32 %77, 1
br i1 %78, label %79, label %85
79: ; preds = %74
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 2
%82 = load i8*, i8** %81
%83 = call i32 @perror(i8* %82)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %74
%86 = load i32*, i32** %6
%87 = load i32, i32* %9
%88 = add nsw i32 80, %87
%89 = sext i32 %88 to i64
%90 = mul nsw i64 %89, 5120
%91 = trunc i64 %90 to i32
%92 = call i32 @fseek(i32* %86, i32 %91, i32 0)
%93 = icmp eq i32 %92, -1
br i1 %93, label %94, label %100
94: ; preds = %85
%95 = load i8**, i8*** %5
%96 = getelementptr inbounds i8*, i8** %95, i64 1
%97 = load i8*, i8** %96
%98 = call i32 @perror(i8* %97)
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %85
%101 = getelementptr inbounds [5120 x i8], [5120 x i8]* %8, i64 0, i64 0
%102 = load i32*, i32** %6
%103 = call i32 @fread(i8* %101, i32 5120, i32 1, i32* %102)
%104 = icmp ne i32 %103, 1
br i1 %104, label %105, label %111
105: ; preds = %100
%106 = load i8**, i8*** %5
%107 = getelementptr inbounds i8*, i8** %106, i64 1
%108 = load i8*, i8** %107
%109 = call i32 @perror(i8* %108)
%110 = call i32 @exit(i32 1)
unreachable
111: ; preds = %100
%112 = getelementptr inbounds [5120 x i8], [5120 x i8]* %8, i64 0, i64 0
%113 = load i32*, i32** %7
%114 = call i32 @fwrite(i8* %112, i32 5120, i32 1, i32* %113)
%115 = icmp ne i32 %114, 1
br i1 %115, label %116, label %122
116: ; preds = %111
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 2
%119 = load i8*, i8** %118
%120 = call i32 @perror(i8* %119)
%121 = call i32 @exit(i32 1)
unreachable
122: ; preds = %111
br label %123
123: ; preds = %122
%124 = load i32, i32* %9
%125 = add nsw i32 %124, 1
store i32 %125, i32* %9
br label %46
126: ; preds = %46
%127 = load i32*, i32** %6
%128 = call i64 @fclose(i32* %127)
%129 = icmp ne i64 %128, 0
br i1 %129, label %130, label %136
130: ; preds = %126
%131 = load i8**, i8*** %5
%132 = getelementptr inbounds i8*, i8** %131, i64 1
%133 = load i8*, i8** %132
%134 = call i32 @perror(i8* %133)
%135 = call i32 @exit(i32 1)
unreachable
136: ; preds = %126
%137 = load i32*, i32** %7
%138 = call i64 @fclose(i32* %137)
%139 = icmp ne i64 %138, 0
br i1 %139, label %140, label %146
140: ; preds = %136
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 2
%143 = load i8*, i8** %142
%144 = call i32 @perror(i8* %143)
%145 = call i32 @exit(i32 1)
unreachable
146: ; preds = %136
%147 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"%s: source dest.\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [2 x i8] c"w\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [5120 x i8]
%4 = getelementptr inbounds [5120 x i8], [5120 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i8*, i8** %12
%18 = tail call i32 @perror(i8* %17)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %11
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %32
25: ; preds = %20
%26 = load i8*, i8** %21
%27 = tail call i32 @perror(i8* %26)
%28 = tail call i32 @exit(i32 1)
unreachable
29: ; preds = %70
%30 = add nuw nsw i32 %33, 1
%31 = icmp eq i32 %30, 80
br i1 %31, label %77, label %32
32: ; preds = %20, %29
%33 = phi i32 [ %30, %29 ], [ 0, %20 ]
%34 = mul nuw nsw i32 %33, 5120
%35 = tail call i32 @fseek(i32* %14, i32 %34, i32 0)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i8*, i8** %12
%39 = tail call i32 @perror(i8* %38)
%40 = tail call i32 @exit(i32 1)
unreachable
41: ; preds = %32
%42 = call i32 @fread(i8* %4, i32 5120, i32 1, i32* %14)
%43 = icmp eq i32 %42, 1
br i1 %43, label %48, label %44
44: ; preds = %41
%45 = load i8*, i8** %12
%46 = tail call i32 @perror(i8* %45)
%47 = tail call i32 @exit(i32 1)
unreachable
48: ; preds = %41
%49 = call i32 @fwrite(i8* %4, i32 5120, i32 1, i32* %23)
%50 = icmp eq i32 %49, 1
br i1 %50, label %55, label %51
51: ; preds = %48
%52 = load i8*, i8** %21
%53 = tail call i32 @perror(i8* %52)
%54 = tail call i32 @exit(i32 1)
unreachable
55: ; preds = %48
%56 = add nuw nsw i32 %34, 409600
%57 = tail call i32 @fseek(i32* %14, i32 %56, i32 0)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %63
59: ; preds = %55
%60 = load i8*, i8** %12
%61 = tail call i32 @perror(i8* %60)
%62 = tail call i32 @exit(i32 1)
unreachable
63: ; preds = %55
%64 = call i32 @fread(i8* %4, i32 5120, i32 1, i32* %14)
%65 = icmp eq i32 %64, 1
br i1 %65, label %70, label %66
66: ; preds = %63
%67 = load i8*, i8** %12
%68 = tail call i32 @perror(i8* %67)
%69 = tail call i32 @exit(i32 1)
unreachable
70: ; preds = %63
%71 = call i32 @fwrite(i8* %4, i32 5120, i32 1, i32* %23)
%72 = icmp eq i32 %71, 1
br i1 %72, label %29, label %73
73: ; preds = %70
%74 = load i8*, i8** %21
%75 = tail call i32 @perror(i8* %74)
%76 = tail call i32 @exit(i32 1)
unreachable
77: ; preds = %29
%78 = tail call i64 @fclose(i32* %14)
%79 = icmp eq i64 %78, 0
br i1 %79, label %84, label %80
80: ; preds = %77
%81 = load i8*, i8** %12
%82 = tail call i32 @perror(i8* %81)
%83 = tail call i32 @exit(i32 1)
unreachable
84: ; preds = %77
%85 = tail call i64 @fclose(i32* %23)
%86 = icmp eq i64 %85, 0
br i1 %86, label %91, label %87
87: ; preds = %84
%88 = load i8*, i8** %21
%89 = tail call i32 @perror(i8* %88)
%90 = tail call i32 @exit(i32 1)
unreachable
91: ; preds = %84
%92 = tail call i32 @exit(i32 0)
unreachable
}