#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__ access(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  char *path, *cp;
  char buf[400];
  char prog[400];
  char patbuf[512];
  int quit, none;
  int excode = 0;
  if (argc < 2) {
    fprintf(stderr, "Usage: which cmd [cmd, ..]\n");
    exit(1);
  }
  for (argv++; *argv; argv++) {
    quit = 0;
    none = 1;
    if ((path = getenv("PATH")) == NULL) {
      fprintf(stderr, "Null path.\n");
      exit(0);
    }
    strcpy(patbuf, path);
    path = patbuf;
    cp = path;
    while (1) {
      cp = strchr(path, ':');
      if (cp == NULL)
        quit++;
      else
        *cp = '\0';
      if (strcmp(path, "") == 0 && quit == 0) {
        sprintf(buf, "%s./%s", path, *argv);
      } else
        sprintf(buf, "%s/%s", path, *argv);
      path = ++cp;
      if (access(buf, 1) == 0) {
        printf("%s\n", buf);
        none = 0;
      }
      sprintf(prog, "%s.%s", buf, "prg");
      if (access(prog, 1) == 0) {
        printf("%s\n", prog);
        none = 0;
      }
      sprintf(prog, "%s.%s", buf, "ttp");
      if (access(prog, 1) == 0) {
        printf("%s\n", prog);
        none = 0;
      }
      sprintf(prog, "%s.%s", buf, "tos");
      if (access(prog, 1) == 0) {
        printf("%s\n", prog);
        none = 0;
      }
      if (quit) {
        if (none) {
          fprintf(stderr, "No %s in %s\n", *argv, getenv("PATH"));
          excode = 1;
        }
        break;
      }
    }
  }
  return (excode);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x560,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x54c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11de <main+0x4e>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     14e5 <main+0x355>
