#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 *);
int nbCaracteresSpeciaux(char *commande[]) {
  int nbCar = 0;
  int i;
  for (i = 0; i < nbElementsCommande(commande); i++) {
    if (strcmp(commande[i], "<") == 0 || strcmp(commande[i], ">") == 0 ||
        strcmp(commande[i], "|") == 0)
      nbCar++;
  }
  return nbCar;
}


x86 assembly (clang, -O0):
<nbCaracteresSpeciaux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <nbElementsCommande@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    11d8 <nbCaracteresSpeciaux+0xb8>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe97(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11bc <nbCaracteresSpeciaux+0x9c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe77(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11bc <nbCaracteresSpeciaux+0x9c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe57(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c5 <nbCaracteresSpeciaux+0xa5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ca <nbCaracteresSpeciaux+0xaa>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113a <nbCaracteresSpeciaux+0x1a>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbCaracteresSpeciaux>:
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    11ac <nbCaracteresSpeciaux+0x8c>
xor    %ebp,%ebp
lea    0xec0(%rip),%r14
lea    0xebb(%rip),%r15
lea    0xeb6(%rip),%r12
xor    %r13d,%r13d
jmp    1177 <nbCaracteresSpeciaux+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13d
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <nbElementsCommande@plt>
cltq
cmp    %rax,%rbp
jge    11af <nbCaracteresSpeciaux+0x8f>
mov    (%rbx,%rbp,8),%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1160 <nbCaracteresSpeciaux+0x40>
mov    (%rbx,%rbp,8),%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1160 <nbCaracteresSpeciaux+0x40>
mov    (%rbx,%rbp,8),%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1164 <nbCaracteresSpeciaux+0x44>
jmp    1160 <nbCaracteresSpeciaux+0x40>
xor    %r13d,%r13d
mov    %r13d,%eax
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"
define i32 @nbCaracteresSpeciaux(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %38, %1
%6 = load i32, i32* %4
%7 = load i8**, i8*** %2
%8 = call i32 @nbElementsCommande(i8** %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %41
10: ; preds = %5
%11 = load i8**, i8*** %2
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %34, label %18
18: ; preds = %10
%19 = load i8**, i8*** %2
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %34, label %26
26: ; preds = %18
%27 = load i8**, i8*** %2
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %26, %18, %10
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %37
37: ; preds = %34, %26
br label %38
38: ; preds = %37
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %5
41: ; preds = %5
%42 = load i32, i32* %3
ret i32 %42
}

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