#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 /*<<< orphan*/ scanf(char *, ...);
void doit(float *gallon, int *size) {
  printf("gallon's price: ");
  while (!scanf("%f", gallon) || (*gallon) <= 0) {
    while (getchar() != '\n')
      ;
    printf("please enter numbers only ");
  }
  printf("tank capacity: ");
  while (!scanf("%d", size) || (*size) <= 0) {
    while (getchar() != '\n')
      ;
    printf("numbers only: ");
  }
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     117e <doit+0x4e>
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomiss (%rax),%xmm0
setae  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    118e <doit+0x5e>
jmp    11bc <doit+0x8c>
jmp    1193 <doit+0x63>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11ab <doit+0x7b>
jmp    1193 <doit+0x63>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
jmp    114c <doit+0x1c>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x12(%rbp)
je     11f7 <doit+0xc7>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1207 <doit+0xd7>
jmp    1235 <doit+0x105>
jmp    120c <doit+0xdc>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1224 <doit+0xf4>
jmp    120c <doit+0xdc>
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
jmp    11c8 <doit+0x98>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doit>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
lea    0xec9(%rip),%r15
lea    0xec5(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %eax,%eax
je     1180 <doit+0x50>
xorps  %xmm0,%xmm0
ucomiss (%rbx),%xmm0
jb     1190 <doit+0x60>
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1180 <doit+0x50>
mov    %r12,%rdi
jmp    1160 <doit+0x30>
lea    0xe9c(%rip),%rdi
lea    0xea5(%rip),%r15
lea    0xea1(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %eax,%eax
je     11d0 <doit+0xa0>
cmpl   $0x0,(%r14)
jg     11e0 <doit+0xb0>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    11d0 <doit+0xa0>
mov    %rbx,%rdi
jmp    11b0 <doit+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"gallon's price: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [27 x i8] c"please enter numbers only \00"
@.str.3 = [16 x i8] c"tank capacity: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [15 x i8] c"numbers only: \00"
define void @doit(float* %0, i32* %1) {
%3 = alloca float*
%4 = alloca i32*
store float* %0, float** %3
store i32* %1, i32** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %22, %2
%7 = load float*, float** %3
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load float*, float** %3
%12 = load float, float* %11
%13 = fcmp ole float %12, 0.000000e+00
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ true, %6 ], [ %13, %10 ]
br i1 %15, label %16, label %24
16: ; preds = %14
br label %17
17: ; preds = %21, %16
%18 = call signext i8 (...) @getchar()
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 10
br i1 %20, label %21, label %22
21: ; preds = %17
br label %17
22: ; preds = %17
%23 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %6
24: ; preds = %14
%25 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %42, %24
%27 = load i32*, i32** %4
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %27)
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i32*, i32** %4
%32 = load i32, i32* %31
%33 = icmp sle i32 %32, 0
br label %34
34: ; preds = %30, %26
%35 = phi i1 [ true, %26 ], [ %33, %30 ]
br i1 %35, label %36, label %44
36: ; preds = %34
br label %37
37: ; preds = %41, %36
%38 = call signext i8 (...) @getchar()
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %39, 10
br i1 %40, label %41, label %42
41: ; preds = %37
br label %37
42: ; preds = %37
%43 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %26
44: ; preds = %34
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"gallon's price: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [27 x i8] c"please enter numbers only \00"
@.str.3 = [16 x i8] c"tank capacity: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [15 x i8] c"numbers only: \00"
define void @doit(float* %0, i32* %1) {
br label %3
3: ; preds = %12, %2
%4 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), %12 ]
%5 = tail call i32 @printf(i8* dereferenceable(1) %4)
%6 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = load float, float* %0
%10 = fcmp ugt float %9, 0.000000e+00
br i1 %10, label %15, label %11
11: ; preds = %3, %8
br label %12
12: ; preds = %11, %12
%13 = tail call signext i8 (...) @getchar()
%14 = icmp eq i8 %13, 10
br i1 %14, label %3, label %12
15: ; preds = %24, %8
%16 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), %24 ]
%17 = tail call i32 @printf(i8* dereferenceable(1) %16)
%18 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = load i32, i32* %1
%22 = icmp slt i32 %21, 1
br i1 %22, label %23, label %27
23: ; preds = %15, %20
br label %24
24: ; preds = %23, %24
%25 = tail call signext i8 (...) @getchar()
%26 = icmp eq i8 %25, 10
br i1 %26, label %15, label %24
27: ; preds = %20
ret void
}