#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 */
int EOF;
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  const int SIZE = 10;
  float array[SIZE];
  int n, p, getfloat(float *);
  for (n = 0; n < SIZE && (p = getfloat(&array[n])) != EOF; n++)
    if (p != 0)
      printf("%f\n", array[n]);
    else
      printf("non-digit\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x14(%rbp)
mov    %al,-0x41(%rbp)
jge    1179 <main+0x59>
movslq -0x14(%rbp),%rax
lea    -0x40(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <getfloat@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1189 <main+0x69>
jmp    11d5 <main+0xb5>
cmpl   $0x0,-0x18(%rbp)
je     11b4 <main+0x94>
movslq -0x14(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe58(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11c2 <main+0xa2>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c7 <main+0xa7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
xor    %r12d,%r12d
mov    0x2ea1(%rip),%r13
lea    0xeb6(%rip),%r14
lea    0xeab(%rip),%r15
jmp    1172 <main+0x42>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
add    $0x4,%r12
cmp    $0x28,%r12
je     119c <main+0x6c>
lea    (%rsp,%r12,1),%rbx
mov    %rbx,%rdi
call   1050 <getfloat@plt>
cmp    0x0(%r13),%eax
je     119c <main+0x6c>
test   %eax,%eax
je     1160 <main+0x30>
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1168 <main+0x38>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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