#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*/ fprintf(int /*<<< orphan*/, char *);
char *getword(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
scalar_t__ strtod(char *, char **);
int read_float4_f(FILE *fp, float *array, int size) {
  register int i;
  char *ch, *stat;
  for (i = 0; i < size; i++) {
    ch = getword(fp);
    array[i] = (float)strtod(ch, &stat);
    if (*stat) {
      fprintf(stderr, "non-digits in datablock\n");
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<read_float4_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c3 <read_float4_f+0x93>
mov    -0x10(%rbp),%rdi
call   1040 <getword@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strtod@plt>
cvtsi2ss %rax,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b0 <read_float4_f+0x80>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ca <read_float4_f+0x9a>
jmp    11b5 <read_float4_f+0x85>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114a <read_float4_f+0x1a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_float4_f>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edx,%edx
jle    1194 <read_float4_f+0x64>
mov    %rsi,%r14
mov    %rdi,%r13
mov    %edx,%r12d
xor    %ebx,%ebx
lea    0x8(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <getword@plt>
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strtod@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%r14,%rbx,4)
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
jne    1198 <read_float4_f+0x68>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1160 <read_float4_f+0x30>
xor    %eax,%eax
jmp    11b2 <read_float4_f+0x82>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xe58(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"non-digits in datablock\0A\00"
define i32 @read_float4_f(i32* %0, float* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
store i32* %0, i32** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %11
11: ; preds = %32, %3
%12 = load i32, i32* %8
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %35
15: ; preds = %11
%16 = load i32*, i32** %5
%17 = call i8* @getword(i32* %16)
store i8* %17, i8** %9
%18 = load i8*, i8** %9
%19 = call i64 @strtod(i8* %18, i8** %10)
%20 = sitofp i64 %19 to float
%21 = load float*, float** %6
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %21, i64 %23
store float %20, float* %24
%25 = load i8*, i8** %10
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %15
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %36
31: ; preds = %15
br label %32
32: ; preds = %31
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %11
35: ; preds = %11
store i32 0, i32* %4
br label %36
36: ; preds = %35, %28
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"non-digits in datablock\0A\00"
define i32 @read_float4_f(i32* %0, float* nocapture writeonly %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %24
7: ; preds = %3
%8 = zext i32 %2 to i64
br label %11
9: ; preds = %11
%10 = icmp eq i64 %20, %8
br i1 %10, label %24, label %11
11: ; preds = %7, %9
%12 = phi i64 [ 0, %7 ], [ %20, %9 ]
%13 = tail call i8* @getword(i32* %0)
%14 = call i64 @strtod(i8* %13, i8** %4)
%15 = sitofp i64 %14 to float
%16 = getelementptr inbounds float, float* %1, i64 %12
store float %15, float* %16
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
%20 = add nuw nsw i64 %12, 1
br i1 %19, label %9, label %21
21: ; preds = %11
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %9, %3, %21
%25 = phi i32 [ 1, %21 ], [ 0, %3 ], [ 0, %9 ]
ret i32 %25
}