#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
void affiche_xml_texte(char *texte_) {
  int i = 0;
  while (texte_[i] != '\0') {
    if (texte_[i] == '<') {
      fprintf(stdout, "&lt;");
    } else if (texte_[i] == '>') {
      fprintf(stdout, "&gt;");
    } else if (texte_[i] == '&') {
      fprintf(stdout, "&amp;");
    } else {
      putchar(texte_[i]);
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<affiche_xml_texte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11fe <affiche_xml_texte+0xde>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3c,%eax
jne    1177 <affiche_xml_texte+0x57>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11f0 <affiche_xml_texte+0xd0>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3e,%eax
jne    11a6 <affiche_xml_texte+0x86>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11eb <affiche_xml_texte+0xcb>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x26,%eax
jne    11d5 <affiche_xml_texte+0xb5>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xe3f(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11e6 <affiche_xml_texte+0xc6>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    11eb <affiche_xml_texte+0xcb>
jmp    11f0 <affiche_xml_texte+0xd0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <affiche_xml_texte+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<affiche_xml_texte>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%r13
lea    0xed0(%rip),%r14
lea    0xec4(%rip),%r15
lea    0xeb8(%rip),%r12
jmp    1160 <affiche_xml_texte+0x40>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    %r15,%rsi
call   1040 <fprintf@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x3b,%al
jle    1180 <affiche_xml_texte+0x60>
cmp    $0x3e,%al
je     1150 <affiche_xml_texte+0x30>
cmp    $0x3c,%al
jne    1191 <affiche_xml_texte+0x71>
mov    0x0(%r13),%edi
mov    %r12,%rsi
jmp    1157 <affiche_xml_texte+0x37>
nopl   0x0(%rax,%rax,1)
cmp    $0x26,%al
jne    118d <affiche_xml_texte+0x6d>
mov    0x0(%r13),%edi
mov    %r14,%rsi
jmp    1157 <affiche_xml_texte+0x37>
test   %al,%al
je     119f <affiche_xml_texte+0x7f>
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    1160 <affiche_xml_texte+0x40>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
@.str.2 = [6 x i8] c"&amp;\00"
define void @affiche_xml_texte(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %54, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %57
12: ; preds = %4
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 60
br i1 %19, label %20, label %23
20: ; preds = %12
%21 = load i32, i32* @stdout
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %54
23: ; preds = %12
%24 = load i8*, i8** %2
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 62
br i1 %30, label %31, label %34
31: ; preds = %23
%32 = load i32, i32* @stdout
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %53
34: ; preds = %23
%35 = load i8*, i8** %2
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 38
br i1 %41, label %42, label %45
42: ; preds = %34
%43 = load i32, i32* @stdout
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %52
45: ; preds = %34
%46 = load i8*, i8** %2
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = call i32 @putchar(i8 signext %50)
br label %52
52: ; preds = %45, %42
br label %53
53: ; preds = %52, %31
br label %54
54: ; preds = %53, %20
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %4
57: ; preds = %4
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c"&lt;\00"
@.str.1 = [5 x i8] c"&gt;\00"
@.str.2 = [6 x i8] c"&amp;\00"
define void @affiche_xml_texte(i8* nocapture %0) {
br label %2
2: ; preds = %17, %1
%3 = phi i64 [ %18, %17 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %15 [
i8 0, label %19
i8 60, label %6
i8 62, label %9
i8 38, label %12
]
6: ; preds = %2
%7 = load i32, i32* @stdout
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %17
9: ; preds = %2
%10 = load i32, i32* @stdout
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %17
12: ; preds = %2
%13 = load i32, i32* @stdout
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %17
15: ; preds = %2
%16 = tail call i32 @putchar(i8 signext %5)
br label %17
17: ; preds = %9, %15, %12, %6
%18 = add nuw i64 %3, 1
br label %2
19: ; preds = %2
ret void
}