#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*/ printf(char *, ...);
int /*<<< orphan*/ *strchr(char const *, char const);
int strlen(char const *);
void afficher_chaine_masquee(const char *chaine, const char *trouves) {
  int taille = strlen(chaine), i;
  for (i = 0; i < taille; i++) {
    if (strchr(trouves, chaine[i]) == NULL) {
      printf("_");
    } else {
      printf("%c", chaine[i]);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<afficher_chaine_masquee>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11be <afficher_chaine_masquee+0x8e>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    1191 <afficher_chaine_masquee+0x61>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11ab <afficher_chaine_masquee+0x7b>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11b0 <afficher_chaine_masquee+0x80>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1153 <afficher_chaine_masquee+0x23>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficher_chaine_masquee>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
test   %eax,%eax
jle    117c <afficher_chaine_masquee+0x4c>
mov    %eax,%r15d
xor    %ebx,%ebx
jmp    1163 <afficher_chaine_masquee+0x33>
xchg   %ax,%ax
movsbl (%r12,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     117c <afficher_chaine_masquee+0x4c>
movsbl (%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1050 <strchr@plt>
test   %rax,%rax
jne    1150 <afficher_chaine_masquee+0x20>
mov    $0x5f,%edi
jmp    1155 <afficher_chaine_masquee+0x25>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"_\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @afficher_chaine_masquee(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
store i32 0, i32* %6
br label %9
9: ; preds = %33, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %36
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = call i32* @strchr(i8* %14, i8 signext %19)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %32
24: ; preds = %13
%25 = load i8*, i8** %3
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %24, %22
br label %33
33: ; preds = %32
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %9
36: ; preds = %9
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @afficher_chaine_masquee(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %21
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %16
%8 = phi i64 [ 0, %5 ], [ %19, %16 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32* @strchr(i8* %1, i8 signext %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = load i8, i8* %9
%15 = sext i8 %14 to i32
br label %16
16: ; preds = %7, %13
%17 = phi i32 [ %15, %13 ], [ 95, %7 ]
%18 = tail call i32 @putchar(i32 %17)
%19 = add nuw nsw i64 %8, 1
%20 = icmp eq i64 %19, %6
br i1 %20, label %21, label %7
21: ; preds = %16, %2
%22 = tail call i32 @putchar(i32 10)
ret void
}