#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*/ chl_print_errors();
int /*<<< orphan*/ chl_print_headers();
int /*<<< orphan*/ chl_set_default_headers();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *file_read_data(char **, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ file_read_open(char *, int /*<<< orphan*/ **);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ parse_view(char **, char *);
void chl_view(char *view_path) {
  FILE *fd;
  char *buff_st = NULL, *buff = NULL;
  chl_set_default_headers();
  chl_print_headers();
  if (!file_read_open(view_path, &fd))
    goto print_error;
  if ((buff_st = file_read_data(&buff, view_path, fd)) == NULL)
    goto print_error;
  parse_view(&buff, view_path);
print_error:
  chl_print_errors();
  free(buff_st);
  if (fd != NULL)
    fclose(fd);
}


x86 assembly (clang, -O0):
<chl_view>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <chl_set_default_headers@plt>
mov    $0x0,%al
call   1040 <chl_print_headers@plt>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1080 <file_read_open@plt>
cmp    $0x0,%eax
jne    11c5 <chl_view+0x45>
jmp    11f6 <chl_view+0x76>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x20(%rbp),%rdi
call   10a0 <file_read_data@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11e9 <chl_view+0x69>
jmp    11f6 <chl_view+0x76>
mov    -0x8(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1070 <parse_view@plt>
mov    $0x0,%al
call   1090 <chl_print_errors@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     121a <chl_view+0x9a>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chl_view>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movq   $0x0,0x8(%rsp)
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <chl_set_default_headers@plt>
xor    %eax,%eax
call   1040 <chl_print_headers@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1080 <file_read_open@plt>
test   %eax,%eax
je     11df <chl_view+0x5f>
mov    0x10(%rsp),%rdx
lea    0x8(%rsp),%rdi
mov    %r14,%rsi
call   10a0 <file_read_data@plt>
test   %rax,%rax
je     11dd <chl_view+0x5d>
mov    %rax,%rbx
lea    0x8(%rsp),%rdi
mov    %r14,%rsi
call   1070 <parse_view@plt>
jmp    11df <chl_view+0x5f>
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <chl_print_errors@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     11fd <chl_view+0x7d>
call   1060 <fclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @chl_view(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %4
store i8* null, i8** %5
%6 = call i32 (...) @chl_set_default_headers()
%7 = call i32 (...) @chl_print_headers()
%8 = load i8*, i8** %2
%9 = call i32 @file_read_open(i8* %8, i32** %3)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %1
br label %21
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = load i32*, i32** %3
%15 = call i8* @file_read_data(i8** %5, i8* %13, i32* %14)
store i8* %15, i8** %4
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %12
br label %21
18: ; preds = %12
%19 = load i8*, i8** %2
%20 = call i32 @parse_view(i8** %5, i8* %19)
br label %21
21: ; preds = %18, %17, %11
%22 = call i32 (...) @chl_print_errors()
%23 = load i8*, i8** %4
%24 = call i32 @free(i8* %23)
%25 = load i32*, i32** %3
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %30
27: ; preds = %21
%28 = load i32*, i32** %3
%29 = call i32 @fclose(i32* %28)
br label %30
30: ; preds = %27, %21
ret void
}

LLVM IR (-O2):
define void @chl_view(i8* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = bitcast i32** %2 to i8*
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = tail call i32 (...) @chl_set_default_headers()
%7 = tail call i32 (...) @chl_print_headers()
%8 = call i32 @file_read_open(i8* %0, i32** %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %1
%11 = load i32*, i32** %2
%12 = call i8* @file_read_data(i8** %3, i8* %0, i32* %11)
%13 = icmp eq i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 @parse_view(i8** %3, i8* %0)
br label %16
16: ; preds = %10, %1, %14
%17 = phi i8* [ null, %10 ], [ %12, %14 ], [ null, %1 ]
%18 = call i32 (...) @chl_print_errors()
%19 = call i32 @free(i8* %17)
%20 = load i32*, i32** %2
%21 = icmp eq i32* %20, null
br i1 %21, label %24, label %22
22: ; preds = %16
%23 = call i32 @fclose(i32* %20)
br label %24
24: ; preds = %22, %16
ret void
}