#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*/ reverse_transform_data(int /*<<< orphan*/ *, char const *,
                                          char const *);
int main(int argc, char const *argv[]) {
  FILE *input_file;
  if (argc < 4) {
    printf("Proper usage is ./ReverseTransform [source-filename] "
           "[destination-filename] [status-filename]\n");
    return 0;
  }
  input_file = fopen(argv[1], "rb");
  if (input_file == NULL) {
    printf("Error in opening the input file\n");
    return 0;
  }
  reverse_transform_data(input_file, argv[2], argv[3]);
  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   $0x4,-0x8(%rbp)
jge    1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11dc <main+0x9c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xed8(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b3 <main+0x73>
lea    0xec0(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11dc <main+0x9c>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
call   1030 <reverse_transform_data@plt>
mov    -0x18(%rbp),%rdi
call   1040 <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    $0x3,%edi
jg     1152 <main+0x12>
lea    0xed3(%rip),%rdi
jmp    118e <main+0x4e>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xea0(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1187 <main+0x47>
mov    %rax,%r14
mov    0x10(%rbx),%rsi
mov    0x18(%rbx),%rdx
mov    %rax,%rdi
call   1040 <reverse_transform_data@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
jmp    1193 <main+0x53>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [95 x i8] c"Proper usage is ./ReverseTransform [source-filename] [destination-filename] [status-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, 4
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %31
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 %31
20: ; preds = %11
%21 = load i32*, i32** %6
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 3
%27 = load i8*, i8** %26
%28 = call i32 @reverse_transform_data(i32* %21, i8* %24, i8* %27)
%29 = load i32*, i32** %6
%30 = call i32 @fclose(i32* %29)
store i32 0, i32* %3
br label %31
31: ; preds = %20, %18, %9
%32 = load i32, i32* %3
ret i32 %32
}

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 = [94 x i8] c"Proper usage is ./ReverseTransform [source-filename] [destination-filename] [status-filename]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @str.3, i64 0, i64 0))
br label %20
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 %20
13: ; preds = %6
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @reverse_transform_data(i32* %9, i8* %15, i8* %17)
%19 = tail call i32 @fclose(i32* %9)
br label %20
20: ; preds = %13, %11, %4
ret i32 0
}