#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int vehicleAndHrs(float *hrs) {
  int type;
  printf("\n\nMenu Options:");
  printf("\n1 = car");
  printf("\n2 = bus");
  printf("\n3 = truck");
  printf("\n\nEnter 1, 2, or 3 to choose a vehicle type: ");
  scanf("%d", &type);
  if (type < 1 || type > 3) {
    printf("\n\nInvalid vehicle type entered. Please start over!\n");
    exit(1);
  }
  printf("\nEnter number of hours parked: ");
  scanf("%f", hrs);
  if (hrs < 0) {
    printf("\n\nNumber of hours must be positive. Please start over!\n");
    exit(1);
  }
  return type;
}


x86 assembly (clang, -O0):
<vehicleAndHrs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
jl     119e <vehicleAndHrs+0x6e>
cmpl   $0x3,-0xc(%rbp)
jle    11b4 <vehicleAndHrs+0x84>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpq   $0x0,-0x8(%rbp)
jae    11f3 <vehicleAndHrs+0xc3>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vehicleAndHrs>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xfffffffc,%eax
cmp    $0xfffffffc,%eax
jbe    11ca <vehicleAndHrs+0x8a>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"\0A\0AMenu Options:\00"
@.str.1 = [9 x i8] c"\0A1 = car\00"
@.str.2 = [9 x i8] c"\0A2 = bus\00"
@.str.3 = [11 x i8] c"\0A3 = truck\00"
@.str.4 = [46 x i8] c"\0A\0AEnter 1, 2, or 3 to choose a vehicle type: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [52 x i8] c"\0A\0AInvalid vehicle type entered. Please start over!\0A\00"
@.str.7 = [32 x i8] c"\0AEnter number of hours parked: \00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [56 x i8] c"\0A\0ANumber of hours must be positive. Please start over!\0A\00"
define i32 @vehicleAndHrs(float* %0) {
%2 = alloca float*
%3 = alloca i32
store float* %0, float** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 1
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 3
br i1 %14, label %15, label %18
15: ; preds = %12, %1
%16 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%20 = load float*, float** %2
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %20)
%22 = load float*, float** %2
%23 = icmp ult float* %22, null
br i1 %23, label %24, label %27
24: ; preds = %18
%25 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.9, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %18
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0A\0AMenu Options:\00"
@.str.1 = [9 x i8] c"\0A1 = car\00"
@.str.2 = [9 x i8] c"\0A2 = bus\00"
@.str.3 = [11 x i8] c"\0A3 = truck\00"
@.str.4 = [46 x i8] c"\0A\0AEnter 1, 2, or 3 to choose a vehicle type: \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.7 = [32 x i8] c"\0AEnter number of hours parked: \00"
@.str.8 = [3 x i8] c"%f\00"
@str = [51 x i8] c"\0A\0AInvalid vehicle type entered. Please start over!\00"
define i32 @vehicleAndHrs(float* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = add i32 %10, -4
%12 = icmp ult i32 %11, -3
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %1
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %0)
%19 = load i32, i32* %2
ret i32 %19
}