#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int strlen(char *);
void view_entete() {
  FILE *ft;
  char st[200];
  printf("|--------------------------------|\n");
  printf("|BIENVENUE Chez Notre Entreprise |\n");
  printf("|--------------------------------|\n");
  ft = fopen("en_téte", "r");
  for (; fgets(st, 100, ft);) {
    *(st + strlen(st) - 1) = '\0';
    puts(st);
  }
}


x86 assembly (clang, -O0):
<view_entete>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1050 <printf@plt>
lea    0xe86(%rip),%rdi
call   1050 <printf@plt>
lea    0xec2(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     11dc <view_entete+0x8c>
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0xd1(%rbp,%rax,1)
lea    -0xd0(%rbp),%rdi
call   1030 <puts@plt>
jmp    1196 <view_entete+0x46>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<view_entete>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
lea    0xedd(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
lea    0xe8e(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x64,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11cc <view_entete+0x8c>
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rsp,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
jne    11a0 <view_entete+0x60>
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"|--------------------------------|\0A\00"
@.str.1 = [36 x i8] c"|BIENVENUE Chez Notre Entreprise |\0A\00"
@.str.2 = [9 x i8] c"en_t\C3\A9te\00"
@.str.3 = [2 x i8] c"r\00"
define void @view_entete() {
%1 = alloca i32*
%2 = alloca [200 x i8]
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %6, i32** %1
br label %7
7: ; preds = %12, %0
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%9 = load i32*, i32** %1
%10 = call i64 @fgets(i8* %8, i32 100, i32* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
%18 = getelementptr inbounds i8, i8* %17, i64 -1
store i8 0, i8* %18
%19 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%20 = call i32 @puts(i8* %19)
br label %7
21: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"en_t\C3\A9te\00"
@.str.3 = [2 x i8] c"r\00"
@str.4 = [35 x i8] c"|BIENVENUE Chez Notre Entreprise |\00"
@str.5 = [35 x i8] c"|--------------------------------|\00"
define void @view_entete() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = call i64 @fgets(i8* %2, i32 100, i32* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %0, %9
%10 = call i32 @strlen(i8* %2)
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %11
%13 = getelementptr inbounds i8, i8* %12, i64 -1
store i8 0, i8* %13
%14 = call i32 @puts(i8* %2)
%15 = call i64 @fgets(i8* %2, i32 100, i32* %6)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9, %0
ret void
}