#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 */
scalar_t__ matches(int /*<<< orphan*/, char *);
int prj_find_package(char const *);
int /*<<< orphan*/ prj_get_language_for(int);
char const *prj_get_relativetarget_for(int);
const char *listSiblingRefs(const char *name) {
  int i = prj_find_package(name);
  if (i >= 0) {
    if (matches(prj_get_language_for(i), "c#")) {
      return prj_get_relativetarget_for(i);
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<listSiblingRefs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <prj_find_package@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1198 <listSiblingRefs+0x58>
mov    -0x14(%rbp),%edi
call   1040 <prj_get_language_for@plt>
mov    %eax,%edi
lea    0xe8d(%rip),%rsi
call   1030 <matches@plt>
cmp    $0x0,%rax
je     1193 <listSiblingRefs+0x53>
mov    -0x14(%rbp),%edi
call   1050 <prj_get_relativetarget_for@plt>
mov    %rax,-0x8(%rbp)
jmp    11a0 <listSiblingRefs+0x60>
jmp    1198 <listSiblingRefs+0x58>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listSiblingRefs>:
push   %rbx
call   1060 <prj_find_package@plt>
test   %eax,%eax
js     116e <listSiblingRefs+0x2e>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <prj_get_language_for@plt>
lea    0xea6(%rip),%rsi
mov    %eax,%edi
call   1030 <matches@plt>
test   %rax,%rax
je     116e <listSiblingRefs+0x2e>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <prj_get_relativetarget_for@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"c#\00"
define i8* @listSiblingRefs(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @prj_find_package(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load i32, i32* %4
%11 = call i32 @prj_get_language_for(i32 %10)
%12 = call i64 @matches(i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %4
%16 = call i8* @prj_get_relativetarget_for(i32 %15)
store i8* %16, i8** %2
br label %19
17: ; preds = %9
br label %18
18: ; preds = %17, %1
store i8* null, i8** %2
br label %19
19: ; preds = %18, %14
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [3 x i8] c"c#\00"
define i8* @listSiblingRefs(i8* %0) {
%2 = tail call i32 @prj_find_package(i8* %0)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = tail call i32 @prj_get_language_for(i32 %2)
%6 = tail call i64 @matches(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i8* @prj_get_relativetarget_for(i32 %2)
br label %10
10: ; preds = %1, %4, %8
%11 = phi i8* [ %9, %8 ], [ null, %4 ], [ null, %1 ]
ret i8* %11
}