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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0x1a1(%rbp)
jge    1177 <main+0x57>
movslq -0x8(%rbp),%rax
lea    -0x1a0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
call   1040 <getfloat@plt>
cltq
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x1a1(%rbp)
mov    -0x1a1(%rbp),%al
test   $0x1,%al
jne    118a <main+0x6a>
jmp    11b1 <main+0x91>
movslq -0x8(%rbp),%rax
movss  -0x1a0(%rbp,%rax,4),%xmm0
ff ff
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x190,%rsp
xor    %ebx,%ebx
mov    0x2eb3(%rip),%r15
lea    0xec4(%rip),%r14
nopl   0x0(%rax)
lea    (%rsp,%rbx,1),%rdi
call   1040 <getfloat@plt>
cltq
cmp    %rax,(%r15)
je     116a <main+0x4a>
movss  (%rsp,%rbx,1),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x4,%rbx
cmp    $0x190,%rbx
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [10 x i8] c"array:%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x float]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %23, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [100 x float], [100 x float]* %3, i64 0, i64 %9
%11 = call i32 @getfloat(float* %10)
%12 = sext i32 %11 to i64
%13 = load i64, i64* @EOF
%14 = icmp ne i64 %12, %13
br label %15
15: ; preds = %7, %4
%16 = phi i1 [ false, %4 ], [ %14, %7 ]
br i1 %16, label %17, label %26
17: ; preds = %15
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x float], [100 x float]* %3, i64 0, i64 %19
%21 = load float, float* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), float %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %4
26: ; preds = %15
%27 = load i32, i32* %1
ret i32 %27
}

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