#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 max = 0.0f;
  float n;
  printf("Enter a series of positive numbers.\n");
  printf("Enter a negative number or zero to quit.\n");
  printf("Enter a number greater than 0: ");
  scanf("%f", &n);
  if (n > max) {
    max = n;
  }
  while (n > 0.0f) {
    printf("Enter a number greater than 0: ");
    scanf("%f", &n);
    if (n > max) {
      max = n;
    }
  }
  printf("The largest number entered was: %f\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)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    118a <main+0x6a>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    118f <main+0x6f>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11dc <main+0xbc>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    11d7 <main+0xb7>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    118f <main+0x6f>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe86(%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    0xf07(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1f(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jbe    11d6 <main+0xa6>
lea    0xe78(%rip),%r14
lea    0xe91(%rip),%r15
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  %xmm1,0xc(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
maxss  0xc(%rsp),%xmm1
ja     11a0 <main+0x70>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe46(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter a series of positive numbers.\0A\00"
@.str.1 = [42 x i8] c"Enter a negative number or zero to quit.\0A\00"
@.str.2 = [32 x i8] c"Enter a number greater than 0: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [36 x i8] c"The largest number entered was: %f\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
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%8 = load float, float* %3
%9 = load float, float* %2
%10 = fcmp ogt float %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = load float, float* %3
store float %12, float* %2
br label %13
13: ; preds = %11, %0
br label %14
14: ; preds = %25, %13
%15 = load float, float* %3
%16 = fcmp ogt float %15, 0.000000e+00
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%20 = load float, float* %3
%21 = load float, float* %2
%22 = fcmp ogt float %20, %21
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = load float, float* %3
store float %24, float* %2
br label %25
25: ; preds = %23, %17
br label %14
26: ; preds = %14
%27 = load float, float* %2
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), double %28)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [32 x i8] c"Enter a number greater than 0: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [36 x i8] c"The largest number entered was: %f\0A\00"
@str = [36 x i8] c"Enter a series of positive numbers.\00"
@str.5 = [41 x i8] c"Enter a negative number or zero to quit.\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%7 = load float, float* %1
%8 = fcmp ogt float %7, 0.000000e+00
br i1 %8, label %9, label %19
9: ; preds = %0, %9
%10 = phi float [ %15, %9 ], [ %7, %0 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%13 = load float, float* %1
%14 = fcmp ogt float %13, %10
%15 = select i1 %14, float %13, float %10
%16 = fcmp ogt float %13, 0.000000e+00
br i1 %16, label %9, label %17
17: ; preds = %9
%18 = fpext float %15 to double
br label %19
19: ; preds = %17, %0
%20 = phi double [ 0.000000e+00, %0 ], [ %18, %17 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), double %20)
ret i32 0
}