#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 count_array(char **);
scalar_t__ strcmp(char *, char *);
int is_pipe_exist(char **cmdline) {
  int arguments_count = count_array(cmdline);
  int index = 0;
  for (; index < arguments_count; index++) {
    if (strcmp(cmdline[index], "|") == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_pipe_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <count_array@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118c <is_pipe_exist+0x6c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xea2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1179 <is_pipe_exist+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1193 <is_pipe_exist+0x73>
jmp    117e <is_pipe_exist+0x5e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113f <is_pipe_exist+0x1f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_pipe_exist>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <count_array@plt>
test   %eax,%eax
jle    115a <is_pipe_exist+0x3a>
mov    %eax,%r12d
xor    %ebx,%ebx
lea    0xec0(%rip),%r14
mov    (%r15,%rbx,8),%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     115e <is_pipe_exist+0x3e>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <is_pipe_exist+0x20>
xor    %eax,%eax
jmp    1163 <is_pipe_exist+0x43>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"|\00"
define i32 @is_pipe_exist(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
%6 = load i8**, i8*** %3
%7 = call i32 @count_array(i8** %6)
store i32 %7, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %22, %1
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i8**, i8*** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %12
store i32 1, i32* %2
br label %26
21: ; preds = %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %8
25: ; preds = %8
store i32 0, i32* %2
br label %26
26: ; preds = %25, %20
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@.str = [2 x i8] c"|\00"
define i32 @is_pipe_exist(i8** %0) {
%2 = tail call i32 @count_array(i8** %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %15
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %14, %5
br i1 %7, label %15, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %14, %6 ]
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
%14 = add nuw nsw i64 %9, 1
br i1 %13, label %15, label %6
15: ; preds = %8, %6, %1
%16 = phi i32 [ 0, %1 ], [ 0, %6 ], [ 1, %8 ]
ret i32 %16
}