#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 /*<<< orphan*/ libererSimple(void **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ removeHeadAndTailChar(char **, char);
scalar_t__ strcmp(char *, char *);
int removeHeadAndTailChar_test() {
  int returnValue = 0;
  char c1[] = "---Bonjour, comment vas-tu ?-------";
  char c2[] = "-";
  char *cT;
  copierCharE((void *)c1, (void **)&cT);
  removeHeadAndTailChar(&cT, '-');
  printf("\tTest %d [", 1);
  if (strcmp("Bonjour, comment vas-tu ?", cT) != 0) {
    printf("] Failed !\n");
    returnValue = 1;
  } else {
    printf("] OK !\n");
  }
  libererSimple((void **)&cT);
  copierCharE((void *)c2, (void **)&cT);
  removeHeadAndTailChar(&cT, '-');
  printf("\tTest %d [", 2);
  if (strcmp("", cT) != 0) {
    printf("] Failed !\n");
    returnValue = 1;
  } else {
    printf("] OK !\n");
  }
  libererSimple((void **)&cT);
  return returnValue;
}


x86 assembly (clang, -O0):
<removeHeadAndTailChar_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x24,%edx
call   1070 <memcpy@plt>
mov    0xe99(%rip),%ax
mov    %ax,-0x32(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <copierCharE@plt>
lea    -0x40(%rbp),%rdi
mov    $0x2d,%esi
call   1040 <removeHeadAndTailChar@plt>
lea    0xe75(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11f1 <removeHeadAndTailChar_test+0x91>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ff <removeHeadAndTailChar_test+0x9f>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1080 <libererSimple@plt>
lea    -0x32(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <copierCharE@plt>
lea    -0x40(%rbp),%rdi
mov    $0x2d,%esi
call   1040 <removeHeadAndTailChar@plt>
lea    0xdfc(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     126a <removeHeadAndTailChar_test+0x10a>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1278 <removeHeadAndTailChar_test+0x118>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1080 <libererSimple@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeHeadAndTailChar_test>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe81(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x2d2d2d,0x30(%rsp)
movw   $0x2d,0x6(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1030 <copierCharE@plt>
mov    %r14,%rdi
mov    $0x2d,%esi
call   1050 <removeHeadAndTailChar@plt>
lea    0xe6b(%rip),%r12
mov    %r12,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xe5b(%rip),%rdi
call   1070 <strcmp@plt>
mov    %rax,%r15
test   %rax,%rax
lea    0xe63(%rip),%rbp
lea    0xe63(%rip),%rbx
mov    %rbx,%rdi
cmove  %rbp,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1080 <libererSimple@plt>
lea    0x6(%rsp),%rdi
mov    %r14,%rsi
call   1030 <copierCharE@plt>
mov    %r14,%rdi
mov    $0x2d,%esi
call   1050 <removeHeadAndTailChar@plt>
mov    %r12,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xe19(%rip),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
cmove  %rbp,%rbx
xor    %ebp,%ebp
or     %r15,%rax
setne  %bpl
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1080 <libererSimple@plt>
mov    %ebp,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.removeHeadAndTailChar_test.c1 = [36 x i8] c"---Bonjour, comment vas-tu ?-------\00"
@__const.removeHeadAndTailChar_test.c2 = [2 x i8] c"-\00"
@.str = [11 x i8] c"\09Test %d [\00"
@.str.1 = [26 x i8] c"Bonjour, comment vas-tu ?\00"
@.str.2 = [12 x i8] c"] Failed !\0A\00"
@.str.3 = [8 x i8] c"] OK !\0A\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @removeHeadAndTailChar_test() {
%1 = alloca i32
%2 = alloca [36 x i8]
%3 = alloca [2 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [36 x i8]* %2 to i8*
%6 = bitcast [2 x i8]* %3 to i8*
%7 = getelementptr inbounds [36 x i8], [36 x i8]* %2, i64 0, i64 0
%8 = call i32 @copierCharE(i8* %7, i8** %4)
%9 = call i32 @removeHeadAndTailChar(i8** %4, i8 signext 45)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1)
%11 = load i8*, i8** %4
%12 = call i64 @strcmp(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = 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 %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = call i32 @libererSimple(i8** %4)
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%21 = call i32 @copierCharE(i8* %20, i8** %4)
%22 = call i32 @removeHeadAndTailChar(i8** %4, i8 signext 45)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 2)
%24 = load i8*, i8** %4
%25 = call i64 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %18
%28 = 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 %31
29: ; preds = %18
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
%32 = call i32 @libererSimple(i8** %4)
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@__const.removeHeadAndTailChar_test.c1 = [36 x i8] c"---Bonjour, comment vas-tu ?-------\00"
@.str = [11 x i8] c"\09Test %d [\00"
@.str.1 = [26 x i8] c"Bonjour, comment vas-tu ?\00"
@.str.4 = [1 x i8] zeroinitializer
@str.5 = [7 x i8] c"] OK !\00"
@str.7 = [11 x i8] c"] Failed !\00"
define i32 @removeHeadAndTailChar_test() {
%1 = alloca [36 x i8]
%2 = alloca i16
%3 = alloca i8*
%4 = getelementptr inbounds [36 x i8], [36 x i8]* %1, i64 0, i64 0
%5 = bitcast i16* %2 to i8*
store i16 45, i16* %2
%6 = bitcast i8** %3 to i8*
%7 = call i32 @copierCharE(i8* %4, i8** %3)
%8 = call i32 @removeHeadAndTailChar(i8** %3, i8 signext 45)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = load i8*, i8** %3
%11 = call i64 @strcmp(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, 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.7, i64 0, i64 0)
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = call i32 @libererSimple(i8** %3)
%16 = call i32 @copierCharE(i8* %5, i8** %3)
%17 = call i32 @removeHeadAndTailChar(i8** %3, i8 signext 45)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 2)
%19 = load i8*, i8** %3
%20 = call i64 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, 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.7, i64 0, i64 0)
%23 = select i1 %21, i1 %12, i1 false
%24 = xor i1 %23, true
%25 = zext i1 %24 to i32
%26 = call i32 @puts(i8* dereferenceable(1) %22)
%27 = call i32 @libererSimple(i8** %3)
ret i32 %25
}