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


x86 assembly (clang, -O0):
<chl_import>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <file_read_open@plt>
cmp    $0x0,%eax
jne    1197 <chl_import+0x37>
jmp    11c8 <chl_import+0x68>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x20(%rbp),%rdi
call   1080 <file_read_data@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11bb <chl_import+0x5b>
jmp    11c8 <chl_import+0x68>
mov    -0x8(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <parse_view@plt>
mov    $0x0,%al
call   1070 <chl_print_errors@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     11ec <chl_import+0x8c>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chl_import>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rsi
call   1060 <file_read_open@plt>
test   %eax,%eax
je     11aa <chl_import+0x4a>
mov    0x10(%rsp),%rdx
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1080 <file_read_data@plt>
test   %rax,%rax
je     11aa <chl_import+0x4a>
mov    %rax,%r14
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <parse_view@plt>
jmp    11ad <chl_import+0x4d>
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <chl_print_errors@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     11cb <chl_import+0x6b>
call   1040 <fclose@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @chl_import(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 = call i32 @file_read_open(i8* %0, i32** %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %1
%9 = load i32*, i32** %2
%10 = call i8* @file_read_data(i8** %3, i8* %0, i32* %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @parse_view(i8** %3, i8* %0)
br label %14
14: ; preds = %8, %1, %12
%15 = phi i8* [ null, %8 ], [ %10, %12 ], [ null, %1 ]
%16 = call i32 (...) @chl_print_errors()
%17 = call i32 @free(i8* %15)
%18 = load i32*, i32** %2
%19 = icmp eq i32* %18, null
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = call i32 @fclose(i32* %18)
br label %22
22: ; preds = %20, %14
ret void
}