#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);
scalar_t__ round(double);
int /*<<< orphan*/ scanf(char *, double *, int *, int *);
int main() {
  double base_cost;
  int tax_pct;
  int tip_pct;
  double total_cost;
  scanf("%lf\n %d\n %d\n", &base_cost, &tax_pct, &tip_pct);
  total_cost =
      base_cost + (base_cost * tip_pct / 100.0) + (base_cost * tax_pct / 100.0);
  printf("The total meal cost is %d dollars.\n", (int)round(total_cost));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe8e(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe70(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <round@plt>
mov    %eax,%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm2
unpcklps %xmm0,%xmm2
cvtdq2pd %xmm2,%xmm2
movapd %xmm1,%xmm0
unpcklpd %xmm1,%xmm0
mulpd  %xmm2,%xmm0
divpd  0xe84(%rip),%xmm0
addsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1050 <round@plt>
lea    0xe89(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%lf\0A %d\0A %d\0A\00"
@.str.1 = [36 x i8] c"The total meal cost is %d dollars.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %2, i32* %3, i32* %4)
%7 = load double, double* %2
%8 = load double, double* %2
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to double
%11 = fmul double %8, %10
%12 = fdiv double %11, 1.000000e+02
%13 = fadd double %7, %12
%14 = load double, double* %2
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to double
%17 = fmul double %14, %16
%18 = fdiv double %17, 1.000000e+02
%19 = fadd double %13, %18
store double %19, double* %5
%20 = load double, double* %5
%21 = call i64 @round(double %20)
%22 = trunc i64 %21 to i32
%23 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%lf\0A %d\0A %d\0A\00"
@.str.1 = [36 x i8] c"The total meal cost is %d dollars.\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = alloca i32
%4 = bitcast double* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double* %1, i32* %2, i32* %3)
%8 = load double, double* %1
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = insertelement <2 x i32> poison, i32 %9, i64 0
%12 = insertelement <2 x i32> %11, i32 %10, i64 1
%13 = sitofp <2 x i32> %12 to <2 x double>
%14 = insertelement <2 x double> poison, double %8, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = fmul <2 x double> %15, %13
%17 = fdiv <2 x double> %16, <double 1.000000e+02, double 1.000000e+02>
%18 = extractelement <2 x double> %17, i64 0
%19 = fadd double %8, %18
%20 = extractelement <2 x double> %17, i64 1
%21 = fadd double %19, %20
%22 = call i64 @round(double %21)
%23 = trunc i64 %22 to i32
%24 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %23)
ret i32 0
}