#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_input_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ transform_data(char const *);
int main(int argc, char const *argv[]) {
  FILE *input_file;
  if (argc < 3) {
    printf("Proper usage is ./Transform [source-filename] "
           "[destination-filename]\n");
    return 0;
  }
  input_file = fopen(argv[1], "rb");
  if (input_file == NULL) {
    printf("Error in opening the input file\n");
    return 0;
  }
  read_input_file(input_file);
  transform_data(argv[2]);
  fclose(input_file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1188 <main+0x38>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e9 <main+0x99>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeaf(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c3 <main+0x73>
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e9 <main+0x99>
mov    -0x18(%rbp),%rdi
call   1060 <read_input_file@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <transform_data@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jg     1162 <main+0x12>
lea    0xec3(%rip),%rdi
jmp    119f <main+0x4f>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe90(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1198 <main+0x48>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <read_input_file@plt>
mov    0x10(%r14),%rdi
call   1050 <transform_data@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    11a4 <main+0x54>
lea    0xe64(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [70 x i8] c"Proper usage is ./Transform [source-filename] [destination-filename]\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [33 x i8] c"Error in opening the input file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %29
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %29
20: ; preds = %11
%21 = load i32*, i32** %6
%22 = call i32 @read_input_file(i32* %21)
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @transform_data(i8* %25)
%27 = load i32*, i32** %6
%28 = call i32 @fclose(i32* %27)
store i32 0, i32* %3
br label %29
29: ; preds = %20, %18, %9
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"rb\00"
@str = [32 x i8] c"Error in opening the input file\00"
@str.3 = [69 x i8] c"Proper usage is ./Transform [source-filename] [destination-filename]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str.3, i64 0, i64 0))
br label %19
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %19
13: ; preds = %6
%14 = tail call i32 @read_input_file(i32* %9)
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @transform_data(i8* %16)
%18 = tail call i32 @fclose(i32* %9)
br label %19
19: ; preds = %13, %11, %4
ret i32 0
}