#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*/ copierCharE(void *, void **);
int countNumberOfChamps(char *, char const *, int *);
int /*<<< orphan*/ libererSimple(void **);
int /*<<< orphan*/ printf(char *, ...);
int countNumberOfChamps_test() {
  int returnValue = 0;
  int result;
  int useless;
  const char *delimitor = "|";
  char stack1[] = "   alice  |  poisson  |     yourt  | ";
  char stack2[] = "   alice  |  poisson  |     yourt  |";
  char stack3[] = "   alice  |  poisson  |     yourt  ";
  char *str = NULL;
  printf("\tTest %d [", 1);
  copierCharE((void *)stack1, (void **)&str);
  result = countNumberOfChamps(str, delimitor, &useless);
  if (result != 3) {
    printf("] Failed !\n");
    returnValue = 1;
  } else {
    printf("] OK !\n");
  }
  libererSimple((void **)&str);
  printf("\tTest %d [", 2);
  copierCharE((void *)stack2, (void **)&str);
  result = countNumberOfChamps(str, delimitor, &useless);
  if (result != 3) {
    printf("] Failed !\n");
    returnValue = 1;
  } else {
    printf("] OK !\n");
  }
  libererSimple((void **)&str);
  printf("\tTest %d [", 3);
  copierCharE((void *)stack3, (void **)&str);
  result = countNumberOfChamps(str, delimitor, &useless);
  if (result != 3) {
    printf("] Failed !\n");
    returnValue = 1;
  } else {
    printf("] OK !\n");
  }
  libererSimple((void **)&str);
  return returnValue;
}


