void test_open_test_dtree(void) {
  _test_start(__func__,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/master/test/"
              "dtree_open_test.c",
              52);
  int err = dtree_open("device-tree");
  if (((err) != 0) != 0) {
    _test_fail(__func__,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/"
               "master/test/dtree_open_test.c",
               54, ((("Can not open testing device-tree"))));
    return;
  };
  if ((dtree_iserror()) != 0) {
    _test_warn(__func__,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/"
               "master/test/dtree_open_test.c",
               55, (("Error state is set, but should not be")));
  };
  dtree_close();
  _test_end(__func__);
}


x86 assembly (clang, -O0):
<test_open_test_dtree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x34,%edx
mov    $0x0,%al
call   1060 <_test_start@plt>
lea    0xf20(%rip),%rdi
mov    $0x0,%al
call   1090 <dtree_open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
je     11de <test_open_test_dtree+0x6e>
lea    0xe41(%rip),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x36,%edx
lea    0xed2(%rip),%rcx
mov    $0x0,%al
call   1040 <_test_fail@plt>
jmp    1224 <test_open_test_dtree+0xb4>
mov    $0x0,%al
call   1070 <dtree_iserror@plt>
cmp    $0x0,%eax
je     120f <test_open_test_dtree+0x9f>
lea    0xe0b(%rip),%rdi
lea    0xe19(%rip),%rsi
mov    $0x37,%edx
lea    0xebd(%rip),%rcx
mov    $0x0,%al
call   1080 <_test_warn@plt>
mov    $0x0,%al
call   1050 <dtree_close@plt>
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <_test_end@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_open_test_dtree>:
push   %rax
lea    0xe88(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x34,%edx
xor    %eax,%eax
call   1060 <_test_start@plt>
lea    0xf27(%rip),%rdi
xor    %eax,%eax
call   1090 <dtree_open@plt>
test   %eax,%eax
je     11c0 <test_open_test_dtree+0x50>
lea    0xe5c(%rip),%rdi
lea    0xe6a(%rip),%rsi
lea    0xef2(%rip),%rcx
mov    $0x36,%edx
xor    %eax,%eax
pop    %r8
jmp    1040 <_test_fail@plt>
xor    %eax,%eax
call   1070 <dtree_iserror@plt>
test   %eax,%eax
je     11ec <test_open_test_dtree+0x7c>
lea    0xe2e(%rip),%rdi
lea    0xe3c(%rip),%rsi
lea    0xee5(%rip),%rcx
mov    $0x37,%edx
xor    %eax,%eax
call   1080 <_test_warn@plt>
xor    %eax,%eax
call   1050 <dtree_close@plt>
lea    0xe06(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <_test_end@plt>

LLVM IR (-O0):
@__func__.test_open_test_dtree = [21 x i8] c"test_open_test_dtree\00"
@.str = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/master/test/dtree_open_test.c\00"
@.str.1 = [12 x i8] c"device-tree\00"
@.str.2 = [33 x i8] c"Can not open testing device-tree\00"
@.str.3 = [38 x i8] c"Error state is set, but should not be\00"
define void @test_open_test_dtree() {
%1 = alloca i32
%2 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @_test_start to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 52)
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @dtree_open to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @_test_fail to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 54, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %18
10: ; preds = %0
%11 = call i32 (...) @dtree_iserror()
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @_test_warn to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = call i32 (...) @dtree_close()
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @_test_end to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0))
br label %18
18: ; preds = %15, %8
ret void
}

LLVM IR (-O2):
@__func__.test_open_test_dtree = [21 x i8] c"test_open_test_dtree\00"
@.str = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jviki/dtree/refs/heads/master/test/dtree_open_test.c\00"
@.str.1 = [12 x i8] c"device-tree\00"
@.str.2 = [33 x i8] c"Can not open testing device-tree\00"
@.str.3 = [38 x i8] c"Error state is set, but should not be\00"
define void @test_open_test_dtree() {
%1 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @_test_start to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 52)
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @dtree_open to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @_test_fail to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 54, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %14
6: ; preds = %0
%7 = tail call i32 (...) @dtree_iserror()
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 (i8*, i8*, i32, i8*, ...) bitcast (i32 (...)* @_test_warn to i32 (i8*, i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = tail call i32 (...) @dtree_close()
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @_test_end to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.test_open_test_dtree, i64 0, i64 0))
br label %14
14: ; preds = %11, %4
ret void
}