#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  float f, max = 0.0f;
  do {
    printf("Enter a number: ");
    scanf("%f", &f);
    if (f > max)
      max = f;
  } while (f > 0);
  printf("\nThe largest number entered was %.2f.\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    116e <main+0x4e>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1173 <main+0x53>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
ja     1137 <main+0x17>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%r14
lea    0xede(%rip),%r15
lea    0xc(%rsp),%rbx
xorps  %xmm0,%xmm0
nop
movss  %xmm0,0x8(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe98(%rip),%xmm0
maxss  0x8(%rsp),%xmm0
ja     1140 <main+0x20>
cvtss2sd %xmm0,%xmm0
lea    0xe9d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [39 x i8] c"\0AThe largest number entered was %.2f.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %3
br label %4
4: ; preds = %13, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = load float, float* %2
%8 = load float, float* %3
%9 = fcmp ogt float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = load float, float* %2
store float %11, float* %3
br label %12
12: ; preds = %10, %4
br label %13
13: ; preds = %12
%14 = load float, float* %2
%15 = fcmp ogt float %14, 0.000000e+00
br i1 %15, label %4, label %16
16: ; preds = %13
%17 = load float, float* %3
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), double %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [39 x i8] c"\0AThe largest number entered was %.2f.\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi float [ 0.000000e+00, %0 ], [ %9, %3 ]
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = load float, float* %1
%8 = fcmp ogt float %7, %4
%9 = select i1 %8, float %7, float %4
%10 = fcmp ogt float %7, 0.000000e+00
br i1 %10, label %3, label %11
11: ; preds = %3
%12 = fpext float %9 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), double %12)
ret i32 0
}