#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 */
int /*<<< orphan*/ runCommand(char *, char **);
int /*<<< orphan*/ runIn(char *, char **, int);
int /*<<< orphan*/ runOut(char *, char **, int);
scalar_t__ strcmp(char *, char *);
void checkCommand(char *command, char **args) {
  int i = 0;
  int check = 0;
  while (args[i] != NULL) {
    if (strcmp(args[i], "<") == 0) {
      check++;
      runIn(command, args, i);
    }
    if (strcmp(args[i], ">") == 0) {
      check++;
      runOut(command, args, i);
    }
    if (strcmp(args[i], "|") == 0) {
      check++;
    }
    i++;
  }
  if (check == 0) {
    runCommand(command, args);
  }
}


x86 assembly (clang, -O0):
<checkCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1220 <checkCommand+0xe0>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe7c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ac <checkCommand+0x6c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1060 <runIn@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe43(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11e7 <checkCommand+0xa7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <runOut@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1212 <checkCommand+0xd2>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115e <checkCommand+0x1e>
cmpl   $0x0,-0x18(%rbp)
jne    1237 <checkCommand+0xf7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <runCommand@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkCommand>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    (%rsi),%rdi
test   %rdi,%rdi
je     11fc <checkCommand+0xbc>
xor    %ebx,%ebx
lea    0xe9c(%rip),%r13
lea    0xe97(%rip),%rbp
xor    %r12d,%r12d
jmp    11a2 <checkCommand+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rdi
mov    %rbp,%rsi
call   1040 <strcmp@plt>
cmp    $0x1,%rax
adc    $0x0,%r12d
mov    0x8(%r15,%rbx,8),%rdi
add    $0x1,%rbx
test   %rdi,%rdi
je     11e8 <checkCommand+0xa8>
lea    0xe57(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11c4 <checkCommand+0x84>
add    $0x1,%r12d
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1060 <runIn@plt>
mov    (%r15,%rbx,8),%rdi
mov    %r13,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1180 <checkCommand+0x40>
add    $0x1,%r12d
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1050 <runOut@plt>
jmp    1180 <checkCommand+0x40>
test   %r12d,%r12d
je     11fc <checkCommand+0xbc>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <runCommand@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"<\00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [2 x i8] c"|\00"
define void @checkCommand(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8** %1, i8*** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %55, %2
%8 = load i8**, i8*** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %58
14: ; preds = %7
%15 = load i8**, i8*** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %14
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
%25 = load i8*, i8** %3
%26 = load i8**, i8*** %4
%27 = load i32, i32* %5
%28 = call i32 @runIn(i8* %25, i8** %26, i32 %27)
br label %29
29: ; preds = %22, %14
%30 = load i8**, i8*** %4
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %29
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
%40 = load i8*, i8** %3
%41 = load i8**, i8*** %4
%42 = load i32, i32* %5
%43 = call i32 @runOut(i8* %40, i8** %41, i32 %42)
br label %44
44: ; preds = %37, %29
%45 = load i8**, i8*** %4
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %44
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %55
55: ; preds = %52, %44
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 1
store i32 %57, i32* %5
br label %7
58: ; preds = %7
%59 = load i32, i32* %6
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = load i8*, i8** %3
%63 = load i8**, i8*** %4
%64 = call i32 @runCommand(i8* %62, i8** %63)
br label %65
65: ; preds = %61, %58
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"<\00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [2 x i8] c"|\00"
define void @checkCommand(i8* %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %38, label %5
5: ; preds = %2, %25
%6 = phi i64 [ %32, %25 ], [ 0, %2 ]
%7 = phi i8* [ %34, %25 ], [ %3, %2 ]
%8 = phi i8** [ %33, %25 ], [ %1, %2 ]
%9 = phi i32 [ %31, %25 ], [ 0, %2 ]
%10 = tail call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %5
%13 = add nsw i32 %9, 1
%14 = trunc i64 %6 to i32
%15 = tail call i32 @runIn(i8* %0, i8** %1, i32 %14)
br label %16
16: ; preds = %12, %5
%17 = phi i32 [ %13, %12 ], [ %9, %5 ]
%18 = load i8*, i8** %8
%19 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = add nsw i32 %17, 1
%23 = trunc i64 %6 to i32
%24 = tail call i32 @runOut(i8* %0, i8** %1, i32 %23)
br label %25
25: ; preds = %21, %16
%26 = phi i32 [ %22, %21 ], [ %17, %16 ]
%27 = load i8*, i8** %8
%28 = tail call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
%30 = zext i1 %29 to i32
%31 = add nsw i32 %26, %30
%32 = add nuw i64 %6, 1
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %5
36: ; preds = %25
%37 = icmp eq i32 %31, 0
br i1 %37, label %38, label %40
38: ; preds = %2, %36
%39 = tail call i32 @runCommand(i8* %0, i8** %1)
br label %40
40: ; preds = %38, %36
ret void
}