#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double originalPrice = 0.0;
  double specialPrice = 0.0;
  double discount = 0.0;
  double tax = 0.0;
  printf("Enter original price:");
  scanf("%lf\n", &originalPrice);
  printf("Enter discount:");
  scanf("%lf\n", &discount);
  printf("Enter tax:");
  scanf("%lf\n", &tax);
  double afterTax = originalPrice * (1.0 + tax / 100.0);
  double theDiscount = originalPrice * (discount / 100.0);
  specialPrice = afterTax - theDiscount;
  printf("Original price is: £%.2lf\n", originalPrice);
  printf("The price after tax is: £%.2lf\n", afterTax);
  printf("The discount amount is: £%.2lf\n", theDiscount);
  printf("Your special Price is: £%.2lf\n", specialPrice);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xe45(%rip),%xmm1
divsd  %xmm1,%xmm2
movsd  0xe41(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe1a(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe38(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xe41(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xe4f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe5d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm2
movsd  0xe58(%rip),%xmm1
divsd  %xmm1,%xmm2
addsd  0xe54(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%rsp)
movsd  0x8(%rsp),%xmm3
divsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
movsd  %xmm3,0x20(%rsp)
movapd %xmm2,%xmm1
subsd  %xmm3,%xmm1
movsd  %xmm1,0x28(%rsp)
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe87(%rip),%rdi
movsd  0x28(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter original price:\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.2 = [16 x i8] c"Enter discount:\00"
@.str.3 = [11 x i8] c"Enter tax:\00"
@.str.4 = [28 x i8] c"Original price is: \C2\A3%.2lf\0A\00"
@.str.5 = [33 x i8] c"The price after tax is: \C2\A3%.2lf\0A\00"
@.str.6 = [33 x i8] c"The discount amount is: \C2\A3%.2lf\0A\00"
@.str.7 = [32 x i8] c"Your special Price is: \C2\A3%.2lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %4)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %5)
%14 = load double, double* %2
%15 = load double, double* %5
%16 = fdiv double %15, 1.000000e+02
%17 = fadd double 1.000000e+00, %16
%18 = fmul double %14, %17
store double %18, double* %6
%19 = load double, double* %2
%20 = load double, double* %4
%21 = fdiv double %20, 1.000000e+02
%22 = fmul double %19, %21
store double %22, double* %7
%23 = load double, double* %6
%24 = load double, double* %7
%25 = fsub double %23, %24
store double %25, double* %3
%26 = load double, double* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %26)
%28 = load double, double* %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), double %28)
%30 = load double, double* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), double %30)
%32 = load double, double* %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), double %32)
%34 = load i32, i32* @EXIT_SUCCESS
ret i32 %34
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter original price:\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.2 = [16 x i8] c"Enter discount:\00"
@.str.3 = [11 x i8] c"Enter tax:\00"
@.str.4 = [28 x i8] c"Original price is: \C2\A3%.2lf\0A\00"
@.str.5 = [33 x i8] c"The price after tax is: \C2\A3%.2lf\0A\00"
@.str.6 = [33 x i8] c"The discount amount is: \C2\A3%.2lf\0A\00"
@.str.7 = [32 x i8] c"Your special Price is: \C2\A3%.2lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%5 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%6 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %3)
%13 = load double, double* %1
%14 = load double, double* %3
%15 = fdiv double %14, 1.000000e+02
%16 = fadd double %15, 1.000000e+00
%17 = fmul double %13, %16
%18 = load double, double* %2
%19 = fdiv double %18, 1.000000e+02
%20 = fmul double %13, %19
%21 = fsub double %17, %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), double %13)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), double %17)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), double %20)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), double %21)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}