#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);
int round(float);
void calculateTotal(float *head, int len) {
  float total = 0;
  total = head[0] + (head[0] * head[1] / 100) + (head[0] * head[2] / 100);
  int totalRounded = round(total);
  printf("The total meal cost is %d dollars.", totalRounded);
}


x86 assembly (clang, -O0):
<calculateTotal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm1
movss  0xea8(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
mulss  0x8(%rax),%xmm1
movss  0xe87(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <round@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateTotal>:
push   %rax
movsd  (%rdi),%xmm1
movaps %xmm1,%xmm2
shufps $0xe1,%xmm1,%xmm2
movss  0x8(%rdi),%xmm0
movlhps %xmm1,%xmm0
shufps $0xe2,%xmm1,%xmm0
mulps  %xmm2,%xmm0
divps  0xebe(%rip),%xmm0
addss  %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm0
addss  %xmm1,%xmm0
call   1040 <round@plt>
lea    0xeb6(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"The total meal cost is %d dollars.\00"
define void @calculateTotal(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store float 0.000000e+00, float* %5
%7 = load float*, float** %3
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = load float*, float** %3
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = load float*, float** %3
%14 = getelementptr inbounds float, float* %13, i64 1
%15 = load float, float* %14
%16 = fmul float %12, %15
%17 = fdiv float %16, 1.000000e+02
%18 = fadd float %9, %17
%19 = load float*, float** %3
%20 = getelementptr inbounds float, float* %19, i64 0
%21 = load float, float* %20
%22 = load float*, float** %3
%23 = getelementptr inbounds float, float* %22, i64 2
%24 = load float, float* %23
%25 = fmul float %21, %24
%26 = fdiv float %25, 1.000000e+02
%27 = fadd float %18, %26
store float %27, float* %5
%28 = load float, float* %5
%29 = call i32 @round(float %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %30)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"The total meal cost is %d dollars.\00"
define void @calculateTotal(float* nocapture %0, i32 %1) {
%3 = bitcast float* %0 to <2 x float>*
%4 = load <2 x float>, <2 x float>* %3
%5 = shufflevector <2 x float> %4, <2 x float> poison, <2 x i32> <i32 1, i32 0>
%6 = getelementptr inbounds float, float* %0, i64 2
%7 = load float, float* %6
%8 = extractelement <2 x float> %4, i64 0
%9 = insertelement <2 x float> %4, float %7, i64 1
%10 = fmul <2 x float> %5, %9
%11 = fdiv <2 x float> %10, <float 1.000000e+02, float 1.000000e+02>
%12 = extractelement <2 x float> %11, i64 0
%13 = fadd float %8, %12
%14 = extractelement <2 x float> %11, i64 1
%15 = fadd float %13, %14
%16 = tail call i32 @round(float %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %16)
ret void
}