#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ trim(char *);
void run(char *original, char *expected) {
  char buffer[41];
  printf("Fonction trim avec valeur '%s'\n", original);
  strcpy(buffer, original);
  trim(buffer);
  printf("Resultat '%s' avec le resultat attendu '%s'\n", buffer, expected);
  if (strcmp(buffer, expected) == 0)
    printf("SUCCES\n\n");
  else {
    printf("ECHEC\n\n");
    assert(0);
  }
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1050 <trim@plt>
lea    -0x40(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11c8 <run+0x78>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dd <run+0x8d>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <assert@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1060 <trim@plt>
lea    0xe83(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11cf <run+0x6f>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <assert@plt>
jmp    11db <run+0x7b>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Fonction trim avec valeur '%s'\0A\00"
@.str.1 = [45 x i8] c"Resultat '%s' avec le resultat attendu '%s'\0A\00"
@.str.2 = [9 x i8] c"SUCCES\0A\0A\00"
@.str.3 = [8 x i8] c"ECHEC\0A\0A\00"
define void @run(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [41 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [41 x i8], [41 x i8]* %5, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = getelementptr inbounds [41 x i8], [41 x i8]* %5, i64 0, i64 0
%12 = call i32 @trim(i8* %11)
%13 = getelementptr inbounds [41 x i8], [41 x i8]* %5, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
%16 = getelementptr inbounds [41 x i8], [41 x i8]* %5, i64 0, i64 0
%17 = load i8*, i8** %4
%18 = call i64 @strcmp(i8* %16, i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %25
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @assert(i32 0)
br label %25
25: ; preds = %22, %20
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Fonction trim avec valeur '%s'\0A\00"
@.str.1 = [45 x i8] c"Resultat '%s' avec le resultat attendu '%s'\0A\00"
@str = [7 x i8] c"ECHEC\0A\00"
@str.4 = [8 x i8] c"SUCCES\0A\00"
define void @run(i8* %0, i8* %1) {
%3 = alloca [41 x i8]
%4 = getelementptr inbounds [41 x i8], [41 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = call i32 @strcpy(i8* %4, i8* %0)
%7 = call i32 @trim(i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %1)
%9 = call i64 @strcmp(i8* %4, i8* %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0))
br label %16
13: ; preds = %2
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%15 = call i32 @assert(i32 0)
br label %16
16: ; preds = %13, %11
ret void
}