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


x86 assembly (clang, -O0):
<Lecture_cfile_vec_F12_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)
movb   $0x0,-0x22(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b0 <Lecture_cfile_vec_F12_int+0x80>
mov    -0x20(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x22(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x21(%rbp)
movzbl -0x22(%rbp),%edx
shl    $0x8,%edx
movzbl -0x21(%rbp),%eax
xor    %eax,%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    1166 <Lecture_cfile_vec_F12_int+0x36>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lecture_cfile_vec_F12_int>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebx
lea    0xebc(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r12
test   %ebx,%ebx
jle    118a <Lecture_cfile_vec_F12_int+0x5a>
mov    %ebx,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1040 <fgetc@plt>
movzbl %bl,%ecx
shl    $0x8,%ecx
movzbl %al,%eax
or     %ecx,%eax
mov    %eax,(%r14,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1160 <Lecture_cfile_vec_F12_int+0x30>
mov    %r12,%rdi
pop    %rbx
pop    %r12
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_F12_int(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%11 = load i8*, i8** %4
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %7
store i8 0, i8* %8
store i8 0, i8* %9
store i32 0, i32* %10
br label %13
13: ; preds = %32, %3
%14 = load i32, i32* %10
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %35
17: ; preds = %13
%18 = load i32*, i32** %7
%19 = call zeroext i8 @fgetc(i32* %18)
store i8 %19, i8* %9
%20 = load i32*, i32** %7
%21 = call zeroext i8 @fgetc(i32* %20)
store i8 %21, i8* %8
%22 = load i8, i8* %9
%23 = zext i8 %22 to i32
%24 = shl i32 %23, 8
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = xor i32 %24, %26
%28 = load i32*, i32** %6
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 %27, i32* %31
br label %32
32: ; preds = %17
%33 = load i32, i32* %10
%34 = add nsw i32 %33, 1
store i32 %34, i32* %10
br label %13
35: ; preds = %13
%36 = load i32*, i32** %7
%37 = call i32 @fclose(i32* %36)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define void @Lecture_cfile_vec_F12_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 %19
6: ; preds = %3
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %17, %8 ]
%10 = tail call zeroext i8 @fgetc(i32* %4)
%11 = tail call zeroext i8 @fgetc(i32* %4)
%12 = zext i8 %10 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = zext i8 %11 to i32
%15 = or i32 %13, %14
%16 = getelementptr inbounds i32, i32* %2, i64 %9
store i32 %15, i32* %16
%17 = add nuw nsw i64 %9, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %19, label %8
19: ; preds = %8, %3
%20 = tail call i32 @fclose(i32* %4)
ret void
}