#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*/ close(int);
int /*<<< orphan*/ get_message();
int lecture(char *);
scalar_t__ liste_fichiers(char *);
int /*<<< orphan*/ size_message();
int /*<<< orphan*/ write(int, int /*<<< orphan*/, int /*<<< orphan*/);
void ajout_info_liste(int fd) {
  while (lecture("entete_ref") == 1)
    write(fd, get_message(), size_message());
  while (liste_fichiers(".")) {
    write(fd, get_message(), size_message());
  }
  close(fd);
}


x86 assembly (clang, -O0):
<ajout_info_liste>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe8e(%rip),%rdi
call   1040 <lecture@plt>
cmp    $0x1,%eax
jne    11a9 <ajout_info_liste+0x49>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <get_message@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <size_message@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %eax,%edx
call   1050 <write@plt>
jmp    116b <ajout_info_liste+0xb>
jmp    11ae <ajout_info_liste+0x4e>
lea    0xe56(%rip),%rdi
call   1080 <liste_fichiers@plt>
cmp    $0x0,%rax
je     11ed <ajout_info_liste+0x8d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <get_message@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <size_message@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    %eax,%edx
call   1050 <write@plt>
jmp    11ae <ajout_info_liste+0x4e>
mov    -0x4(%rbp),%edi
call   1060 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ajout_info_liste>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xe93(%rip),%rdi
call   1040 <lecture@plt>
cmp    $0x1,%eax
jne    11a8 <ajout_info_liste+0x48>
lea    0xe82(%rip),%r14
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <get_message@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <size_message@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <write@plt>
mov    %r14,%rdi
call   1040 <lecture@plt>
cmp    $0x1,%eax
je     1180 <ajout_info_liste+0x20>
lea    0xe5c(%rip),%rdi
call   1080 <liste_fichiers@plt>
test   %rax,%rax
je     11e8 <ajout_info_liste+0x88>
lea    0xe4b(%rip),%r14
xor    %eax,%eax
call   1030 <get_message@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <size_message@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <write@plt>
mov    %r14,%rdi
call   1080 <liste_fichiers@plt>
test   %rax,%rax
jne    11c0 <ajout_info_liste+0x60>
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <close@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"entete_ref\00"
@.str.1 = [2 x i8] c".\00"
define void @ajout_info_liste(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %6, %1
%4 = call i32 @lecture(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 (...) @get_message()
%9 = call i32 (...) @size_message()
%10 = call i32 @write(i32 %7, i32 %8, i32 %9)
br label %3
11: ; preds = %3
br label %12
12: ; preds = %15, %11
%13 = call i64 @liste_fichiers(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %2
%17 = call i32 (...) @get_message()
%18 = call i32 (...) @size_message()
%19 = call i32 @write(i32 %16, i32 %17, i32 %18)
br label %12
20: ; preds = %12
%21 = load i32, i32* %2
%22 = call i32 @close(i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"entete_ref\00"
@.str.1 = [2 x i8] c".\00"
define void @ajout_info_liste(i32 %0) {
%2 = tail call i32 @lecture(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 1
br i1 %3, label %7, label %4
4: ; preds = %7, %1
%5 = tail call i64 @liste_fichiers(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %19, label %13
7: ; preds = %1, %7
%8 = tail call i32 (...) @get_message()
%9 = tail call i32 (...) @size_message()
%10 = tail call i32 @write(i32 %0, i32 %8, i32 %9)
%11 = tail call i32 @lecture(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %11, 1
br i1 %12, label %7, label %4
13: ; preds = %4, %13
%14 = tail call i32 (...) @get_message()
%15 = tail call i32 (...) @size_message()
%16 = tail call i32 @write(i32 %0, i32 %14, i32 %15)
%17 = tail call i64 @liste_fichiers(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %13
19: ; preds = %13, %4
%20 = tail call i32 @close(i32 %0)
ret void
}