#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__ EOF;
scalar_t__ getfloat(double *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int n;
  double array[100];
  for (n = 0; n < 100; n++)
    array[n] = 0;
  for (n = 0; n < 100 && getfloat(&array[n]) != EOF; n++)
    ;
  for (n = 0; n < 100; n++)
    printf("%f ", array[n]);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1161 <main+0x41>
movslq -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x330(%rbp,%rax,8)
ff ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0x331(%rbp)
jge    11a4 <main+0x84>
movslq -0x8(%rbp),%rax
lea    -0x330(%rbp),%rdi
shl    $0x3,%rax
add    %rax,%rdi
call   1040 <getfloat@plt>
mov    0x2e50(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x331(%rbp)
mov    -0x331(%rbp),%al
test   $0x1,%al
jne    11b7 <main+0x97>
jmp    11ca <main+0xaa>
jmp    11bc <main+0x9c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1168 <main+0x48>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1204 <main+0xe4>
movslq -0x8(%rbp),%rax
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
lea    0xe11(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <main+0xb1>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x328,%rsp
mov    %rsp,%rdi
xor    %ebx,%ebx
mov    $0x320,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    0x2e86(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rsp,%rbx,1),%rdi
call   1060 <getfloat@plt>
cmp    (%r14),%rax
je     118e <main+0x4e>
lea    0x8(%rbx),%rax
cmp    $0x318,%rbx
mov    %rax,%rbx
jne    1170 <main+0x30>
xor    %ebx,%ebx
lea    0xe69(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  (%rsp,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    11a0 <main+0x60>
lea    0xe44(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [4 x i8] c"%f \00"
@.str.1 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x double]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [100 x double], [100 x double]* %3, i64 0, i64 %9
store double 0.000000e+00, double* %10
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
store i32 0, i32* %2
br label %15
15: ; preds = %28, %14
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 100
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100 x double], [100 x double]* %3, i64 0, i64 %20
%22 = call i64 @getfloat(double* %21)
%23 = load i64, i64* @EOF
%24 = icmp ne i64 %22, %23
br label %25
25: ; preds = %18, %15
%26 = phi i1 [ false, %15 ], [ %24, %18 ]
br i1 %26, label %27, label %31
27: ; preds = %25
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %15
31: ; preds = %25
store i32 0, i32* %2
br label %32
32: ; preds = %41, %31
%33 = load i32, i32* %2
%34 = icmp slt i32 %33, 100
br i1 %34, label %35, label %44
35: ; preds = %32
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [100 x double], [100 x double]* %3, i64 0, i64 %37
%39 = load double, double* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %39)
br label %41
41: ; preds = %35
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %32
44: ; preds = %32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [4 x i8] c"%f \00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [100 x double]
%2 = bitcast [100 x double]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %9, %3 ]
%5 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %4
%6 = call i64 @getfloat(double* %5)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
%9 = add nuw nsw i64 %4, 1
%10 = icmp eq i64 %9, 100
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %12, label %3
12: ; preds = %3, %12
%13 = phi i64 [ %17, %12 ], [ 0, %3 ]
%14 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %13
%15 = load double, double* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %15)
%17 = add nuw nsw i64 %13, 1
%18 = icmp eq i64 %17, 100
br i1 %18, label %19, label %12
19: ; preds = %12
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}