#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 */
typedef float pretax_cost_1;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int Quantity_1;
  int Quantity_2;
  float Price_1;
  float Price_2;
  float taxrate;
  float pretax_cost_1;
  float pretax_cost_2;
  float total_pretax_cost;
  float total_cost;
  float tax_dollars;
  printf("Enter Item 1 quantity: ");
  scanf("%d", &Quantity_1);
  printf("Enter Item 1 price: ");
  scanf("%f", &Price_1);
  printf("Enter Item 2 quantity: ");
  scanf("%d", &Quantity_2);
  printf("Enter Item 2 price: ");
  scanf("%f", &Price_2);
  printf("Enter tax rate (in percent): ");
  scanf("%f", &taxrate);
  pretax_cost_1 = (Quantity_1 * Price_1);
  pretax_cost_2 = (Quantity_2 * Price_2);
  total_pretax_cost = (pretax_cost_1) + (pretax_cost_2);
  tax_dollars = (taxrate / 100.0) * total_pretax_cost;
  total_cost = total_pretax_cost + tax_dollars;
  printf("\n");
  printf("%s\n", "Fernando's Enterprise");
  printf("Invoice #%d\n", 007);
  printf("Item 1: %d @ $%.2f per item \t$%.2f\n", Quantity_1, Price_1,
         pretax_cost_1);
  printf("Item 2: %d @ $%.2f per item \t$%.2f\n", Quantity_2, Price_2,
         pretax_cost_2);
  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    0xedc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%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    0xe74(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf3(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3b(%rip),%rdi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe40(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe25(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe26(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe33(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe31(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe30(%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    0xeba(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec4(%rip),%r14
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb8(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
cvtsi2ssl 0x14(%rsp),%xmm2
mulss  0xc(%rsp),%xmm2
movss  %xmm2,0x18(%rsp)
cvtsi2ssl 0x10(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
addss  %xmm0,%xmm2
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xde0(%rip),%xmm0
cvtss2sd %xmm2,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x20(%rsp)
addss  %xmm0,%xmm2
movss  %xmm2,0x24(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe36(%rip),%rdi
call   1040 <puts@plt>
lea    0xe40(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x18(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe22(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x1c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe20(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x20(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe29(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x24(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe27(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [24 x i8] c"Enter Item 1 quantity: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"Enter Item 1 price: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [24 x i8] c"Enter Item 2 quantity: \00"
@.str.5 = [21 x i8] c"Enter Item 2 price: \00"
@.str.6 = [30 x i8] c"Enter tax rate (in percent): \00"
@.str.9 = [22 x i8] c"Fernando's Enterprise\00"
@.str.10 = [13 x i8] c"Invoice #%d\0A\00"
@.str.11 = [36 x i8] c"Item 1: %d @ $%.2f per item \09$%.2f\0A\00"
@.str.12 = [36 x i8] c"Item 2: %d @ $%.2f per item \09$%.2f\0A\00"
@.str.13 = [21 x i8] c"Tax rate: \09\09\09%.2f%%\0A\00"
@.str.14 = [22 x i8] c"Tax amount: \09\09\09$%.2f\0A\00"
@.str.15 = [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 float
%5 = alloca float
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast float* %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 ([24 x i8], [24 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 ([21 x i8], [21 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* %3)
%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* %2)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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* %3
%24 = fmul float %23, %22
%25 = load i32, i32* %2
%26 = sitofp i32 %25 to float
%27 = load float, float* %4
%28 = fmul float %27, %26
%29 = fadd float %24, %28
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = fdiv double %31, 1.000000e+02
%33 = fpext float %29 to double
%34 = fmul double %32, %33
%35 = fptrunc double %34 to float
%36 = fadd float %29, %35
%37 = call i32 @putchar(i32 10)
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 7)
%40 = load i32, i32* %1
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = fpext float %24 to double
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i32 %40, double %42, double %43)
%45 = load i32, i32* %2
%46 = load float, float* %4
%47 = fpext float %46 to double
%48 = fpext float %28 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.12, i64 0, i64 0), i32 %45, double %47, double %48)
%50 = load float, float* %5
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), double %51)
%53 = fpext float %35 to double
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), double %53)
%55 = fpext float %36 to double
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), double %55)
ret i32 0
}