#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*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, float *,
                          float *, float *, float *, float *);
int read(char filename[], char name[][40], float w[], float q[], float t[],
         float p[], float e[]) {
  FILE *fp = fopen(filename, "r");
  int result = -1;
  int i;
  if (fp != NULL) {
    while (!feof(fp)) {
      for (i = 0; i < 100; i++) {
        fscanf(fp, "%[^,],%f,%f,%f,%f,%f\n", name[i], &w[i], &q[i], &t[i],
               &p[i], &e[i]);
      }
      result = 0;
    }
    fclose(fp);
  }
  return result;
}


x86 assembly (clang, -O0):
<read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x38(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1254 <read+0x114>
jmp    118f <read+0x4f>
mov    -0x38(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ad <read+0x6d>
jmp    124b <read+0x10b>
movl   $0x0,-0x40(%rbp)
cmpl   $0x64,-0x40(%rbp)
jge    123f <read+0xff>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rdx
movslq -0x40(%rbp),%rax
imul   $0x28,%rax,%rax
add    %rax,%rdx
mov    -0x18(%rbp),%rcx
movslq -0x40(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
mov    -0x20(%rbp),%r8
movslq -0x40(%rbp),%rax
shl    $0x2,%rax
add    %rax,%r8
mov    -0x28(%rbp),%r9
movslq -0x40(%rbp),%rax
shl    $0x2,%rax
add    %rax,%r9
mov    -0x30(%rbp),%r10
movslq -0x40(%rbp),%rax
shl    $0x2,%rax
add    %rax,%r10
mov    0x10(%rbp),%rax
movslq -0x40(%rbp),%rsi
shl    $0x2,%rsi
add    %rsi,%rax
lea    0xddf(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <fscanf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11b4 <read+0x74>
movl   $0x0,-0x3c(%rbp)
jmp    118f <read+0x4f>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x3c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%rbx
mov    %r8,%rbp
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
lea    0xe9f(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     1202 <read+0xc2>
mov    %rax,%r12
mov    %rax,%rdi
call   1050 <feof@plt>
mov    %r15,(%rsp)
mov    %r14,%r15
mov    $0xffffffff,%r14d
test   %eax,%eax
jne    11f8 <read+0xb8>
xor    %r14d,%r14d
xchg   %ax,%ax
lea    (%r14,%r14,4),%rax
mov    (%rsp),%rcx
lea    (%rcx,%rax,8),%rdx
lea    0x0(,%r14,4),%rcx
add    %r13,%rcx
lea    (%r15,%r14,4),%r8
lea    0x0(%rbp,%r14,4),%r9
lea    (%rbx,%r14,4),%r10
mov    %rbp,%rax
mov    %rbx,%rbp
mov    0x40(%rsp),%rsi
lea    (%rsi,%r14,4),%rbx
mov    %r12,%rdi
lea    0xe35(%rip),%rsi
push   %rbx
mov    %rbp,%rbx
mov    %rax,%rbp
push   %r10
call   1040 <fscanf@plt>
add    $0x10,%rsp
add    $0x1,%r14
cmp    $0x64,%r14
jne    1190 <read+0x50>
mov    %r12,%rdi
call   1050 <feof@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     1190 <read+0x50>
mov    %r12,%rdi
call   1030 <fclose@plt>
jmp    1208 <read+0xc8>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"%[^,],%f,%f,%f,%f,%f\0A\00"
define i32 @read(i8* %0, [40 x i8]* %1, float* %2, float* %3, float* %4, float* %5, float* %6) {
%8 = alloca i8*
%9 = alloca [40 x i8]*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca i32*
%16 = alloca i32
%17 = alloca i32
store i8* %0, i8** %8
store [40 x i8]* %1, [40 x i8]** %9
store float* %2, float** %10
store float* %3, float** %11
store float* %4, float** %12
store float* %5, float** %13
store float* %6, float** %14
%18 = load i8*, i8** %8
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %15
store i32 -1, i32* %16
%20 = load i32*, i32** %15
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %67
22: ; preds = %7
br label %23
23: ; preds = %63, %22
%24 = load i32*, i32** %15
%25 = call i32 @feof(i32* %24)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br i1 %27, label %28, label %64
28: ; preds = %23
store i32 0, i32* %17
br label %29
29: ; preds = %60, %28
%30 = load i32, i32* %17
%31 = icmp slt i32 %30, 100
br i1 %31, label %32, label %63
32: ; preds = %29
%33 = load i32*, i32** %15
%34 = load [40 x i8]*, [40 x i8]** %9
%35 = load i32, i32* %17
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [40 x i8], [40 x i8]* %34, i64 %36
%38 = getelementptr inbounds [40 x i8], [40 x i8]* %37, i64 0, i64 0
%39 = load float*, float** %10
%40 = load i32, i32* %17
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds float, float* %39, i64 %41
%43 = load float*, float** %11
%44 = load i32, i32* %17
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
%47 = load float*, float** %12
%48 = load i32, i32* %17
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds float, float* %47, i64 %49
%51 = load float*, float** %13
%52 = load i32, i32* %17
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds float, float* %51, i64 %53
%55 = load float*, float** %14
%56 = load i32, i32* %17
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds float, float* %55, i64 %57
%59 = call i32 @fscanf(i32* %33, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %38, float* %42, float* %46, float* %50, float* %54, float* %58)
br label %60
60: ; preds = %32
%61 = load i32, i32* %17
%62 = add nsw i32 %61, 1
store i32 %62, i32* %17
br label %29
63: ; preds = %29
store i32 0, i32* %16
br label %23
64: ; preds = %23
%65 = load i32*, i32** %15
%66 = call i32 @fclose(i32* %65)
br label %67
67: ; preds = %64, %7
%68 = load i32, i32* %16
ret i32 %68
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"%[^,],%f,%f,%f,%f,%f\0A\00"
define i32 @read(i8* nocapture %0, [40 x i8]* %1, float* %2, float* %3, float* %4, float* %5, float* %6) {
%8 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %32, label %10
10: ; preds = %7
%11 = tail call i32 @feof(i32* %8)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %29
13: ; preds = %16
%14 = tail call i32 @feof(i32* %8)
%15 = icmp eq i32 %14, 0
br i1 %15, label %27, label %29
16: ; preds = %10, %27
%17 = phi i64 [ %28, %27 ], [ 0, %10 ]
%18 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 %17, i64 0
%19 = getelementptr inbounds float, float* %2, i64 %17
%20 = getelementptr inbounds float, float* %3, i64 %17
%21 = getelementptr inbounds float, float* %4, i64 %17
%22 = getelementptr inbounds float, float* %5, i64 %17
%23 = getelementptr inbounds float, float* %6, i64 %17
%24 = tail call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %18, float* %19, float* %20, float* %21, float* %22, float* %23)
%25 = add nuw nsw i64 %17, 1
%26 = icmp eq i64 %25, 100
br i1 %26, label %13, label %27
27: ; preds = %16, %13
%28 = phi i64 [ %25, %16 ], [ 0, %13 ]
br label %16
29: ; preds = %13, %10
%30 = phi i32 [ -1, %10 ], [ 0, %13 ]
%31 = tail call i32 @fclose(i32* %8)
br label %32
32: ; preds = %29, %7
%33 = phi i32 [ %30, %29 ], [ -1, %7 ]
ret i32 %33
}