#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ usage(char *);
main(int ac, char *av[]) {
  FILE *fi, *fo;
  char buf[2888];
  int n;
  if (ac != 3)
    usage(av[0]);
  fi = fopen(av[1], "r");
  if (fi == NULL) {
    printf("Cannot open File %s for input\n", av[1]);
    exit(-1);
  }
  fo = fopen(av[2], "w");
  if (fo == NULL) {
    printf("Cannot open File %s for input\n", av[2]);
    exit(-1);
  }
  n = 0;
  while (fread(buf, 1, 2888, fi) == 2888) {
    n++;
    if (fwrite(&buf[4], 1, 2880, fo) != 2880) {
      perror("Error during write");
      exit(-1);
    }
  }
  printf("%s: converted %d blocks\n", av[1], n);
  fclose(fi);
  fclose(fo);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11af <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe42(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe20(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1235 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
movl   $0x0,-0xb74(%rbp)
lea    -0xb70(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0xb48,%edx
call   1030 <fread@plt>
cmp    $0xb48,%eax
jne    12b7 <main+0x137>
mov    -0xb74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb74(%rbp)
lea    -0xb70(%rbp),%rdi
add    $0x4,%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0xb40,%edx
call   10a0 <fwrite@plt>
cmp    $0xb40,%eax
je     12b2 <main+0x132>
lea    0xd80(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
jmp    123f <main+0xbf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0xb74(%rbp),%edx
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb48,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
je     11a1 <main+0x21>
mov    (%r14),%rdi
call   1060 <usage@plt>
mov    0x8(%r14),%rdi
lea    0xe54(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    11bc <main+0x3c>
mov    0x8(%r14),%rsi
jmp    11d8 <main+0x58>
mov    %rax,%r15
mov    0x10(%r14),%rdi
lea    0xe57(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    11f0 <main+0x70>
mov    0x10(%r14),%rsi
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
lea    0x4(%rsp),%r12
mov    %rsp,%r13
nopl   (%rax)
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0xb48,%edx
mov    %r15,%rcx
call   1030 <fread@plt>
cmp    $0xb48,%eax
jne    1251 <main+0xd1>
add    $0x1,%ebp
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0xb40,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
cmp    $0xb40,%eax
je     1200 <main+0x80>
lea    0xde1(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    0x8(%r14),%rsi
lea    0xdda(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [31 x i8] c"Cannot open File %s for input\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [19 x i8] c"Error during write\00"
@.str.4 = [25 x i8] c"%s: converted %d blocks\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 [2888 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 %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @usage(i8* %15)
br label %17
17: ; preds = %12, %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %21, i32** %6
%22 = load i32*, i32** %6
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %30
24: ; preds = %17
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 -1)
unreachable
30: ; preds = %17
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %34, i32** %7
%35 = load i32*, i32** %7
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %43
37: ; preds = %30
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %40)
%42 = call i32 @exit(i32 -1)
unreachable
43: ; preds = %30
store i32 0, i32* %9
br label %44
44: ; preds = %59, %43
%45 = getelementptr inbounds [2888 x i8], [2888 x i8]* %8, i64 0, i64 0
%46 = load i32*, i32** %6
%47 = call i32 @fread(i8* %45, i32 1, i32 2888, i32* %46)
%48 = icmp eq i32 %47, 2888
br i1 %48, label %49, label %60
49: ; preds = %44
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
store i32 %51, i32* %9
%52 = getelementptr inbounds [2888 x i8], [2888 x i8]* %8, i64 0, i64 4
%53 = load i32*, i32** %7
%54 = call i32 @fwrite(i8* %52, i32 1, i32 2880, i32* %53)
%55 = icmp ne i32 %54, 2880
br i1 %55, label %56, label %59
56: ; preds = %49
%57 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @exit(i32 -1)
unreachable
59: ; preds = %49
br label %44
60: ; preds = %44
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = load i32, i32* %9
%65 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %63, i32 %64)
%66 = load i32*, i32** %6
%67 = call i32 @fclose(i32* %66)
%68 = load i32*, i32** %7
%69 = call i32 @fclose(i32* %68)
%70 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [31 x i8] c"Cannot open File %s for input\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [19 x i8] c"Error during write\00"
@.str.4 = [25 x i8] c"%s: converted %d blocks\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2888 x i8]
%4 = getelementptr inbounds [2888 x i8], [2888 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @usage(i8* %7)
br label %9
9: ; preds = %6, %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i8*, i8** %10
%16 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = tail call i32 @exit(i32 -1)
unreachable
18: ; preds = %9
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %25, label %23
23: ; preds = %18
%24 = getelementptr inbounds [2888 x i8], [2888 x i8]* %3, i64 0, i64 4
br label %29
25: ; preds = %18
%26 = load i8*, i8** %19
%27 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = tail call i32 @exit(i32 -1)
unreachable
29: ; preds = %23, %33
%30 = phi i32 [ %34, %33 ], [ 0, %23 ]
%31 = call i32 @fread(i8* %4, i32 1, i32 2888, i32* %12)
%32 = icmp eq i32 %31, 2888
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = add nuw nsw i32 %30, 1
%35 = call i32 @fwrite(i8* %24, i32 1, i32 2880, i32* %21)
%36 = icmp eq i32 %35, 2880
br i1 %36, label %29, label %37
37: ; preds = %33
%38 = tail call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%39 = tail call i32 @exit(i32 -1)
unreachable
40: ; preds = %29
%41 = load i8*, i8** %10
%42 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %41, i32 %30)
%43 = tail call i32 @fclose(i32* %12)
%44 = tail call i32 @fclose(i32* %21)
%45 = tail call i32 @exit(i32 0)
unreachable
}