#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 numA, numB = 0;
  while (1) {
    printf("Enter a number:");
    scanf("%f", &numA);
    if (numA == 0 || numA < 0) {
      printf("The largest number entered was : %.2f\n", numB);
      break;
    } else if (numA > numB)
      numB = numA;
  }
  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    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1171 <main+0x51>
jp     1171 <main+0x51>
jmp    117e <main+0x5e>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    119a <main+0x7a>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe85(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11bd <main+0x9d>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11b3 <main+0x93>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    11b8 <main+0x98>
jmp    1137 <main+0x17>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm1,%xmm2
jae    11a7 <main+0x87>
lea    0xea0(%rip),%r14
lea    0xea9(%rip),%r15
lea    0x8(%rsp),%rbx
xorps  %xmm0,%xmm0
nop
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  %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm1,%xmm0
movss  0xc(%rsp),%xmm0
jb     1170 <main+0x50>
cvtss2sd %xmm0,%xmm0
lea    0xe65(%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 = [16 x i8] c"Enter a number:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [39 x i8] c"The 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 = %0, %23
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 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 oeq float %7, 0.000000e+00
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load float, float* %2
%11 = fcmp olt float %10, 0.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %9, %4
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), double %14)
br label %24
16: ; preds = %9
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fcmp ogt float %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load float, float* %2
store float %21, float* %3
br label %22
22: ; preds = %20, %16
br label %23
23: ; preds = %22
br label %4
24: ; preds = %12
ret i32 0
}

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