#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 */

/* Variables and functions */
scalar_t__ feof(int /*<<< orphan*/);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, float *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  float tab[1000];
  int i = 0;
  while (feof(stdin) == 0) {
    fscanf(stdin, "%f\n", &tab[i]);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xfb4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
call   1040 <feof@plt>
cmp    $0x0,%rax
jne    1199 <main+0x79>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
movslq -0xfb4(%rbp),%rax
lea    -0xfb0(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe80(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1143 <main+0x23>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xfa0,%rsp
mov    0x2eb5(%rip),%r15
mov    (%r15),%edi
call   1040 <feof@plt>
test   %rax,%rax
jne    116f <main+0x4f>
mov    %rsp,%rbx
lea    0xeb6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <fscanf@plt>
mov    (%r15),%edi
call   1040 <feof@plt>
add    $0x4,%rbx
test   %rax,%rax
je     1150 <main+0x30>
xor    %eax,%eax
add    $0xfa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x float]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %12, %2
%9 = load i32, i32* @stdin
%10 = call i64 @feof(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i32, i32* @stdin
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1000 x float], [1000 x float]* %6, i64 0, i64 %15
%17 = call i32 @fscanf(i32 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %16)
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %8
20: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x float]
%4 = bitcast [1000 x float]* %3 to i8*
%5 = load i32, i32* @stdin
%6 = call i64 @feof(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %2, %8
%9 = phi i64 [ %13, %8 ], [ 0, %2 ]
%10 = load i32, i32* @stdin
%11 = getelementptr inbounds [1000 x float], [1000 x float]* %3, i64 0, i64 %9
%12 = call i32 @fscanf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %11)
%13 = add nuw i64 %9, 1
%14 = load i32, i32* @stdin
%15 = call i64 @feof(i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %8, label %17
17: ; preds = %8, %2
ret i32 0
}