#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 *, double);
double meltsMmajors(double *const array) {
  for (int i = 0; i < 9; i++) {
    printf("%.1f, ", array[i]);
  }
  double Si = array[0] / (28.0844 + 15.9994 * 2);
  double Ti = array[1] / (47.867 + 15.9994 * 2);
  double Al = array[2] / (26.9815 + 15.9994 * 1.5);
  double Fe =
      array[3] / (55.845 + 15.9994 * 1.5) + array[4] / (55.845 + 15.9994);
  double Mg = array[5] / (24.3050 + 15.9994);
  double Ca = array[6] / (40.078 + 15.9994);
  double Na = array[7] / (22.9898 + 15.9994 / 2);
  double K = array[8] / (39.0983 + 15.9994 / 2);
  double TotalMoles = Si + Ti + Al + Fe + Mg + Ca + Na + K;
  double M = (Na + K + 2 * Ca) / (Al * Si) * TotalMoles;
  printf("\t\t\t\t%.2g", M);
  return M;
}


x86 assembly (clang, -O0):
<meltsMmajors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    1154 <meltsMmajors+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xf07(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <meltsMmajors+0x13>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xedc(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  0xeba(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  0xe98(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  0xe76(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm1
movsd  0xe59(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  0xe33(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  0xe11(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  0xdef(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  0xdcd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm1
addsd  -0x50(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
lea    0xdab(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x60(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meltsMmajors>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
lea    0xf2b(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x8(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x10(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x18(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x20(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x28(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x30(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x38(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x40(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0x10(%rbx),%xmm0
divsd  0xe5e(%rip),%xmm0
movsd  0x18(%rbx),%xmm3
divsd  0xe59(%rip),%xmm3
movsd  0x8(%rbx),%xmm4
movhpd 0x20(%rbx),%xmm4
divpd  0xe5f(%rip),%xmm4
movsd  0x28(%rbx),%xmm5
divsd  0xe42(%rip),%xmm5
movupd 0x30(%rbx),%xmm1
divpd  0xe55(%rip),%xmm1
movsd  0x40(%rbx),%xmm2
movhpd (%rbx),%xmm2
divpd  0xe54(%rip),%xmm2
movapd %xmm2,%xmm6
shufpd $0x1,%xmm3,%xmm6
addpd  %xmm4,%xmm6
movapd %xmm6,%xmm3
addsd  %xmm0,%xmm3
unpckhpd %xmm6,%xmm6
addsd  %xmm3,%xmm6
addsd  %xmm5,%xmm6
addsd  %xmm1,%xmm6
movapd %xmm1,%xmm3
unpckhpd %xmm1,%xmm3
addsd  %xmm3,%xmm6
addsd  %xmm2,%xmm3
addsd  %xmm2,%xmm6
unpckhpd %xmm2,%xmm2
addsd  %xmm1,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
movapd %xmm6,%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
movaps (%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.1f, \00"
@.str.1 = [9 x i8] c"\09\09\09\09%.2g\00"
define double @meltsMmajors(double* %0) {
%2 = alloca double*
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double* %0, double** %2
store i32 0, i32* %3
br label %14
14: ; preds = %24, %1
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 9
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load double*, double** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %14
27: ; preds = %14
%28 = load double*, double** %2
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
%31 = fdiv double %30, 0x404E0AA64C2F837B
store double %31, double* %4
%32 = load double*, double** %2
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
%35 = fdiv double %34, 0x4053F7694467381D
store double %35, double* %5
%36 = load double*, double** %2
%37 = getelementptr inbounds double, double* %36, i64 2
%38 = load double, double* %37
%39 = fdiv double %38, 0x40497D844D013A92
store double %39, double* %6
%40 = load double*, double** %2
%41 = getelementptr inbounds double, double* %40, i64 3
%42 = load double, double* %41
%43 = fdiv double %42, 7.984410e+01
%44 = load double*, double** %2
%45 = getelementptr inbounds double, double* %44, i64 4
%46 = load double, double* %45
%47 = fdiv double %46, 7.184440e+01
%48 = fadd double %43, %47
store double %48, double* %7
%49 = load double*, double** %2
%50 = getelementptr inbounds double, double* %49, i64 5
%51 = load double, double* %50
%52 = fdiv double %51, 4.030440e+01
store double %52, double* %8
%53 = load double*, double** %2
%54 = getelementptr inbounds double, double* %53, i64 6
%55 = load double, double* %54
%56 = fdiv double %55, 0x404C09E83E425AEF
store double %56, double* %9
%57 = load double*, double** %2
%58 = getelementptr inbounds double, double* %57, i64 7
%59 = load double, double* %58
%60 = fdiv double %59, 3.098950e+01
store double %60, double* %10
%61 = load double*, double** %2
%62 = getelementptr inbounds double, double* %61, i64 8
%63 = load double, double* %62
%64 = fdiv double %63, 4.709800e+01
store double %64, double* %11
%65 = load double, double* %4
%66 = load double, double* %5
%67 = fadd double %65, %66
%68 = load double, double* %6
%69 = fadd double %67, %68
%70 = load double, double* %7
%71 = fadd double %69, %70
%72 = load double, double* %8
%73 = fadd double %71, %72
%74 = load double, double* %9
%75 = fadd double %73, %74
%76 = load double, double* %10
%77 = fadd double %75, %76
%78 = load double, double* %11
%79 = fadd double %77, %78
store double %79, double* %12
%80 = load double, double* %10
%81 = load double, double* %11
%82 = fadd double %80, %81
%83 = load double, double* %9
%84 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %83, double %82)
%85 = load double, double* %6
%86 = load double, double* %4
%87 = fmul double %85, %86
%88 = fdiv double %84, %87
%89 = load double, double* %12
%90 = fmul double %88, %89
store double %90, double* %13
%91 = load double, double* %13
%92 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %91)
%93 = load double, double* %13
ret double %93
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.1f, \00"
@.str.1 = [9 x i8] c"\09\09\09\09%.2g\00"
define double @meltsMmajors(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %2)
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %8)
%10 = getelementptr inbounds double, double* %0, i64 3
%11 = load double, double* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
%13 = getelementptr inbounds double, double* %0, i64 4
%14 = load double, double* %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %14)
%16 = getelementptr inbounds double, double* %0, i64 5
%17 = load double, double* %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %17)
%19 = getelementptr inbounds double, double* %0, i64 6
%20 = load double, double* %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %20)
%22 = getelementptr inbounds double, double* %0, i64 7
%23 = load double, double* %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %23)
%25 = getelementptr inbounds double, double* %0, i64 8
%26 = load double, double* %25
%27 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %26)
%28 = load double, double* %0
%29 = load double, double* %4
%30 = load double, double* %7
%31 = fdiv double %30, 0x40497D844D013A92
%32 = load double, double* %10
%33 = fdiv double %32, 7.984410e+01
%34 = load double, double* %13
%35 = insertelement <2 x double> poison, double %29, i64 0
%36 = insertelement <2 x double> %35, double %34, i64 1
%37 = fdiv <2 x double> %36, <double 0x4053F7694467381D, double 7.184440e+01>
%38 = load double, double* %16
%39 = fdiv double %38, 4.030440e+01
%40 = bitcast double* %19 to <2 x double>*
%41 = load <2 x double>, <2 x double>* %40
%42 = fdiv <2 x double> %41, <double 0x404C09E83E425AEF, double 3.098950e+01>
%43 = load double, double* %25
%44 = insertelement <2 x double> poison, double %43, i64 0
%45 = insertelement <2 x double> %44, double %28, i64 1
%46 = fdiv <2 x double> %45, <double 4.709800e+01, double 0x404E0AA64C2F837B>
%47 = extractelement <2 x double> %46, i64 1
%48 = insertelement <2 x double> poison, double %47, i64 0
%49 = insertelement <2 x double> %48, double %33, i64 1
%50 = fadd <2 x double> %49, %37
%51 = extractelement <2 x double> %50, i64 0
%52 = fadd double %51, %31
%53 = extractelement <2 x double> %50, i64 1
%54 = fadd double %52, %53
%55 = fadd double %39, %54
%56 = extractelement <2 x double> %42, i64 0
%57 = fadd double %56, %55
%58 = extractelement <2 x double> %42, i64 1
%59 = fadd double %58, %57
%60 = extractelement <2 x double> %46, i64 0
%61 = fadd double %58, %60
%62 = tail call double @llvm.fmuladd.f64(double %56, double 2.000000e+00, double %61)
%63 = extractelement <2 x double> %46, i64 1
%64 = fmul double %63, %31
%65 = fdiv double %62, %64
%66 = extractelement <2 x double> %46, i64 0
%67 = fadd double %66, %59
%68 = fmul double %67, %65
%69 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %68)
ret double %68
}