#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__ path_compare(int /*<<< orphan*/, int /*<<< orphan*/);
int prj_get_numpackages();
scalar_t__ prj_get_package();
scalar_t__ prj_get_package_for(int);
int /*<<< orphan*/ prj_get_path();
int /*<<< orphan*/ prj_get_pkgpath();
int /*<<< orphan*/ prj_get_pkgpath_for(int);
int gnu_pkgOwnsPath() {
  int i;
  if (path_compare(prj_get_pkgpath(), prj_get_path()))
    return 0;
  for (i = 0; i < prj_get_numpackages(); ++i) {
    if (prj_get_package() != prj_get_package_for(i)) {
      if (path_compare(prj_get_pkgpath(), prj_get_pkgpath_for(i)))
        return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<gnu_pkgOwnsPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1090 <prj_get_pkgpath@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <prj_get_path@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1040 <path_compare@plt>
cmp    $0x0,%rax
je     11a9 <gnu_pkgOwnsPath+0x39>
movl   $0x0,-0x4(%rbp)
jmp    123e <gnu_pkgOwnsPath+0xce>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <prj_get_numpackages@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    1237 <gnu_pkgOwnsPath+0xc7>
mov    $0x0,%al
call   1060 <prj_get_package@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <prj_get_package_for@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     1224 <gnu_pkgOwnsPath+0xb4>
mov    $0x0,%al
call   1090 <prj_get_pkgpath@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1080 <prj_get_pkgpath_for@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1040 <path_compare@plt>
cmp    $0x0,%rax
je     121f <gnu_pkgOwnsPath+0xaf>
movl   $0x0,-0x4(%rbp)
jmp    123e <gnu_pkgOwnsPath+0xce>
jmp    1224 <gnu_pkgOwnsPath+0xb4>
jmp    1229 <gnu_pkgOwnsPath+0xb9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <gnu_pkgOwnsPath+0x40>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnu_pkgOwnsPath>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1090 <prj_get_pkgpath@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <prj_get_path@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <path_compare@plt>
test   %rax,%rax
jne    11fa <gnu_pkgOwnsPath+0x8a>
xor    %eax,%eax
call   1070 <prj_get_numpackages@plt>
test   %eax,%eax
jle    11f4 <gnu_pkgOwnsPath+0x84>
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    11be <gnu_pkgOwnsPath+0x4e>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
xor    %eax,%eax
call   1070 <prj_get_numpackages@plt>
cmp    %eax,%ebx
jge    11f4 <gnu_pkgOwnsPath+0x84>
xor    %eax,%eax
call   1060 <prj_get_package@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   1050 <prj_get_package_for@plt>
cmp    %rax,%rbp
je     11b0 <gnu_pkgOwnsPath+0x40>
xor    %eax,%eax
call   1090 <prj_get_pkgpath@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1080 <prj_get_pkgpath_for@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <path_compare@plt>
test   %rax,%rax
je     11b0 <gnu_pkgOwnsPath+0x40>
jmp    11fa <gnu_pkgOwnsPath+0x8a>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @gnu_pkgOwnsPath() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @prj_get_pkgpath()
%4 = call i32 (...) @prj_get_path()
%5 = call i64 @path_compare(i32 %3, i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 0, i32* %1
br label %31
8: ; preds = %0
store i32 0, i32* %2
br label %9
9: ; preds = %27, %8
%10 = load i32, i32* %2
%11 = call i32 (...) @prj_get_numpackages()
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = call i64 (...) @prj_get_package()
%15 = load i32, i32* %2
%16 = call i64 @prj_get_package_for(i32 %15)
%17 = icmp ne i64 %14, %16
br i1 %17, label %18, label %26
18: ; preds = %13
%19 = call i32 (...) @prj_get_pkgpath()
%20 = load i32, i32* %2
%21 = call i32 @prj_get_pkgpath_for(i32 %20)
%22 = call i64 @path_compare(i32 %19, i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 0, i32* %1
br label %31
25: ; preds = %18
br label %26
26: ; preds = %25, %13
br label %27
27: ; preds = %26
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %9
30: ; preds = %9
store i32 1, i32* %1
br label %31
31: ; preds = %30, %24, %7
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
define i32 @gnu_pkgOwnsPath() {
%1 = tail call i32 (...) @prj_get_pkgpath()
%2 = tail call i32 (...) @prj_get_path()
%3 = tail call i64 @path_compare(i32 %1, i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %22
5: ; preds = %0
%6 = tail call i32 (...) @prj_get_numpackages()
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %5, %18
%9 = phi i32 [ %19, %18 ], [ 0, %5 ]
%10 = tail call i64 (...) @prj_get_package()
%11 = tail call i64 @prj_get_package_for(i32 %9)
%12 = icmp eq i64 %10, %11
br i1 %12, label %18, label %13
13: ; preds = %8
%14 = tail call i32 (...) @prj_get_pkgpath()
%15 = tail call i32 @prj_get_pkgpath_for(i32 %9)
%16 = tail call i64 @path_compare(i32 %14, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %8, %13
%19 = add nuw nsw i32 %9, 1
%20 = tail call i32 (...) @prj_get_numpackages()
%21 = icmp slt i32 %19, %20
br i1 %21, label %8, label %22
22: ; preds = %13, %18, %5, %0
%23 = phi i32 [ 0, %0 ], [ 1, %5 ], [ 0, %13 ], [ 1, %18 ]
ret i32 %23
}