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

/* Variables and functions */
int /*<<< orphan*/ ReadBinaryTxt();
int checkBinary(char **, int);
int /*<<< orphan*/ printf(char *);
int readFile();
int writeToFile(char **, int);
int main(int argc, char *argv[]) {
  int result = 1;
  printf("I will perform binary hex conversion\n");
  result = checkBinary(argv, argc);
  if (result == 0) {
    return 0;
  }
  result = writeToFile(argv, argc);
  if (result == 0) {
    return 0;
  }
  ReadBinaryTxt();
  result = readFile();
  if (result == 0) {
    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)
movl   $0x1,-0x14(%rbp)
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <checkBinary@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    119e <main+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    11e5 <main+0x95>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <writeToFile@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11c3 <main+0x73>
movl   $0x0,-0x4(%rbp)
jmp    11e5 <main+0x95>
mov    $0x0,%al
call   1060 <ReadBinaryTxt@plt>
mov    $0x0,%al
call   1070 <readFile@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11e5 <main+0x95>
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
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <checkBinary@plt>
test   %eax,%eax
je     118f <main+0x3f>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <writeToFile@plt>
test   %eax,%eax
je     118f <main+0x3f>
xor    %eax,%eax
call   1060 <ReadBinaryTxt@plt>
xor    %eax,%eax
call   1070 <readFile@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [38 x i8] c"I will perform binary hex conversion\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
store i32 1, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%8 = load i8**, i8*** %5
%9 = load i32, i32* %4
%10 = call i32 @checkBinary(i8** %8, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %27
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = load i32, i32* %4
%17 = call i32 @writeToFile(i8** %15, i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 0, i32* %3
br label %27
21: ; preds = %14
%22 = call i32 (...) @ReadBinaryTxt()
%23 = call i32 (...) @readFile()
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 0, i32* %3
br label %27
27: ; preds = %13, %20, %26, %21
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@str = [37 x i8] c"I will perform binary hex conversion\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @checkBinary(i8** %1, i32 %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = tail call i32 @writeToFile(i8** %1, i32 %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 (...) @ReadBinaryTxt()
%11 = tail call i32 (...) @readFile()
br label %12
12: ; preds = %9, %6, %2
ret i32 0
}