#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*/ O_RDWR;
int close(int);
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
char File_Read(char *Address, char *Content, int Content_Length) {
  int File = open(Address, O_RDWR);
  if (File == -1) {
    return 'X';
  }
  if (read(File, Content, Content_Length) == -1) {
    close(File);
    return 'X';
  }
  if (close(File) == -1) {
    return 'X';
  }
  return 'V';
}


x86 assembly (clang, -O0):
<File_Read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    116b <File_Read+0x3b>
movb   $0x58,-0x1(%rbp)
jmp    11b2 <File_Read+0x82>
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <read@plt>
cmp    $0xffffffff,%eax
jne    1194 <File_Read+0x64>
mov    -0x20(%rbp),%edi
call   1030 <close@plt>
movb   $0x58,-0x1(%rbp)
jmp    11b2 <File_Read+0x82>
mov    -0x20(%rbp),%edi
call   1030 <close@plt>
cmp    $0xffffffff,%eax
jne    11ae <File_Read+0x7e>
movb   $0x58,-0x1(%rbp)
jmp    11b2 <File_Read+0x82>
movb   $0x56,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<File_Read>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%r15
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    $0x58,%bl
cmp    $0xffffffff,%eax
je     117c <File_Read+0x4c>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r15,%rsi
mov    %r14d,%edx
call   1040 <read@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1030 <close@plt>
cmp    $0xffffffff,%r14d
je     117c <File_Read+0x4c>
cmp    $0xffffffff,%eax
sete   %bl
add    %bl,%bl
add    $0x56,%bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
define signext i8 @File_Read(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = load i32, i32* @O_RDWR
%11 = call i32 @open(i8* %9, i32 %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %3
store i8 88, i8* %4
br label %30
15: ; preds = %3
%16 = load i32, i32* %8
%17 = load i8*, i8** %6
%18 = load i32, i32* %7
%19 = call i32 @read(i32 %16, i8* %17, i32 %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i32, i32* %8
%23 = call i32 @close(i32 %22)
store i8 88, i8* %4
br label %30
24: ; preds = %15
%25 = load i32, i32* %8
%26 = call i32 @close(i32 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %29
28: ; preds = %24
store i8 88, i8* %4
br label %30
29: ; preds = %24
store i8 86, i8* %4
br label %30
30: ; preds = %29, %28, %21, %14
%31 = load i8, i8* %4
ret i8 %31
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define signext i8 @File_Read(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = load i32, i32* @O_RDWR
%5 = tail call i32 @open(i8* %0, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %14, label %7
7: ; preds = %3
%8 = tail call i32 @read(i32 %5, i8* %1, i32 %2)
%9 = icmp eq i32 %8, -1
%10 = tail call i32 @close(i32 %5)
br i1 %9, label %14, label %11
11: ; preds = %7
%12 = icmp eq i32 %10, -1
%13 = select i1 %12, i8 88, i8 86
br label %14
14: ; preds = %7, %11, %3
%15 = phi i8 [ 88, %3 ], [ %13, %11 ], [ 88, %7 ]
ret i8 %15
}