#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, float *);
int main(void) {
  long double water_molculers;
  float quota;
  printf("how many quarts of the water: ");
  int ret1, ret2;
  while ((ret1 = scanf("%f", &quota) != 1) || quota < 0 ||
         (ret2 = getchar()) != '\n') {
    if (ret1 != 1 || ret2 != '\n')
      while (getchar() != '\n')
        ;
    printf("input invalid!\n");
    printf("how many quarts of the water: ");
  }
  water_molculers = (quota * 950) / 3.0e-23;
  printf("awesome! you've got %Le water molecules!\n", water_molculers);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
setne  %cl
mov    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
mov    $0x1,%al
test   $0x1,%cl
mov    %al,-0x39(%rbp)
jne    11a3 <main+0x73>
mov    $0x1,%al
xorps  %xmm0,%xmm0
ucomiss -0x24(%rbp),%xmm0
mov    %al,-0x39(%rbp)
ja     11a3 <main+0x73>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
mov    %eax,-0x2c(%rbp)
cmp    $0xa,%eax
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    11b3 <main+0x83>
jmp    120a <main+0xda>
cmpl   $0x1,-0x28(%rbp)
jne    11c7 <main+0x97>
cmpl   $0xa,-0x2c(%rbp)
je     11e9 <main+0xb9>
jmp    11cc <main+0x9c>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11e4 <main+0xb4>
jmp    11cc <main+0x9c>
jmp    11e9 <main+0xb9>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114d <main+0x1d>
movss  -0x24(%rbp),%xmm0
movss  0xde9(%rip),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
fldl   -0x38(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xdfd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebb(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%r15
lea    0x1c(%rsp),%r13
lea    0xeea(%rip),%r12
jmp    1192 <main+0x52>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
jne    11bc <main+0x7c>
xorps  %xmm0,%xmm0
ucomiss 0x1c(%rsp),%xmm0
ja     11bc <main+0x7c>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     11dd <main+0x9d>
movsbl %al,%ebx
cmp    $0x1,%ebp
je     11d0 <main+0x90>
cmp    $0xa,%ebx
je     1180 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11d0 <main+0x90>
jmp    1180 <main+0x40>
movss  0x1c(%rsp),%xmm0
mulss  0xe15(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe11(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
fldl   0x20(%rsp)
fstpt  (%rsp)
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"how many quarts of the water: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [16 x i8] c"input invalid!\0A\00"
@.str.3 = [42 x i8] c"awesome! you've got %Le water molecules!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca x86_fp80
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %33, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%9 = icmp ne i32 %8, 1
%10 = zext i1 %9 to i32
store i32 %10, i32* %4
br i1 %9, label %18, label %11
11: ; preds = %7
%12 = load float, float* %3
%13 = fcmp olt float %12, 0.000000e+00
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = call signext i8 (...) @getchar()
%16 = sext i8 %15 to i32
store i32 %16, i32* %5
%17 = icmp ne i32 %16, 10
br label %18
18: ; preds = %14, %11, %7
%19 = phi i1 [ true, %11 ], [ true, %7 ], [ %17, %14 ]
br i1 %19, label %20, label %36
20: ; preds = %18
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 1
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* %5
%25 = icmp ne i32 %24, 10
br i1 %25, label %26, label %33
26: ; preds = %23, %20
br label %27
27: ; preds = %31, %26
%28 = call signext i8 (...) @getchar()
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 10
br i1 %30, label %31, label %32
31: ; preds = %27
br label %27
32: ; preds = %27
br label %33
33: ; preds = %32, %23
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %7
36: ; preds = %18
%37 = load float, float* %3
%38 = fmul float %37, 9.500000e+02
%39 = fpext float %38 to double
%40 = fdiv double %39, 3.000000e-23
%41 = fpext double %40 to x86_fp80
store x86_fp80 %41, x86_fp80* %2
%42 = load x86_fp80, x86_fp80* %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"how many quarts of the water: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [42 x i8] c"awesome! you've got %Le water molecules!\0A\00"
@str = [15 x i8] c"input invalid!\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %23, %0
%5 = phi i32 [ undef, %0 ], [ %16, %23 ]
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%7 = icmp ne i32 %6, 1
%8 = load float, float* %1
%9 = fcmp olt float %8, 0.000000e+00
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %15, label %11
11: ; preds = %4
%12 = call signext i8 (...) @getchar()
%13 = sext i8 %12 to i32
%14 = icmp eq i8 %12, 10
br i1 %14, label %26, label %15
15: ; preds = %4, %11
%16 = phi i32 [ %5, %4 ], [ %13, %11 ]
%17 = xor i1 %7, true
%18 = icmp ne i32 %16, 10
%19 = select i1 %17, i1 true, i1 %18
br i1 %19, label %20, label %23
20: ; preds = %15, %20
%21 = call signext i8 (...) @getchar()
%22 = icmp eq i8 %21, 10
br i1 %22, label %23, label %20
23: ; preds = %20, %15
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %4
26: ; preds = %11
%27 = load float, float* %1
%28 = fmul float %27, 9.500000e+02
%29 = fpext float %28 to double
%30 = fdiv double %29, 3.000000e-23
%31 = fpext double %30 to x86_fp80
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), x86_fp80 %31)
ret i32 0
}