#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 num = 0.0f, max = 0.0f;
  for (;;) {
    printf("enter a number(0 to terminate):");
    scanf("%f", &num);
    if (num != 0) {
      max = max > num ? max : num;
    } else {
      printf("the largest number entered is: %.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,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1179 <main+0x59>
jp     1179 <main+0x59>
jmp    11b0 <main+0x90>
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1197 <main+0x77>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11a1 <main+0x81>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11cf <main+0xaf>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    113f <main+0x1f>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1160 <main+0x40>
jnp    11be <main+0x9e>
lea    0xe99(%rip),%r14
lea    0xeb2(%rip),%r15
lea    0x8(%rsp),%rbx
xorps  %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
maxss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
xorps  %xmm1,%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm1,%xmm0
movss  0xc(%rsp),%xmm1
jne    1180 <main+0x60>
jp     1180 <main+0x60>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jmp    11c1 <main+0xa1>
xorps  %xmm0,%xmm0
lea    0xe5b(%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 = [32 x i8] c"enter a number(0 to terminate):\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [37 x i8] c"the largest number entered is: %.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* %2
store float 0.000000e+00, float* %3
br label %4
4: ; preds = %23, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 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 = fcmp une float %7, 0.000000e+00
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = load float, float* %3
%11 = load float, float* %2
%12 = fcmp ogt float %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load float, float* %3
br label %17
15: ; preds = %9
%16 = load float, float* %2
br label %17
17: ; preds = %15, %13
%18 = phi float [ %14, %13 ], [ %16, %15 ]
store float %18, float* %3
br label %23
19: ; preds = %4
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %21)
ret i32 0
23: ; preds = %17
br label %4
}

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