x86 assembly (clang, -O0):
<countNumberOfChamps_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x26,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xed3(%rip),%rsi
mov    $0x25,%edx
call   1050 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
lea    0xeeb(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
movq   $0x0,-0xa8(%rbp)
lea    0xe41(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0xa8(%rbp),%rsi
call   1030 <copierCharE@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1070 <countNumberOfChamps@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1218 <countNumberOfChamps_test+0xc8>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1226 <countNumberOfChamps_test+0xd6>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa8(%rbp),%rdi
call   1060 <libererSimple@plt>
lea    0xdc9(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xa8(%rbp),%rsi
call   1030 <copierCharE@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1070 <countNumberOfChamps@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1290 <countNumberOfChamps_test+0x140>
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    129e <countNumberOfChamps_test+0x14e>
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa8(%rbp),%rdi
call   1060 <libererSimple@plt>
lea    0xd51(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xa8(%rbp),%rsi
call   1030 <copierCharE@plt>
mov    -0xa8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1070 <countNumberOfChamps@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     130b <countNumberOfChamps_test+0x1bb>
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1319 <countNumberOfChamps_test+0x1c9>
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa8(%rbp),%rdi
call   1060 <libererSimple@plt>
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countNumberOfChamps_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xea9(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movabs $0x207c2020747275,%rax
mov    %rax,0x9e(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movabs $0x7c20207472756f,%rax
mov    %rax,0x6d(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x202074,0x40(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe1a(%rip),%rbp
mov    %rbp,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x80(%rsp),%rdi
lea    0x10(%rsp),%r14
mov    %r14,%rsi
call   1030 <copierCharE@plt>
mov    0x10(%rsp),%rdi
lea    0xde8(%rip),%r12
lea    0x1c(%rsp),%r13
mov    %r12,%rsi
mov    %r13,%rdx
call   1070 <countNumberOfChamps@plt>
cmp    $0x3,%eax
sete   0xf(%rsp)
lea    0xdd6(%rip),%r15
lea    0xdd6(%rip),%rbx
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <libererSimple@plt>
mov    %rbp,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x50(%rsp),%rdi
mov    %r14,%rsi
call   1030 <copierCharE@plt>
mov    0x10(%rsp),%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1070 <countNumberOfChamps@plt>
cmp    $0x3,%eax
sete   %bpl
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <libererSimple@plt>
lea    0xd62(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x20(%rsp),%rdi
mov    %r14,%rsi
call   1030 <copierCharE@plt>
mov    0x10(%rsp),%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1070 <countNumberOfChamps@plt>
cmp    $0x3,%eax
sete   %al
cmove  %r15,%rbx
and    %bpl,%al
and    0xf(%rsp),%al
xor    $0x1,%al
movzbl %al,%ebp
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <libererSimple@plt>
mov    %ebp,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"|\00"
@__const.countNumberOfChamps_test.stack1 = [38 x i8] c" alice | poisson | yourt | \00"
@__const.countNumberOfChamps_test.stack2 = [37 x i8] c" alice | poisson | yourt |\00"
@__const.countNumberOfChamps_test.stack3 = [36 x i8] c" alice | poisson | yourt \00"
@.str.1 = [11 x i8] c"\09Test %d [\00"
@.str.2 = [12 x i8] c"] Failed !\0A\00"
@.str.3 = [8 x i8] c"] OK !\0A\00"
define i32 @countNumberOfChamps_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [38 x i8]
%6 = alloca [37 x i8]
%7 = alloca [36 x i8]
%8 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4
%9 = bitcast [38 x i8]* %5 to i8*
%10 = bitcast [37 x i8]* %6 to i8*
%11 = bitcast [36 x i8]* %7 to i8*
store i8* null, i8** %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 1)
%13 = getelementptr inbounds [38 x i8], [38 x i8]* %5, i64 0, i64 0
%14 = call i32 @copierCharE(i8* %13, i8** %8)
%15 = load i8*, i8** %8
%16 = load i8*, i8** %4
%17 = call i32 @countNumberOfChamps(i8* %15, i8* %16, i32* %3)
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %24
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
%25 = call i32 @libererSimple(i8** %8)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 2)
%27 = getelementptr inbounds [37 x i8], [37 x i8]* %6, i64 0, i64 0
%28 = call i32 @copierCharE(i8* %27, i8** %8)
%29 = load i8*, i8** %8
%30 = load i8*, i8** %4
%31 = call i32 @countNumberOfChamps(i8* %29, i8* %30, i32* %3)
store i32 %31, i32* %2
%32 = load i32, i32* %2
%33 = icmp ne i32 %32, 3
br i1 %33, label %34, label %36
34: ; preds = %24
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %38
36: ; preds = %24
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
%39 = call i32 @libererSimple(i8** %8)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 3)
%41 = getelementptr inbounds [36 x i8], [36 x i8]* %7, i64 0, i64 0
%42 = call i32 @copierCharE(i8* %41, i8** %8)
%43 = load i8*, i8** %8
%44 = load i8*, i8** %4
%45 = call i32 @countNumberOfChamps(i8* %43, i8* %44, i32* %3)
store i32 %45, i32* %2
%46 = load i32, i32* %2
%47 = icmp ne i32 %46, 3
br i1 %47, label %48, label %50
48: ; preds = %38
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %52
50: ; preds = %38
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
%53 = call i32 @libererSimple(i8** %8)
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str = [2 x i8] c"|\00"
@__const.countNumberOfChamps_test.stack1 = [38 x i8] c" alice | poisson | yourt | \00"
@__const.countNumberOfChamps_test.stack2 = [37 x i8] c" alice | poisson | yourt |\00"
@__const.countNumberOfChamps_test.stack3 = [36 x i8] c" alice | poisson | yourt \00"
@.str.1 = [11 x i8] c"\09Test %d [\00"
@str.5 = [7 x i8] c"] OK !\00"
@str.8 = [11 x i8] c"] Failed !\00"
define i32 @countNumberOfChamps_test() {
%1 = alloca i32
%2 = alloca [38 x i8]
%3 = alloca [37 x i8]
%4 = alloca [36 x i8]
%5 = alloca i8*
%6 = bitcast i32* %1 to i8*
%7 = getelementptr inbounds [38 x i8], [38 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [37 x i8], [37 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [36 x i8], [36 x i8]* %4, i64 0, i64 0
%10 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 1)
%12 = call i32 @copierCharE(i8* %7, i8** %5)
%13 = load i8*, i8** %5
%14 = call i32 @countNumberOfChamps(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %1)
%15 = icmp eq i32 %14, 3
%16 = select i1 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0)
%17 = call i32 @puts(i8* dereferenceable(1) %16)
%18 = call i32 @libererSimple(i8** %5)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 2)
%20 = call i32 @copierCharE(i8* %8, i8** %5)
%21 = load i8*, i8** %5
%22 = call i32 @countNumberOfChamps(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %1)
%23 = icmp eq i32 %22, 3
%24 = select i1 %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0)
%25 = call i32 @puts(i8* dereferenceable(1) %24)
%26 = call i32 @libererSimple(i8** %5)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 3)
%28 = call i32 @copierCharE(i8* %9, i8** %5)
%29 = load i8*, i8** %5
%30 = call i32 @countNumberOfChamps(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %1)
%31 = icmp eq i32 %30, 3
%32 = select i1 %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.8, i64 0, i64 0)
%33 = select i1 %31, i1 %23, i1 false
%34 = select i1 %33, i1 %15, i1 false
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
%37 = call i32 @puts(i8* dereferenceable(1) %32)
%38 = call i32 @libererSimple(i8** %5)
ret i32 %36
}