#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 M_PI;
int /*<<< orphan*/ printf(char *, double const, ...);
int main(int argc, char **argv) {
  printf("%f\n", 3.1415926);
  printf("%.10f\n\n", M_PI);
  const double TAXRATE_CONST = 0.174;
  double taxrate = 0.171;
  double subtotal = 200;
  double tax, grandtotal;
  taxrate = 0.2;
  tax = subtotal * taxrate;
  grandtotal = subtotal + tax;
  printf("The taxrate is %.3f.\n", taxrate);
  printf("The tax on %f is %f, so the grand total is %f.\n\n", subtotal, tax,
         grandtotal);
  subtotal = 200;
  tax = subtotal * 0.2;
  grandtotal = subtotal + tax;
  printf("The TAXRATE is %.3f.\n", 0.2);
  printf("The tax on %.2f is %.2f, so the grand total is %.2f.\n\n", subtotal,
         tax, grandtotal);
  subtotal = 200;
  tax = subtotal * TAXRATE_CONST;
  grandtotal = subtotal + tax;
  printf("The TAXRATE_CONST is %.3f.\n", TAXRATE_CONST);
  printf("The tax on %.2f is %.2f, so the grand total is %.2f.\n\n", subtotal,
         tax, grandtotal);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xefb(%rip),%rdi
movsd  0xeeb(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2ea5(%rip),%rax
movsd  (%rax),%xmm0
lea    0xede(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeae(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    0xe7a(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0xe29(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe24(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe6f(%rip),%rdi
movsd  0xdfc(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    0xe60(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0xdc8(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xdb3(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe5b(%rip),%rdi
movsd  0xd8b(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
lea    0xdff(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf28(%rip),%rdi
movsd  0xee0(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2eba(%rip),%rax
movsd  (%rax),%xmm0
lea    0xf0b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
movsd  0xeb9(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
movsd  0xeab(%rip),%xmm0
movsd  0xeab(%rip),%xmm1
movsd  0xeab(%rip),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xf10(%rip),%rdi
movsd  0xe7d(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf10(%rip),%rbx
mov    %rbx,%rdi
movsd  0xe6c(%rip),%xmm0
movsd  0xe6c(%rip),%xmm1
movsd  0xe6c(%rip),%xmm2
mov    $0x3,%al
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
movsd  0xe5e(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xe57(%rip),%xmm1
movsd  0xe57(%rip),%xmm2
mov    %rbx,%rdi
movsd  0xe24(%rip),%xmm0
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [8 x i8] c"%.10f\0A\0A\00"
@M_PI = global double 0.000000e+00
@.str.2 = [22 x i8] c"The taxrate is %.3f.\0A\00"
@.str.3 = [49 x i8] c"The tax on %f is %f, so the grand total is %f.\0A\0A\00"
@.str.4 = [22 x i8] c"The TAXRATE is %.3f.\0A\00"
@.str.5 = [55 x i8] c"The tax on %.2f is %.2f, so the grand total is %.2f.\0A\0A\00"
@.str.6 = [28 x i8] c"The TAXRATE_CONST is %.3f.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 0x400921FB4D12D84A)
%12 = load double, double* @M_PI
%13 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %12)
store double 1.740000e-01, double* %6
store double 1.710000e-01, double* %7
store double 2.000000e+02, double* %8
store double 2.000000e-01, double* %7
%14 = load double, double* %8
%15 = load double, double* %7
%16 = fmul double %14, %15
store double %16, double* %9
%17 = load double, double* %8
%18 = load double, double* %9
%19 = fadd double %17, %18
store double %19, double* %10
%20 = load double, double* %7
%21 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %20)
%22 = load double, double* %8
%23 = load double, double* %9
%24 = load double, double* %10
%25 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), double %22, double %23, double %24)
store double 2.000000e+02, double* %8
%26 = load double, double* %8
%27 = fmul double %26, 2.000000e-01
store double %27, double* %9
%28 = load double, double* %8
%29 = load double, double* %9
%30 = fadd double %28, %29
store double %30, double* %10
%31 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double 2.000000e-01)
%32 = load double, double* %8
%33 = load double, double* %9
%34 = load double, double* %10
%35 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %32, double %33, double %34)
store double 2.000000e+02, double* %8
%36 = load double, double* %8
%37 = fmul double %36, 1.740000e-01
store double %37, double* %9
%38 = load double, double* %8
%39 = load double, double* %9
%40 = fadd double %38, %39
store double %40, double* %10
%41 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double 1.740000e-01)
%42 = load double, double* %8
%43 = load double, double* %9
%44 = load double, double* %10
%45 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %42, double %43, double %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [8 x i8] c"%.10f\0A\0A\00"
@M_PI = global double 0.000000e+00
@.str.2 = [22 x i8] c"The taxrate is %.3f.\0A\00"
@.str.3 = [49 x i8] c"The tax on %f is %f, so the grand total is %f.\0A\0A\00"
@.str.4 = [22 x i8] c"The TAXRATE is %.3f.\0A\00"
@.str.5 = [55 x i8] c"The tax on %.2f is %.2f, so the grand total is %.2f.\0A\0A\00"
@.str.6 = [28 x i8] c"The TAXRATE_CONST is %.3f.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 0x400921FB4D12D84A)
%4 = load double, double* @M_PI
%5 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double 2.000000e-01)
%7 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), double 2.000000e+02, double 4.000000e+01, double 2.400000e+02)
%8 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double 2.000000e-01)
%9 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double 2.000000e+02, double 4.000000e+01, double 2.400000e+02)
%10 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double 1.740000e-01)
%11 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double 2.000000e+02, double 3.480000e+01, double 2.348000e+02)
ret i32 0
}