#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 /*<<< orphan*/ canonical(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
char *detectApplications(char *known[], size_t total) {
  size_t i;
  char which[2048];
  char which_output[2048];
  char which_output_canonical[2048];
  FILE *pfile;
  char *applicationList;
  char canonicalList[2048 * 30];
  applicationList = (char *)malloc(2048 * total);
  applicationList[0] = '\0';
  canonicalList[0] = '\0';
  for (i = 0; i < total; i++) {
    if (known[i] != NULL) {
      which[0] = '\0';
      which_output[0] = '\0';
      which_output_canonical[0] = '\0';
      strcat(which, "which \'");
      strcat(which, known[i]);
      strcat(which, "\'");
      pfile = popen(which, "r");
      fgets(which_output, 2048, pfile);
      pclose(pfile);
      if (which_output[0] != '/') {
        continue;
      }
      while (strlen(which_output) > 0 &&
             which_output[strlen(which_output) - 1] == '\n') {
        which_output[strlen(which_output) - 1] = '\0';
      }
      strcat(which_output_canonical, which_output);
      canonical(which_output_canonical);
      if (strstr(canonicalList, which_output_canonical) == NULL) {
        if (strlen(canonicalList) > 0) {
          if (canonicalList[strlen(canonicalList) - 1] != ':')
            strcat(canonicalList, ":");
        }
        strcat(canonicalList, which_output_canonical);
        if (strstr(applicationList, which_output) == NULL) {
          if (strlen(applicationList) > 0) {
            if (applicationList[strlen(applicationList) - 1] != ':')
              strcat(applicationList, ":");
          }
          strcat(applicationList, which_output);
        }
      }
    }
  }
  if (applicationList != NULL) {
    if (strlen(applicationList) == 0) {
      free(applicationList);
      applicationList = NULL;
    }
  }
  return applicationList;
}


