#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 EXIT_SUCCESS;
int /*<<< orphan*/ FAIL(char *, int, int);
int /*<<< orphan*/ PASS(char *);
int atoi(char const *);
int foo();
int main(int argc, const char *argv[]) {
  int expectedResult = atoi(argv[1]);
  int actualResult = foo();
  if (actualResult != expectedResult)
    FAIL("framework-DYLD_LIBRARY_PATH using wrong dylib. foo() returned %d, "
         "expected %d",
         actualResult, expectedResult);
  else
    PASS("framework-DYLD_LIBRARY_PATH");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <foo@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1193 <main+0x53>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe77(%rip),%rdi
call   1060 <FAIL@plt>
jmp    119f <main+0x5f>
lea    0xeb4(%rip),%rdi
call   1040 <PASS@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <foo@plt>
cmp    %ebx,%eax
jne    1165 <main+0x25>
lea    0xef0(%rip),%rdi
call   1040 <PASS@plt>
jmp    1175 <main+0x35>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
call   1060 <FAIL@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [78 x i8] c"framework-DYLD_LIBRARY_PATH using wrong dylib. foo() returned %d, expected %d\00"
@.str.1 = [28 x i8] c"framework-DYLD_LIBRARY_PATH\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %6
%12 = call i32 (...) @foo()
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = call i32 @FAIL(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
br label %22
20: ; preds = %2
%21 = call i32 @PASS(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}

LLVM IR (-O2):
@.str = [78 x i8] c"framework-DYLD_LIBRARY_PATH using wrong dylib. foo() returned %d, expected %d\00"
@.str.1 = [28 x i8] c"framework-DYLD_LIBRARY_PATH\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 (...) @foo()
%7 = icmp eq i32 %6, %5
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @FAIL(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %5)
br label %12
10: ; preds = %2
%11 = tail call i32 @PASS(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}