int main(void) {
  int retval = (!0);
  printf("%s(): %d (+)\n", __FUNCTION__, 40);
  ;
  if (0 == open_hello()) {
    printf("Successfully opened /dev/hello0!\n");
    if (0 == close_hello()) {
      printf("Successfully closed /dev/hello0!\n");
      retval = 0;
    }
  }
  if (0 == retval) {
    printf("Test Successful!\n");
  } else {
    printf("Test Failure!!!\n");
  }
  printf("%s(): %d (-)\n", __FUNCTION__, 58);
  ;
  return retval;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xeba(%rip),%rsi
mov    $0x28,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <open_hello@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    11ae <main+0x7e>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <close_hello@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    11a9 <main+0x79>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
jmp    11ae <main+0x7e>
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jne    11cc <main+0x9c>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11da <main+0xaa>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe99(%rip),%rdi
lea    0xe26(%rip),%rsi
mov    $0x3a,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
lea    0xebd(%rip),%rsi
mov    $0x28,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1030 <open_hello@plt>
mov    $0x1,%ebp
lea    0xeb1(%rip),%rbx
test   %eax,%eax
jne    11a0 <main+0x60>
lea    0xec7(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <close_hello@plt>
test   %eax,%eax
jne    11a0 <main+0x60>
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe93(%rip),%rbx
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe64(%rip),%rdi
lea    0xe58(%rip),%rsi
mov    $0x3a,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s(): %d (+)\0A\00"
@__FUNCTION__.main = [5 x i8] c"main\00"
@.str.1 = [34 x i8] c"Successfully opened /dev/hello0!\0A\00"
@.str.2 = [34 x i8] c"Successfully closed /dev/hello0!\0A\00"
@.str.3 = [18 x i8] c"Test Successful!\0A\00"
@.str.4 = [17 x i8] c"Test Failure!!!\0A\00"
@.str.5 = [14 x i8] c"%s(): %d (-)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.main, i64 0, i64 0), i32 40)
%4 = call i32 (...) @open_hello()
%5 = icmp eq i32 0, %4
br i1 %5, label %6, label %13
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @close_hello()
%9 = icmp eq i32 0, %8
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %12
12: ; preds = %10, %6
br label %13
13: ; preds = %12, %0
%14 = load i32, i32* %2
%15 = icmp eq i32 0, %14
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %13
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.main, i64 0, i64 0), i32 58)
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s(): %d (+)\0A\00"
@__FUNCTION__.main = [5 x i8] c"main\00"
@.str.5 = [14 x i8] c"%s(): %d (-)\0A\00"
@str = [16 x i8] c"Test Failure!!!\00"
@str.6 = [17 x i8] c"Test Successful!\00"
@str.7 = [33 x i8] c"Successfully opened /dev/hello0!\00"
@str.8 = [33 x i8] c"Successfully closed /dev/hello0!\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.main, i64 0, i64 0), i32 40)
%2 = tail call i32 (...) @open_hello()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0))
%6 = tail call i32 (...) @close_hello()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.8, i64 0, i64 0))
br label %10
10: ; preds = %0, %4, %8
%11 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0), %0 ]
%12 = phi i32 [ 0, %8 ], [ 1, %4 ], [ 1, %0 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %11)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.main, i64 0, i64 0), i32 58)
ret i32 %12
}