#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;
  int item2;
  float price1;
  float price2;
  float tax_percent;
  printf("Enter item1 quantity: ");
  scanf("%d", &item1);
  printf("Enter item1 price: ");
  scanf("%f", &price1);
  printf("Enter item2 quantity: ");
  scanf("%d", &item2);
  printf("Enter item2 price: ");
  scanf("%f", &price2);
  printf("Enter the tax rate (in percent):");
  scanf("%f", &tax_percent);
  float pretax_cost = (item1 * price1) + (item2 * price2);
  float tax_dollars = (tax_percent / 100.0) * pretax_cost;
  float total_cost = pretax_cost + tax_dollars;
  printf("\t%s\n", "price industries,inc");
  printf("\t%s\n", "invoice #12345");
  float item1p = item1 * price1;
  float item2p = item2 * price2;
  printf("item 1: %d @ %.2f per item\t$%f\n", item1, price1, item1p);
  printf("item 2: %d @ %.2f per item\t$%f\n", item2, price2, item2p);
  printf("tax rate:\t\t\t%f%%\n", tax_percent);
  printf("tax amount:\t\t\t$%f\n", tax_dollars);
  printf("total cost:\t\t\t$%f\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    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
cvtsi2ssl -0xc(%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)
lea    0xe54(%rip),%rdi
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3f(%rip),%rdi
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x8(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe20(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe1d(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe26(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe21(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1d(%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    0xeda(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%r14
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed6(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
cvtsi2ssl 0x18(%rsp),%xmm2
cvtsi2ssl 0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
mulss  0x14(%rsp),%xmm2
addss  %xmm0,%xmm2
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe0c(%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)
lea    0xe6b(%rip),%rbx
lea    0xe69(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
xorps  %xmm1,%xmm1
cvtsi2ss %esi,%xmm1
movss  0x14(%rsp),%xmm0
mulss  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cvtsi2ssl 0xc(%rsp),%xmm2
mulss  0x8(%rsp),%xmm2
movss  %xmm2,0x1c(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe39(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x1c(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe33(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x20(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x24(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe30(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [23 x i8] c"Enter item1 quantity: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Enter item1 price: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [23 x i8] c"Enter item2 quantity: \00"
@.str.5 = [20 x i8] c"Enter item2 price: \00"
@.str.6 = [33 x i8] c"Enter the tax rate (in percent):\00"
@.str.7 = [5 x i8] c"\09%s\0A\00"
@.str.8 = [21 x i8] c"price industries,inc\00"
@.str.9 = [15 x i8] c"invoice\00"
@.str.10 = [32 x i8] c"item 1: %d @ %.2f per item\09$%f\0A\00"
@.str.11 = [32 x i8] c"item 2: %d @ %.2f per item\09$%f\0A\00"
@.str.12 = [18 x i8] c"tax rate:\09\09\09%f%%\0A\00"
@.str.13 = [19 x i8] c"tax amount:\09\09\09$%f\0A\00"
@.str.14 = [19 x i8] c"total cost:\09\09\09$%f\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 ([23 x i8], [23 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 ([20 x i8], [20 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 ([23 x i8], [23 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 ([20 x i8], [20 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 ([33 x i8], [33 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 = load i32, i32* %2
%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 ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%38 = load i32, i32* %1
%39 = sitofp i32 %38 to float
%40 = load float, float* %3
%41 = fmul float %40, %39
%42 = load i32, i32* %2
%43 = sitofp i32 %42 to float
%44 = load float, float* %4
%45 = fmul float %44, %43
%46 = fpext float %40 to double
%47 = fpext float %41 to double
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i32 %38, double %46, double %47)
%49 = load i32, i32* %2
%50 = load float, float* %4
%51 = fpext float %50 to double
%52 = fpext float %45 to double
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0), i32 %49, double %51, double %52)
%54 = load float, float* %5
%55 = fpext float %54 to double
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), double %55)
%57 = fpext float %34 to double
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), double %57)
%59 = fpext float %35 to double
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0), double %59)
ret i32 0
}