#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fermerFichier(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *ouvrirFichier(char const *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
void lireEtAfficher(const char *chemin) {
  FILE *fichier;
  char buffer[200];
  fichier = ouvrirFichier(chemin, "r", "fonction \"lireEtAfficher\"");
  while (!feof(fichier)) {
    fgets(buffer, 200, fichier);
    if (!feof(fichier))
      printf("%s", buffer);
  }
  fermerFichier(fichier, "fonction \"lireEtAfficher\"");
}


x86 assembly (clang, -O0):
<lireEtAfficher>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
lea    0xe91(%rip),%rdx
call   1060 <ouvrirFichier@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1198 <lireEtAfficher+0x48>
jmp    11d7 <lireEtAfficher+0x87>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0xc8,%esi
call   1050 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
jne    11d2 <lireEtAfficher+0x82>
lea    -0xe0(%rbp),%rsi
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
jmp    117a <lireEtAfficher+0x2a>
mov    -0x10(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   1030 <fermerFichier@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lireEtAfficher>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
lea    0xe9d(%rip),%rsi
lea    0xe98(%rip),%rdx
call   1060 <ouvrirFichier@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     119a <lireEtAfficher+0x4a>
lea    0xe7d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <fermerFichier@plt>
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rsp,%r14
lea    0xe78(%rip),%r15
jmp    11bc <lireEtAfficher+0x6c>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    117e <lireEtAfficher+0x2e>
mov    %r14,%rdi
mov    $0xc8,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    11b0 <lireEtAfficher+0x60>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
jmp    11b0 <lireEtAfficher+0x60>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [26 x i8] c"fonction \22lireEtAfficher\22\00"
@.str.2 = [3 x i8] c"%s\00"
define void @lireEtAfficher(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [200 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32* @ouvrirFichier(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %3
br label %7
7: ; preds = %22, %1
%8 = load i32*, i32** %3
%9 = call i32 @feof(i32* %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br i1 %11, label %12, label %23
12: ; preds = %7
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%14 = load i32*, i32** %3
%15 = call i32 @fgets(i8* %13, i32 200, i32* %14)
%16 = load i32*, i32** %3
%17 = call i32 @feof(i32* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %12
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %19, %12
br label %7
23: ; preds = %7
%24 = load i32*, i32** %3
%25 = call i32 @fermerFichier(i32* %24, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [26 x i8] c"fonction \22lireEtAfficher\22\00"
@.str.2 = [3 x i8] c"%s\00"
define void @lireEtAfficher(i8* %0) {
%2 = alloca [200 x i8]
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @ouvrirFichier(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @feof(i32* %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1, %13
%8 = call i32 @fgets(i8* %3, i32 200, i32* %4)
%9 = call i32 @feof(i32* %4)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %13
13: ; preds = %11, %7
%14 = call i32 @feof(i32* %4)
%15 = icmp eq i32 %14, 0
br i1 %15, label %7, label %16
16: ; preds = %13, %1
%17 = call i32 @fermerFichier(i32* %4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}