#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 */
double Cal_GrandTotal(int);
double Cal_Tax(int);
int /*<<< orphan*/ printf(char *, double, ...);
int main(int argc, char **argv) {
  double subtotal = 200;
  printf("The TAXRATE is %.3f.\n", 0.174);
  printf("The tax on %f is %f, so the grand total is %f.\n\n", subtotal,
         Cal_Tax(subtotal), Cal_GrandTotal(subtotal));
  printf("The tax on %f is %f, so the grand total is %f.\n\n", 101.0,
         Cal_Tax(101), Cal_GrandTotal(102));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xebe(%rip),%rdi
movsd  0xea6(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvttsd2si -0x18(%rbp),%edi
call   1040 <Cal_Tax@plt>
movsd  %xmm0,-0x30(%rbp)
cvttsd2si -0x18(%rbp),%edi
call   1050 <Cal_GrandTotal@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
lea    0xe8e(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
mov    $0x65,%edi
call   1040 <Cal_Tax@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0x66,%edi
call   1050 <Cal_GrandTotal@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
lea    0xe5f(%rip),%rdi
movsd  0xe29(%rip),%xmm0
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
movsd  0xebc(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0xc8,%edi
call   1040 <Cal_Tax@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0xc8,%edi
call   1050 <Cal_GrandTotal@plt>
movaps %xmm0,%xmm2
lea    0xebf(%rip),%rbx
movsd  0xe91(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm1
mov    $0x3,%al
call   1030 <printf@plt>
mov    $0x65,%edi
call   1040 <Cal_Tax@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x66,%edi
call   1050 <Cal_GrandTotal@plt>
movaps %xmm0,%xmm2
movsd  0xe64(%rip),%xmm0
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm1
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"The TAXRATE is %.3f.\0A\00"
@.str.1 = [49 x i8] c"The tax on %f is %f, so the grand total is %f.\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 2.000000e+02, double* %6
%7 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 1.740000e-01)
%8 = load double, double* %6
%9 = load double, double* %6
%10 = fptosi double %9 to i32
%11 = call double @Cal_Tax(i32 %10)
%12 = load double, double* %6
%13 = fptosi double %12 to i32
%14 = call double @Cal_GrandTotal(i32 %13)
%15 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), double %8, double %11, double %14)
%16 = call double @Cal_Tax(i32 101)
%17 = call double @Cal_GrandTotal(i32 102)
%18 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), double 1.010000e+02, double %16, double %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"The TAXRATE is %.3f.\0A\00"
@.str.1 = [49 x i8] c"The tax on %f is %f, so the grand total is %f.\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double 1.740000e-01)
%4 = tail call double @Cal_Tax(i32 200)
%5 = tail call double @Cal_GrandTotal(i32 200)
%6 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), double 2.000000e+02, double %4, double %5)
%7 = tail call double @Cal_Tax(i32 101)
%8 = tail call double @Cal_GrandTotal(i32 102)
%9 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), double 1.010000e+02, double %7, double %8)
ret i32 0
}