#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);
int 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) || (n >= sizeof(file_buf))) {
      continue;
    }
    if (access(file_buf, X_OK) < 0) {
      continue;
    }
    if ((dst != NULL) && (dstlen > 0)) {
      if (strlcpy(dst, file_buf, dstlen) >= 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    145c <search_exec_path+0x2dc>
mov    -0x88(%rbp),%rax
mov    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
call   1090 <strlcpy@plt>
mov    -0x88(%rbp),%rcx
cltq
cmp    %rcx,%rax
jb     12d1 <search_exec_path+0x151>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    145c <search_exec_path+0x2dc>
mov    -0x80(%rbp),%rax
mov    %rax,-0x48(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x48(%rbp)
mov    %al,-0x89(%rbp)
je     12ff <search_exec_path+0x17f>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x89(%rbp)
mov    -0x89(%rbp),%al
test   $0x1,%al
jne    1312 <search_exec_path+0x192>
jmp    144e <search_exec_path+0x2ce>
mov    -0x48(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
je     1345 <search_exec_path+0x1c5>
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x50(%rbp)
movb   $0x0,(%rax)
jmp    1354 <search_exec_path+0x1d4>
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    1370 <search_exec_path+0x1f0>
jmp    1441 <search_exec_path+0x2c1>
mov    -0x58(%rbp),%edi
call   1050 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    1386 <search_exec_path+0x206>
jmp    1441 <search_exec_path+0x2c1>
mov    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rax
mov    %eax,%esi
mov    -0x48(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xc61(%rip),%rdx
call   1060 <snprintf@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jl     13c2 <search_exec_path+0x242>
mov    -0x78(%rbp),%rcx
movslq -0x5c(%rbp),%rax
cmp    %rcx,%rax
jb     13c7 <search_exec_path+0x247>
jmp    1441 <search_exec_path+0x2c1>
mov    -0x70(%rbp),%rdi
mov    0x2c0e(%rip),%rax
mov    (%rax),%esi
call   10a0 <access@plt>
cmp    $0x0,%rax
jge    13e8 <search_exec_path+0x268>
jmp    1441 <search_exec_path+0x2c1>
cmpq   $0x0,-0x20(%rbp)
je     142e <search_exec_path+0x2ae>
cmpl   $0x0,-0x24(%rbp)
jle    142e <search_exec_path+0x2ae>
mov    -0x70(%rbp),%rsi
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
call   1090 <strlcpy@plt>
cmp    -0x24(%rbp),%eax
jl     1429 <search_exec_path+0x2a9>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    145c <search_exec_path+0x2dc>
jmp    142e <search_exec_path+0x2ae>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x60(%rbp)
jmp    145c <search_exec_path+0x2dc>
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    12d9 <search_exec_path+0x159>
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>
cltq
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)
xchg   %ax,%ax
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),%r14d
mov    %r14d,%edx
call   1090 <strlcpy@plt>
mov    $0x1,%ebx
cmp    %r14d,%eax
jge    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 i32 @strlcpy(i8* %21, i8* %57, i32 %58)
%60 = sext i32 %59 to i64
%61 = icmp uge i64 %60, %19
br i1 %61, label %62, label %63
62: ; preds = %56
store i32 -1, i32* %5
store i32 1, i32* %17
br label %130
63: ; preds = %56
store i8* %21, i8** %13
br label %64
64: ; preds = %127, %63
%65 = load i8*, i8** %13
%66 = icmp ne i8* %65, null
br i1 %66, label %67, label %72
67: ; preds = %64
%68 = load i8*, i8** %13
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp ne i32 %70, 0
br label %72
72: ; preds = %67, %64
%73 = phi i1 [ false, %64 ], [ %71, %67 ]
br i1 %73, label %74, label %129
74: ; preds = %72
%75 = load i8*, i8** %13
%76 = call i8* @strchr(i8* %75, i8 signext 58)
store i8* %76, i8** %14
%77 = icmp ne i8* %76, null
br i1 %77, label %78, label %81
78: ; preds = %74
%79 = load i8*, i8** %14
%80 = getelementptr inbounds i8, i8* %79, i32 1
store i8* %80, i8** %14
store i8 0, i8* %79
br label %84
81: ; preds = %74
%82 = load i8*, i8** %13
%83 = call i8* @strchr(i8* %82, i8 signext 0)
store i8* %83, i8** %14
br label %84
84: ; preds = %81, %78
%85 = load i8*, i8** %13
%86 = call i64 @stat(i8* %85, %struct.stat* %15)
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %84
br label %127
89: ; preds = %84
%90 = getelementptr inbounds %struct.stat, %struct.stat* %15, i32 0, i32 0
%91 = load i32, i32* %90
%92 = call i32 @S_ISDIR(i32 %91)
%93 = icmp ne i32 %92, 0
br i1 %93, label %95, label %94
94: ; preds = %89
br label %127
95: ; preds = %89
%96 = trunc i64 %23 to i32
%97 = load i8*, i8** %13
%98 = load i8*, i8** %7
%99 = call i32 @snprintf(i8* %24, i32 %96, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %97, i8* %98)
store i32 %99, i32* %16
%100 = load i32, i32* %16
%101 = icmp slt i32 %100, 0
br i1 %101, label %106, label %102
102: ; preds = %95
%103 = load i32, i32* %16
%104 = sext i32 %103 to i64
%105 = icmp uge i64 %104, %23
br i1 %105, label %106, label %107
106: ; preds = %102, %95
br label %127
107: ; preds = %102
%108 = load i32, i32* @X_OK
%109 = call i64 @access(i8* %24, i32 %108)
%110 = icmp slt i64 %109, 0
br i1 %110, label %111, label %112
111: ; preds = %107
br label %127
112: ; preds = %107
%113 = load i8*, i8** %8
%114 = icmp ne i8* %113, null
br i1 %114, label %115, label %126
115: ; preds = %112
%116 = load i32, i32* %9
%117 = icmp sgt i32 %116, 0
br i1 %117, label %118, label %126
118: ; preds = %115
%119 = load i8*, i8** %8
%120 = load i32, i32* %9
%121 = call i32 @strlcpy(i8* %119, i8* %24, i32 %120)
%122 = load i32, i32* %9
%123 = icmp sge i32 %121, %122
br i1 %123, label %124, label %125
124: ; preds = %118
store i32 1, i32* %5
store i32 1, i32* %17
br label %130
125: ; preds = %118
br label %126
126: ; preds = %125, %115, %112
store i32 0, i32* %5
store i32 1, i32* %17
br label %130
127: ; preds = %111, %106, %94, %88
%128 = load i8*, i8** %14
store i8* %128, i8** %13
br label %64
129: ; preds = %72
store i32 -1, i32* %5
store i32 1, i32* %17
br label %130
130: ; preds = %129, %126, %124, %62, %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 i32 @strlcpy(i8* %8, i8* %0, i32 %6)
%35 = sext i32 %34 to i64
%36 = icmp ult i64 %35, %7
br i1 %36, label %37, label %78
37: ; preds = %33
%38 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
br label %39
39: ; preds = %37, %76
%40 = phi i8* [ %8, %37 ], [ %52, %76 ]
%41 = load i8, i8* %40
%42 = icmp eq i8 %41, 0
br i1 %42, label %78, label %43
43: ; preds = %39
%44 = call i8* @strchr(i8* %40, i8 signext 58)
%45 = icmp eq i8* %44, null
br i1 %45, label %48, label %46
46: ; preds = %43
%47 = getelementptr inbounds i8, i8* %44, i64 1
store i8 0, i8* %44
br label %51
48: ; preds = %43
%49 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %40)
%50 = getelementptr i8, i8* %40, i64 %49
br label %51
51: ; preds = %48, %46
%52 = phi i8* [ %47, %46 ], [ %50, %48 ]
%53 = call i64 @stat(i8* %40, %struct.stat* %5)
%54 = icmp slt i64 %53, 0
br i1 %54, label %76, label %55
55: ; preds = %51
%56 = load i32, i32* %38
%57 = call i32 @S_ISDIR(i32 %56)
%58 = icmp eq i32 %57, 0
br i1 %58, label %76, label %59
59: ; preds = %55
%60 = call i32 @snprintf(i8* %9, i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %40, i8* %1)
%61 = icmp slt i32 %60, 0
%62 = sext i32 %60 to i64
%63 = icmp uge i64 %62, %7
%64 = select i1 %61, i1 true, i1 %63
br i1 %64, label %76, label %65
65: ; preds = %59
%66 = load i32, i32* @X_OK
%67 = call i64 @access(i8* %9, i32 %66)
%68 = icmp slt i64 %67, 0
br i1 %68, label %76, label %69
69: ; preds = %65
%70 = icmp sgt i32 %3, 0
%71 = and i1 %27, %70
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = call i32 @strlcpy(i8* %2, i8* %9, i32 %3)
%74 = icmp slt i32 %73, %3
br i1 %74, label %75, label %78
75: ; preds = %72, %69
br label %78
76: ; preds = %65, %59, %55, %51
%77 = icmp eq i8* %52, null
br i1 %77, label %78, label %39
78: ; preds = %39, %76, %72, %33, %17, %75
%79 = phi i32 [ 0, %75 ], [ -1, %17 ], [ -1, %33 ], [ 1, %72 ], [ -1, %76 ], [ -1, %39 ]
ret i32 %79
}