#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*/ fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ isspace(char);
int /*<<< orphan*/ sscanf(char *, char *, float *);
void scan_line(FILE *fp, float f[], int n) {
  char s[256];
  char *ps, *pe;
  int i;
  fgets(s, 256, fp);
  ps = pe = s;
  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    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1040 <fgets@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    %rax,-0x128(%rbp)
movl   $0x0,-0x134(%rbp)
mov    -0x134(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1246 <scan_line+0x116>
jmp    118e <scan_line+0x5e>
mov    -0x130(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11be <scan_line+0x8e>
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    118e <scan_line+0x5e>
jmp    11c3 <scan_line+0x93>
mov    -0x130(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e8 <scan_line+0xb8>
jmp    11ff <scan_line+0xcf>
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    11c3 <scan_line+0x93>
mov    -0x128(%rbp),%rdi
mov    -0x10(%rbp),%rdx
movslq -0x134(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xde1(%rip),%rsi
call   1050 <sscanf@plt>
mov    -0x130(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    117a <scan_line+0x4a>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rdx
mov    %rsp,%r13
mov    %r13,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
test   %ebp,%ebp
jle    11d1 <scan_line+0xa1>
mov    %ebp,%r12d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%r13),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rbx
add    $0x1,%r15
movsbl 0x1(%rbx),%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1180 <scan_line+0x50>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
je     11a0 <scan_line+0x70>
lea    (%r14,%rbp,4),%rdx
mov    %r13,%rdi
lea    0xe40(%rip),%rsi
call   1050 <sscanf@plt>
add    $0x1,%rbp
mov    %rbx,%r13
cmp    %r12,%rbp
jne    1170 <scan_line+0x40>
add    $0x108,%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 [256 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 [256 x i8], [256 x i8]* %7, i64 0, i64 0
%12 = load i32*, i32** %4
%13 = call i32 @fgets(i8* %11, i32 256, i32* %12)
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
store i8* %14, i8** %9
store i8* %14, i8** %8
store i32 0, i32* %10
br label %15
15: ; preds = %46, %3
%16 = load i32, i32* %10
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %49
19: ; preds = %15
br label %20
20: ; preds = %25, %19
%21 = load i8*, i8** %9
%22 = load i8, i8* %21
%23 = call i64 @isspace(i8 signext %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %9
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %9
br label %20
28: ; preds = %20
br label %29
29: ; preds = %35, %28
%30 = load i8*, i8** %9
%31 = load i8, i8* %30
%32 = call i64 @isspace(i8 signext %31)
%33 = icmp ne i64 %32, 0
%34 = xor i1 %33, true
br i1 %34, label %35, label %38
35: ; preds = %29
%36 = load i8*, i8** %9
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %9
br label %29
38: ; preds = %29
%39 = load i8*, i8** %8
%40 = load float*, float** %5
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds float, float* %40, i64 %42
%44 = call i32 @sscanf(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %43)
%45 = load i8*, i8** %9
store i8* %45, i8** %8
br label %46
46: ; preds = %38
%47 = load i32, i32* %10
%48 = add nsw i32 %47, 1
store i32 %48, i32* %10
br label %15
49: ; preds = %15
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 [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @fgets(i8* %5, i32 256, i32* %0)
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %30
8: ; preds = %3
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %8, %25
%11 = phi i64 [ 0, %8 ], [ %28, %25 ]
%12 = phi i8* [ %5, %8 ], [ %20, %25 ]
br label %13
13: ; preds = %13, %10
%14 = phi i8* [ %18, %13 ], [ %12, %10 ]
%15 = load i8, i8* %14
%16 = call i64 @isspace(i8 signext %15)
%17 = icmp eq i64 %16, 0
%18 = getelementptr inbounds i8, i8* %14, i64 1
br i1 %17, label %19, label %13
19: ; preds = %13, %19
%20 = phi i8* [ %24, %19 ], [ %14, %13 ]
%21 = load i8, i8* %20
%22 = call i64 @isspace(i8 signext %21)
%23 = icmp eq i64 %22, 0
%24 = getelementptr inbounds i8, i8* %20, i64 1
br i1 %23, label %19, label %25
25: ; preds = %19
%26 = getelementptr inbounds float, float* %1, i64 %11
%27 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %26)
%28 = add nuw nsw i64 %11, 1
%29 = icmp eq i64 %28, %9
br i1 %29, label %30, label %10
30: ; preds = %25, %3
ret void
}