void test_pass_mostly_valid(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",
              38);
  int err = dtree_open("/proc/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",
               40,
               ((("Open of "
                  "/proc/device-tree"
                  " failed, is it present on the system?"))));
    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",
               41,
               (("Error is indicated by dtree_iserror(), but should not be")));
  };
  dtree_close();
  _test_end(__func__);
}


x86 assembly (clang, -O0):
<test_pass_mostly_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
lea    0xe91(%rip),%rsi
mov    $0x26,%edx
mov    $0x0,%al
call   1060 <_test_start@plt>
lea    0xf0d(%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_pass_mostly_valid+0x6e>
lea    0xe41(%rip),%rdi
lea    0xe51(%rip),%rsi
mov    $0x28,%edx
lea    0xee6(%rip),%rcx
mov    $0x0,%al
call   1040 <_test_fail@plt>
jmp    1224 <test_pass_mostly_valid+0xb4>
mov    $0x0,%al
call   1070 <dtree_iserror@plt>
cmp    $0x0,%eax
je     120f <test_pass_mostly_valid+0x9f>
lea    0xe0b(%rip),%rdi
lea    0xe1b(%rip),%rsi
mov    $0x29,%edx
lea    0xeef(%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_pass_mostly_valid>:
push   %rax
lea    0xe88(%rip),%rdi
lea    0xe98(%rip),%rsi
mov    $0x26,%edx
xor    %eax,%eax
call   1060 <_test_start@plt>
lea    0xf14(%rip),%rdi
xor    %eax,%eax
call   1090 <dtree_open@plt>
test   %eax,%eax
je     11c0 <test_pass_mostly_valid+0x50>
lea    0xe5c(%rip),%rdi
lea    0xe6c(%rip),%rsi
lea    0xf06(%rip),%rcx
mov    $0x28,%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_pass_mostly_valid+0x7c>
lea    0xe2e(%rip),%rdi
lea    0xe3e(%rip),%rsi
lea    0xf17(%rip),%rcx
mov    $0x29,%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_pass_mostly_valid = [23 x i8] c"test_pass_mostly_valid\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 = [18 x i8] c"/proc/device-tree\00"
@.str.2 = [63 x i8] c"Open of /proc/device-tree failed, is it present on the system?\00"
@.str.3 = [57 x i8] c"Error is indicated by dtree_iserror(), but should not be\00"
define void @test_pass_mostly_valid() {
%1 = alloca i32
%2 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @_test_start to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 38)
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @dtree_open to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 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 ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 40, i8* getelementptr inbounds ([63 x i8], [63 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 ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 41, i8* getelementptr inbounds ([57 x i8], [57 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 ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0))
br label %18
18: ; preds = %15, %8
ret void
}

LLVM IR (-O2):
@__func__.test_pass_mostly_valid = [23 x i8] c"test_pass_mostly_valid\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 = [18 x i8] c"/proc/device-tree\00"
@.str.2 = [63 x i8] c"Open of /proc/device-tree failed, is it present on the system?\00"
@.str.3 = [57 x i8] c"Error is indicated by dtree_iserror(), but should not be\00"
define void @test_pass_mostly_valid() {
%1 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @_test_start to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 38)
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @dtree_open to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 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 ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 40, i8* getelementptr inbounds ([63 x i8], [63 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 ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i32 41, i8* getelementptr inbounds ([57 x i8], [57 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 ([23 x i8], [23 x i8]* @__func__.test_pass_mostly_valid, i64 0, i64 0))
br label %14
14: ; preds = %11, %4
ret void
}