x86 assembly (clang, -O0):
<detectApplications>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10840,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0xb,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x1830(%rbp)
mov    -0x1830(%rbp),%rax
movb   $0x0,(%rax)
movb   $0x0,-0x10830(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1464 <detectApplications+0x2d4>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     144e <detectApplications+0x2be>
movb   $0x0,-0x820(%rbp)
movb   $0x0,-0x1020(%rbp)
movb   $0x0,-0x1820(%rbp)
lea    -0x820(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x820(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10a0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xdc5(%rip),%rsi
call   10a0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xdb4(%rip),%rsi
call   1080 <popen@plt>
mov    %rax,-0x1828(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x1828(%rbp),%rdx
mov    $0x800,%esi
call   1060 <fgets@plt>
mov    -0x1828(%rbp),%rdi
call   1050 <pclose@plt>
movsbl -0x1020(%rbp),%eax
cmp    $0x2f,%eax
je     1299 <detectApplications+0x109>
jmp    1453 <detectApplications+0x2c3>
jmp    129e <detectApplications+0x10e>
lea    -0x1020(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x10831(%rbp)
jle    12e2 <detectApplications+0x152>
lea    -0x1020(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x1020(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
sete   %al
mov    %al,-0x10831(%rbp)
mov    -0x10831(%rbp),%al
test   $0x1,%al
jne    12f5 <detectApplications+0x165>
jmp    1313 <detectApplications+0x183>
lea    -0x1020(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x1020(%rbp,%rax,1)
jmp    129e <detectApplications+0x10e>
lea    -0x1820(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
call   10a0 <strcat@plt>
lea    -0x1820(%rbp),%rdi
call   1090 <canonical@plt>
lea    -0x10830(%rbp),%rdi
lea    -0x1820(%rbp),%rsi
call   10b0 <strstr@plt>
cmp    $0x0,%rax
jne    1449 <detectApplications+0x2b9>
lea    -0x10830(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jle    139e <detectApplications+0x20e>
lea    -0x10830(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x10830(%rbp,%rax,1),%eax
ff
cmp    $0x3a,%eax
je     1399 <detectApplications+0x209>
lea    -0x10830(%rbp),%rdi
lea    0xc76(%rip),%rsi
call   10a0 <strcat@plt>
jmp    139e <detectApplications+0x20e>
lea    -0x10830(%rbp),%rdi
lea    -0x1820(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x1830(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
call   10b0 <strstr@plt>
cmp    $0x0,%rax
jne    1444 <detectApplications+0x2b4>
mov    -0x1830(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jle    1431 <detectApplications+0x2a1>
mov    -0x1830(%rbp),%rax
mov    %rax,-0x10840(%rbp)
mov    -0x1830(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x10840(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
je     142c <detectApplications+0x29c>
mov    -0x1830(%rbp),%rdi
lea    0xbe3(%rip),%rsi
call   10a0 <strcat@plt>
jmp    1431 <detectApplications+0x2a1>
mov    -0x1830(%rbp),%rdi
lea    -0x1020(%rbp),%rsi
call   10a0 <strcat@plt>
jmp    1449 <detectApplications+0x2b9>
jmp    144e <detectApplications+0x2be>
jmp    1453 <detectApplications+0x2c3>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11d2 <detectApplications+0x42>
cmpq   $0x0,-0x1830(%rbp)
je     14a3 <detectApplications+0x313>
mov    -0x1830(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jne    149e <detectApplications+0x30e>
mov    -0x1830(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x1830(%rbp)
jmp    14a3 <detectApplications+0x313>
mov    -0x1830(%rbp),%rax
add    $0x10840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detectApplications>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10818,%rsp
mov    %rsi,%r13
mov    %rdi,0x8(%rsp)
mov    %r13d,%edi
shl    $0xb,%edi
call   1070 <malloc@plt>
mov    %rax,(%rsp)
movb   $0x0,(%rax)
movb   $0x0,0x1810(%rsp)
test   %r13,%r13
je     13a9 <detectApplications+0x219>
xor    %r12d,%r12d
lea    0x810(%rsp),%rbp
lea    0x1810(%rsp),%r14
jmp    123d <detectApplications+0xad>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x10(%rsp),%r13
mov    %r13,%rdi
mov    %rbp,%rsi
call   10a0 <strcat@plt>
mov    %r13,%rdi
call   1090 <canonical@plt>
mov    %r15,%rbx
mov    %r15,%rdi
mov    %r13,%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
mov    %r14,%r13
mov    %r15,%r14
je     1316 <detectApplications+0x186>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r12
cmp    %r13,%r12
je     13a9 <detectApplications+0x219>
mov    0x8(%rsp),%rax
cmpq   $0x0,(%rax,%r12,8)
je     1230 <detectApplications+0xa0>
movb   $0x0,0x1010(%rsp)
movb   $0x0,0x810(%rsp)
movb   $0x0,0x10(%rsp)
lea    0x1010(%rsp),%rbx
mov    %rbx,%rdi
lea    0xd90(%rip),%rsi
call   10a0 <strcat@plt>
mov    0x8(%rsp),%rax
mov    (%rax,%r12,8),%rsi
mov    %rbx,%rdi
call   10a0 <strcat@plt>
mov    %rbx,%rdi
lea    0xd76(%rip),%rsi
call   10a0 <strcat@plt>
mov    %rbx,%rdi
lea    0xd69(%rip),%rsi
call   1080 <popen@plt>
mov    %r14,%r15
mov    %rax,%r14
mov    %rbp,%rdi
mov    $0x800,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
mov    %r14,%rdi
mov    %r15,%r14
call   1050 <pclose@plt>
cmpb   $0x2f,0x810(%rsp)
2f
jne    1230 <detectApplications+0xa0>
mov    %r13,%r14
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11f0 <detectApplications+0x60>
mov    %rbp,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbp,1)
jne    11f0 <detectApplications+0x60>
mov    %rbp,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbp,1)
jmp    12e0 <detectApplications+0x150>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1343 <detectApplications+0x1b3>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0x3a,-0x1(%rax,%r14,1)
je     1343 <detectApplications+0x1b3>
mov    %r14,%rdi
lea    0xccc(%rip),%rsi
call   10a0 <strcat@plt>
mov    %r14,%rdi
lea    0x10(%rsp),%rsi
call   10a0 <strcat@plt>
mov    (%rsp),%rdi
mov    %rbp,%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
jne    1230 <detectApplications+0xa0>
mov    (%rsp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1396 <detectApplications+0x206>
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0x3a,-0x1(%rax,%r14,1)
je     1396 <detectApplications+0x206>
mov    %r14,%rdi
lea    0xc79(%rip),%rsi
call   10a0 <strcat@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   10a0 <strcat@plt>
mov    %r15,%r14
jmp    1230 <detectApplications+0xa0>
mov    (%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jne    13c3 <detectApplications+0x233>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x10818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"which '\00"
@.str.1 = [2 x i8] c"'\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c":\00"
define i8* @detectApplications(i8** nocapture %0, i64 %1) {
%3 = alloca [2048 x i8]
%4 = alloca [2048 x i8]
%5 = alloca [2048 x i8]
%6 = alloca [61440 x i8]
%7 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [61440 x i8], [61440 x i8]* %6, i64 0, i64 0
%11 = trunc i64 %1 to i32
%12 = shl i32 %11, 11
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8 0, i8* %14
store i8 0, i8* %10
%15 = icmp eq i64 %1, 0
br i1 %15, label %86, label %16
16: ; preds = %2, %83
%17 = phi i64 [ %84, %83 ], [ 0, %2 ]
%18 = getelementptr inbounds i8*, i8** %0, i64 %17
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %83, label %21
21: ; preds = %16
store i8 0, i8* %7
store i8 0, i8* %8
store i8 0, i8* %9
%22 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%23 = load i8*, i8** %18
%24 = call i32 @strcat(i8* %7, i8* %23)
%25 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32* @popen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @fgets(i8* %8, i32 2048, i32* %26)
%28 = call i32 @pclose(i32* %26)
%29 = load i8, i8* %8
%30 = icmp eq i8 %29, 47
br i1 %30, label %31, label %83
31: ; preds = %21
%32 = call i32 @strlen(i8* %8)
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %48
34: ; preds = %31, %41
%35 = call i32 @strlen(i8* %8)
%36 = add nsw i32 %35, -1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 10
br i1 %40, label %41, label %48
41: ; preds = %34
%42 = call i32 @strlen(i8* %8)
%43 = add nsw i32 %42, -1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 %44
store i8 0, i8* %45
%46 = call i32 @strlen(i8* %8)
%47 = icmp sgt i32 %46, 0
br i1 %47, label %34, label %48
48: ; preds = %34, %41, %31
%49 = call i32 @strcat(i8* %9, i8* %8)
%50 = call i32 @canonical(i8* %9)
%51 = call i32* @strstr(i8* %10, i8* %9)
%52 = icmp eq i32* %51, null
br i1 %52, label %53, label %83
53: ; preds = %48
%54 = call i32 @strlen(i8* %10)
%55 = icmp sgt i32 %54, 0
br i1 %55, label %56, label %65
56: ; preds = %53
%57 = call i32 @strlen(i8* %10)
%58 = add nsw i32 %57, -1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [61440 x i8], [61440 x i8]* %6, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 58
br i1 %62, label %65, label %63
63: ; preds = %56
%64 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %65
65: ; preds = %56, %63, %53
%66 = call i32 @strcat(i8* %10, i8* %9)
%67 = call i32* @strstr(i8* %14, i8* %8)
%68 = icmp eq i32* %67, null
br i1 %68, label %69, label %83
69: ; preds = %65
%70 = call i32 @strlen(i8* %14)
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %81
72: ; preds = %69
%73 = call i32 @strlen(i8* %14)
%74 = add nsw i32 %73, -1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %14, i64 %75
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 58
br i1 %78, label %81, label %79
79: ; preds = %72
%80 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %81
81: ; preds = %72, %79, %69
%82 = call i32 @strcat(i8* %14, i8* %8)
br label %83
83: ; preds = %16, %65, %81, %48, %21
%84 = add nuw i64 %17, 1
%85 = icmp eq i64 %84, %1
br i1 %85, label %86, label %16
86: ; preds = %83, %2
%87 = call i32 @strlen(i8* %14)
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %86
%90 = call i32 @free(i8* %14)
br label %91
91: ; preds = %86, %89
%92 = phi i8* [ null, %89 ], [ %14, %86 ]
ret i8* %92
}