movl   $0x0,-0x544(%rbp)
movl   $0x1,-0x548(%rbp)
lea    0xe09(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1244 <main+0xb4>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    -0x540(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x540(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1298 <main+0x108>
mov    -0x544(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x544(%rbp)
jmp    129f <main+0x10f>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
lea    0xd82(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12e9 <main+0x159>
cmpl   $0x0,-0x544(%rbp)
jne    12e9 <main+0x159>
lea    -0x1b0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd4e(%rip),%rsi
call   10a0 <sprintf@plt>
jmp    1307 <main+0x177>
lea    -0x1b0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd32(%rip),%rsi
call   10a0 <sprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
lea    -0x1b0(%rbp),%rdi
mov    $0x1,%esi
call   1090 <access@plt>
cmp    $0x0,%rax
jne    134f <main+0x1bf>
lea    -0x1b0(%rbp),%rsi
lea    0xd15(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x548(%rbp)
lea    -0x340(%rbp),%rdi
lea    -0x1b0(%rbp),%rdx
lea    0xcd6(%rip),%rsi
lea    0xcd5(%rip),%rcx
call   10a0 <sprintf@plt>
lea    -0x340(%rbp),%rdi
mov    $0x1,%esi
call   1090 <access@plt>
cmp    $0x0,%rax
jne    13a8 <main+0x218>
lea    -0x340(%rbp),%rsi
lea    0xcbc(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x548(%rbp)
lea    -0x340(%rbp),%rdi
lea    -0x1b0(%rbp),%rdx
lea    0xc7d(%rip),%rsi
lea    0xc80(%rip),%rcx
call   10a0 <sprintf@plt>
lea    -0x340(%rbp),%rdi
mov    $0x1,%esi
call   1090 <access@plt>
cmp    $0x0,%rax
jne    1401 <main+0x271>
lea    -0x340(%rbp),%rsi
lea    0xc63(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x548(%rbp)
lea    -0x340(%rbp),%rdi
lea    -0x1b0(%rbp),%rdx
lea    0xc24(%rip),%rsi
lea    0xc2b(%rip),%rcx
call   10a0 <sprintf@plt>
lea    -0x340(%rbp),%rdi
mov    $0x1,%esi
call   1090 <access@plt>
cmp    $0x0,%rax
jne    145a <main+0x2ca>
lea    -0x340(%rbp),%rsi
lea    0xc0a(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x548(%rbp)
cmpl   $0x0,-0x544(%rbp)
je     14ca <main+0x33a>
cmpl   $0x0,-0x548(%rbp)
je     14c5 <main+0x335>
mov    0x2b65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x55c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x558(%rbp)
lea    0xb84(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x55c(%rbp),%edi
mov    -0x558(%rbp),%rdx
mov    %rax,%rcx
lea    0xb98(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x54c(%rbp)
jmp    14cf <main+0x33f>
jmp    1267 <main+0xd7>
jmp    14d4 <main+0x344>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11ea <main+0x5a>
mov    -0x54c(%rbp),%eax
add    $0x560,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x538,%rsp
cmp    $0x2,%edi
jl     13f4 <main+0x264>
cmpq   $0x0,0x8(%rsi)
je     13b8 <main+0x228>
add    $0x8,%rsi
lea    0x1a0(%rsp),%rbx
lea    0xe72(%rip),%r14
lea    0x10(%rsp),%r12
movl   $0x0,0x4(%rsp)
jmp    11f4 <main+0x64>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rbp
cmpq   $0x0,0x8(%rbp)
lea    0x8(%rbp),%rsi
je     13c0 <main+0x230>
mov    %rsi,0x8(%rsp)
lea    0xe1c(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     13d6 <main+0x246>
lea    0x330(%rsp),%rbp
mov    %rbp,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
mov    $0x1,%r13d
jmp    1247 <main+0xb7>
nopl   0x0(%rax)
lea    0xe1e(%rip),%rdi
mov    %r12,%rsi
call   1060 <printf@plt>
xor    %r13d,%r13d
test   %r15,%r15
je     11e0 <main+0x50>
mov    %rbp,%rdi
mov    $0x3a,%esi
call   1050 <strchr@plt>
mov    %rax,%r15
test   %rax,%rax
je     1260 <main+0xd0>
movb   $0x0,(%r15)
mov    %rbp,%rdi
lea    0xdc2(%rip),%rsi
call   1070 <strcmp@plt>
test   %r15,%r15
lea    0xdb4(%rip),%rsi
lea    0xdb4(%rip),%rdx
cmove  %rdx,%rsi
test   %rax,%rax
mov    0x8(%rsp),%rax
mov    (%rax),%rcx
cmovne %rdx,%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
call   10a0 <sprintf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1090 <access@plt>
test   %rax,%rax
jne    12c2 <main+0x132>
lea    0xd9e(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
xor    %r13d,%r13d
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
lea    0xd6e(%rip),%rcx
call   10a0 <sprintf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
call   1090 <access@plt>
test   %rax,%rax
jne    12fb <main+0x16b>
lea    0xd65(%rip),%rdi
mov    %r12,%rsi
call   1060 <printf@plt>
xor    %r13d,%r13d
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
lea    0xd39(%rip),%rcx
call   10a0 <sprintf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
call   1090 <access@plt>
test   %rax,%rax
jne    1334 <main+0x1a4>
lea    0xd2c(%rip),%rdi
mov    %r12,%rsi
call   1060 <printf@plt>
xor    %r13d,%r13d
lea    0x1(%r15),%rbp
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
lea    0xd00(%rip),%rcx
call   10a0 <sprintf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
call   1090 <access@plt>
test   %rax,%rax
je     1230 <main+0xa0>
test   %r15,%r15
jne    1247 <main+0xb7>
test   %r13d,%r13d
mov    0x8(%rsp),%rbp
je     11e5 <main+0x55>
mov    0x2c5f(%rip),%rax
mov    (%rax),%r13d
mov    0x0(%rbp),%r15
lea    0xc8d(%rip),%rdi
call   1030 <getenv@plt>
mov    %r13d,%edi
lea    0xcae(%rip),%rsi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
movl   $0x1,0x4(%rsp)
jmp    11e5 <main+0x55>
movl   $0x0,0x4(%rsp)
mov    0x4(%rsp),%eax
add    $0x538,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c03(%rip),%rax
mov    (%rax),%edi
lea    0xc3b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    0x2be5(%rip),%rax
mov    (%rax),%edi
lea    0xbfc(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: which cmd [cmd, ..]\0A\00"
@.str.1 = [5 x i8] c"PATH\00"
@.str.2 = [12 x i8] c"Null path.\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [7 x i8] c"%s./%s\00"
@.str.5 = [6 x i8] c"%s/%s\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [6 x i8] c"%s.%s\00"
@.str.8 = [4 x i8] c"prg\00"
@.str.9 = [4 x i8] c"ttp\00"
@.str.10 = [4 x i8] c"tos\00"
@.str.11 = [13 x i8] c"No %s in %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [400 x i8]
%9 = alloca [400 x i8]
%10 = alloca [512 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i32 1
store i8** %22, i8*** %5
br label %23
23: ; preds = %123, %20
%24 = load i8**, i8*** %5
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %126
27: ; preds = %23
store i32 0, i32* %11
store i32 1, i32* %12
%28 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %28, i8** %6
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 @exit(i32 0)
unreachable
34: ; preds = %27
%35 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%36 = load i8*, i8** %6
%37 = call i32 @strcpy(i8* %35, i8* %36)
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
store i8* %38, i8** %6
%39 = load i8*, i8** %6
store i8* %39, i8** %7
br label %40
40: ; preds = %34, %121
%41 = load i8*, i8** %6
%42 = call i8* @strchr(i8* %41, i8 signext 58)
store i8* %42, i8** %7
%43 = load i8*, i8** %7
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = load i32, i32* %11
%47 = add nsw i32 %46, 1
store i32 %47, i32* %11
br label %50
48: ; preds = %40
%49 = load i8*, i8** %7
store i8 0, i8* %49
br label %50
50: ; preds = %48, %45
%51 = load i8*, i8** %6
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %63
54: ; preds = %50
%55 = load i32, i32* %11
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%59 = load i8*, i8** %6
%60 = load i8**, i8*** %5
%61 = load i8*, i8** %60
%62 = call i32 @sprintf(i8* %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %59, i8* %61)
br label %69
63: ; preds = %54, %50
%64 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%65 = load i8*, i8** %6
%66 = load i8**, i8*** %5
%67 = load i8*, i8** %66
%68 = call i32 @sprintf(i8* %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %65, i8* %67)
br label %69
69: ; preds = %63, %57
%70 = load i8*, i8** %7
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %7
store i8* %71, i8** %6
%72 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%73 = call i64 @access(i8* %72, i32 1)
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %69
%76 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%77 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %76)
store i32 0, i32* %12
br label %78
78: ; preds = %75, %69
%79 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%80 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%81 = call i32 @sprintf(i8* %79, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%82 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%83 = call i64 @access(i8* %82, i32 1)
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %78
%86 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%87 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %86)
store i32 0, i32* %12
br label %88
88: ; preds = %85, %78
%89 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%90 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%91 = call i32 @sprintf(i8* %89, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %90, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%92 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%93 = call i64 @access(i8* %92, i32 1)
%94 = icmp eq i64 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %88
%96 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%97 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %96)
store i32 0, i32* %12
br label %98
98: ; preds = %95, %88
%99 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%100 = getelementptr inbounds [400 x i8], [400 x i8]* %8, i64 0, i64 0
%101 = call i32 @sprintf(i8* %99, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %100, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%102 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%103 = call i64 @access(i8* %102, i32 1)
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %98
%106 = getelementptr inbounds [400 x i8], [400 x i8]* %9, i64 0, i64 0
%107 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %106)
store i32 0, i32* %12
br label %108
108: ; preds = %105, %98
%109 = load i32, i32* %11
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %121
111: ; preds = %108
%112 = load i32, i32* %12
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %120
114: ; preds = %111
%115 = load i32, i32* @stderr
%116 = load i8**, i8*** %5
%117 = load i8*, i8** %116
%118 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %117, i8* %118)
store i32 1, i32* %13
br label %120
120: ; preds = %114, %111
br label %122
121: ; preds = %108
br label %40
122: ; preds = %120
br label %123
123: ; preds = %122
%124 = load i8**, i8*** %5
%125 = getelementptr inbounds i8*, i8** %124, i32 1
store i8** %125, i8*** %5
br label %23
126: ; preds = %23
%127 = load i32, i32* %13
ret i32 %127
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: which cmd [cmd, ..]\0A\00"
@.str.1 = [5 x i8] c"PATH\00"
@.str.2 = [12 x i8] c"Null path.\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [7 x i8] c"%s./%s\00"
@.str.5 = [6 x i8] c"%s/%s\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [6 x i8] c"%s.%s\00"
@.str.8 = [4 x i8] c"prg\00"
@.str.9 = [4 x i8] c"ttp\00"
@.str.10 = [4 x i8] c"tos\00"
@.str.11 = [13 x i8] c"No %s in %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [400 x i8]
%4 = alloca [400 x i8]
%5 = alloca [512 x i8]
%6 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [400 x i8], [400 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 2
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %84, label %18
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %10, %79
%19 = phi i8** [ %81, %79 ], [ %11, %10 ]
%20 = phi i32 [ %80, %79 ], [ 0, %10 ]
%21 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %18
%28 = call i32 @strcpy(i8* %8, i8* %21)
br label %29
29: ; preds = %68, %27
%30 = phi i8* [ %8, %27 ], [ %43, %68 ]
%31 = phi i32 [ 1, %27 ], [ %69, %68 ]
%32 = call i8* @strchr(i8* dereferenceable(1) %30, i8 signext 58)
%33 = icmp eq i8* %32, null
br i1 %33, label %35, label %34
34: ; preds = %29
store i8 0, i8* %32
br label %35
35: ; preds = %29, %34
%36 = xor i1 %33, true
%37 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
%39 = select i1 %38, i1 %36, i1 false
%40 = load i8*, i8** %19
%41 = select i1 %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0)
%42 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) %41, i8* %30, i8* %40)
%43 = getelementptr inbounds i8, i8* %32, i64 1
%44 = call i64 @access(i8* %6, i32 1)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %35
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %6)
br label %48
48: ; preds = %46, %35
%49 = phi i32 [ 0, %46 ], [ %31, %35 ]
%50 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%51 = call i64 @access(i8* %7, i32 1)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %48
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %7)
br label %55
55: ; preds = %53, %48
%56 = phi i32 [ 0, %53 ], [ %49, %48 ]
%57 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%58 = call i64 @access(i8* %7, i32 1)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %7)
br label %62
62: ; preds = %60, %55
%63 = phi i32 [ 0, %60 ], [ %56, %55 ]
%64 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%65 = call i64 @access(i8* %7, i32 1)
%66 = icmp eq i64 %65, 0
br i1 %66, label %70, label %67
67: ; preds = %62
br i1 %33, label %72, label %68
68: ; preds = %67, %70
%69 = phi i32 [ %63, %67 ], [ 0, %70 ]
br label %29
70: ; preds = %62
%71 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %7)
br i1 %33, label %79, label %68
72: ; preds = %67
%73 = icmp eq i32 %63, 0
br i1 %73, label %79, label %74
74: ; preds = %72
%75 = load i32, i32* @stderr
%76 = load i8*, i8** %19
%77 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* %76, i8* %77)
br label %79
79: ; preds = %70, %74, %72
%80 = phi i32 [ 1, %74 ], [ %20, %72 ], [ %20, %70 ]
%81 = getelementptr inbounds i8*, i8** %19, i64 1
%82 = load i8*, i8** %81
%83 = icmp eq i8* %82, null
br i1 %83, label %84, label %18
84: ; preds = %79, %10
%85 = phi i32 [ 0, %10 ], [ %80, %79 ]
ret i32 %85
}