#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*/ fclose(int /*<<< orphan*/ *);
unsigned char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void Lecture_cfile_vec_F6_int(char *file, int n, int *L) {
  FILE *fichier;
  fichier = fopen(file, "rb");
  unsigned char c = 0;
  int i;
  for (i = 0; i < n; i++) {
    c = fgetc(fichier);
    L[i] = c;
  }
  fclose(fichier);
}


x86 assembly (clang, -O0):
<Lecture_cfile_vec_F6_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1197 <Lecture_cfile_vec_F6_int+0x67>
mov    -0x20(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x21(%rbp)
movzbl -0x21(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1162 <Lecture_cfile_vec_F6_int+0x32>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lecture_cfile_vec_F6_int>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
lea    0xebd(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r15
test   %ebp,%ebp
jle    1178 <Lecture_cfile_vec_F6_int+0x48>
mov    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
call   1040 <fgetc@plt>
movzbl %al,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <Lecture_cfile_vec_F6_int+0x30>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define void @Lecture_cfile_vec_F6_int(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%10 = load i8*, i8** %4
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %7
store i8 0, i8* %8
store i32 0, i32* %9
br label %12
12: ; preds = %25, %3
%13 = load i32, i32* %9
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i32*, i32** %7
%18 = call zeroext i8 @fgetc(i32* %17)
store i8 %18, i8* %8
%19 = load i8, i8* %8
%20 = zext i8 %19 to i32
%21 = load i32*, i32** %6
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
store i32 %20, i32* %24
br label %25
25: ; preds = %16
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %12
28: ; preds = %12
%29 = load i32*, i32** %7
%30 = call i32 @fclose(i32* %29)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define void @Lecture_cfile_vec_F6_int(i8* nocapture %0, i32 %1, i32* nocapture writeonly %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = tail call zeroext i8 @fgetc(i32* %4)
%11 = zext i8 %10 to i32
%12 = getelementptr inbounds i32, i32* %2, i64 %9
store i32 %11, i32* %12
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %3
%16 = tail call i32 @fclose(i32* %4)
ret void
}