#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 */
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
bool FileIsEmptyOrNotExist(const char *Path) {
  bool judge = false;
  FILE *fp = fopen(Path, "r");
  if (fp == NULL)
    return true;
  if (fgetc(fp) == EOF)
    judge = true;
  fclose(fp);
  return judge;
}


x86 assembly (clang, -O0):
<FileIsEmptyOrNotExist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116e <FileIsEmptyOrNotExist+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    119d <FileIsEmptyOrNotExist+0x6d>
mov    -0x20(%rbp),%rdi
call   1040 <fgetc@plt>
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%rax
jne    118e <FileIsEmptyOrNotExist+0x5e>
movl   $0x1,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FileIsEmptyOrNotExist>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1169 <FileIsEmptyOrNotExist+0x39>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <fgetc@plt>
mov    0x2e92(%rip),%rcx
xor    %ebp,%ebp
cmp    (%rcx),%rax
sete   %bpl
mov    %rbx,%rdi
call   1030 <fclose@plt>
jmp    116e <FileIsEmptyOrNotExist+0x3e>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i64 0
define i32 @FileIsEmptyOrNotExist(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = tail call i64 @fgetc(i32* %2)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @fclose(i32* %2)
br label %10
10: ; preds = %1, %4
%11 = phi i32 [ %8, %4 ], [ 1, %1 ]
ret i32 %11
}