#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*/ *fopen(char *, char *);
int /*<<< orphan*/ perror(char *);
int open_files(FILE **fat_file, char *fat_path, FILE **data_file,
               char *data_path) {
  if (!(*fat_file = fopen(fat_path, "rb"))) {
    perror(fat_path);
    return 0;
  }
  if (!(*data_file = fopen(data_path, "rb"))) {
    perror(data_path);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<open_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <fopen@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    116e <open_files+0x4e>
mov    -0x18(%rbp),%rdi
call   1040 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ab <open_files+0x8b>
mov    -0x28(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1030 <fopen@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    11a4 <open_files+0x84>
mov    -0x28(%rbp),%rdi
call   1040 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ab <open_files+0x8b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_files>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r12
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fopen@plt>
mov    %rax,(%r12)
test   %rax,%rax
je     117a <open_files+0x5a>
lea    0xead(%rip),%rsi
mov    %r15,%rdi
call   1030 <fopen@plt>
mov    %rax,%rcx
mov    %rax,(%r14)
mov    $0x1,%eax
mov    %r15,%rbx
test   %rcx,%rcx
je     117a <open_files+0x5a>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rbx,%rdi
call   1040 <perror@plt>
xor    %eax,%eax
jmp    116e <open_files+0x4e>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define i32 @open_files(i32** %0, i8* %1, i32** %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32**
%7 = alloca i8*
%8 = alloca i32**
%9 = alloca i8*
store i32** %0, i32*** %6
store i8* %1, i8** %7
store i32** %2, i32*** %8
store i8* %3, i8** %9
%10 = load i8*, i8** %7
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = load i32**, i32*** %6
store i32* %11, i32** %12
%13 = icmp ne i32* %11, null
br i1 %13, label %17, label %14
14: ; preds = %4
%15 = load i8*, i8** %7
%16 = call i32 @perror(i8* %15)
store i32 0, i32* %5
br label %26
17: ; preds = %4
%18 = load i8*, i8** %9
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%20 = load i32**, i32*** %8
store i32* %19, i32** %20
%21 = icmp ne i32* %19, null
br i1 %21, label %25, label %22
22: ; preds = %17
%23 = load i8*, i8** %9
%24 = call i32 @perror(i8* %23)
store i32 0, i32* %5
br label %26
25: ; preds = %17
store i32 1, i32* %5
br label %26
26: ; preds = %25, %22, %14
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define i32 @open_files(i32** nocapture writeonly %0, i8* nocapture %1, i32** nocapture writeonly %2, i8* nocapture %3) {
%5 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %0
%6 = icmp eq i32* %5, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %2
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7, %4
%11 = phi i8* [ %1, %4 ], [ %3, %7 ]
%12 = tail call i32 @perror(i8* %11)
br label %13
13: ; preds = %10, %7
%14 = phi i32 [ 1, %7 ], [ 0, %10 ]
ret i32 %14
}