#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 *, char *);
int /*<<< orphan*/ perror(char *);
bool isFiles(char *a, char *b) {
  FILE *inputA;
  FILE *inputB;
  bool sol = true;
  inputA = fopen(a, "r");
  if (inputA == NULL) {
    perror("Error opening file in argv[1]");
    sol = false;
  } else {
    fclose(inputA);
  }
  inputB = fopen(b, "r");
  if (inputB == NULL) {
    perror("Error opening file in argv[2]");
    sol = false;
  } else {
    fclose(inputB);
  }
  return sol;
}


x86 assembly (clang, -O0):
<isFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117e <isFiles+0x4e>
lea    0xe95(%rip),%rdi
call   1050 <perror@plt>
movl   $0x0,-0x24(%rbp)
jmp    1187 <isFiles+0x57>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11be <isFiles+0x8e>
lea    0xe73(%rip),%rdi
call   1050 <perror@plt>
movl   $0x0,-0x24(%rbp)
jmp    11c7 <isFiles+0x97>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isFiles>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
lea    0xec3(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1179 <isFiles+0x49>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%ebp
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fopen@plt>
test   %rax,%rax
je     1189 <isFiles+0x59>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe82(%rip),%rdi
call   1050 <perror@plt>
xor    %ebp,%ebp
jmp    1154 <isFiles+0x24>
lea    0xe90(%rip),%rdi
call   1050 <perror@plt>
xor    %ebp,%ebp
jmp    1170 <isFiles+0x40>

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [30 x i8] c"Error opening file in argv[1]\00"
@.str.2 = [30 x i8] c"Error opening file in argv[2]\00"
define i32 @isFiles(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 @fclose(i32* %3)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 0, %5 ], [ 1, %7 ]
%11 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %17
15: ; preds = %9
%16 = tail call i32 @fclose(i32* %11)
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ 0, %13 ], [ %10, %15 ]
ret i32 %18
}