#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 */
float getfloat(float *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int ret = 0;
  float a = 0.0;
  printf("This program gets next float from input into *pn,\nSo give me some "
         "numbers:\n\t");
  while ((a = getfloat(&a)) != -1)
    printf("\n\tYour value is %.2f\n", a);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1040 <getfloat@plt>
movss  %xmm0,-0xc(%rbp)
movss  0xe9e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1176 <main+0x56>
jp     1176 <main+0x56>
jmp    1192 <main+0x72>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xecb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    114c <main+0x2c>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <getfloat@plt>
movss  %xmm0,0x4(%rsp)
ucomiss 0xeaf(%rip),%xmm0
jne    1155 <main+0x35>
jnp    1197 <main+0x77>
lea    0xef5(%rip),%r14
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <getfloat@plt>
movss  %xmm0,0x4(%rsp)
ucomiss 0xe6d(%rip),%xmm0
jne    1170 <main+0x50>
jp     1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [77 x i8] c"This program gets next float from input into *pn,\0ASo give me some numbers:\0A\09\00"
@.str.1 = [22 x i8] c"\0A\09Your value is %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store float 0.000000e+00, float* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %8, %0
%6 = call float @getfloat(float* %3)
store float %6, float* %3
%7 = fcmp une float %6, -1.000000e+00
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %10)
br label %5
12: ; preds = %5
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [77 x i8] c"This program gets next float from input into *pn,\0ASo give me some numbers:\0A\09\00"
@.str.1 = [22 x i8] c"\0A\09Your value is %.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
%4 = call float @getfloat(float* %1)
store float %4, float* %1
%5 = fcmp une float %4, -1.000000e+00
br i1 %5, label %6, label %12
6: ; preds = %0, %6
%7 = phi float [ %10, %6 ], [ %4, %0 ]
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = call float @getfloat(float* %1)
store float %10, float* %1
%11 = fcmp une float %10, -1.000000e+00
br i1 %11, label %6, label %12
12: ; preds = %6, %0
ret i32 0
}