#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 *, double *);
int main() {
  double userinput = 0;
  double largestnumber = 0;
  do {
    printf("Enter a number: ");
    scanf("%lf", &userinput);
    if (largestnumber < userinput) {
      largestnumber = userinput;
    }
  } while (userinput > 0);
  if (largestnumber > 0) {
    printf("\nThe largest number entered was %.2lf\n", largestnumber);
  } else {
    printf("\nNo number was entered.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    117b <main+0x5b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1180 <main+0x60>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     113f <main+0x1f>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11bc <main+0x9c>
movsd  -0x18(%rbp),%xmm0
lea    0xe65(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11ca <main+0xaa>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,(%rsp)
lea    0xec0(%rip),%r14
lea    0xeca(%rip),%r15
mov    %rsp,%rbx
xorpd  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe78(%rip),%xmm0
maxsd  0x8(%rsp),%xmm0
ja     1160 <main+0x30>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11aa <main+0x7a>
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11b6 <main+0x86>
lea    0xe93(%rip),%rdi
call   1030 <puts@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 = [4 x i8] c"%lf\00"
@.str.2 = [39 x i8] c"\0AThe largest number entered was %.2lf\0A\00"
@.str.3 = [25 x i8] c"\0ANo number was entered.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%7 = load double, double* %3
%8 = load double, double* %2
%9 = fcmp olt double %7, %8
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = load double, double* %2
store double %11, double* %3
br label %12
12: ; preds = %10, %4
br label %13
13: ; preds = %12
%14 = load double, double* %2
%15 = fcmp ogt double %14, 0.000000e+00
br i1 %15, label %4, label %16
16: ; preds = %13
%17 = load double, double* %3
%18 = fcmp ogt double %17, 0.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load double, double* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), double %20)
br label %24
22: ; preds = %16
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
ret i32 0
}

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