#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int quantity1;
  float price1;
  int quantity2;
  float price2;
  float taxrate;
  float item1;
  float item2;
  int pretotal;
  float total;
  float taxdollars;
  char company;
  printf("Enter item 1 quantity: \t");
  scanf("%d", &quantity1);
  printf("Enter item 1 price:$\t$");
  scanf("%f", &price1);
  printf("Enter item 2 quantity:\t");
  scanf("%d", &quantity2);
  printf("Enter item 2 price:\t$");
  scanf("%f", &price2);
  printf("Enter tax rate (in percent):\t");
  scanf("%f", &taxrate);
  item1 = quantity1 * price1;
  item2 = quantity2 * price2;
  pretotal = (price1 * quantity1) + (price2 * quantity2);
  taxdollars = (taxrate / 100) * pretotal;
  total = ((taxrate / 100) * pretotal) + pretotal;
  printf("\t\t  %s\n", "Matthew. Inc.");
  printf("\t\tInvoice:%s\n", "153");
  printf("Item 1:%d @ $%.2f per item\t $%.2f \n", quantity1, price1, item1);
  printf("Item 2:%d @ $%.2f per item\t $%.2f  \n", quantity2, price2, item2);
  printf("Tax rate:\t\t\t %.2f%%   \n", taxrate);
  printf("Tax amount:\t\t\t $%.2f  \n", taxdollars);
  printf("Total cost:\t\t\t $%.2f  \n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
cvtsi2ssl -0x10(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xddf(%rip),%xmm1
divss  %xmm1,%xmm0
cvtsi2ssl -0x24(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xdc0(%rip),%xmm1
divss  %xmm1,%xmm0
cvtsi2ssl -0x24(%rbp),%xmm2
cvtsi2ssl -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
lea    0xe24(%rip),%rdi
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe25(%rip),%rdi
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe0d(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe0e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%r14
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
cvtsi2ssl 0x10(%rsp),%xmm0
cvtsi2ssl 0x8(%rsp),%xmm1
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
mulss  0x4(%rsp),%xmm1
movss  %xmm1,0x18(%rsp)
addss  %xmm1,%xmm0
movss  (%rsp),%xmm1
divss  0xe07(%rip),%xmm1
cvttps2dq %xmm0,%xmm0
cvtdq2ps %xmm0,%xmm0
mulss  %xmm0,%xmm1
movss  %xmm1,0x1c(%rsp)
addss  %xmm1,%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xe6c(%rip),%rdi
lea    0xe6d(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
lea    0xe74(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe52(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x18(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe50(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movaps 0x20(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter item 1 quantity: \09\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Enter item 1 price:$\09$\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [24 x i8] c"Enter item 2 quantity:\09\00"
@.str.5 = [22 x i8] c"Enter item 2 price:\09$\00"
@.str.6 = [30 x i8] c"Enter tax rate (in percent):\09\00"
@.str.7 = [8 x i8] c"\09\09 %s\0A\00"
@.str.8 = [14 x i8] c"Matthew. Inc.\00"
@.str.9 = [14 x i8] c"\09\09Invoice:%s\0A\00"
@.str.10 = [4 x i8] c"153\00"
@.str.11 = [36 x i8] c"Item 1:%d @ $%.2f per item\09 $%.2f \0A\00"
@.str.12 = [37 x i8] c"Item 2:%d @ $%.2f per item\09 $%.2f \0A\00"
@.str.13 = [24 x i8] c"Tax rate:\09\09\09 %.2f%% \0A\00"
@.str.14 = [24 x i8] c"Tax amount:\09\09\09 $%.2f \0A\00"
@.str.15 = [24 x i8] c"Total cost:\09\09\09 $%.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca i8
store i32 0, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %5)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %6)
%23 = load i32, i32* %2
%24 = sitofp i32 %23 to float
%25 = load float, float* %3
%26 = fmul float %24, %25
store float %26, float* %7
%27 = load i32, i32* %4
%28 = sitofp i32 %27 to float
%29 = load float, float* %5
%30 = fmul float %28, %29
store float %30, float* %8
%31 = load float, float* %3
%32 = load i32, i32* %2
%33 = sitofp i32 %32 to float
%34 = load float, float* %5
%35 = load i32, i32* %4
%36 = sitofp i32 %35 to float
%37 = fmul float %34, %36
%38 = call float @llvm.fmuladd.f32(float %31, float %33, float %37)
%39 = fptosi float %38 to i32
store i32 %39, i32* %9
%40 = load float, float* %6
%41 = fdiv float %40, 1.000000e+02
%42 = load i32, i32* %9
%43 = sitofp i32 %42 to float
%44 = fmul float %41, %43
store float %44, float* %11
%45 = load float, float* %6
%46 = fdiv float %45, 1.000000e+02
%47 = load i32, i32* %9
%48 = sitofp i32 %47 to float
%49 = load i32, i32* %9
%50 = sitofp i32 %49 to float
%51 = call float @llvm.fmuladd.f32(float %46, float %48, float %50)
store float %51, float* %10
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%54 = load i32, i32* %2
%55 = load float, float* %3
%56 = fpext float %55 to double
%57 = load float, float* %7
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %54, double %56, double %58)
%60 = load i32, i32* %4
%61 = load float, float* %5
%62 = fpext float %61 to double
%63 = load float, float* %8
%64 = fpext float %63 to double
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0), i32 %60, double %62, double %64)
%66 = load float, float* %6
%67 = fpext float %66 to double
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), double %67)
%69 = load float, float* %11
%70 = fpext float %69 to double
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), double %70)
%72 = load float, float* %10
%73 = fpext float %72 to double
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), double %73)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter item 1 quantity: \09\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Enter item 1 price:$\09$\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [24 x i8] c"Enter item 2 quantity:\09\00"
@.str.5 = [22 x i8] c"Enter item 2 price:\09$\00"
@.str.6 = [30 x i8] c"Enter tax rate (in percent):\09\00"
@.str.7 = [8 x i8] c"\09\09 %s\0A\00"
@.str.8 = [14 x i8] c"Matthew. Inc.\00"
@.str.9 = [14 x i8] c"\09\09Invoice:%s\0A\00"
@.str.10 = [4 x i8] c"153\00"
@.str.11 = [36 x i8] c"Item 1:%d @ $%.2f per item\09 $%.2f \0A\00"
@.str.12 = [37 x i8] c"Item 2:%d @ $%.2f per item\09 $%.2f \0A\00"
@.str.13 = [24 x i8] c"Tax rate:\09\09\09 %.2f%% \0A\00"
@.str.14 = [24 x i8] c"Tax amount:\09\09\09 $%.2f \0A\00"
@.str.15 = [24 x i8] c"Total cost:\09\09\09 $%.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = bitcast i32* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast float* %4 to i8*
%10 = bitcast float* %5 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %5)
%21 = load i32, i32* %1
%22 = sitofp i32 %21 to float
%23 = load float, float* %2
%24 = fmul float %23, %22
%25 = load i32, i32* %3
%26 = sitofp i32 %25 to float
%27 = load float, float* %4
%28 = fmul float %27, %26
%29 = call float @llvm.fmuladd.f32(float %23, float %22, float %28)
%30 = fptosi float %29 to i32
%31 = load float, float* %5
%32 = fdiv float %31, 1.000000e+02
%33 = sitofp i32 %30 to float
%34 = fmul float %32, %33
%35 = call float @llvm.fmuladd.f32(float %32, float %33, float %33)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%38 = load i32, i32* %1
%39 = load float, float* %2
%40 = fpext float %39 to double
%41 = fpext float %24 to double
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %38, double %40, double %41)
%43 = load i32, i32* %3
%44 = load float, float* %4
%45 = fpext float %44 to double
%46 = fpext float %28 to double
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0), i32 %43, double %45, double %46)
%48 = load float, float* %5
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), double %49)
%51 = fpext float %34 to double
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), double %51)
%53 = fpext float %35 to double
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), double %53)
ret i32 0
}