#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ memmove(char *, char *, int);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *strchr(char *, char);
int strlen(char *);
int strspn(char *, char *);
char *whichpath(char *program, int *nlocate) {
  static char pathbuff[256];
  char command[256];
  FILE *whichout = NULL;
  int nchars = 0, pathchar;
  char *path = NULL;
  char *locatepath();
  int islocate = (nlocate == NULL ? 1 : (*nlocate != 0 ? 1 : 0));
  if (!1)
    return (NULL);
  if (((program) == NULL ? 1 : (*(program) == '\000' ? 1 : 0)))
    goto end_of_job;
  sprintf(command, "which %s", program);
  whichout = popen(command, "r");
  if (whichout == NULL)
    goto end_of_job;
  while ((pathchar = fgetc(whichout)) != EOF) {
    pathbuff[nchars] = (char)pathchar;
    if (++nchars >= 255)
      break;
  }
  pathbuff[nchars] = '\000';
  if ((pathbuff) != NULL) {
    int thislen = strlen(pathbuff);
    while (--thislen >= 0)
      if ((((pathbuff)[thislen]) != '\000' &&
           !((" \t\n\r\f\v") == NULL ? 1
                                     : (*(" \t\n\r\f\v") == '\000' ? 1 : 0)) &&
           strchr((" \t\n\r\f\v"), ((pathbuff)[thislen])) != (char *)NULL))
        (pathbuff)[thislen] = '\000';
      else
        break;
    if ((thislen = strspn((pathbuff), " \t\n\r\f\v")) > 0) {
      if ((thislen) != 0) {
        if (!((((pathbuff))) == NULL ? 1
                                     : (*(((pathbuff))) == '\000' ? 1 : 0))) {
          int thislen3 = strlen((pathbuff));
          if ((thislen) >= thislen3)
            *((pathbuff)) = '\000';
          else
            memmove(((pathbuff)), ((pathbuff)) + (thislen),
                    1 + thislen3 - (thislen));
        }
      } else
        ;
    }
  } else
    ;
  pclose(whichout);
  if (nchars > 0) {
    path = pathbuff;
    if (islocate && nlocate != NULL)
      *nlocate = 0;
  }
end_of_job:
  if (path == NULL)
    if (islocate)
      path = locatepath(program, nlocate);
  return (path);
}


