#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*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *);
void leer_precios(float precios[10]) {
  FILE *fich;
  int i;
  fich = fopen("precios.txt", "r");
  for (i = 0; i < 10; i = i + 1) {
    fscanf(fich, "%f", &precios[i]);
  }
  fclose(fich);
}


x86 assembly (clang, -O0):
<leer_precios>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1191 <leer_precios+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe90(%rip),%rsi
call   1040 <fscanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <leer_precios+0x2a>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leer_precios>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xec1(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
lea    0xeb9(%rip),%r15
mov    %rax,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <fscanf@plt>
lea    0x4(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x8(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0xc(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x10(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x14(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x18(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x1c(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x20(%rbx),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
add    $0x24,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <fscanf@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"precios.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%f\00"
define void @leer_precios(float* %0) {
%2 = alloca float*
%3 = alloca i32*
%4 = alloca i32
store float* %0, float** %2
%5 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %3
store i32 0, i32* %4
br label %6
6: ; preds = %16, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32*, i32** %3
%11 = load float*, float** %2
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float, float* %11, i64 %13
%15 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %14)
br label %16
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %6
19: ; preds = %6
%20 = load i32*, i32** %3
%21 = call i32 @fclose(i32* %20)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"precios.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%f\00"
define void @leer_precios(float* %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %0)
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %4)
%6 = getelementptr inbounds float, float* %0, i64 2
%7 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %6)
%8 = getelementptr inbounds float, float* %0, i64 3
%9 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %8)
%10 = getelementptr inbounds float, float* %0, i64 4
%11 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %10)
%12 = getelementptr inbounds float, float* %0, i64 5
%13 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %12)
%14 = getelementptr inbounds float, float* %0, i64 6
%15 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %14)
%16 = getelementptr inbounds float, float* %0, i64 7
%17 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %16)
%18 = getelementptr inbounds float, float* %0, i64 8
%19 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %18)
%20 = getelementptr inbounds float, float* %0, i64 9
%21 = tail call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %20)
%22 = tail call i32 @fclose(i32* %2)
ret void
}