#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 */

/* Variables and functions */
int /*<<< orphan*/ check_atts(int);
int /*<<< orphan*/ check_dims(int);
int /*<<< orphan*/ check_vars(int);
int /*<<< orphan*/ error(char *, int /*<<< orphan*/);
scalar_t__ ifFail(int, int, char *);
int nc_close(int);
int nc_open(char *, int /*<<< orphan*/, int *);
int /*<<< orphan*/ nc_strerror(int);
void check_file(char *filename) {
  int ncid;
  int err;
  err = nc_open(filename, 0, &ncid);
  if (ifFail(err, 847,
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/borismarin/genesis2.4gamma/refs/heads/"
             "master/genesis/src/diskio/interface/netcdf/netcdf-3.4/src/"
             "nc_test/util.c")) {
    error("nc_open: %s", nc_strerror(err));
  } else {
    check_dims(ncid);
    check_vars(ncid);
    check_atts(ncid);
    err = nc_close(ncid);
    if (ifFail(err, 854,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/borismarin/genesis2.4gamma/"
               "refs/heads/master/genesis/src/diskio/interface/netcdf/"
               "netcdf-3.4/src/nc_test/util.c"))
      error("nc_close: %s", nc_strerror(err));
  }
}


x86 assembly (clang, -O0):
<check_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    -0xc(%rbp),%rdx
call   1090 <nc_open@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x34f,%esi
lea    0xe53(%rip),%rdx
call   1050 <ifFail@plt>
cmp    $0x0,%rax
je     11d7 <check_file+0x57>
mov    -0x10(%rbp),%edi
call   10a0 <nc_strerror@plt>
mov    %eax,%esi
lea    0xefc(%rip),%rdi
call   1080 <error@plt>
jmp    1233 <check_file+0xb3>
mov    -0xc(%rbp),%edi
call   1070 <check_dims@plt>
mov    -0xc(%rbp),%edi
call   1060 <check_vars@plt>
mov    -0xc(%rbp),%edi
call   1040 <check_atts@plt>
mov    -0xc(%rbp),%edi
call   1030 <nc_close@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x356,%esi
lea    0xdf7(%rip),%rdx
call   1050 <ifFail@plt>
cmp    $0x0,%rax
je     122e <check_file+0xae>
mov    -0x10(%rbp),%edi
call   10a0 <nc_strerror@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1080 <error@plt>
jmp    1233 <check_file+0xb3>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_file>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rdx
xor    %esi,%esi
call   1090 <nc_open@plt>
mov    %eax,%ebx
lea    0xe67(%rip),%rdx
mov    %eax,%edi
mov    $0x34f,%esi
call   1050 <ifFail@plt>
test   %rax,%rax
je     11b3 <check_file+0x33>
lea    0xf18(%rip),%r14
jmp    11f8 <check_file+0x78>
mov    0x4(%rsp),%edi
call   1070 <check_dims@plt>
mov    0x4(%rsp),%edi
call   1060 <check_vars@plt>
mov    0x4(%rsp),%edi
call   1040 <check_atts@plt>
mov    0x4(%rsp),%edi
call   1030 <nc_close@plt>
mov    %eax,%ebx
lea    0xe20(%rip),%rdx
mov    %eax,%edi
mov    $0x356,%esi
call   1050 <ifFail@plt>
test   %rax,%rax
je     1209 <check_file+0x89>
lea    0xedd(%rip),%r14
mov    %ebx,%edi
call   10a0 <nc_strerror@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1080 <error@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/borismarin/genesis2.4gamma/refs/heads/master/genesis/src/diskio/interface/netcdf/netcdf-3.4/src/nc_test/util.c\00"
@.str.1 = [12 x i8] c"nc_open: %s\00"
@.str.2 = [13 x i8] c"nc_close: %s\00"
define void @check_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @nc_open(i8* %5, i32 0, i32* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i64 @ifFail(i32 %7, i32 847, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 @nc_strerror(i32 %11)
%13 = call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %31
14: ; preds = %1
%15 = load i32, i32* %3
%16 = call i32 @check_dims(i32 %15)
%17 = load i32, i32* %3
%18 = call i32 @check_vars(i32 %17)
%19 = load i32, i32* %3
%20 = call i32 @check_atts(i32 %19)
%21 = load i32, i32* %3
%22 = call i32 @nc_close(i32 %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = call i64 @ifFail(i32 %23, i32 854, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0))
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %14
%27 = load i32, i32* %4
%28 = call i32 @nc_strerror(i32 %27)
%29 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %26, %14
br label %31
31: ; preds = %30, %10
ret void
}

LLVM IR (-O2):
@.str = [201 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/borismarin/genesis2.4gamma/refs/heads/master/genesis/src/diskio/interface/netcdf/netcdf-3.4/src/nc_test/util.c\00"
@.str.1 = [12 x i8] c"nc_open: %s\00"
@.str.2 = [13 x i8] c"nc_close: %s\00"
define void @check_file(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @nc_open(i8* %0, i32 0, i32* %2)
%5 = call i64 @ifFail(i32 %4, i32 847, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @check_dims(i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @check_vars(i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @check_atts(i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @nc_close(i32 %14)
%16 = call i64 @ifFail(i32 %15, i32 854, i8* getelementptr inbounds ([201 x i8], [201 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %7, %1
%19 = phi i32 [ %4, %1 ], [ %15, %7 ]
%20 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %7 ]
%21 = call i32 @nc_strerror(i32 %19)
%22 = call i32 @error(i8* %20, i32 %21)
br label %23
23: ; preds = %18, %7
ret void
}