#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 */
struct stat {
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ path_buf;
typedef int /*<<< orphan*/ file_buf;

/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ S_ISDIR(int /*<<< orphan*/);
int /*<<< orphan*/ X_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int snprintf(char *, int, char *, char *, char const *);
scalar_t__ stat(char *, struct stat *);
char *strchr(char const *, char);
size_t strlcpy(char *, char const *, int);
int strlen(char const *);
int search_exec_path(const char *path, const char *src, char *dst, int dstlen) {
  char path_buf[PATH_MAX];
  char file_buf[PATH_MAX];
  char *p;
  char *q;
  struct stat st;
  int n;
  assert((path == NULL) || (strlen(path) < PATH_MAX));
  assert(src != NULL);
  assert(strchr(src, '/') == NULL);
  assert(dst != NULL);
  assert(dstlen >= 0);
  if (!path) {
    return (-1);
  }
  if (strlcpy(path_buf, path, sizeof(path_buf)) >= sizeof(path_buf)) {
    return (-1);
  }
  for (p = path_buf; p && *p; p = q) {
    if ((q = strchr(p, ':'))) {
      *q++ = '\0';
    } else {
      q = strchr(p, '\0');
    }
    if (stat(p, &st) < 0) {
      continue;
    }
    if (!S_ISDIR(st.st_mode)) {
      continue;
    }
    n = snprintf(file_buf, sizeof(file_buf), "%s/%s", p, src);
    if ((n < 0) || ((size_t)n >= sizeof(file_buf))) {
      continue;
    }
    if (access(file_buf, X_OK) < 0) {
      continue;
    }
    if ((dst != NULL) && (dstlen > 0)) {
      if (strlcpy(dst, file_buf, dstlen) >= (size_t)dstlen) {
        return (1);
      }
    }
    return (0);
  }
  return (-1);
}


x86 assembly (clang, -O0):
<search_exec_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%ecx
mov    %rcx,-0x88(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x80(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x38(%rbp)
mov    (%rax),%eax
mov    %rax,-0x78(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x61(%rbp)
je     1217 <search_exec_path+0x97>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    0x2de1(%rip),%rcx
cmp    (%rcx),%eax
setl   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpl   $0x0,-0x24(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1296 <search_exec_path+0x116>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    145e <search_exec_path+0x2de>
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
call   1090 <strlcpy@plt>
mov    -0x88(%rbp),%rcx
cmp    %rcx,%rax
jb     12cf <search_exec_path+0x14f>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    145e <search_exec_path+0x2de>
mov    -0x80(%rbp),%rax
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x48(%rbp)
mov    %al,-0x89(%rbp)
je     12fd <search_exec_path+0x17d>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x89(%rbp)
mov    -0x89(%rbp),%al
test   $0x1,%al
jne    1310 <search_exec_path+0x190>
jmp    1450 <search_exec_path+0x2d0>
mov    -0x48(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
je     1343 <search_exec_path+0x1c3>
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x50(%rbp)
movb   $0x0,(%rax)
jmp    1352 <search_exec_path+0x1d2>
mov    -0x48(%rbp),%rdi
xor    %esi,%esi
call   1040 <strchr@plt>
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1080 <stat@plt>
cmp    $0x0,%rax
jge    136e <search_exec_path+0x1ee>
jmp    1443 <search_exec_path+0x2c3>
mov    -0x58(%rbp),%edi
call   1050 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1384 <search_exec_path+0x204>
jmp    1443 <search_exec_path+0x2c3>
mov    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rax
mov    %eax,%esi
mov    -0x48(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xc63(%rip),%rdx
call   1060 <snprintf@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jl     13c0 <search_exec_path+0x240>
mov    -0x78(%rbp),%rcx
movslq -0x5c(%rbp),%rax
cmp    %rcx,%rax
jb     13c5 <search_exec_path+0x245>
jmp    1443 <search_exec_path+0x2c3>
mov    -0x70(%rbp),%rdi
mov    0x2c10(%rip),%rax
mov    (%rax),%esi
call   10a0 <access@plt>
cmp    $0x0,%rax
jge    13e6 <search_exec_path+0x266>
jmp    1443 <search_exec_path+0x2c3>
cmpq   $0x0,-0x20(%rbp)
je     1430 <search_exec_path+0x2b0>
cmpl   $0x0,-0x24(%rbp)
jle    1430 <search_exec_path+0x2b0>
mov    -0x70(%rbp),%rsi
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
call   1090 <strlcpy@plt>
movslq -0x24(%rbp),%rcx
cmp    %rcx,%rax
jb     142b <search_exec_path+0x2ab>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    145e <search_exec_path+0x2de>
jmp    1430 <search_exec_path+0x2b0>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    145e <search_exec_path+0x2de>
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    12d7 <search_exec_path+0x157>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_exec_path>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,-0x2c(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rsi,-0x48(%rbp)
mov    %rdi,%r15
mov    0x2e4a(%rip),%r14
mov    (%r14),%ecx
mov    %rsp,%r12
lea    0xf(%rcx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
test   %rdi,%rdi
mov    %rcx,-0x50(%rbp)
je     11df <search_exec_path+0x5f>
mov    %r15,%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    (%r14),%eax
setl   %dil
jmp    11e4 <search_exec_path+0x64>
mov    $0x1,%edi
call   1070 <assert@plt>
xor    %edi,%edi
mov    -0x48(%rbp),%rbx
test   %rbx,%rbx
setne  %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1040 <strchr@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpq   $0x0,-0x38(%rbp)
setne  %dil
call   1070 <assert@plt>
mov    -0x2c(%rbp),%edi
not    %edi
shr    $0x1f,%edi
call   1070 <assert@plt>
mov    $0xffffffff,%ebx
test   %r15,%r15
je     1353 <search_exec_path+0x1d3>
mov    %r12,%rdi
mov    %r15,%rsi
mov    -0x50(%rbp),%r15
mov    %r15d,%edx
call   1090 <strlcpy@plt>
cmp    %r15,%rax
jae    1353 <search_exec_path+0x1d3>
lea    -0x40(%rbp),%rbx
jmp    1279 <search_exec_path+0xf9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %r12,%r12
je     134e <search_exec_path+0x1ce>
cmpb   $0x0,(%r12)
je     134e <search_exec_path+0x1ce>
mov    %r12,%r14
mov    %r12,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     12b0 <search_exec_path+0x130>
mov    %rax,%r12
add    $0x1,%r12
movb   $0x0,(%rax)
jmp    12be <search_exec_path+0x13e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%r12
add    %r14,%r12
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <stat@plt>
test   %rax,%rax
js     1270 <search_exec_path+0xf0>
mov    -0x40(%rbp),%edi
call   1050 <S_ISDIR@plt>
test   %eax,%eax
je     1270 <search_exec_path+0xf0>
mov    %r13,%rdi
mov    %r15d,%esi
lea    0xd19(%rip),%rdx
mov    %r14,%rcx
mov    -0x48(%rbp),%r8
call   1060 <snprintf@plt>
test   %eax,%eax
js     1270 <search_exec_path+0xf0>
cltq
cmp    %r15,%rax
jae    1270 <search_exec_path+0xf0>
mov    0x2cd3(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   10a0 <access@plt>
test   %rax,%rax
js     1270 <search_exec_path+0xf0>
cmpq   $0x0,-0x38(%rbp)
je     134a <search_exec_path+0x1ca>
cmpl   $0x0,-0x2c(%rbp)
jle    134a <search_exec_path+0x1ca>
mov    -0x38(%rbp),%rdi
mov    %r13,%rsi
mov    -0x2c(%rbp),%ebx
mov    %ebx,%edx
call   1090 <strlcpy@plt>
mov    %ebx,%ecx
mov    $0x1,%ebx
cmp    %rcx,%rax
jae    1353 <search_exec_path+0x1d3>
xor    %ebx,%ebx
jmp    1353 <search_exec_path+0x1d3>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@PATH_MAX = global i32 0
@.str = [6 x i8] c"%s/%s\00"
@X_OK = global i32 0
define i32 @search_exec_path(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca %struct.stat
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%18 = load i32, i32* @PATH_MAX
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %10
%21 = alloca i8, i64 %19
store i64 %19, i64* %11
%22 = load i32, i32* @PATH_MAX
%23 = zext i32 %22 to i64
%24 = alloca i8, i64 %23
store i64 %23, i64* %12
%25 = load i8*, i8** %6
%26 = icmp eq i8* %25, null
br i1 %26, label %32, label %27
27: ; preds = %4
%28 = load i8*, i8** %6
%29 = call i32 @strlen(i8* %28)
%30 = load i32, i32* @PATH_MAX
%31 = icmp slt i32 %29, %30
br label %32
32: ; preds = %27, %4
%33 = phi i1 [ true, %4 ], [ %31, %27 ]
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i8*, i8** %7
%37 = icmp ne i8* %36, null
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load i8*, i8** %7
%41 = call i8* @strchr(i8* %40, i8 signext 47)
%42 = icmp eq i8* %41, null
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i8*, i8** %8
%46 = icmp ne i8* %45, null
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = load i32, i32* %9
%50 = icmp sge i32 %49, 0
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = load i8*, i8** %6
%54 = icmp ne i8* %53, null
br i1 %54, label %56, label %55
55: ; preds = %32
store i32 -1, i32* %5
store i32 1, i32* %17
br label %130
56: ; preds = %32
%57 = load i8*, i8** %6
%58 = trunc i64 %19 to i32
%59 = call i64 @strlcpy(i8* %21, i8* %57, i32 %58)
%60 = icmp uge i64 %59, %19
br i1 %60, label %61, label %62
61: ; preds = %56
store i32 -1, i32* %5
store i32 1, i32* %17
br label %130
62: ; preds = %56
store i8* %21, i8** %13
br label %63
63: ; preds = %127, %62
%64 = load i8*, i8** %13
%65 = icmp ne i8* %64, null
br i1 %65, label %66, label %71
66: ; preds = %63
%67 = load i8*, i8** %13
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp ne i32 %69, 0
br label %71
71: ; preds = %66, %63
%72 = phi i1 [ false, %63 ], [ %70, %66 ]
br i1 %72, label %73, label %129
73: ; preds = %71
%74 = load i8*, i8** %13
%75 = call i8* @strchr(i8* %74, i8 signext 58)
store i8* %75, i8** %14
%76 = icmp ne i8* %75, null
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = load i8*, i8** %14
%79 = getelementptr inbounds i8, i8* %78, i32 1
store i8* %79, i8** %14
store i8 0, i8* %78
br label %83
80: ; preds = %73
%81 = load i8*, i8** %13
%82 = call i8* @strchr(i8* %81, i8 signext 0)
store i8* %82, i8** %14
br label %83
83: ; preds = %80, %77
%84 = load i8*, i8** %13
%85 = call i64 @stat(i8* %84, %struct.stat* %15)
%86 = icmp slt i64 %85, 0
br i1 %86, label %87, label %88
87: ; preds = %83
br label %127
88: ; preds = %83
%89 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%90 = load i32, i32* %89
%91 = call i32 @S_ISDIR(i32 %90)
%92 = icmp ne i32 %91, 0
br i1 %92, label %94, label %93
93: ; preds = %88
br label %127
94: ; preds = %88
%95 = trunc i64 %23 to i32
%96 = load i8*, i8** %13
%97 = load i8*, i8** %7
%98 = call i32 @snprintf(i8* %24, i32 %95, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %96, i8* %97)
store i32 %98, i32* %16
%99 = load i32, i32* %16
%100 = icmp slt i32 %99, 0
br i1 %100, label %105, label %101
101: ; preds = %94
%102 = load i32, i32* %16
%103 = sext i32 %102 to i64
%104 = icmp uge i64 %103, %23
br i1 %104, label %105, label %106
105: ; preds = %101, %94
br label %127
106: ; preds = %101
%107 = load i32, i32* @X_OK
%108 = call i64 @access(i8* %24, i32 %107)
%109 = icmp slt i64 %108, 0
br i1 %109, label %110, label %111
110: ; preds = %106
br label %127
111: ; preds = %106
%112 = load i8*, i8** %8
%113 = icmp ne i8* %112, null
br i1 %113, label %114, label %126
114: ; preds = %111
%115 = load i32, i32* %9
%116 = icmp sgt i32 %115, 0
br i1 %116, label %117, label %126
117: ; preds = %114
%118 = load i8*, i8** %8
%119 = load i32, i32* %9
%120 = call i64 @strlcpy(i8* %118, i8* %24, i32 %119)
%121 = load i32, i32* %9
%122 = sext i32 %121 to i64
%123 = icmp uge i64 %120, %122
br i1 %123, label %124, label %125
124: ; preds = %117
store i32 1, i32* %5
store i32 1, i32* %17
br label %130
125: ; preds = %117
br label %126
126: ; preds = %125, %114, %111
store i32 0, i32* %5
store i32 1, i32* %17
br label %130
127: ; preds = %110, %105, %93, %87
%128 = load i8*, i8** %14
store i8* %128, i8** %13
br label %63
129: ; preds = %71
store i32 -1, i32* %5
store i32 1, i32* %17
br label %130
130: ; preds = %129, %126, %124, %61, %55
%131 = load i8*, i8** %10
%132 = load i32, i32* %5
ret i32 %132
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@PATH_MAX = global i32 0
@.str = [6 x i8] c"%s/%s\00"
@X_OK = global i32 0
define i32 @search_exec_path(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca %struct.stat
%6 = load i32, i32* @PATH_MAX
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = alloca i8, i64 %7
%10 = bitcast %struct.stat* %5 to i8*
%11 = icmp eq i8* %0, null
br i1 %11, label %17, label %12
12: ; preds = %4
%13 = tail call i32 @strlen(i8* %0)
%14 = load i32, i32* @PATH_MAX
%15 = icmp slt i32 %13, %14
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %12, %4
%18 = phi i32 [ 1, %4 ], [ %16, %12 ]
%19 = tail call i32 @assert(i32 %18)
%20 = icmp ne i8* %1, null
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 47)
%24 = icmp eq i8* %23, null
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = icmp ne i8* %2, null
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = xor i32 %3, -1
%31 = lshr i32 %30, 31
%32 = tail call i32 @assert(i32 %31)
br i1 %11, label %78, label %33
33: ; preds = %17
%34 = call i64 @strlcpy(i8* %8, i8* %0, i32 %6)
%35 = icmp ult i64 %34, %7
br i1 %35, label %36, label %78
36: ; preds = %33
%37 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
br label %38
38: ; preds = %36, %76
%39 = phi i8* [ %8, %36 ], [ %51, %76 ]
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %78, label %42
42: ; preds = %38
%43 = call i8* @strchr(i8* %39, i8 signext 58)
%44 = icmp eq i8* %43, null
br i1 %44, label %47, label %45
45: ; preds = %42
%46 = getelementptr inbounds i8, i8* %43, i64 1
store i8 0, i8* %43
br label %50
47: ; preds = %42
%48 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %39)
%49 = getelementptr i8, i8* %39, i64 %48
br label %50
50: ; preds = %47, %45
%51 = phi i8* [ %46, %45 ], [ %49, %47 ]
%52 = call i64 @stat(i8* %39, %struct.stat* %5)
%53 = icmp slt i64 %52, 0
br i1 %53, label %76, label %54
54: ; preds = %50
%55 = load i32, i32* %37
%56 = call i32 @S_ISDIR(i32 %55)
%57 = icmp eq i32 %56, 0
br i1 %57, label %76, label %58
58: ; preds = %54
%59 = call i32 @snprintf(i8* %9, i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %39, i8* %1)
%60 = icmp slt i32 %59, 0
%61 = sext i32 %59 to i64
%62 = icmp uge i64 %61, %7
%63 = select i1 %60, i1 true, i1 %62
br i1 %63, label %76, label %64
64: ; preds = %58
%65 = load i32, i32* @X_OK
%66 = call i64 @access(i8* %9, i32 %65)
%67 = icmp slt i64 %66, 0
br i1 %67, label %76, label %68
68: ; preds = %64
%69 = icmp sgt i32 %3, 0
%70 = and i1 %27, %69
br i1 %70, label %71, label %75
71: ; preds = %68
%72 = call i64 @strlcpy(i8* %2, i8* %9, i32 %3)
%73 = zext i32 %3 to i64
%74 = icmp ult i64 %72, %73
br i1 %74, label %75, label %78
75: ; preds = %71, %68
br label %78
76: ; preds = %64, %58, %54, %50
%77 = icmp eq i8* %51, null
br i1 %77, label %78, label %38
78: ; preds = %38, %76, %71, %33, %17, %75
%79 = phi i32 [ 0, %75 ], [ -1, %17 ], [ -1, %33 ], [ 1, %71 ], [ -1, %76 ], [ -1, %38 ]
ret i32 %79
}