#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*/ X_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
scalar_t__ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int snprintf(char *, int, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int run_script(char *dir, char *scriptName, char *output, int output_max_size,
               int debug) {
  FILE *pf;
  char *command;
  int command_len;
  int i;
  for (i = 0; i < strlen(scriptName); i++) {
    if (scriptName[i] == '.') {
      if (!strcmp(&scriptName[i], ".sh"))
        break;
      else {
        if (debug > 1)
          printf("Invalid script name.\n");
        return 1;
      }
    } else if ((scriptName[i] >= 'a') && (scriptName[i] <= 'z')) {
      continue;
    } else if ((scriptName[i] >= '0') && (scriptName[i] <= '9')) {
      continue;
    } else if (scriptName[i] == '-') {
      continue;
    } else if (scriptName[i] == '_') {
      continue;
    } else {
      if (debug > 1)
        printf("Invalid script name.\n");
      return 1;
    }
  }
  command_len = snprintf(NULL, 0, "%s/%s", dir, scriptName);
  if ((command = malloc((command_len + 1) * (sizeof(char)))) == NULL) {
    fprintf(stderr, "No memory left.\n");
    return -1;
  }
  snprintf(command, command_len + 1, "%s/%s", dir, scriptName);
  if (debug > 1)
    printf("script name: %s\n", scriptName);
  if (access(command, X_OK) != -1) {
    pf = popen(command, "r");
    if (!pf) {
      fprintf(stderr, " Could not open pipe for output.\n");
      free(command);
      return 1;
    }
    fgets(output, output_max_size, pf);
    if (pclose(pf) != 0) {
      fprintf(stderr, " Error: Failed to close command stream \n");
      free(command);
      return 1;
    }
  } else {
    if (debug > 1)
      printf("Cannot execute: %s\n", command);
  }
  free(command);
  return 0;
}


x86 assembly (clang, -O0):
<run_script>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jge    1310 <run_script+0x160>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    124c <run_script+0x9c>
mov    -0x18(%rbp),%rdi
movslq -0x40(%rbp),%rax
add    %rax,%rdi
lea    0xdeb(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1228 <run_script+0x78>
jmp    1310 <run_script+0x160>
cmpl   $0x1,-0x28(%rbp)
jle    1240 <run_script+0x90>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1490 <run_script+0x2e0>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x61,%eax
jl     127b <run_script+0xcb>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7a,%eax
jg     127b <run_script+0xcb>
jmp    1302 <run_script+0x152>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     12aa <run_script+0xfa>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     12aa <run_script+0xfa>
jmp    1302 <run_script+0x152>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    12c4 <run_script+0x114>
jmp    1302 <run_script+0x152>
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5f,%eax
jne    12de <run_script+0x12e>
jmp    1302 <run_script+0x152>
cmpl   $0x1,-0x28(%rbp)
jle    12f6 <run_script+0x146>
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1490 <run_script+0x2e0>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11d2 <run_script+0x22>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
lea    0xcf5(%rip),%rdx
call   1070 <snprintf@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    136f <run_script+0x1bf>
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
lea    0xcc2(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1490 <run_script+0x2e0>
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xc92(%rip),%rdx
call   1070 <snprintf@plt>
cmpl   $0x1,-0x28(%rbp)
jle    13a9 <run_script+0x1f9>
mov    -0x18(%rbp),%rsi
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2c34(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0xffffffff,%eax
je     145f <run_script+0x2af>
mov    -0x38(%rbp),%rdi
lea    0xc73(%rip),%rsi
call   10d0 <popen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    140d <run_script+0x25d>
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
lea    0xc51(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1490 <run_script+0x2e0>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1080 <fgets@plt>
mov    -0x30(%rbp),%rdi
call   1060 <pclose@plt>
cmp    $0x0,%rax
je     145a <run_script+0x2aa>
mov    0x2ba1(%rip),%rax
mov    (%rax),%edi
lea    0xc26(%rip),%rsi
call   10a0 <fprintf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1490 <run_script+0x2e0>
jmp    1480 <run_script+0x2d0>
cmpl   $0x1,-0x28(%rbp)
jle    147b <run_script+0x2cb>
mov    -0x38(%rbp),%rsi
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1480 <run_script+0x2d0>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_script>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r12d
mov    %ecx,0x4(%rsp)
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%r13
mov    %rsi,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    125c <run_script+0x9c>
xor    %ebx,%ebx
jmp    1203 <run_script+0x43>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %rbp,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    125c <run_script+0x9c>
movzbl 0x0(%rbp,%rbx,1),%eax
cmp    $0x2e,%al
je     1226 <run_script+0x66>
lea    -0x61(%rax),%ecx
cmp    $0x1a,%cl
jb     11f0 <run_script+0x30>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     11f0 <run_script+0x30>
cmp    $0x2d,%al
je     11f0 <run_script+0x30>
cmp    $0x5f,%al
je     11f0 <run_script+0x30>
jmp    123c <run_script+0x7c>
add    %rbp,%rbx
lea    0xdd0(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     125c <run_script+0x9c>
mov    $0x1,%ebx
cmp    $0x2,%r12d
jl     1389 <run_script+0x1c9>
lea    0xe3b(%rip),%rdi
call   1040 <puts@plt>
jmp    1389 <run_script+0x1c9>
lea    0xda1(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
mov    %r13,%rcx
mov    %rbp,%r8
call   1080 <snprintf@plt>
mov    %eax,%r14d
add    $0x1,%r14d
mov    %r14d,%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     12e1 <run_script+0x121>
mov    %rax,%rbx
lea    0xd74(%rip),%rdx
mov    %rax,%rdi
mov    %r14d,%esi
mov    %r13,%rcx
mov    %rbp,%r8
call   1080 <snprintf@plt>
cmp    $0x2,%r12d
jl     1300 <run_script+0x140>
lea    0xd6d(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10d0 <access@plt>
cmp    $0xffffffff,%eax
jne    1316 <run_script+0x156>
lea    0xda4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    135b <run_script+0x19b>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
lea    0xd19(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0xffffffff,%ebx
jmp    1389 <run_script+0x1c9>
mov    0x2ce1(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10d0 <access@plt>
cmp    $0xffffffff,%eax
je     135b <run_script+0x19b>
lea    0xd0f(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <popen@plt>
test   %rax,%rax
je     1367 <run_script+0x1a7>
mov    %rax,%rbp
mov    %r15,%rdi
mov    0x4(%rsp),%esi
mov    %rax,%rdx
call   1090 <fgets@plt>
mov    %rbp,%rdi
call   1070 <pclose@plt>
test   %rax,%rax
je     135b <run_script+0x19b>
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
lea    0xcf7(%rip),%rsi
jmp    1377 <run_script+0x1b7>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
jmp    1389 <run_script+0x1c9>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
lea    0xcb7(%rip),%rsi
call   10b0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c".sh\00"
@.str.1 = [22 x i8] c"Invalid script name.\0A\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@stderr = global i32 0
@.str.3 = [17 x i8] c"No memory left.\0A\00"
@.str.4 = [17 x i8] c"script name: %s\0A\00"
@X_OK = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [34 x i8] c" Could not open pipe for output.\0A\00"
@.str.7 = [41 x i8] c" Error: Failed to close command stream \0A\00"
@.str.8 = [20 x i8] c"Cannot execute: %s\0A\00"
define i32 @run_script(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 0, i32* %15
br label %16
16: ; preds = %101, %5
%17 = load i32, i32* %15
%18 = load i8*, i8** %8
%19 = call i32 @strlen(i8* %18)
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %104
21: ; preds = %16
%22 = load i8*, i8** %8
%23 = load i32, i32* %15
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 46
br i1 %28, label %29, label %43
29: ; preds = %21
%30 = load i8*, i8** %8
%31 = load i32, i32* %15
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = call i32 @strcmp(i8* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %29
br label %104
37: ; preds = %29
%38 = load i32, i32* %11
%39 = icmp sgt i32 %38, 1
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %40, %37
store i32 1, i32* %6
br label %169
43: ; preds = %21
%44 = load i8*, i8** %8
%45 = load i32, i32* %15
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp sge i32 %49, 97
br i1 %50, label %51, label %60
51: ; preds = %43
%52 = load i8*, i8** %8
%53 = load i32, i32* %15
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp sle i32 %57, 122
br i1 %58, label %59, label %60
59: ; preds = %51
br label %101
60: ; preds = %51, %43
%61 = load i8*, i8** %8
%62 = load i32, i32* %15
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %61, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp sge i32 %66, 48
br i1 %67, label %68, label %77
68: ; preds = %60
%69 = load i8*, i8** %8
%70 = load i32, i32* %15
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp sle i32 %74, 57
br i1 %75, label %76, label %77
76: ; preds = %68
br label %101
77: ; preds = %68, %60
%78 = load i8*, i8** %8
%79 = load i32, i32* %15
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp eq i32 %83, 45
br i1 %84, label %85, label %86
85: ; preds = %77
br label %101
86: ; preds = %77
%87 = load i8*, i8** %8
%88 = load i32, i32* %15
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 95
br i1 %93, label %94, label %95
94: ; preds = %86
br label %101
95: ; preds = %86
%96 = load i32, i32* %11
%97 = icmp sgt i32 %96, 1
br i1 %97, label %98, label %100
98: ; preds = %95
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %100
100: ; preds = %98, %95
store i32 1, i32* %6
br label %169
101: ; preds = %94, %85, %76, %59
%102 = load i32, i32* %15
%103 = add nsw i32 %102, 1
store i32 %103, i32* %15
br label %16
104: ; preds = %36, %16
%105 = load i8*, i8** %7
%106 = load i8*, i8** %8
%107 = call i32 @snprintf(i8* null, i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %105, i8* %106)
store i32 %107, i32* %14
%108 = load i32, i32* %14
%109 = add nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = mul i64 %110, 1
%112 = trunc i64 %111 to i32
%113 = call i8* @malloc(i32 %112)
store i8* %113, i8** %13
%114 = icmp eq i8* %113, null
br i1 %114, label %115, label %118
115: ; preds = %104
%116 = load i32, i32* @stderr
%117 = call i32 @fprintf(i32 %116, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %6
br label %169
118: ; preds = %104
%119 = load i8*, i8** %13
%120 = load i32, i32* %14
%121 = add nsw i32 %120, 1
%122 = load i8*, i8** %7
%123 = load i8*, i8** %8
%124 = call i32 @snprintf(i8* %119, i32 %121, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %122, i8* %123)
%125 = load i32, i32* %11
%126 = icmp sgt i32 %125, 1
br i1 %126, label %127, label %130
127: ; preds = %118
%128 = load i8*, i8** %8
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %128)
br label %130
130: ; preds = %127, %118
%131 = load i8*, i8** %13
%132 = load i32, i32* @X_OK
%133 = call i32 @access(i8* %131, i32 %132)
%134 = icmp ne i32 %133, -1
br i1 %134, label %135, label %159
135: ; preds = %130
%136 = load i8*, i8** %13
%137 = call i32* @popen(i8* %136, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %137, i32** %12
%138 = load i32*, i32** %12
%139 = icmp ne i32* %138, null
br i1 %139, label %145, label %140
140: ; preds = %135
%141 = load i32, i32* @stderr
%142 = call i32 @fprintf(i32 %141, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%143 = load i8*, i8** %13
%144 = call i32 @free(i8* %143)
store i32 1, i32* %6
br label %169
145: ; preds = %135
%146 = load i8*, i8** %9
%147 = load i32, i32* %10
%148 = load i32*, i32** %12
%149 = call i32 @fgets(i8* %146, i32 %147, i32* %148)
%150 = load i32*, i32** %12
%151 = call i64 @pclose(i32* %150)
%152 = icmp ne i64 %151, 0
br i1 %152, label %153, label %158
153: ; preds = %145
%154 = load i32, i32* @stderr
%155 = call i32 @fprintf(i32 %154, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%156 = load i8*, i8** %13
%157 = call i32 @free(i8* %156)
store i32 1, i32* %6
br label %169
158: ; preds = %145
br label %166
159: ; preds = %130
%160 = load i32, i32* %11
%161 = icmp sgt i32 %160, 1
br i1 %161, label %162, label %165
162: ; preds = %159
%163 = load i8*, i8** %13
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %163)
br label %165
165: ; preds = %162, %159
br label %166
166: ; preds = %165, %158
%167 = load i8*, i8** %13
%168 = call i32 @free(i8* %167)
store i32 0, i32* %6
br label %169
169: ; preds = %166, %153, %140, %115, %100, %42
%170 = load i32, i32* %6
ret i32 %170
}

LLVM IR (-O2):
@.str = [4 x i8] c".sh\00"
@.str.2 = [6 x i8] c"%s/%s\00"
@stderr = global i32 0
@.str.3 = [17 x i8] c"No memory left.\0A\00"
@.str.4 = [17 x i8] c"script name: %s\0A\00"
@X_OK = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [34 x i8] c" Could not open pipe for output.\0A\00"
@.str.7 = [41 x i8] c" Error: Failed to close command stream \0A\00"
@.str.8 = [20 x i8] c"Cannot execute: %s\0A\00"
@str.9 = [21 x i8] c"Invalid script name.\00"
define i32 @run_script(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = tail call i32 @strlen(i8* %1)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %38
8: ; preds = %5, %33
%9 = phi i64 [ %34, %33 ], [ 0, %5 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 46
br i1 %12, label %13, label %22
13: ; preds = %8
%14 = and i64 %9, 4294967295
%15 = getelementptr inbounds i8, i8* %1, i64 %14
%16 = tail call i32 @strcmp(i8* %15, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %38, label %18
18: ; preds = %13
%19 = icmp sgt i32 %4, 1
br i1 %19, label %20, label %77
20: ; preds = %18
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.9, i64 0, i64 0))
br label %77
22: ; preds = %8
%23 = add i8 %11, -97
%24 = icmp ult i8 %23, 26
%25 = add i8 %11, -48
%26 = icmp ult i8 %25, 10
%27 = or i1 %24, %26
br i1 %27, label %33, label %28
28: ; preds = %22
switch i8 %11, label %29 [
i8 45, label %33
i8 95, label %33
]
29: ; preds = %28
%30 = icmp sgt i32 %4, 1
br i1 %30, label %31, label %77
31: ; preds = %29
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.9, i64 0, i64 0))
br label %77
33: ; preds = %28, %28, %22
%34 = add nuw nsw i64 %9, 1
%35 = tail call i32 @strlen(i8* %1)
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %8, label %38
38: ; preds = %33, %5, %13
%39 = tail call i32 @snprintf(i8* null, i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1)
%40 = add nsw i32 %39, 1
%41 = tail call i8* @malloc(i32 %40)
%42 = icmp eq i8* %41, null
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = tail call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %77
46: ; preds = %38
%47 = tail call i32 @snprintf(i8* %41, i32 %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1)
%48 = icmp sgt i32 %4, 1
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%51 = load i32, i32* @X_OK
%52 = tail call i32 @access(i8* %41, i32 %51)
%53 = icmp eq i32 %52, -1
br i1 %53, label %73, label %58
54: ; preds = %46
%55 = load i32, i32* @X_OK
%56 = tail call i32 @access(i8* %41, i32 %55)
%57 = icmp eq i32 %56, -1
br i1 %57, label %75, label %58
58: ; preds = %54, %49
%59 = tail call i32* @popen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = load i32, i32* @stderr
%63 = tail call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%64 = tail call i32 @free(i8* %41)
br label %77
65: ; preds = %58
%66 = tail call i32 @fgets(i8* %2, i32 %3, i32* %59)
%67 = tail call i64 @pclose(i32* %59)
%68 = icmp eq i64 %67, 0
br i1 %68, label %75, label %69
69: ; preds = %65
%70 = load i32, i32* @stderr
%71 = tail call i32 @fprintf(i32 %70, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%72 = tail call i32 @free(i8* %41)
br label %77
73: ; preds = %49
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %41)
br label %75
75: ; preds = %54, %73, %65
%76 = tail call i32 @free(i8* %41)
br label %77
77: ; preds = %29, %31, %18, %20, %75, %69, %61, %43
%78 = phi i32 [ -1, %43 ], [ 1, %69 ], [ 0, %75 ], [ 1, %61 ], [ 1, %20 ], [ 1, %18 ], [ 1, %31 ], [ 1, %29 ]
ret i32 %78
}