void chaine_test1() {
  char source[20] = {"coucou.bmp"};
  char separateur = '3';
  char entre[10] = {"-machin"};
  char *resultat;
  int i, ind = -1;
  printf("%d\n", strlen(source));
  for (i = 0; i < strlen(source); i++) {
    if (source[i] == separateur)
      ind = i;
  }
  printf("%d\n", ind);
  printf("strcharind : %d\n", strchrind("coucou.bmp", '.'));
  resultat = (char *)malloc((strlen("coucou.bmp") + strlen("coucou.bmp")) *
                            sizeof(char));
  strcpybtw(&resultat, "coucou.bmp", "-angle", '.');
  printf("test concat between : %s\n", resultat);
}


x86 assembly (clang, -O0):
<chaine_test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xea1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe9c(%rip),%eax
mov    %eax,-0x10(%rbp)
movb   $0x33,-0x21(%rbp)
mov    0xe92(%rip),%rax
mov    %rax,-0x2b(%rbp)
mov    0xe8f(%rip),%ax
mov    %ax,-0x23(%rbp)
movl   $0xffffffff,-0x40(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
cmp    %rcx,%rax
jae    1208 <chaine_test1+0xb8>
movslq -0x3c(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
movsbl -0x21(%rbp),%ecx
cmp    %ecx,%eax
jne    11f5 <chaine_test1+0xa5>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    11fa <chaine_test1+0xaa>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11b9 <chaine_test1+0x69>
mov    -0x40(%rbp),%esi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe0f(%rip),%rdi
mov    $0x2e,%esi
mov    $0x0,%al
call   1070 <strchrind@plt>
mov    %eax,%esi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x14,%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
lea    -0x38(%rbp),%rdi
lea    0xdda(%rip),%rsi
lea    0xdde(%rip),%rdx
mov    $0x2e,%ecx
mov    $0x0,%al
call   1030 <strcpybtw@plt>
mov    -0x38(%rbp),%rsi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chaine_test1>:
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rbx
mov    $0xa,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea0(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
xor    %eax,%eax
call   1060 <strchrind@plt>
lea    0xe79(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x14,%edi
call   1050 <malloc@plt>
mov    %rax,0x8(%rsp)
lea    0xe76(%rip),%rdx
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x2e,%ecx
xor    %eax,%eax
call   1030 <strcpybtw@plt>
mov    0x8(%rsp),%rsi
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.chaine_test1.source = [20 x i8] c"coucou.bmp\00\00\00\00\00\00\00\00\00\00"
@__const.chaine_test1.entre = [10 x i8] c"-machin\00\00\00"
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [17 x i8] c"strcharind : %d\0A\00"
@.str.2 = [11 x i8] c"coucou.bmp\00"
@.str.3 = [7 x i8] c"-angle\00"
@.str.4 = [26 x i8] c"test concat between : %s\0A\00"
define void @chaine_test1() {
%1 = alloca [20 x i8]
%2 = alloca i8
%3 = alloca [10 x i8]
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [20 x i8]* %1 to i8*
store i8 51, i8* %2
%8 = bitcast [10 x i8]* %3 to i8*
store i32 -1, i32* %6
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%10 = call i64 @strlen(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %10)
store i32 0, i32* %5
br label %12
12: ; preds = %30, %0
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%16 = call i64 @strlen(i8* %15)
%17 = icmp ult i64 %14, %16
br i1 %17, label %18, label %33
18: ; preds = %12
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %29
27: ; preds = %18
%28 = load i32, i32* %5
store i32 %28, i32* %6
br label %29
29: ; preds = %27, %18
br label %30
30: ; preds = %29
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %12
33: ; preds = %12
%34 = load i32, i32* %6
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @strchrind to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 46)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = call i8* @malloc(i64 20)
store i8* %38, i8** %4
%39 = call i32 (i8**, i8*, i8*, i32, ...) bitcast (i32 (...)* @strcpybtw to i32 (i8**, i8*, i8*, i32, ...)*)(i8** %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 46)
%40 = load i8*, i8** %4
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %40)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [17 x i8] c"strcharind : %d\0A\00"
@.str.2 = [11 x i8] c"coucou.bmp\00"
@.str.3 = [7 x i8] c"-angle\00"
@.str.4 = [26 x i8] c"test concat between : %s\0A\00"
define void @chaine_test1() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -1)
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @strchrind to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 46)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call dereferenceable_or_null(20) i8* @malloc(i64 20)
store i8* %7, i8** %1
%8 = call i32 (i8**, i8*, i8*, i32, ...) bitcast (i32 (...)* @strcpybtw to i32 (i8**, i8*, i8*, i32, ...)*)(i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 46)
%9 = load i8*, i8** %1
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %9)
ret void
}