#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 *, ...);
void second(float *gallon, int *size) {
  printf("price-per-gallon: ");
  while (scanf("%f", gallon) != 1 || (*gallon) <= 0) {
    while (getchar() != '\n')
      ;
    printf("Corrected to: ");
  }
  printf("tank size: ");
  while (scanf("%d", size) != 1 || (*size) <= 0) {
    while (getchar() != '\n')
      ;
    printf("Corrected to: ");
  }
}


x86 assembly (clang, -O0):
<second>:
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    0xebc(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x11(%rbp)
jne    117e <second+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 <second+0x5e>
jmp    11bc <second+0x8c>
jmp    1193 <second+0x63>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11ab <second+0x7b>
jmp    1193 <second+0x63>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    114c <second+0x1c>
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0x12(%rbp)
jne    11f7 <second+0xc7>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setle  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1207 <second+0xd7>
jmp    1235 <second+0x105>
jmp    120c <second+0xdc>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1224 <second+0xf4>
jmp    120c <second+0xdc>
lea    0xdeb(%rip),%rdi
call   1030 <printf@plt>
jmp    11c8 <second+0x98>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<second>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
lea    0xecb(%rip),%r15
lea    0xec7(%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>
cmp    $0x1,%eax
jne    1180 <second+0x50>
xorps  %xmm0,%xmm0
ucomiss (%rbx),%xmm0
jb     1190 <second+0x60>
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1180 <second+0x50>
mov    %r12,%rdi
jmp    1160 <second+0x30>
lea    0xe92(%rip),%rdi
lea    0xe97(%rip),%r15
lea    0xe75(%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>
cmp    $0x1,%eax
jne    11d0 <second+0xa0>
cmpl   $0x0,(%r14)
jg     11e0 <second+0xb0>
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    11d0 <second+0xa0>
mov    %rbx,%rdi
jmp    11b0 <second+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"price-per-gallon: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [15 x i8] c"Corrected to: \00"
@.str.3 = [12 x i8] c"tank size: \00"
@.str.4 = [3 x i8] c"%d\00"
define void @second(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 ([19 x i8], [19 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, 1
br i1 %9, label %14, label %10
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 ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %6
24: ; preds = %14
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 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, 1
br i1 %29, label %34, label %30
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.2, i64 0, i64 0))
br label %26
44: ; preds = %34
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"price-per-gallon: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [15 x i8] c"Corrected to: \00"
@.str.3 = [12 x i8] c"tank size: \00"
@.str.4 = [3 x i8] c"%d\00"
define void @second(float* %0, i32* %1) {
br label %3
3: ; preds = %12, %2
%4 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([15 x i8], [15 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, 1
br i1 %7, label %8, label %11
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 ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, 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, 1
br i1 %19, label %20, label %23
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
}