#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 printmaxnum() {
  float max = 0;
  float input;
  do {
    printf("Enter a number:");
    scanf("%f", &input);
    if (input > max)
      max = input;
  } while (input != 0);
  printf("The largest number entered was %f\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<printmaxnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1167 <printmaxnum+0x47>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    116c <printmaxnum+0x4c>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1130 <printmaxnum+0x10>
jp     1130 <printmaxnum+0x10>
movss  -0x4(%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):
<printmaxnum>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%r14
lea    0xedd(%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
jne    1140 <printmaxnum+0x20>
jp     1140 <printmaxnum+0x20>
cvtss2sd %xmm0,%xmm0
lea    0xe9a(%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 = [35 x i8] c"The largest number entered was %f\0A\00"
define i32 @printmaxnum() {
%1 = alloca float
%2 = alloca float
store float 0.000000e+00, float* %1
br label %3
3: ; preds = %12, %0
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = load float, float* %2
%7 = load float, float* %1
%8 = fcmp ogt float %6, %7
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load float, float* %2
store float %10, float* %1
br label %11
11: ; preds = %9, %3
br label %12
12: ; preds = %11
%13 = load float, float* %2
%14 = fcmp une float %13, 0.000000e+00
br i1 %14, label %3, label %15
15: ; preds = %12
%16 = load float, float* %1
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %17)
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 = [35 x i8] c"The largest number entered was %f\0A\00"
define i32 @printmaxnum() {
%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 ([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* %1)
%7 = load float, float* %1
%8 = fcmp ogt float %7, %4
%9 = select i1 %8, float %7, float %4
%10 = fcmp une 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 ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %12)
ret i32 0
}