#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(char);
float parkingCharge(char, float);
int /*<<< orphan*/ printType(char);
int /*<<< orphan*/ printf(char *, ...);
char vehicleAndHrs(float *);
int main() {
  char type = 'x';
  float hrs;
  float totalOwed;
  int rate;
  type = vehicleAndHrs(&hrs);
  totalOwed = parkingCharge(type, hrs);
  rate = getRate(type);
  printf("\n\nYou parked a ");
  printType(type);
  printf(" for %4.2f hrs at $%d/hr", hrs, rate);
  printf("\nand owe $%1.2f.\n\n", totalOwed);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x78,-0x5(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <vehicleAndHrs@plt>
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
movss  -0xc(%rbp),%xmm0
movsbl %al,%edi
call   1060 <parkingCharge@plt>
movss  %xmm0,-0x10(%rbp)
movsbl -0x5(%rbp),%edi
call   1070 <getRate@plt>
mov    %eax,-0x14(%rbp)
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x5(%rbp),%edi
call   1030 <printType@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x14(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe58(%rip),%rdi
mov    $0x1,%al
call   1040 <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   1050 <vehicleAndHrs@plt>
movss  (%rsp),%xmm0
movsbl %al,%ebx
mov    %ebx,%edi
call   1060 <parkingCharge@plt>
movss  %xmm0,0x4(%rsp)
mov    %ebx,%edi
call   1070 <getRate@plt>
mov    %eax,%ebp
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
call   1030 <printType@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe72(%rip),%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe71(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0A\0AYou parked a \00"
@.str.1 = [25 x i8] c" for %4.2f hrs at $%d/hr\00"
@.str.2 = [19 x i8] c"\0Aand owe $%1.2f.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %1
store i8 120, i8* %2
%6 = call signext i8 @vehicleAndHrs(float* %3)
store i8 %6, i8* %2
%7 = load i8, i8* %2
%8 = load float, float* %3
%9 = call float @parkingCharge(i8 signext %7, float %8)
store float %9, float* %4
%10 = load i8, i8* %2
%11 = call i32 @getRate(i8 signext %10)
store i32 %11, i32* %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%13 = load i8, i8* %2
%14 = call i32 @printType(i8 signext %13)
%15 = load float, float* %3
%16 = fpext float %15 to double
%17 = load i32, i32* %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %16, i32 %17)
%19 = load float, float* %4
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0A\0AYou parked a \00"
@.str.1 = [25 x i8] c" for %4.2f hrs at $%d/hr\00"
@.str.2 = [19 x i8] c"\0Aand owe $%1.2f.\0A\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call signext i8 @vehicleAndHrs(float* %1)
%4 = load float, float* %1
%5 = call float @parkingCharge(i8 signext %3, float %4)
%6 = call i32 @getRate(i8 signext %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printType(i8 signext %3)
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %10, i32 %6)
%12 = fpext float %5 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %12)
ret i32 0
}