#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*/ exit(int);
int fread(float *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ lg(char *);
void readfiles(FILE *fp[], float *s, int nscores) {
  int f;
  for (f = 0; f < nscores; f++)
    if (1 != fread(&s[f], sizeof(float), 1, fp[f])) {
      lg("Error\n");
      exit(1);
    }
}


x86 assembly (clang, -O0):
<readfiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b8 <readfiles+0x88>
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     11a5 <readfiles+0x75>
lea    0xe6a(%rip),%rdi
call   1040 <lg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11aa <readfiles+0x7a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114a <readfiles+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readfiles>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1175 <readfiles+0x45>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
shl    $0x2,%r12
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r14,%rbx,1),%rdi
mov    (%r15,%rbx,2),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    1181 <readfiles+0x51>
add    $0x4,%rbx
cmp    %rbx,%r12
jne    1150 <readfiles+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe78(%rip),%rdi
call   1040 <lg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"Error\0A\00"
define void @readfiles(i32** nocapture %0, float* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %20
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %20, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds float, float* %1, i64 %10
%12 = getelementptr inbounds i32*, i32** %0, i64 %10
%13 = load i32*, i32** %12
%14 = tail call i32 @fread(float* %11, i32 4, i32 1, i32* %13)
%15 = icmp eq i32 %14, 1
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9
%18 = tail call i32 @lg(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %7, %3
ret void
}