#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*/ FAIL(char *);
int /*<<< orphan*/ PASS(char *);
scalar_t__ bar();
int foo();
int main() {
  if (foo() != 1) {
    FAIL("lazy-dylib-missing-symbol: foo not found");
    return 0;
  }
  if (bar() != 0) {
    FAIL("lazy-dylib-missing-symbol: bar found");
    return 0;
  }
  PASS("lazy-dylib-missing-symbol");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
cmp    $0x1,%eax
je     1177 <main+0x37>
lea    0xe9a(%rip),%rdi
call   1060 <FAIL@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <main+0x73>
mov    $0x0,%al
call   1030 <bar@plt>
cmp    $0x0,%rax
je     11a0 <main+0x60>
lea    0xe9a(%rip),%rdi
call   1060 <FAIL@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <main+0x73>
lea    0xea7(%rip),%rdi
call   1050 <PASS@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    1167 <main+0x27>
xor    %eax,%eax
call   1030 <bar@plt>
test   %rax,%rax
je     1175 <main+0x35>
lea    0xec9(%rip),%rdi
call   1060 <FAIL@plt>
jmp    1181 <main+0x41>
lea    0xe92(%rip),%rdi
call   1060 <FAIL@plt>
jmp    1181 <main+0x41>
lea    0xed2(%rip),%rdi
call   1050 <PASS@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"lazy-dylib-missing-symbol: foo not found\00"
@.str.1 = [37 x i8] c"lazy-dylib-missing-symbol: bar found\00"
@.str.2 = [26 x i8] c"lazy-dylib-missing-symbol\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @FAIL(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %13
6: ; preds = %0
%7 = call i64 (...) @bar()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @FAIL(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %13
11: ; preds = %6
%12 = call i32 @PASS(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %13
13: ; preds = %11, %9, %4
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [41 x i8] c"lazy-dylib-missing-symbol: foo not found\00"
@.str.1 = [37 x i8] c"lazy-dylib-missing-symbol: bar found\00"
@.str.2 = [26 x i8] c"lazy-dylib-missing-symbol\00"
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @FAIL(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %12
5: ; preds = %0
%6 = tail call i64 (...) @bar()
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @FAIL(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %12
10: ; preds = %5
%11 = tail call i32 @PASS(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %8, %3
ret i32 0
}