x86 assembly (clang, -O0):
<whichpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x118(%rbp)
movl   $0x0,-0x11c(%rbp)
movq   $0x0,-0x128(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11de <whichpath+0x4e>
mov    $0x1,%eax
mov    %eax,-0x138(%rbp)
jmp    11f7 <whichpath+0x67>
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x138(%rbp)
mov    -0x138(%rbp),%eax
mov    %eax,-0x12c(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    121d <whichpath+0x8d>
mov    $0x1,%al
test   $0x1,%al
jne    124b <whichpath+0xbb>
jmp    1250 <whichpath+0xc0>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    123c <whichpath+0xac>
mov    $0x1,%al
test   $0x1,%al
jne    124b <whichpath+0xbb>
jmp    1250 <whichpath+0xc0>
xor    %eax,%eax
test   $0x1,%al
jne    124b <whichpath+0xbb>
jmp    1250 <whichpath+0xc0>
jmp    14d5 <whichpath+0x345>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xd9e(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xd94(%rip),%rsi
call   10a0 <popen@plt>
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
jne    1294 <whichpath+0x104>
jmp    14d5 <whichpath+0x345>
jmp    1299 <whichpath+0x109>
mov    -0x118(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x120(%rbp)
mov    0x2d36(%rip),%rcx
cmp    (%rcx),%eax
je     12f7 <whichpath+0x167>
mov    -0x120(%rbp),%eax
mov    %al,%dl
movslq -0x11c(%rbp),%rcx
lea    0x2db0(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
cmp    $0xff,%eax
jl     12f2 <whichpath+0x162>
jmp    12f7 <whichpath+0x167>
jmp    1299 <whichpath+0x109>
movslq -0x11c(%rbp),%rcx
lea    0x2d7b(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2d70(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x130(%rbp)
mov    -0x130(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x130(%rbp)
cmp    $0x0,%eax
jl     1397 <whichpath+0x207>
movslq -0x130(%rbp),%rcx
lea    0x2d3f(%rip),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     138d <whichpath+0x1fd>
movslq -0x130(%rbp),%rcx
lea    0xcaf(%rip),%rdi
lea    0x2d1d(%rip),%rax
movsbl (%rax,%rcx,1),%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     138d <whichpath+0x1fd>
movslq -0x130(%rbp),%rcx
lea    0x2cfc(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    1392 <whichpath+0x202>
jmp    1397 <whichpath+0x207>
jmp    131b <whichpath+0x18b>
lea    0x2ce2(%rip),%rdi
lea    0xc66(%rip),%rsi
call   1080 <strspn@plt>
mov    %eax,-0x130(%rbp)
cmp    $0x0,%eax
jle    1482 <whichpath+0x2f2>
cmpl   $0x0,-0x130(%rbp)
je     1478 <whichpath+0x2e8>
xor    %eax,%eax
test   $0x1,%al
jne    13d5 <whichpath+0x245>
jmp    13e4 <whichpath+0x254>
mov    $0x1,%al
test   $0x1,%al
jne    1473 <whichpath+0x2e3>
jmp    1412 <whichpath+0x282>
movsbl 0x2c95(%rip),%eax
cmp    $0x0,%eax
jne    1403 <whichpath+0x273>
mov    $0x1,%al
test   $0x1,%al
jne    1473 <whichpath+0x2e3>
jmp    1412 <whichpath+0x282>
xor    %eax,%eax
test   $0x1,%al
jne    1473 <whichpath+0x2e3>
jmp    1412 <whichpath+0x282>
lea    0x2c67(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x134(%rbp)
mov    -0x130(%rbp),%eax
cmp    -0x134(%rbp),%eax
jl     1442 <whichpath+0x2b2>
movb   $0x0,0x2c43(%rip)
jmp    146e <whichpath+0x2de>
movslq -0x130(%rbp),%rax
lea    0x2c30(%rip),%rsi
add    %rax,%rsi
mov    -0x134(%rbp),%edx
add    $0x1,%edx
sub    -0x130(%rbp),%edx
lea    0x2c17(%rip),%rdi
call   1090 <memmove@plt>
jmp    1473 <whichpath+0x2e3>
jmp    147d <whichpath+0x2ed>
jmp    147d <whichpath+0x2ed>
jmp    1482 <whichpath+0x2f2>
mov    -0x118(%rbp),%rdi
call   1060 <pclose@plt>
cmpl   $0x0,-0x11c(%rbp)
jle    14d0 <whichpath+0x340>
lea    0x2bde(%rip),%rax
mov    %rax,-0x128(%rbp)
cmpl   $0x0,-0x12c(%rbp)
je     14cb <whichpath+0x33b>
cmpq   $0x0,-0x10(%rbp)
je     14cb <whichpath+0x33b>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    14d0 <whichpath+0x340>
jmp    14d5 <whichpath+0x345>
cmpq   $0x0,-0x128(%rbp)
jne    150b <whichpath+0x37b>
cmpl   $0x0,-0x12c(%rbp)
je     1506 <whichpath+0x376>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <locatepath@plt>
mov    %rax,-0x128(%rbp)
jmp    150b <whichpath+0x37b>
mov    -0x128(%rbp),%rax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whichpath>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%rbp
mov    %rdi,%r15
test   %rsi,%rsi
je     11bf <whichpath+0x2f>
xor    %ebx,%ebx
cmpl   $0x0,0x0(%rbp)
setne  %bl
test   %r15,%r15
jne    11cd <whichpath+0x3d>
jmp    1329 <whichpath+0x199>
mov    $0x1,%ebx
test   %r15,%r15
je     1329 <whichpath+0x199>
cmpb   $0x0,(%r15)
je     1329 <whichpath+0x199>
lea    0xe22(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rdx
call   10b0 <sprintf@plt>
lea    0xe14(%rip),%rsi
mov    %r14,%rdi
call   10a0 <popen@plt>
test   %rax,%rax
je     1329 <whichpath+0x199>
mov    %rax,%r12
mov    %ebx,0x4(%rsp)
mov    %rbp,0x8(%rsp)
xor    %r14d,%r14d
mov    0x2dcc(%rip),%rbp
lea    0x2e5d(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   1070 <fgetc@plt>
cmp    0x0(%rbp),%eax
je     1254 <whichpath+0xc4>
mov    %al,(%r14,%rbx,1)
add    $0x1,%r14
cmp    $0xff,%r14
jne    1230 <whichpath+0xa0>
mov    $0xff,%r14d
movslq %r14d,%rax
movb   $0x0,(%rax,%rbx,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12a2 <whichpath+0x112>
mov    %eax,%ebp
add    $0x1,%rbp
nopl   (%rax)
lea    -0x2(%rbp),%r13d
movzbl 0x0(%r13,%rbx,1),%eax
test   %al,%al
je     12a2 <whichpath+0x112>
movsbl %al,%esi
lea    0xd83(%rip),%rdi
call   1050 <strchr@plt>
test   %rax,%rax
je     12a2 <whichpath+0x112>
movb   $0x0,0x0(%r13,%rbx,1)
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%rbp
ja     1270 <whichpath+0xe0>
lea    0x2dd7(%rip),%rbx
lea    0xd5b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strspn@plt>
test   %eax,%eax
jle    12fb <whichpath+0x16b>
cmpb   $0x0,0x2dbd(%rip)
je     12fb <whichpath+0x16b>
mov    %eax,%r13d
lea    0x2db1(%rip),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
cmp    %eax,%r13d
jge    12f4 <whichpath+0x164>
mov    %r13d,%esi
add    %rbp,%rsi
sub    %r13d,%eax
add    $0x1,%eax
mov    %rbp,%rdi
mov    %eax,%edx
call   1090 <memmove@plt>
jmp    12fb <whichpath+0x16b>
movb   $0x0,0x2d85(%rip)
mov    %rbx,%r13
mov    %r12,%rdi
call   1060 <pclose@plt>
test   %r14d,%r14d
mov    0x8(%rsp),%rbp
mov    0x4(%rsp),%ebx
jle    1329 <whichpath+0x199>
test   %rbp,%rbp
je     1324 <whichpath+0x194>
test   %ebx,%ebx
je     1324 <whichpath+0x194>
movl   $0x0,0x0(%rbp)
mov    %r13,%rax
jmp    134d <whichpath+0x1bd>
test   %ebx,%ebx
je     134b <whichpath+0x1bb>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <locatepath@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@whichpath.pathbuff = internal global [256 x i8] zeroinitializer
@.str = [9 x i8] c"which %s\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [7 x i8] c" \09\0A\0D\0C\0B\00"
define i8* @whichpath(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [256 x i8]
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32* null, i32** %6
store i32 0, i32* %7
store i8* null, i8** %9
%13 = load i32*, i32** %4
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %16
15: ; preds = %2
br label %22
16: ; preds = %2
%17 = load i32*, i32** %4
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 0
br label %22
22: ; preds = %16, %15
%23 = phi i32 [ 1, %15 ], [ %21, %16 ]
store i32 %23, i32* %10
%24 = load i8*, i8** %3
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %27
26: ; preds = %22
br i1 true, label %34, label %35
27: ; preds = %22
%28 = load i8*, i8** %3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %27
br i1 true, label %34, label %35
33: ; preds = %27
br i1 false, label %34, label %35
34: ; preds = %33, %32, %26
br label %138
35: ; preds = %33, %32, %26
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%37 = load i8*, i8** %3
%38 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%40 = call i32* @popen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %6
%41 = load i32*, i32** %6
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %44
43: ; preds = %35
br label %138
44: ; preds = %35
br label %45
45: ; preds = %60, %44
%46 = load i32*, i32** %6
%47 = call i32 @fgetc(i32* %46)
store i32 %47, i32* %8
%48 = load i32, i32* @EOF
%49 = icmp ne i32 %47, %48
br i1 %49, label %50, label %61
50: ; preds = %45
%51 = load i32, i32* %8
%52 = trunc i32 %51 to i8
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %54
store i8 %52, i8* %55
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
%58 = icmp sge i32 %57, 255
br i1 %58, label %59, label %60
59: ; preds = %50
br label %61
60: ; preds = %50
br label %45
61: ; preds = %59, %45
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %63
store i8 0, i8* %64
%65 = call i32 @strlen(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0))
store i32 %65, i32* %11
br label %66
66: ; preds = %89, %61
%67 = load i32, i32* %11
%68 = add nsw i32 %67, -1
store i32 %68, i32* %11
%69 = icmp sge i32 %68, 0
br i1 %69, label %70, label %90
70: ; preds = %66
%71 = load i32, i32* %11
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %88
77: ; preds = %70
%78 = load i32, i32* %11
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %79
%81 = load i8, i8* %80
%82 = call i8* @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8 signext %81)
%83 = icmp ne i8* %82, null
br i1 %83, label %84, label %88
84: ; preds = %77
%85 = load i32, i32* %11
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %86
store i8 0, i8* %87
br label %89
88: ; preds = %77, %70
br label %90
89: ; preds = %84
br label %66
90: ; preds = %88, %66
%91 = call i32 @strspn(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 %91, i32* %11
%92 = icmp sgt i32 %91, 0
br i1 %92, label %93, label %123
93: ; preds = %90
%94 = load i32, i32* %11
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %121
96: ; preds = %93
br i1 false, label %97, label %98
97: ; preds = %96
br i1 true, label %120, label %104
98: ; preds = %96
%99 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0)
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %103
102: ; preds = %98
br i1 true, label %120, label %104
103: ; preds = %98
br i1 false, label %120, label %104
104: ; preds = %103, %102, %97
%105 = call i32 @strlen(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0))
store i32 %105, i32* %12
%106 = load i32, i32* %11
%107 = load i32, i32* %12
%108 = icmp sge i32 %106, %107
br i1 %108, label %109, label %110
109: ; preds = %104
store i8 0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0)
br label %119
110: ; preds = %104
%111 = load i32, i32* %11
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), i64 %112
%114 = load i32, i32* %12
%115 = add nsw i32 1, %114
%116 = load i32, i32* %11
%117 = sub nsw i32 %115, %116
%118 = call i32 @memmove(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), i8* %113, i32 %117)
br label %119
119: ; preds = %110, %109
br label %120
120: ; preds = %119, %103, %102, %97
br label %122
121: ; preds = %93
br label %122
122: ; preds = %121, %120
br label %123
123: ; preds = %122, %90
%124 = load i32*, i32** %6
%125 = call i32 @pclose(i32* %124)
%126 = load i32, i32* %7
%127 = icmp sgt i32 %126, 0
br i1 %127, label %128, label %137
128: ; preds = %123
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), i8** %9
%129 = load i32, i32* %10
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %128
%132 = load i32*, i32** %4
%133 = icmp ne i32* %132, null
br i1 %133, label %134, label %136
134: ; preds = %131
%135 = load i32*, i32** %4
store i32 0, i32* %135
br label %136
136: ; preds = %134, %131, %128
br label %137
137: ; preds = %136, %123
br label %138
138: ; preds = %137, %43, %34
%139 = load i8*, i8** %9
%140 = icmp eq i8* %139, null
br i1 %140, label %141, label %149
141: ; preds = %138
%142 = load i32, i32* %10
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %148
144: ; preds = %141
%145 = load i8*, i8** %3
%146 = load i32*, i32** %4
%147 = call i8* (i8*, i32*, ...) bitcast (i8* (...)* @locatepath to i8* (i8*, i32*, ...)*)(i8* %145, i32* %146)
store i8* %147, i8** %9
br label %148
148: ; preds = %144, %141
br label %149
149: ; preds = %148, %138
%150 = load i8*, i8** %9
ret i8* %150
}

LLVM IR (-O2):
@whichpath.pathbuff = internal global [256 x i8] zeroinitializer
@.str = [9 x i8] c"which %s\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [7 x i8] c" \09\0A\0D\0C\0B\00"
define i8* @whichpath(i8* %0, i32* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32* %1, null
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %2, %6
%11 = phi i32 [ %9, %6 ], [ 1, %2 ]
%12 = icmp eq i8* %0, null
br i1 %12, label %76, label %13
13: ; preds = %10
%14 = load i8, i8* %0
%15 = icmp eq i8 %14, 0
br i1 %15, label %76, label %16
16: ; preds = %13
%17 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%18 = call i32* @popen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %76, label %20
20: ; preds = %16, %25
%21 = phi i64 [ %28, %25 ], [ 0, %16 ]
%22 = tail call i32 @fgetc(i32* %18)
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %22, %23
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = trunc i32 %22 to i8
%27 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %21
store i8 %26, i8* %27
%28 = add nuw nsw i64 %21, 1
%29 = icmp eq i64 %28, 255
br i1 %29, label %32, label %20
30: ; preds = %20
%31 = trunc i64 %21 to i32
br label %32
32: ; preds = %25, %30
%33 = phi i32 [ %31, %30 ], [ 255, %25 ]
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %34
store i8 0, i8* %35
%36 = tail call i32 @strlen(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0))
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %52
38: ; preds = %32
%39 = zext i32 %36 to i64
br label %40
40: ; preds = %38, %50
%41 = phi i64 [ %39, %38 ], [ %42, %50 ]
%42 = add nsw i64 %41, -1
%43 = and i64 %42, 4294967295
%44 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 0
br i1 %46, label %52, label %47
47: ; preds = %40
%48 = tail call i8* @strchr(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8 signext %45)
%49 = icmp eq i8* %48, null
br i1 %49, label %52, label %50
50: ; preds = %47
store i8 0, i8* %44
%51 = icmp ugt i64 %41, 1
br i1 %51, label %40, label %52
52: ; preds = %50, %47, %40, %32
%53 = tail call i32 @strspn(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%54 = icmp slt i32 %53, 1
%55 = load i8, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0)
%56 = icmp eq i8 %55, 0
%57 = select i1 %54, i1 true, i1 %56
br i1 %57, label %68, label %58
58: ; preds = %52
%59 = tail call i32 @strlen(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0))
%60 = icmp slt i32 %53, %59
br i1 %60, label %62, label %61
61: ; preds = %58
store i8 0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0)
br label %68
62: ; preds = %58
%63 = zext i32 %53 to i64
%64 = getelementptr inbounds [256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 %63
%65 = sub nsw i32 1, %53
%66 = add i32 %65, %59
%67 = tail call i32 @memmove(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), i8* %64, i32 %66)
br label %68
68: ; preds = %61, %62, %52
%69 = tail call i32 @pclose(i32* %18)
%70 = icmp sgt i32 %33, 0
br i1 %70, label %71, label %76
71: ; preds = %68
%72 = icmp ne i32 %11, 0
%73 = icmp ne i32* %1, null
%74 = and i1 %73, %72
br i1 %74, label %75, label %80
75: ; preds = %71
store i32 0, i32* %1
br label %80
76: ; preds = %68, %16, %10, %13
%77 = icmp eq i32 %11, 0
br i1 %77, label %80, label %78
78: ; preds = %76
%79 = tail call i8* (i8*, i32*, ...) bitcast (i8* (...)* @locatepath to i8* (i8*, i32*, ...)*)(i8* %0, i32* %1)
br label %80
80: ; preds = %71, %75, %78, %76
%81 = phi i8* [ %79, %78 ], [ null, %76 ], [ getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), %75 ], [ getelementptr inbounds ([256 x i8], [256 x i8]* @whichpath.pathbuff, i64 0, i64 0), %71 ]
ret i8* %81
}