#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 item1_quantity = 1;
  int item2_quantity = 10;
  float item1_price = 5;
  float item2_price = 3;
  float tax = 110;
  float tax_percent = 0.10;
  float total_1;
  float total_2;
  float tax_amount;
  float total_cost;
  printf("What is the quantity of item 1?\n");
  scanf("%d", &item1_quantity);
  printf("What is the price of item 1?\n$");
  scanf("%f", &item1_price);
  printf("What is the quantity of item 2?\n");
  scanf("%d", &item2_quantity);
  printf("What is the price of item 2?\n$");
  scanf("%f", &item2_price);
  printf("What is the tax rate in %% ?\n");
  scanf("%f", &tax_percent);
  printf("What is the company name?\n");
  printf("What is the invoice number\n");
  total_1 = (item1_quantity * item1_price);
  total_2 = (item2_quantity * item2_price);
  tax_amount = (item1_quantity * item1_price + item2_quantity * item2_price) *
               tax_percent / 100;
  total_cost = (item1_quantity * item1_price + item2_quantity * item2_price) +
               tax_amount;
  printf("\t Nowara Industries, Inc.\n Invoice #12345\n\n");
  printf("Item 1: %d @ %0.2f per item \t $%0.2f\n", item1_quantity, item1_price,
         total_1);
  printf("Item 2: %d @ %0.2f per item \t $%0.2f\n", item2_quantity, item2_price,
         total_2);
  printf("Tax rate: \t\t\t %0.2f%%\n", tax_percent);
  printf("Tax amount: \t\t\t $%0.2f\n", tax_amount);
  printf("Total cost: \t\t\t $%0.2f\n", total_cost);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movss  0xecb(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xeba(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xea9(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe98(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe51(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  0xd8c(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe51(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe61(%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
movl   $0x1,0x14(%rsp)
movl   $0xa,0x10(%rsp)
movl   $0x40a00000,0xc(%rsp)
40
movl   $0x40400000,0x8(%rsp)
40
movl   $0x3dcccccd,0x4(%rsp)
3d
lea    0xf93(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%r14
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe90(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf6d(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xf46(%rip),%rdi
call   1030 <puts@plt>
cvtsi2ssl 0x14(%rsp),%xmm0
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
cvtsi2ssl 0x10(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
movss  %xmm1,0x1c(%rsp)
addss  %xmm1,%xmm0
movss  0x4(%rsp),%xmm1
mulss  %xmm0,%xmm1
divss  0xdb4(%rip),%xmm1
movss  %xmm1,0x20(%rsp)
addss  %xmm1,%xmm0
movss  %xmm0,0x24(%rsp)
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
mov    0x14(%rsp),%esi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x18(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xddf(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x1c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xddf(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xded(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x20(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdec(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x24(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdec(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"What is the quantity of item 1?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"What is the price of item 1?\0A$\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [33 x i8] c"What is the quantity of item 2?\0A\00"
@.str.5 = [31 x i8] c"What is the price of item 2?\0A$\00"
@.str.6 = [30 x i8] c"What is the tax rate in %% ?\0A\00"
@.str.7 = [27 x i8] c"What is the company name?\0A\00"
@.str.8 = [28 x i8] c"What is the invoice number\0A\00"
@.str.9 = [44 x i8] c"\09 Nowara Industries, Inc.\0A Invoice\0A\0A\00"
@.str.10 = [38 x i8] c"Item 1: %d @ %0.2f per item \09 $%0.2f\0A\00"
@.str.11 = [38 x i8] c"Item 2: %d @ %0.2f per item \09 $%0.2f\0A\00"
@.str.12 = [23 x i8] c"Tax rate: \09\09\09 %0.2f%%\0A\00"
@.str.13 = [24 x i8] c"Tax amount: \09\09\09 $%0.2f\0A\00"
@.str.14 = [24 x i8] c"Total cost: \09\09\09 $%0.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
store i32 1, i32* %2
store i32 10, i32* %3
store float 5.000000e+00, float* %4
store float 3.000000e+00, float* %5
store float 1.100000e+02, float* %6
store float 0x3FB99999A0000000, float* %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 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 ([31 x i8], [31 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 ([33 x i8], [33 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 ([31 x i8], [31 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* %7)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%24 = load i32, i32* %2
%25 = sitofp i32 %24 to float
%26 = load float, float* %4
%27 = fmul float %25, %26
store float %27, float* %8
%28 = load i32, i32* %3
%29 = sitofp i32 %28 to float
%30 = load float, float* %5
%31 = fmul float %29, %30
store float %31, float* %9
%32 = load i32, i32* %2
%33 = sitofp i32 %32 to float
%34 = load float, float* %4
%35 = load i32, i32* %3
%36 = sitofp i32 %35 to float
%37 = load float, float* %5
%38 = fmul float %36, %37
%39 = call float @llvm.fmuladd.f32(float %33, float %34, float %38)
%40 = load float, float* %7
%41 = fmul float %39, %40
%42 = fdiv float %41, 1.000000e+02
store float %42, float* %10
%43 = load i32, i32* %2
%44 = sitofp i32 %43 to float
%45 = load float, float* %4
%46 = load i32, i32* %3
%47 = sitofp i32 %46 to float
%48 = load float, float* %5
%49 = fmul float %47, %48
%50 = call float @llvm.fmuladd.f32(float %44, float %45, float %49)
%51 = load float, float* %10
%52 = fadd float %50, %51
store float %52, float* %11
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
%54 = load i32, i32* %2
%55 = load float, float* %4
%56 = fpext float %55 to double
%57 = load float, float* %8
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %54, double %56, double %58)
%60 = load i32, i32* %3
%61 = load float, float* %5
%62 = fpext float %61 to double
%63 = load float, float* %9
%64 = fpext float %63 to double
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %60, double %62, double %64)
%66 = load float, float* %7
%67 = fpext float %66 to double
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), double %67)
%69 = load float, float* %10
%70 = fpext float %69 to double
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), double %70)
%72 = load float, float* %11
%73 = fpext float %72 to double
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), double %73)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"What is the price of item 1?\0A$\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.5 = [31 x i8] c"What is the price of item 2?\0A$\00"
@.str.6 = [30 x i8] c"What is the tax rate in %% ?\0A\00"
@.str.10 = [38 x i8] c"Item 1: %d @ %0.2f per item \09 $%0.2f\0A\00"
@.str.11 = [38 x i8] c"Item 2: %d @ %0.2f per item \09 $%0.2f\0A\00"
@.str.12 = [23 x i8] c"Tax rate: \09\09\09 %0.2f%%\0A\00"
@.str.13 = [24 x i8] c"Tax amount: \09\09\09 $%0.2f\0A\00"
@.str.14 = [24 x i8] c"Total cost: \09\09\09 $%0.2f\0A\00"
@str = [32 x i8] c"What is the quantity of item 1?\00"
@str.15 = [32 x i8] c"What is the quantity of item 2?\00"
@str.16 = [26 x i8] c"What is the company name?\00"
@str.17 = [27 x i8] c"What is the invoice number\00"
@str.18 = [43 x i8] c"\09 Nowara Industries, Inc.\0A Invoice\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*
store i32 1, i32* %1
%7 = bitcast i32* %2 to i8*
store i32 10, i32* %2
%8 = bitcast float* %3 to i8*
store float 5.000000e+00, float* %3
%9 = bitcast float* %4 to i8*
store float 3.000000e+00, float* %4
%10 = bitcast float* %5 to i8*
store float 0x3FB99999A0000000, float* %5
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 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 ([31 x i8], [31 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.15, 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 ([31 x i8], [31 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 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.16, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.17, i64 0, i64 0))
%23 = load i32, i32* %1
%24 = sitofp i32 %23 to float
%25 = load float, float* %3
%26 = fmul float %25, %24
%27 = load i32, i32* %2
%28 = sitofp i32 %27 to float
%29 = load float, float* %4
%30 = fmul float %29, %28
%31 = call float @llvm.fmuladd.f32(float %24, float %25, float %30)
%32 = load float, float* %5
%33 = fmul float %32, %31
%34 = fdiv float %33, 1.000000e+02
%35 = fadd float %31, %34
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.18, i64 0, i64 0))
%37 = load i32, i32* %1
%38 = load float, float* %3
%39 = fpext float %38 to double
%40 = fpext float %26 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %37, double %39, double %40)
%42 = load i32, i32* %2
%43 = load float, float* %4
%44 = fpext float %43 to double
%45 = fpext float %30 to double
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %42, double %44, double %45)
%47 = load float, float* %5
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), double %48)
%50 = fpext float %34 to double
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), double %50)
%52 = fpext float %35 to double
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), double %52)
ret i32 0
}