#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 getRate(int);
float parkingCharge(int, float);
int /*<<< orphan*/ printf(char *, ...);
int vehicleAndHrs(float *);
int main() {
  int type;
  float hrs;
  float totalOwed;
  int rate;
  type = vehicleAndHrs(&hrs);
  totalOwed = parkingCharge(type, hrs);
  rate = getRate(type);
  printf("\nYou parked a ");
  if (type == 1)
    printf("car ");
  else if (type == 2)
    printf("bus ");
  else if (type == 3)
    printf("truck ");
  else
    printf("-1");
  printf("for %4.2f hrs at $%d/hr and owe $%6.2f.\n\n", hrs, rate, totalOwed);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <vehicleAndHrs@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
movss  -0xc(%rbp),%xmm0
call   1050 <parkingCharge@plt>
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <getRate@plt>
mov    %eax,-0x14(%rbp)
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11a3 <main+0x63>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <main+0xb5>
cmpl   $0x2,-0x8(%rbp)
jne    11c0 <main+0x80>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f0 <main+0xb0>
cmpl   $0x3,-0x8(%rbp)
jne    11dd <main+0x9d>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <main+0xab>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f0 <main+0xb0>
jmp    11f5 <main+0xb5>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x14(%rbp),%esi
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe12(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsp,%rdi
call   1040 <vehicleAndHrs@plt>
mov    %eax,%ebp
movss  (%rsp),%xmm0
mov    %eax,%edi
call   1050 <parkingCharge@plt>
movss  %xmm0,0x4(%rsp)
mov    %ebp,%edi
call   1060 <getRate@plt>
mov    %eax,%ebx
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
ja     1191 <main+0x51>
movslq %ebp,%rax
lea    0xec8(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    1198 <main+0x58>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe6a(%rip),%rdi
mov    %ebx,%esi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0AYou parked a \00"
@.str.1 = [5 x i8] c"car \00"
@.str.2 = [5 x i8] c"bus \00"
@.str.3 = [7 x i8] c"truck \00"
@.str.4 = [3 x i8] c"-1\00"
@.str.5 = [42 x i8] c"for %4.2f hrs at $%d/hr and owe $%6.2f.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @vehicleAndHrs(float* %3)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = load float, float* %3
%9 = call float @parkingCharge(i32 %7, float %8)
store float %9, float* %4
%10 = load i32, i32* %2
%11 = call i32 @getRate(i32 %10)
store i32 %11, i32* %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %31
17: ; preds = %0
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %30
22: ; preds = %17
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %29
27: ; preds = %22
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
br label %30
30: ; preds = %29, %20
br label %31
31: ; preds = %30, %15
%32 = load float, float* %3
%33 = fpext float %32 to double
%34 = load i32, i32* %5
%35 = load float, float* %4
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), double %33, i32 %34, double %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0AYou parked a \00"
@.str.1 = [5 x i8] c"car \00"
@.str.2 = [5 x i8] c"bus \00"
@.str.3 = [7 x i8] c"truck \00"
@.str.4 = [3 x i8] c"-1\00"
@.str.5 = [42 x i8] c"for %4.2f hrs at $%d/hr and owe $%6.2f.\0A\0A\00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @vehicleAndHrs(float* %1)
%4 = load float, float* %1
%5 = call float @parkingCharge(i32 %3, float %4)
%6 = call i32 @getRate(i32 %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = add i32 %3, -1
%9 = icmp ult i32 %8, 3
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = sext i32 %8 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %12)
br label %14
14: ; preds = %0, %10
%15 = phi i8* [ %13, %10 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %0 ]
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %15)
%17 = load float, float* %1
%18 = fpext float %17 to double
%19 = fpext float %5 to double
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), double %18, i32 %6, double %19)
ret i32 0
}