#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;
  printf("what is the quantity of the first item?\n");
  scanf("%d", &quantity1);
  printf("what is the price of the first item?\n");
  scanf(" %f", &price1);
  printf("what is the quantity of the second item?\n");
  scanf("%d", &quantity2);
  printf("what is the price of the second item?\n");
  scanf(" %f", &price2);
  printf("what is the tax rate (in percent)?\n");
  scanf("%f", &taxrate);
  float pretax_cost = quantity1 * price1 + quantity2 * price2;
  float tax_dollars = (taxrate / 100.0) * pretax_cost;
  float total_cost = pretax_cost + tax_dollars;
  printf("\nSub total\t\t$%.2f\n", pretax_cost);
  printf("total cost with tax\t $%.2f\n", total_cost);
  printf("\n\n%s\n", "Sultan's Co.");
  printf("#%d\n", 7723);
  printf("\nItem 1: %d @ $%.2f per item\t $%.2f\n", quantity1, price1,
         quantity1 * price1);
  printf("Item 2: %d @ $%.2f per item\t $%.2f\n", quantity2, price2,
         quantity2 * price2);
  printf("Tax rate:\t\t\t %.2f%%\n", taxrate);
  printf("Tax amount:\t\t\t $%.2f\n", tax_dollars);
  printf("Total cost:\t\t\t $%.2f\n", total_cost);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdff(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe99(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe95(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    0xea2(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x1e2b,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe79(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe76(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe83(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe80(%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    $0x28,%rsp
lea    0xfa2(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%r14
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xfa8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xfab(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xfb9(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xfc4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe48(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cvtsi2ssl 0x14(%rsp),%xmm2
cvtsi2ssl 0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
mulss  0x10(%rsp),%xmm2
addss  %xmm0,%xmm2
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
divsd  0xe02(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x24(%rsp)
addss  %xmm1,%xmm2
movss  %xmm2,0x18(%rsp)
lea    0xdeb(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
lea    0xde0(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
lea    0xded(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdec(%rip),%rdi
mov    $0x1e2b,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
xorps  %xmm1,%xmm1
cvtsi2ss %esi,%xmm1
movss  0x10(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdbe(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
xorps  %xmm1,%xmm1
cvtsi2ss %esi,%xmm1
movss  0x8(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdb5(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc1(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x24(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdbe(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdc6(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"what is the quantity of the first item?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [38 x i8] c"what is the price of the first item?\0A\00"
@.str.3 = [4 x i8] c" %f\00"
@.str.4 = [42 x i8] c"what is the quantity of the second item?\0A\00"
@.str.5 = [39 x i8] c"what is the price of the second item?\0A\00"
@.str.6 = [36 x i8] c"what is the tax rate (in percent)?\0A\00"
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [19 x i8] c"\0ASub total\09\09$%.2f\0A\00"
@.str.9 = [28 x i8] c"total cost with tax\09 $%.2f\0A\00"
@.str.10 = [6 x i8] c"\0A\0A%s\0A\00"
@.str.11 = [13 x i8] c"Sultan's Co.\00"
@.str.12 = [5 x i8] c"#%d\0A\00"
@.str.13 = [37 x i8] c"\0AItem 1: %d @ $%.2f per item\09 $%.2f\0A\00"
@.str.14 = [36 x i8] c"Item 2: %d @ $%.2f per item\09 $%.2f\0A\00"
@.str.15 = [21 x i8] c"Tax rate:\09\09\09 %.2f%%\0A\00"
@.str.16 = [22 x i8] c"Tax amount:\09\09\09 $%.2f\0A\00"
@.str.17 = [22 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 float
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %5)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %6)
%20 = load i32, i32* %2
%21 = sitofp i32 %20 to float
%22 = load float, float* %3
%23 = load i32, i32* %4
%24 = sitofp i32 %23 to float
%25 = load float, float* %5
%26 = fmul float %24, %25
%27 = call float @llvm.fmuladd.f32(float %21, float %22, float %26)
store float %27, float* %7
%28 = load float, float* %6
%29 = fpext float %28 to double
%30 = fdiv double %29, 1.000000e+02
%31 = load float, float* %7
%32 = fpext float %31 to double
%33 = fmul double %30, %32
%34 = fptrunc double %33 to float
store float %34, float* %8
%35 = load float, float* %7
%36 = load float, float* %8
%37 = fadd float %35, %36
store float %37, float* %9
%38 = load float, float* %7
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %39)
%41 = load float, float* %9
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), double %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 7723)
%46 = load i32, i32* %2
%47 = load float, float* %3
%48 = fpext float %47 to double
%49 = load i32, i32* %2
%50 = sitofp i32 %49 to float
%51 = load float, float* %3
%52 = fmul float %50, %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %46, double %48, double %53)
%55 = load i32, i32* %4
%56 = load float, float* %5
%57 = fpext float %56 to double
%58 = load i32, i32* %4
%59 = sitofp i32 %58 to float
%60 = load float, float* %5
%61 = fmul float %59, %60
%62 = fpext float %61 to double
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0), i32 %55, double %57, double %62)
%64 = load float, float* %6
%65 = fpext float %64 to double
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), double %65)
%67 = load float, float* %8
%68 = fpext float %67 to double
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), double %68)
%70 = load float, float* %9
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.17, i64 0, i64 0), double %71)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c" %f\00"
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [19 x i8] c"\0ASub total\09\09$%.2f\0A\00"
@.str.9 = [28 x i8] c"total cost with tax\09 $%.2f\0A\00"
@.str.10 = [6 x i8] c"\0A\0A%s\0A\00"
@.str.11 = [13 x i8] c"Sultan's Co.\00"
@.str.12 = [5 x i8] c"#%d\0A\00"
@.str.13 = [37 x i8] c"\0AItem 1: %d @ $%.2f per item\09 $%.2f\0A\00"
@.str.14 = [36 x i8] c"Item 2: %d @ $%.2f per item\09 $%.2f\0A\00"
@.str.15 = [21 x i8] c"Tax rate:\09\09\09 %.2f%%\0A\00"
@.str.16 = [22 x i8] c"Tax amount:\09\09\09 $%.2f\0A\00"
@.str.17 = [22 x i8] c"Total cost:\09\09\09 $%.2f\0A\00"
@str = [40 x i8] c"what is the quantity of the first item?\00"
@str.18 = [37 x i8] c"what is the price of the first item?\00"
@str.19 = [41 x i8] c"what is the quantity of the second item?\00"
@str.20 = [38 x i8] c"what is the price of the second item?\00"
@str.21 = [35 x i8] c"what is the tax rate (in percent)?\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.18, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %2)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.19, 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.20, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), float* %4)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.21, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %5)
%21 = load i32, i32* %1
%22 = sitofp i32 %21 to float
%23 = load float, float* %2
%24 = load i32, i32* %3
%25 = sitofp i32 %24 to float
%26 = load float, float* %4
%27 = fmul float %26, %25
%28 = call float @llvm.fmuladd.f32(float %22, float %23, float %27)
%29 = load float, float* %5
%30 = fpext float %29 to double
%31 = fdiv double %30, 1.000000e+02
%32 = fpext float %28 to double
%33 = fmul double %31, %32
%34 = fptrunc double %33 to float
%35 = fadd float %28, %34
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %32)
%37 = fpext float %35 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), double %37)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 7723)
%41 = load i32, i32* %1
%42 = load float, float* %2
%43 = fpext float %42 to double
%44 = sitofp i32 %41 to float
%45 = fmul float %42, %44
%46 = fpext float %45 to double
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0), i32 %41, double %43, double %46)
%48 = load i32, i32* %3
%49 = load float, float* %4
%50 = fpext float %49 to double
%51 = sitofp i32 %48 to float
%52 = fmul float %49, %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0), i32 %48, double %50, double %53)
%55 = load float, float* %5
%56 = fpext float %55 to double
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), double %56)
%58 = fpext float %34 to double
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.16, i64 0, i64 0), double %58)
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.17, i64 0, i64 0), double %37)
ret i32 0
}