#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*/ printf(char *);
scalar_t__ test_file_read();
scalar_t__ test_file_write();
scalar_t__ test_path_check();
int main() {
  printf("----------------------------------------------------------\n");
  if (test_path_check()) {
    printf("----------------------------------------------------------\n");
    printf("eslib_file_path_check: fail\n");
    printf("----------------------------------------------------------\n");
    return -1;
  }
  printf("----------------------------------------------------------\n");
  printf("eslib_file_path_check: passed\n");
  printf("----------------------------------------------------------\n");
  if (test_file_read()) {
    printf("----------------------------------------------------------\n");
    printf("test_file_read: failed\n");
    printf("----------------------------------------------------------\n");
    return -1;
  }
  printf("----------------------------------------------------------\n");
  printf("test_file_read: passed\n");
  printf("----------------------------------------------------------\n");
  if (test_file_write()) {
    printf("----------------------------------------------------------\n");
    printf("test_file_write: failed\n");
    printf("----------------------------------------------------------\n");
    return -1;
  }
  printf("----------------------------------------------------------\n");
  printf("test_file_write: passed\n");
  printf("----------------------------------------------------------\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <test_path_check@plt>
cmp    $0x0,%rax
je     119c <main+0x5c>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1291 <main+0x151>
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <test_file_read@plt>
cmp    $0x0,%rax
je     1201 <main+0xc1>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1291 <main+0x151>
lea    0xdf8(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
lea    0xde0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <test_file_write@plt>
cmp    $0x0,%rax
je     1266 <main+0x126>
lea    0xdc3(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
lea    0xdab(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1291 <main+0x151>
lea    0xd93(%rip),%rdi
call   1030 <printf@plt>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
lea    0xd7b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xf4d(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <test_path_check@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
je     1171 <main+0x31>
lea    0xf10(%rip),%rbp
jmp    11f2 <main+0xb2>
lea    0xf20(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <test_file_read@plt>
test   %rax,%rax
je     11a9 <main+0x69>
lea    0xebe(%rip),%rbp
jmp    11f2 <main+0xb2>
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <test_file_write@plt>
xor    %r14d,%r14d
test   %rax,%rax
setne  %r14b
lea    0xe51(%rip),%rax
lea    0xe62(%rip),%rbp
cmove  %rax,%rbp
neg    %r14d
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [60 x i8] c"----------------------------------------------------------\0A\00"
@.str.1 = [29 x i8] c"eslib_file_path_check: fail\0A\00"
@.str.2 = [31 x i8] c"eslib_file_path_check: passed\0A\00"
@.str.3 = [24 x i8] c"test_file_read: failed\0A\00"
@.str.4 = [24 x i8] c"test_file_read: passed\0A\00"
@.str.5 = [25 x i8] c"test_file_write: failed\0A\00"
@.str.6 = [25 x i8] c"test_file_write: passed\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%3 = call i64 (...) @test_path_check()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %33
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%13 = call i64 (...) @test_file_read()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %33
19: ; preds = %9
%20 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%23 = call i64 (...) @test_file_write()
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %19
%26 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %33
29: ; preds = %19
%30 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %33
33: ; preds = %29, %25, %15, %5
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@str.8 = [30 x i8] c"eslib_file_path_check: passed\00"
@str.11 = [23 x i8] c"test_file_read: passed\00"
@str.14 = [24 x i8] c"test_file_write: passed\00"
@str.17 = [24 x i8] c"test_file_write: failed\00"
@str.20 = [23 x i8] c"test_file_read: failed\00"
@str.23 = [28 x i8] c"eslib_file_path_check: fail\00"
@str.24 = [59 x i8] c"----------------------------------------------------------\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0))
%2 = tail call i64 (...) @test_path_check()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %21
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.8, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0))
%8 = tail call i64 (...) @test_file_read()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %4
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0))
%14 = tail call i64 (...) @test_file_write()
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0)
%17 = select i1 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.17, i64 0, i64 0)
%18 = select i1 %15, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0)
%19 = xor i1 %15, true
%20 = sext i1 %19 to i32
br label %21
21: ; preds = %10, %4, %0
%22 = phi i8* [ getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0), %0 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0), %4 ], [ %16, %10 ]
%23 = phi i8* [ getelementptr inbounds ([28 x i8], [28 x i8]* @str.23, i64 0, i64 0), %0 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.20, i64 0, i64 0), %4 ], [ %17, %10 ]
%24 = phi i8* [ getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0), %0 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @str.24, i64 0, i64 0), %4 ], [ %18, %10 ]
%25 = phi i32 [ -1, %0 ], [ -1, %4 ], [ %20, %10 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) %22)
%27 = tail call i32 @puts(i8* dereferenceable(1) %23)
%28 = tail call i32 @puts(i8* dereferenceable(1) %24)
ret i32 %25
}