#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 nbElementsCommande(char **);
scalar_t__ strcmp(char *, char *);
char *rechercheCaractereSpecial(char *commande[]) {
  char *caractereSpecial = NULL;
  int nbElement = nbElementsCommande(commande);
  int i = 0;
  while (i < nbElement &&
         (!(strcmp(commande[i], ">") == 0 || strcmp(commande[i], "<") == 0 ||
            strcmp(commande[i], "|") == 0 || strcmp(commande[i], ";") == 0))) {
    i++;
  }
  if (i < nbElement) {
    caractereSpecial = commande[i];
  }
  return caractereSpecial;
}


x86 assembly (clang, -O0):
<rechercheCaractereSpecial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <nbElementsCommande@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x19(%rbp)
jge    1200 <rechercheCaractereSpecial+0xe0>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1a(%rbp)
je     11f8 <rechercheCaractereSpecial+0xd8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe6d(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1a(%rbp)
je     11f8 <rechercheCaractereSpecial+0xd8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe45(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1a(%rbp)
je     11f8 <rechercheCaractereSpecial+0xd8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe1d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1210 <rechercheCaractereSpecial+0xf0>
jmp    121e <rechercheCaractereSpecial+0xfe>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1147 <rechercheCaractereSpecial+0x27>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123a <rechercheCaractereSpecial+0x11a>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rechercheCaractereSpecial>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <nbElementsCommande@plt>
test   %eax,%eax
jle    11b1 <rechercheCaractereSpecial+0x91>
mov    %eax,%r14d
lea    0xebf(%rip),%r15
lea    0xeba(%rip),%r12
lea    0xeb5(%rip),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b5 <rechercheCaractereSpecial+0x95>
mov    (%rbx,%rbp,8),%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b5 <rechercheCaractereSpecial+0x95>
mov    (%rbx,%rbp,8),%rdi
mov    %r13,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b5 <rechercheCaractereSpecial+0x95>
mov    (%rbx,%rbp,8),%rdi
lea    0xe68(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b5 <rechercheCaractereSpecial+0x95>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1160 <rechercheCaractereSpecial+0x40>
xor    %eax,%eax
jmp    11b9 <rechercheCaractereSpecial+0x99>
mov    (%rbx,%rbp,8),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c">\00"
@.str.1 = [2 x i8] c"<\00"
@.str.2 = [2 x i8] c"|\00"
@.str.3 = [2 x i8] c";\00"
define i8* @rechercheCaractereSpecial(i8** %0) {
%2 = tail call i32 @nbElementsCommande(i8** %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %29
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %8
6: ; preds = %22
%7 = icmp eq i64 %26, %5
br i1 %7, label %29, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %26, %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
br i1 %13, label %27, label %14
14: ; preds = %8
%15 = load i8*, i8** %10
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %27, label %18
18: ; preds = %14
%19 = load i8*, i8** %10
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = load i8*, i8** %10
%24 = tail call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
%26 = add nuw nsw i64 %9, 1
br i1 %25, label %27, label %6
27: ; preds = %22, %18, %14, %8
%28 = load i8*, i8** %10
br label %29
29: ; preds = %6, %1, %27
%30 = phi i8* [ %28, %27 ], [ null, %1 ], [ null, %6 ]
ret i8* %30
}