#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 */
char const *gnu_escapePath(char const *);
scalar_t__ matches(char const *, int /*<<< orphan*/);
int prj_get_numpackages();
int /*<<< orphan*/ prj_get_pkgname_for(int);
const char *listInterPackageDeps(const char *name) {
  int i;
  for (i = 0; i < prj_get_numpackages(); ++i) {
    if (matches(name, prj_get_pkgname_for(i)))
      return gnu_escapePath(name);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<listInterPackageDeps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <prj_get_numpackages@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11b7 <listInterPackageDeps+0x77>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <prj_get_pkgname_for@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <matches@plt>
cmp    $0x0,%rax
je     11a4 <listInterPackageDeps+0x64>
mov    -0x10(%rbp),%rdi
call   1030 <gnu_escapePath@plt>
mov    %rax,-0x8(%rbp)
jmp    11bf <listInterPackageDeps+0x7f>
jmp    11a9 <listInterPackageDeps+0x69>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <listInterPackageDeps+0x13>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listInterPackageDeps>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <prj_get_numpackages@plt>
test   %eax,%eax
jle    1184 <listInterPackageDeps+0x44>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
call   1050 <prj_get_pkgname_for@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <matches@plt>
test   %rax,%rax
jne    118d <listInterPackageDeps+0x4d>
add    $0x1,%ebp
xor    %eax,%eax
call   1060 <prj_get_numpackages@plt>
cmp    %eax,%ebp
jl     1160 <listInterPackageDeps+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <gnu_escapePath@plt>

LLVM IR (-O0):
define i8* @listInterPackageDeps(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = call i32 (...) @prj_get_numpackages()
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @prj_get_pkgname_for(i32 %11)
%13 = call i64 @matches(i8* %10, i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i8* @gnu_escapePath(i8* %16)
store i8* %17, i8** %2
br label %23
18: ; preds = %9
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
store i8* null, i8** %2
br label %23
23: ; preds = %22, %15
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
define i8* @listInterPackageDeps(i8* %0) {
%2 = tail call i32 (...) @prj_get_numpackages()
%3 = icmp sgt i32 %2, 0
br i1 %3, label %7, label %15
4: ; preds = %7
%5 = tail call i32 (...) @prj_get_numpackages()
%6 = icmp slt i32 %12, %5
br i1 %6, label %7, label %15
7: ; preds = %1, %4
%8 = phi i32 [ %12, %4 ], [ 0, %1 ]
%9 = tail call i32 @prj_get_pkgname_for(i32 %8)
%10 = tail call i64 @matches(i8* %0, i32 %9)
%11 = icmp eq i64 %10, 0
%12 = add nuw nsw i32 %8, 1
br i1 %11, label %4, label %13
13: ; preds = %7
%14 = tail call i8* @gnu_escapePath(i8* %0)
br label %15
15: ; preds = %4, %1, %13
%16 = phi i8* [ %14, %13 ], [ null, %1 ], [ null, %4 ]
ret i8* %16
}