#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*/ execute_binary_with_pipe(char *, char **);
int /*<<< orphan*/ execute_script(char *, char **, char *, char *);
int process_binaries(char *input, char **envp, char *PATH, char *CWD) {
  int i = 0;
  i = 0;
  while (input[i] != '\0' && input[i] != '|')
    i++;
  if (input[i] == '|') {
    execute_binary_with_pipe(input, envp);
  } else
    execute_script(input, envp, PATH, CWD);
  return 0;
}


x86 assembly (clang, -O0):
<process_binaries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x25(%rbp)
je     1175 <process_binaries+0x55>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7c,%eax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1185 <process_binaries+0x65>
jmp    1193 <process_binaries+0x73>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1146 <process_binaries+0x26>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7c,%eax
jne    11ba <process_binaries+0x9a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <execute_binary_with_pipe@plt>
jmp    11cf <process_binaries+0xaf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <execute_script@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_binaries>:
push   %rax
mov    %rdi,%r8
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r8),%eax
test   %al,%al
je     1142 <process_binaries+0x22>
cmp    $0x7c,%al
je     1149 <process_binaries+0x29>
add    $0x1,%r8
jmp    1130 <process_binaries+0x10>
call   1040 <execute_script@plt>
jmp    114e <process_binaries+0x2e>
call   1030 <execute_binary_with_pipe@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @process_binaries(i8* %0, i8** %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i32 0, i32* %9
store i32 0, i32* %9
br label %10
10: ; preds = %28, %4
%11 = load i8*, i8** %5
%12 = load i32, i32* %9
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %10
%19 = load i8*, i8** %5
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 124
br label %26
26: ; preds = %18, %10
%27 = phi i1 [ false, %10 ], [ %25, %18 ]
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %10
31: ; preds = %26
%32 = load i8*, i8** %5
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 124
br i1 %38, label %39, label %43
39: ; preds = %31
%40 = load i8*, i8** %5
%41 = load i8**, i8*** %6
%42 = call i32 @execute_binary_with_pipe(i8* %40, i8** %41)
br label %49
43: ; preds = %31
%44 = load i8*, i8** %5
%45 = load i8**, i8*** %6
%46 = load i8*, i8** %7
%47 = load i8*, i8** %8
%48 = call i32 @execute_script(i8* %44, i8** %45, i8* %46, i8* %47)
br label %49
49: ; preds = %43, %39
ret i32 0
}

LLVM IR (-O2):
define i32 @process_binaries(i8* %0, i8** %1, i8* %2, i8* %3) {
br label %5
5: ; preds = %9, %4
%6 = phi i64 [ %10, %9 ], [ 0, %4 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
switch i8 %8, label %9 [
i8 124, label %11
i8 0, label %13
]
9: ; preds = %5
%10 = add nuw i64 %6, 1
br label %5
11: ; preds = %5
%12 = tail call i32 @execute_binary_with_pipe(i8* %0, i8** %1)
br label %15
13: ; preds = %5
%14 = tail call i32 @execute_script(i8* %0, i8** %1, i8* %2, i8* %3)
br label %15
15: ; preds = %13, %11
ret i32 0
}