#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int _available(int /*<<< orphan*/ *, char const *, char const *, char *,
               char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char const *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *tmpfile();
int main(int ac, char *av[]) {
  const char *CC;
  const char *sym;
  int avail;
  FILE *tmp;
  if (ac < 3) {
    fprintf(stderr, "Usage: %s CC function_name\n", av[0]);
    return -1;
  }
  tmp = tmpfile();
  CC = av[1];
  sym = av[2];
  avail = _available(tmp, sym, CC, "", "");
  printf("%s is %s\n", sym, avail ? "available" : "not available");
  exit(avail);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1197 <main+0x47>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x30,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1040 <tmpfile@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe4e(%rip),%r8
mov    %r8,%rcx
call   1060 <_available@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%ecx
lea    0xe40(%rip),%rdx
lea    0xe3d(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     117f <main+0x2f>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe92(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
call   1040 <tmpfile@plt>
mov    0x8(%rbx),%rdx
mov    0x10(%rbx),%rbx
lea    0xe86(%rip),%rcx
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %rcx,%r8
call   1060 <_available@plt>
mov    %eax,%ebp
test   %eax,%eax
lea    0xe78(%rip),%rax
lea    0xe75(%rip),%rdx
cmove  %rax,%rdx
lea    0xe5c(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %ebp,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s CC function_name\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [10 x i8] c"%s is %s\0A\00"
@.str.3 = [10 x i8] c"available\00"
@.str.4 = [14 x i8] c"not available\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %16)
ret i32 -1
18: ; preds = %2
%19 = call i32* (...) @tmpfile()
store i32* %19, i32** %9
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
store i8* %22, i8** %6
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
store i8* %25, i8** %7
%26 = load i32*, i32** %9
%27 = load i8*, i8** %7
%28 = load i8*, i8** %6
%29 = call i32 @_available(i32* %26, i8* %27, i8* %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i32 %29, i32* %8
%30 = load i8*, i8** %7
%31 = load i32, i32* %8
%32 = icmp ne i32 %31, 0
%33 = zext i1 %32 to i64
%34 = select i1 %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0)
%35 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %30, i8* %34)
%36 = load i32, i32* %8
%37 = call i32 @exit(i32 %36)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s CC function_name\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [10 x i8] c"%s is %s\0A\00"
@.str.3 = [10 x i8] c"available\00"
@.str.4 = [14 x i8] c"not available\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 -1
8: ; preds = %2
%9 = tail call i32* (...) @tmpfile()
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @_available(i32* %9, i8* %13, i8* %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %16)
%18 = tail call i32 @exit(i32 %14)
unreachable
}