#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__ check_executable(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *getcwd(char *, int);
char *getenv(char *);
int /*<<< orphan*/ lt_debugprintf(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ lt_fatal(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int /*<<< orphan*/ nonempty(char const *);
int /*<<< orphan*/ nonnull(int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
size_t strlen(char const *);
scalar_t__ xmalloc(size_t);
char *xstrdup(char const *);
char *find_executable(const char *wrapper) {
  int has_slash = 0;
  const char *p;
  const char *p_next;
  char tmp[1024 + 1];
  size_t tmp_len;
  char *concat_name;
  lt_debugprintf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/ikdekker/stage/refs/heads/"
                 "master/lib/cpputest-3.8/.libs/lt-CppUTestTests.c",
                 393, "(find_executable): %s\n", nonempty(wrapper));
  if ((wrapper == NULL) || (*wrapper == '\0'))
    return NULL;
  if (((wrapper[0]) == '/')) {
    concat_name = xstrdup(wrapper);
    if (check_executable(concat_name))
      return concat_name;
    do {
      if (concat_name) {
        free(concat_name);
        concat_name = 0;
      }
    } while (0);
  }
  for (p = wrapper; *p; p++)
    if (*p == '/') {
      has_slash = 1;
      break;
    }
  if (!has_slash) {
    const char *path = getenv("PATH");
    if (path != NULL) {
      for (p = path; *p; p = p_next) {
        const char *q;
        size_t p_len;
        for (q = p; *q; q++)
          if (((*q) == ':'))
            break;
        p_len = (size_t)(q - p);
        p_next = (*q == '\0' ? q : q + 1);
        if (p_len == 0) {
          if (getcwd(tmp, 1024) == NULL)
            lt_fatal("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/ikdekker/stage/refs/"
                     "heads/master/lib/cpputest-3.8/.libs/lt-CppUTestTests.c",
                     447, "getcwd failed: %s", nonnull(strerror(errno)));
          tmp_len = strlen(tmp);
          concat_name = ((char *)xmalloc((tmp_len + 1 + strlen(wrapper) + 1) *
                                         sizeof(char)));
          memcpy(concat_name, tmp, tmp_len);
          concat_name[tmp_len] = '/';
          strcpy(concat_name + tmp_len + 1, wrapper);
        } else {
          concat_name = ((char *)xmalloc((p_len + 1 + strlen(wrapper) + 1) *
                                         sizeof(char)));
          memcpy(concat_name, p, p_len);
          concat_name[p_len] = '/';
          strcpy(concat_name + p_len + 1, wrapper);
        }
        if (check_executable(concat_name))
          return concat_name;
        do {
          if (concat_name) {
            free(concat_name);
            concat_name = 0;
          }
        } while (0);
      }
    }
  }
  if (getcwd(tmp, 1024) == NULL)
    lt_fatal("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/ikdekker/stage/refs/heads/master/lib/"
             "cpputest-3.8/.libs/lt-CppUTestTests.c",
             473, "getcwd failed: %s", nonnull(strerror(errno)));
  tmp_len = strlen(tmp);
  concat_name =
      ((char *)xmalloc((tmp_len + 1 + strlen(wrapper) + 1) * sizeof(char)));
  memcpy(concat_name, tmp, tmp_len);
  concat_name[tmp_len] = '/';
  strcpy(concat_name + tmp_len + 1, wrapper);
  if (check_executable(concat_name))
    return concat_name;
  do {
    if (concat_name) {
      free(concat_name);
      concat_name = 0;
    }
  } while (0);
  return NULL;
}


x86 assembly (clang, -O0):
<find_executable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <nonempty@plt>
mov    %eax,%ecx
lea    0xdf8(%rip),%rdi
mov    $0x189,%esi
lea    0xe91(%rip),%rdx
call   10f0 <lt_debugprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1234 <find_executable+0x54>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1241 <find_executable+0x61>
movq   $0x0,-0x8(%rbp)
jmp    1704 <find_executable+0x524>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    12bb <find_executable+0xdb>
mov    -0x10(%rbp),%rdi
call   10b0 <xstrdup@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
call   10e0 <check_executable@plt>
cmp    $0x0,%rax
je     1287 <find_executable+0xa7>
mov    -0x440(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1704 <find_executable+0x524>
jmp    128c <find_executable+0xac>
cmpq   $0x0,-0x440(%rbp)
je     12b1 <find_executable+0xd1>
mov    -0x440(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x440(%rbp)
jmp    12b6 <find_executable+0xd6>
jmp    12bb <find_executable+0xdb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     1302 <find_executable+0x122>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    12ec <find_executable+0x10c>
movl   $0x1,-0x14(%rbp)
jmp    1302 <find_executable+0x122>
jmp    12f1 <find_executable+0x111>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    12c3 <find_executable+0xe3>
cmpl   $0x0,-0x14(%rbp)
jne    15ca <find_executable+0x3ea>
lea    0xda9(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x448(%rbp)
je     15c5 <find_executable+0x3e5>
mov    -0x448(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     15c0 <find_executable+0x3e0>
mov    -0x20(%rbp),%rax
mov    %rax,-0x450(%rbp)
mov    -0x450(%rbp),%rax
cmpb   $0x0,(%rax)
je     1394 <find_executable+0x1b4>
mov    -0x450(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1378 <find_executable+0x198>
jmp    1394 <find_executable+0x1b4>
jmp    137d <find_executable+0x19d>
mov    -0x450(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x450(%rbp)
jmp    1350 <find_executable+0x170>
mov    -0x450(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x458(%rbp)
mov    -0x450(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    13cf <find_executable+0x1ef>
mov    -0x450(%rbp),%rax
mov    %rax,-0x460(%rbp)
jmp    13e1 <find_executable+0x201>
mov    -0x450(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x460(%rbp)
mov    -0x460(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x458(%rbp)
jne    14dc <find_executable+0x2fc>
lea    -0x430(%rbp),%rdi
mov    $0x400,%esi
call   1090 <getcwd@plt>
cmp    $0x0,%rax
jne    1444 <find_executable+0x264>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10c0 <nonnull@plt>
mov    %eax,%ecx
lea    0xbcd(%rip),%rdi
mov    $0x1bf,%esi
lea    0xc82(%rip),%rdx
call   1050 <lt_fatal@plt>
lea    -0x430(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x468(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x468(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   10a0 <xmalloc@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x438(%rbp),%rdx
call   10d0 <memcpy@plt>
mov    -0x440(%rbp),%rax
mov    -0x438(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
mov    -0x440(%rbp),%rdi
add    -0x438(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcpy@plt>
jmp    1559 <find_executable+0x379>
mov    -0x458(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x470(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x470(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   10a0 <xmalloc@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x458(%rbp),%rdx
call   10d0 <memcpy@plt>
mov    -0x440(%rbp),%rax
mov    -0x458(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
mov    -0x440(%rbp),%rdi
add    -0x458(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x440(%rbp),%rdi
call   10e0 <check_executable@plt>
cmp    $0x0,%rax
je     157f <find_executable+0x39f>
mov    -0x440(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1704 <find_executable+0x524>
jmp    1584 <find_executable+0x3a4>
cmpq   $0x0,-0x440(%rbp)
je     15a9 <find_executable+0x3c9>
mov    -0x440(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x440(%rbp)
jmp    15ae <find_executable+0x3ce>
jmp    15b3 <find_executable+0x3d3>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1338 <find_executable+0x158>
jmp    15c5 <find_executable+0x3e5>
jmp    15ca <find_executable+0x3ea>
lea    -0x430(%rbp),%rdi
mov    $0x400,%esi
call   1090 <getcwd@plt>
cmp    $0x0,%rax
jne    1614 <find_executable+0x434>
mov    0x29f4(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10c0 <nonnull@plt>
mov    %eax,%ecx
lea    0x9fd(%rip),%rdi
mov    $0x1d9,%esi
lea    0xab2(%rip),%rdx
call   1050 <lt_fatal@plt>
lea    -0x430(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x478(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x478(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   10a0 <xmalloc@plt>
mov    %rax,-0x440(%rbp)
mov    -0x440(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    -0x438(%rbp),%rdx
call   10d0 <memcpy@plt>
mov    -0x440(%rbp),%rax
mov    -0x438(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
mov    -0x440(%rbp),%rdi
add    -0x438(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcpy@plt>
mov    -0x440(%rbp),%rdi
call   10e0 <check_executable@plt>
cmp    $0x0,%rax
je     16cd <find_executable+0x4ed>
mov    -0x440(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1704 <find_executable+0x524>
jmp    16d2 <find_executable+0x4f2>
cmpq   $0x0,-0x440(%rbp)
je     16f7 <find_executable+0x517>
mov    -0x440(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x440(%rbp)
jmp    16fc <find_executable+0x51c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_executable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%r13
call   1070 <nonempty@plt>
lea    0xe00(%rip),%rdi
lea    0xe9e(%rip),%rdx
mov    $0x189,%esi
mov    %eax,%ecx
call   10f0 <lt_debugprintf@plt>
test   %r13,%r13
je     1462 <find_executable+0x282>
mov    0x0(%r13),%al
test   %al,%al
je     1462 <find_executable+0x282>
cmp    $0x2f,%al
jne    1255 <find_executable+0x75>
mov    %r13,%rdi
call   10b0 <xstrdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10e0 <check_executable@plt>
test   %rax,%rax
jne    1464 <find_executable+0x284>
test   %rbx,%rbx
je     1255 <find_executable+0x75>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    %r13,%rax
nopl   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
test   %cl,%cl
je     1276 <find_executable+0x96>
cmp    $0x2f,%cl
je     13bf <find_executable+0x1df>
add    $0x1,%rax
jmp    1260 <find_executable+0x80>
lea    0xe3f(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     13bf <find_executable+0x1df>
mov    %rax,%rbp
mov    (%rax),%al
test   %al,%al
je     13bf <find_executable+0x1df>
mov    %rsp,%r15
nopl   0x0(%rax,%rax,1)
mov    $0x2,%r12d
test   %al,%al
je     12c2 <find_executable+0xe2>
nopw   0x0(%rax,%rax,1)
cmp    $0x3a,%al
je     12c2 <find_executable+0xe2>
movzbl -0x1(%rbp,%r12,1),%eax
add    $0x1,%r12
test   %al,%al
jne    12b0 <find_executable+0xd0>
cmp    $0x1,%al
mov    %rbp,%r14
sbb    $0xffffffffffffffff,%r14
cmp    $0x2,%r12
jne    1350 <find_executable+0x170>
mov    %r15,%rdi
mov    $0x400,%esi
call   1090 <getcwd@plt>
test   %rax,%rax
jne    1312 <find_executable+0x132>
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10c0 <nonnull@plt>
lea    0xd01(%rip),%rdi
mov    $0x1bf,%esi
lea    0xdb6(%rip),%rdx
mov    %eax,%ecx
call   1050 <lt_fatal@plt>
mov    %r15,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1080 <strlen@plt>
lea    (%rax,%rbp,1),%rdi
add    $0x2,%rdi
call   10a0 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   10d0 <memcpy@plt>
mov    %rbx,%rdi
add    %rbp,%rdi
jmp    1382 <find_executable+0x1a2>
nopl   0x0(%rax,%rax,1)
lea    -0x2(%r12),%r15
mov    %r13,%rdi
call   1080 <strlen@plt>
lea    (%rax,%r12,1),%rdi
call   10a0 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %rsp,%r15
call   10d0 <memcpy@plt>
lea    (%rbx,%r12,1),%rdi
add    $0xfffffffffffffffe,%rdi
movb   $0x2f,(%rdi)
add    $0x1,%rdi
mov    %r13,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   10e0 <check_executable@plt>
test   %rax,%rax
jne    1464 <find_executable+0x284>
lea    (%r14,%r12,1),%rbp
add    $0xfffffffffffffffe,%rbp
mov    %rbx,%rdi
call   1040 <free@plt>
mov    -0x2(%r14,%r12,1),%al
test   %al,%al
jne    12a0 <find_executable+0xc0>
mov    %rsp,%rdi
mov    $0x400,%esi
call   1090 <getcwd@plt>
test   %rax,%rax
jne    1400 <find_executable+0x220>
mov    0x2c08(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %eax,%edi
call   10c0 <nonnull@plt>
lea    0xc13(%rip),%rdi
lea    0xccd(%rip),%rdx
mov    $0x1d9,%esi
mov    %eax,%ecx
call   1050 <lt_fatal@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1080 <strlen@plt>
lea    (%rax,%rbp,1),%rdi
add    $0x2,%rdi
call   10a0 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
call   10d0 <memcpy@plt>
movb   $0x2f,(%rbx,%rbp,1)
lea    (%rbx,%rbp,1),%rdi
add    $0x1,%rdi
mov    %r13,%rsi
call   1060 <strcpy@plt>
mov    %rbx,%rdi
call   10e0 <check_executable@plt>
test   %rax,%rax
jne    1464 <find_executable+0x284>
test   %rbx,%rbx
je     1462 <find_executable+0x282>
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [165 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ikdekker/stage/refs/heads/master/lib/cpputest-3.8/.libs/lt-CppUTestTests.c\00"
@.str.1 = [23 x i8] c"(find_executable): %s\0A\00"
@.str.2 = [5 x i8] c"PATH\00"
@.str.3 = [18 x i8] c"getcwd failed: %s\00"
@errno = global i32 0
define i8* @find_executable(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1025 x i8]
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i64
store i8* %0, i8** %3
store i32 0, i32* %4
%13 = load i8*, i8** %3
%14 = call i32 @nonempty(i8* %13)
%15 = call i32 @lt_debugprintf(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i32 393, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i8*, i8** %3
%17 = icmp eq i8* %16, null
br i1 %17, label %23, label %18
18: ; preds = %1
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18, %1
store i8* null, i8** %2
br label %235
24: ; preds = %18
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 47
br i1 %29, label %30, label %47
30: ; preds = %24
%31 = load i8*, i8** %3
%32 = call i8* @xstrdup(i8* %31)
store i8* %32, i8** %9
%33 = load i8*, i8** %9
%34 = call i64 @check_executable(i8* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = load i8*, i8** %9
store i8* %37, i8** %2
br label %235
38: ; preds = %30
br label %39
39: ; preds = %38
%40 = load i8*, i8** %9
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i8*, i8** %9
%44 = call i32 @free(i8* %43)
store i8* null, i8** %9
br label %45
45: ; preds = %42, %39
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46, %24
%48 = load i8*, i8** %3
store i8* %48, i8** %5
br label %49
49: ; preds = %60, %47
%50 = load i8*, i8** %5
%51 = load i8, i8* %50
%52 = icmp ne i8 %51, 0
br i1 %52, label %53, label %63
53: ; preds = %49
%54 = load i8*, i8** %5
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 47
br i1 %57, label %58, label %59
58: ; preds = %53
store i32 1, i32* %4
br label %63
59: ; preds = %53
br label %60
60: ; preds = %59
%61 = load i8*, i8** %5
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %5
br label %49
63: ; preds = %58, %49
%64 = load i32, i32* %4
%65 = icmp ne i32 %64, 0
br i1 %65, label %187, label %66
66: ; preds = %63
%67 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %67, i8** %10
%68 = load i8*, i8** %10
%69 = icmp ne i8* %68, null
br i1 %69, label %70, label %186
70: ; preds = %66
%71 = load i8*, i8** %10
store i8* %71, i8** %5
br label %72
72: ; preds = %183, %70
%73 = load i8*, i8** %5
%74 = load i8, i8* %73
%75 = icmp ne i8 %74, 0
br i1 %75, label %76, label %185
76: ; preds = %72
%77 = load i8*, i8** %5
store i8* %77, i8** %11
br label %78
78: ; preds = %89, %76
%79 = load i8*, i8** %11
%80 = load i8, i8* %79
%81 = icmp ne i8 %80, 0
br i1 %81, label %82, label %92
82: ; preds = %78
%83 = load i8*, i8** %11
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = icmp eq i32 %85, 58
br i1 %86, label %87, label %88
87: ; preds = %82
br label %92
88: ; preds = %82
br label %89
89: ; preds = %88
%90 = load i8*, i8** %11
%91 = getelementptr inbounds i8, i8* %90, i32 1
store i8* %91, i8** %11
br label %78
92: ; preds = %87, %78
%93 = load i8*, i8** %11
%94 = load i8*, i8** %5
%95 = ptrtoint i8* %93 to i64
%96 = ptrtoint i8* %94 to i64
%97 = sub i64 %95, %96
store i64 %97, i64* %12
%98 = load i8*, i8** %11
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %92
%103 = load i8*, i8** %11
br label %107
104: ; preds = %92
%105 = load i8*, i8** %11
%106 = getelementptr inbounds i8, i8* %105, i64 1
br label %107
107: ; preds = %104, %102
%108 = phi i8* [ %103, %102 ], [ %106, %104 ]
store i8* %108, i8** %6
%109 = load i64, i64* %12
%110 = icmp eq i64 %109, 0
br i1 %110, label %111, label %145
111: ; preds = %107
%112 = getelementptr inbounds [1025 x i8], [1025 x i8]* %7, i64 0, i64 0
%113 = call i32* @getcwd(i8* %112, i32 1024)
%114 = icmp eq i32* %113, null
br i1 %114, label %115, label %120
115: ; preds = %111
%116 = load i32, i32* @errno
%117 = call i32 @strerror(i32 %116)
%118 = call i32 @nonnull(i32 %117)
%119 = call i32 @lt_fatal(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i32 447, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %118)
br label %120
120: ; preds = %115, %111
%121 = getelementptr inbounds [1025 x i8], [1025 x i8]* %7, i64 0, i64 0
%122 = call i64 @strlen(i8* %121)
store i64 %122, i64* %8
%123 = load i64, i64* %8
%124 = add i64 %123, 1
%125 = load i8*, i8** %3
%126 = call i64 @strlen(i8* %125)
%127 = add i64 %124, %126
%128 = add i64 %127, 1
%129 = mul i64 %128, 1
%130 = call i64 @xmalloc(i64 %129)
%131 = inttoptr i64 %130 to i8*
store i8* %131, i8** %9
%132 = load i8*, i8** %9
%133 = getelementptr inbounds [1025 x i8], [1025 x i8]* %7, i64 0, i64 0
%134 = load i64, i64* %8
%135 = call i32 @memcpy(i8* %132, i8* %133, i64 %134)
%136 = load i8*, i8** %9
%137 = load i64, i64* %8
%138 = getelementptr inbounds i8, i8* %136, i64 %137
store i8 47, i8* %138
%139 = load i8*, i8** %9
%140 = load i64, i64* %8
%141 = getelementptr inbounds i8, i8* %139, i64 %140
%142 = getelementptr inbounds i8, i8* %141, i64 1
%143 = load i8*, i8** %3
%144 = call i32 @strcpy(i8* %142, i8* %143)
br label %168
145: ; preds = %107
%146 = load i64, i64* %12
%147 = add i64 %146, 1
%148 = load i8*, i8** %3
%149 = call i64 @strlen(i8* %148)
%150 = add i64 %147, %149
%151 = add i64 %150, 1
%152 = mul i64 %151, 1
%153 = call i64 @xmalloc(i64 %152)
%154 = inttoptr i64 %153 to i8*
store i8* %154, i8** %9
%155 = load i8*, i8** %9
%156 = load i8*, i8** %5
%157 = load i64, i64* %12
%158 = call i32 @memcpy(i8* %155, i8* %156, i64 %157)
%159 = load i8*, i8** %9
%160 = load i64, i64* %12
%161 = getelementptr inbounds i8, i8* %159, i64 %160
store i8 47, i8* %161
%162 = load i8*, i8** %9
%163 = load i64, i64* %12
%164 = getelementptr inbounds i8, i8* %162, i64 %163
%165 = getelementptr inbounds i8, i8* %164, i64 1
%166 = load i8*, i8** %3
%167 = call i32 @strcpy(i8* %165, i8* %166)
br label %168
168: ; preds = %145, %120
%169 = load i8*, i8** %9
%170 = call i64 @check_executable(i8* %169)
%171 = icmp ne i64 %170, 0
br i1 %171, label %172, label %174
172: ; preds = %168
%173 = load i8*, i8** %9
store i8* %173, i8** %2
br label %235
174: ; preds = %168
br label %175
175: ; preds = %174
%176 = load i8*, i8** %9
%177 = icmp ne i8* %176, null
br i1 %177, label %178, label %181
178: ; preds = %175
%179 = load i8*, i8** %9
%180 = call i32 @free(i8* %179)
store i8* null, i8** %9
br label %181
181: ; preds = %178, %175
br label %182
182: ; preds = %181
br label %183
183: ; preds = %182
%184 = load i8*, i8** %6
store i8* %184, i8** %5
br label %72
185: ; preds = %72
br label %186
186: ; preds = %185, %66
br label %187
187: ; preds = %186, %63
%188 = getelementptr inbounds [1025 x i8], [1025 x i8]* %7, i64 0, i64 0
%189 = call i32* @getcwd(i8* %188, i32 1024)
%190 = icmp eq i32* %189, null
br i1 %190, label %191, label %196
191: ; preds = %187
%192 = load i32, i32* @errno
%193 = call i32 @strerror(i32 %192)
%194 = call i32 @nonnull(i32 %193)
%195 = call i32 @lt_fatal(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i32 473, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %194)
br label %196
196: ; preds = %191, %187
%197 = getelementptr inbounds [1025 x i8], [1025 x i8]* %7, i64 0, i64 0
%198 = call i64 @strlen(i8* %197)
store i64 %198, i64* %8
%199 = load i64, i64* %8
%200 = add i64 %199, 1
%201 = load i8*, i8** %3
%202 = call i64 @strlen(i8* %201)
%203 = add i64 %200, %202
%204 = add i64 %203, 1
%205 = mul i64 %204, 1
%206 = call i64 @xmalloc(i64 %205)
%207 = inttoptr i64 %206 to i8*
store i8* %207, i8** %9
%208 = load i8*, i8** %9
%209 = getelementptr inbounds [1025 x i8], [1025 x i8]* %7, i64 0, i64 0
%210 = load i64, i64* %8
%211 = call i32 @memcpy(i8* %208, i8* %209, i64 %210)
%212 = load i8*, i8** %9
%213 = load i64, i64* %8
%214 = getelementptr inbounds i8, i8* %212, i64 %213
store i8 47, i8* %214
%215 = load i8*, i8** %9
%216 = load i64, i64* %8
%217 = getelementptr inbounds i8, i8* %215, i64 %216
%218 = getelementptr inbounds i8, i8* %217, i64 1
%219 = load i8*, i8** %3
%220 = call i32 @strcpy(i8* %218, i8* %219)
%221 = load i8*, i8** %9
%222 = call i64 @check_executable(i8* %221)
%223 = icmp ne i64 %222, 0
br i1 %223, label %224, label %226
224: ; preds = %196
%225 = load i8*, i8** %9
store i8* %225, i8** %2
br label %235
226: ; preds = %196
br label %227
227: ; preds = %226
%228 = load i8*, i8** %9
%229 = icmp ne i8* %228, null
br i1 %229, label %230, label %233
230: ; preds = %227
%231 = load i8*, i8** %9
%232 = call i32 @free(i8* %231)
store i8* null, i8** %9
br label %233
233: ; preds = %230, %227
br label %234
234: ; preds = %233
store i8* null, i8** %2
br label %235
235: ; preds = %234, %224, %172, %36, %23
%236 = load i8*, i8** %2
ret i8* %236
}

LLVM IR (-O2):
@.str = [165 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ikdekker/stage/refs/heads/master/lib/cpputest-3.8/.libs/lt-CppUTestTests.c\00"
@.str.1 = [23 x i8] c"(find_executable): %s\0A\00"
@.str.2 = [5 x i8] c"PATH\00"
@.str.3 = [18 x i8] c"getcwd failed: %s\00"
@errno = global i32 0
define i8* @find_executable(i8* %0) {
%2 = alloca [1025 x i8]
%3 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @nonempty(i8* %0)
%5 = tail call i32 @lt_debugprintf(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i32 393, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = icmp eq i8* %0, null
br i1 %6, label %107, label %7
7: ; preds = %1
%8 = load i8, i8* %0
switch i8 %8, label %17 [
i8 0, label %107
i8 47, label %9
]
9: ; preds = %7
%10 = tail call i8* @xstrdup(i8* %0)
%11 = tail call i64 @check_executable(i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %107
13: ; preds = %9
%14 = icmp eq i8* %10, null
br i1 %14, label %17, label %15
15: ; preds = %13
%16 = tail call i32 @free(i8* %10)
br label %17
17: ; preds = %7, %13, %15
br label %18
18: ; preds = %17, %21
%19 = phi i8* [ %22, %21 ], [ %0, %17 ]
%20 = load i8, i8* %19
switch i8 %20, label %21 [
i8 0, label %23
i8 47, label %82
]
21: ; preds = %18
%22 = getelementptr inbounds i8, i8* %19, i64 1
br label %18
23: ; preds = %18
%24 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i8* %24, null
br i1 %25, label %82, label %26
26: ; preds = %23
%27 = load i8, i8* %24
%28 = icmp eq i8 %27, 0
br i1 %28, label %82, label %29
29: ; preds = %26, %78
%30 = phi i8 [ %80, %78 ], [ %27, %26 ]
%31 = phi i8* [ %44, %78 ], [ %24, %26 ]
br label %32
32: ; preds = %29, %35
%33 = phi i8 [ %37, %35 ], [ %30, %29 ]
%34 = phi i8* [ %36, %35 ], [ %31, %29 ]
switch i8 %33, label %35 [
i8 0, label %38
i8 58, label %38
]
35: ; preds = %32
%36 = getelementptr inbounds i8, i8* %34, i64 1
%37 = load i8, i8* %36
br label %32
38: ; preds = %32, %32
%39 = ptrtoint i8* %34 to i64
%40 = ptrtoint i8* %31 to i64
%41 = sub i64 %39, %40
%42 = icmp ne i8 %33, 0
%43 = zext i1 %42 to i64
%44 = getelementptr i8, i8* %34, i64 %43
%45 = icmp eq i64 %41, 0
br i1 %45, label %46, label %63
46: ; preds = %38
%47 = call i32* @getcwd(i8* %3, i32 1024)
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = load i32, i32* @errno
%51 = call i32 @strerror(i32 %50)
%52 = call i32 @nonnull(i32 %51)
%53 = call i32 @lt_fatal(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i32 447, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %49, %46
%55 = call i64 @strlen(i8* %3)
%56 = call i64 @strlen(i8* %0)
%57 = add i64 %55, 2
%58 = add i64 %57, %56
%59 = call i64 @xmalloc(i64 %58)
%60 = inttoptr i64 %59 to i8*
%61 = call i32 @memcpy(i8* %60, i8* %3, i64 %55)
%62 = getelementptr inbounds i8, i8* %60, i64 %55
br label %71
63: ; preds = %38
%64 = call i64 @strlen(i8* %0)
%65 = add i64 %41, 2
%66 = add i64 %65, %64
%67 = call i64 @xmalloc(i64 %66)
%68 = inttoptr i64 %67 to i8*
%69 = call i32 @memcpy(i8* %68, i8* %31, i64 %41)
%70 = getelementptr inbounds i8, i8* %68, i64 %41
br label %71
71: ; preds = %63, %54
%72 = phi i8* [ %70, %63 ], [ %62, %54 ]
%73 = phi i8* [ %68, %63 ], [ %60, %54 ]
store i8 47, i8* %72
%74 = getelementptr inbounds i8, i8* %72, i64 1
%75 = call i32 @strcpy(i8* %74, i8* %0)
%76 = call i64 @check_executable(i8* %73)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %107
78: ; preds = %71
%79 = call i32 @free(i8* %73)
%80 = load i8, i8* %44
%81 = icmp eq i8 %80, 0
br i1 %81, label %82, label %29
82: ; preds = %18, %78, %26, %23
%83 = call i32* @getcwd(i8* %3, i32 1024)
%84 = icmp eq i32* %83, null
br i1 %84, label %85, label %90
85: ; preds = %82
%86 = load i32, i32* @errno
%87 = call i32 @strerror(i32 %86)
%88 = call i32 @nonnull(i32 %87)
%89 = call i32 @lt_fatal(i8* getelementptr inbounds ([165 x i8], [165 x i8]* @.str, i64 0, i64 0), i32 473, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %88)
br label %90
90: ; preds = %85, %82
%91 = call i64 @strlen(i8* %3)
%92 = call i64 @strlen(i8* %0)
%93 = add i64 %91, 2
%94 = add i64 %93, %92
%95 = call i64 @xmalloc(i64 %94)
%96 = inttoptr i64 %95 to i8*
%97 = call i32 @memcpy(i8* %96, i8* %3, i64 %91)
%98 = getelementptr inbounds i8, i8* %96, i64 %91
store i8 47, i8* %98
%99 = getelementptr inbounds i8, i8* %98, i64 1
%100 = call i32 @strcpy(i8* %99, i8* %0)
%101 = call i64 @check_executable(i8* %96)
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %107
103: ; preds = %90
%104 = icmp eq i64 %95, 0
br i1 %104, label %107, label %105
105: ; preds = %103
%106 = call i32 @free(i8* %96)
br label %107
107: ; preds = %71, %103, %105, %90, %9, %7, %1
%108 = phi i8* [ null, %7 ], [ null, %1 ], [ %10, %9 ], [ %96, %90 ], [ null, %105 ], [ null, %103 ], [ %73, %71 ]
ret i8* %108
}