#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 */
char *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ isspace(char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sscanf(char *, char *, float *);
void scan_line(FILE *fp, float f[], int n) {
  char s[2048];
  char *ps, *pe;
  int i;
  memset(s, 0, 2048);
  ps = pe = fgets(s, 2048, fp);
  if (ps == NULL)
    return;
  for (i = 0; i < n; i++) {
    while (isspace(*pe))
      pe++;
    while (!isspace(*pe))
      pe++;
    sscanf(ps, "%f", &f[i]);
    ps = pe;
  }
}


x86 assembly (clang, -O0):
<scan_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x820(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1030 <memset@plt>
lea    -0x820(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x800,%esi
call   1050 <fgets@plt>
mov    %rax,-0x830(%rbp)
mov    %rax,-0x828(%rbp)
cmpq   $0x0,-0x828(%rbp)
jne    119f <scan_line+0x5f>
jmp    1275 <scan_line+0x135>
movl   $0x0,-0x834(%rbp)
mov    -0x834(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1275 <scan_line+0x135>
jmp    11bd <scan_line+0x7d>
mov    -0x830(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     11ed <scan_line+0xad>
mov    -0x830(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x830(%rbp)
jmp    11bd <scan_line+0x7d>
jmp    11f2 <scan_line+0xb2>
mov    -0x830(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1217 <scan_line+0xd7>
jmp    122e <scan_line+0xee>
mov    -0x830(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x830(%rbp)
jmp    11f2 <scan_line+0xb2>
mov    -0x828(%rbp),%rdi
mov    -0x10(%rbp),%rdx
movslq -0x834(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xdb2(%rip),%rsi
call   1060 <sscanf@plt>
mov    -0x830(%rbp),%rax
mov    %rax,-0x828(%rbp)
mov    -0x834(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x834(%rbp)
jmp    11a9 <scan_line+0x69>
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1030 <memset@plt>
mov    %rbp,%rdi
mov    $0x800,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11f1 <scan_line+0xb1>
test   %r15d,%r15d
jle    11f1 <scan_line+0xb1>
mov    %rax,%r13
mov    %r15d,%r12d
xor    %ebp,%ebp
xchg   %ax,%ax
lea    -0x1(%r13),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rbx
add    $0x1,%r15
movsbl 0x1(%rbx),%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    11a0 <scan_line+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %rax,%rax
je     11c0 <scan_line+0x80>
lea    (%r14,%rbp,4),%rdx
mov    %r13,%rdi
lea    0xe20(%rip),%rsi
call   1060 <sscanf@plt>
add    $0x1,%rbp
mov    %rbx,%r13
cmp    %r12,%rbp
jne    1190 <scan_line+0x50>
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define void @scan_line(i32* %0, float* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca float*
%6 = alloca i32
%7 = alloca [2048 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32* %0, i32** %4
store float* %1, float** %5
store i32 %2, i32* %6
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i32 0, i32 2048)
%13 = getelementptr inbounds [2048 x i8], [2048 x i8]* %7, i64 0, i64 0
%14 = load i32*, i32** %4
%15 = call i8* @fgets(i8* %13, i32 2048, i32* %14)
store i8* %15, i8** %9
store i8* %15, i8** %8
%16 = load i8*, i8** %8
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %19
18: ; preds = %3
br label %54
19: ; preds = %3
store i32 0, i32* %10
br label %20
20: ; preds = %51, %19
%21 = load i32, i32* %10
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %54
24: ; preds = %20
br label %25
25: ; preds = %30, %24
%26 = load i8*, i8** %9
%27 = load i8, i8* %26
%28 = call i64 @isspace(i8 signext %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = load i8*, i8** %9
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %9
br label %25
33: ; preds = %25
br label %34
34: ; preds = %40, %33
%35 = load i8*, i8** %9
%36 = load i8, i8* %35
%37 = call i64 @isspace(i8 signext %36)
%38 = icmp ne i64 %37, 0
%39 = xor i1 %38, true
br i1 %39, label %40, label %43
40: ; preds = %34
%41 = load i8*, i8** %9
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %9
br label %34
43: ; preds = %34
%44 = load i8*, i8** %8
%45 = load float*, float** %5
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds float, float* %45, i64 %47
%49 = call i32 @sscanf(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %48)
%50 = load i8*, i8** %9
store i8* %50, i8** %8
br label %51
51: ; preds = %43
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %20
54: ; preds = %18, %20
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define void @scan_line(i32* nocapture %0, float* %1, i32 %2) {
%4 = alloca [2048 x i8]
%5 = getelementptr inbounds [2048 x i8], [2048 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 2048)
%7 = call i8* @fgets(i8* %5, i32 2048, i32* %0)
%8 = icmp ne i8* %7, null
%9 = icmp sgt i32 %2, 0
%10 = and i1 %8, %9
br i1 %10, label %11, label %33
11: ; preds = %3
%12 = zext i32 %2 to i64
br label %13
13: ; preds = %11, %28
%14 = phi i64 [ 0, %11 ], [ %31, %28 ]
%15 = phi i8* [ %7, %11 ], [ %23, %28 ]
br label %16
16: ; preds = %16, %13
%17 = phi i8* [ %21, %16 ], [ %15, %13 ]
%18 = load i8, i8* %17
%19 = call i64 @isspace(i8 signext %18)
%20 = icmp eq i64 %19, 0
%21 = getelementptr inbounds i8, i8* %17, i64 1
br i1 %20, label %22, label %16
22: ; preds = %16, %22
%23 = phi i8* [ %27, %22 ], [ %17, %16 ]
%24 = load i8, i8* %23
%25 = call i64 @isspace(i8 signext %24)
%26 = icmp eq i64 %25, 0
%27 = getelementptr inbounds i8, i8* %23, i64 1
br i1 %26, label %22, label %28
28: ; preds = %22
%29 = getelementptr inbounds float, float* %1, i64 %14
%30 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %29)
%31 = add nuw nsw i64 %14, 1
%32 = icmp eq i64 %31, %12
br i1 %32, label %33, label %13
33: ; preds = %28, %3
ret void
}