#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 */
double log(double);
double intra_entropy(double(*boltz_ptr), double(*boltzener_ptr),
                     double logatt) {
  double DS;
  double sum_boltz = 0.0;
  double sum_enerboltz = 0.0;
  for (int dim1 = 0; dim1 < 10; ++dim1) {
    sum_boltz += boltz_ptr[dim1];
    sum_enerboltz += boltzener_ptr[dim1];
  }
  DS = log(sum_boltz) - logatt + sum_enerboltz / sum_boltz;
  return DS;
}


x86 assembly (clang, -O0):
<intra_entropy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1182 <intra_entropy+0x72>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    113c <intra_entropy+0x2c>
movsd  -0x28(%rbp),%xmm0
call   1030 <log@plt>
subsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intra_entropy>:
sub    $0x38,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
movsd  0x10(%rsi),%xmm2
movsd  0x18(%rsi),%xmm3
movhpd (%rdi),%xmm0
xorpd  %xmm4,%xmm4
addpd  %xmm0,%xmm4
movhpd 0x8(%rdi),%xmm1
addpd  %xmm4,%xmm1
movhpd 0x10(%rdi),%xmm2
addpd  %xmm1,%xmm2
movhpd 0x18(%rdi),%xmm3
addpd  %xmm2,%xmm3
movsd  0x20(%rsi),%xmm0
movhpd 0x20(%rdi),%xmm0
addpd  %xmm3,%xmm0
movsd  0x28(%rsi),%xmm1
movhpd 0x28(%rdi),%xmm1
addpd  %xmm0,%xmm1
movsd  0x30(%rsi),%xmm0
movhpd 0x30(%rdi),%xmm0
addpd  %xmm1,%xmm0
movsd  0x38(%rsi),%xmm1
movhpd 0x38(%rdi),%xmm1
addpd  %xmm0,%xmm1
movsd  0x40(%rsi),%xmm0
movhpd 0x40(%rdi),%xmm0
addpd  %xmm1,%xmm0
movsd  0x48(%rsi),%xmm1
movhpd 0x48(%rdi),%xmm1
addpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
call   1030 <log@plt>
subsd  0x8(%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
divsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @intra_entropy(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
store i32 0, i32* %10
br label %11
11: ; preds = %29, %3
%12 = load i32, i32* %10
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = load double*, double** %4
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = load double, double* %18
%20 = load double, double* %8
%21 = fadd double %20, %19
store double %21, double* %8
%22 = load double*, double** %5
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = load double, double* %9
%28 = fadd double %27, %26
store double %28, double* %9
br label %29
29: ; preds = %14
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
br label %11
32: ; preds = %11
%33 = load double, double* %8
%34 = call double @log(double %33)
%35 = load double, double* %6
%36 = fsub double %34, %35
%37 = load double, double* %9
%38 = load double, double* %8
%39 = fdiv double %37, %38
%40 = fadd double %36, %39
store double %40, double* %7
%41 = load double, double* %7
ret double %41
}

LLVM IR (-O2):
define double @intra_entropy(double* nocapture %0, double* nocapture %1, double %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = insertelement <2 x double> poison, double %5, i64 0
%7 = insertelement <2 x double> %6, double %4, i64 1
%8 = fadd <2 x double> %7, zeroinitializer
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 1
%12 = load double, double* %11
%13 = insertelement <2 x double> poison, double %12, i64 0
%14 = insertelement <2 x double> %13, double %10, i64 1
%15 = fadd <2 x double> %8, %14
%16 = getelementptr inbounds double, double* %0, i64 2
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %1, i64 2
%19 = load double, double* %18
%20 = insertelement <2 x double> poison, double %19, i64 0
%21 = insertelement <2 x double> %20, double %17, i64 1
%22 = fadd <2 x double> %15, %21
%23 = getelementptr inbounds double, double* %0, i64 3
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %1, i64 3
%26 = load double, double* %25
%27 = insertelement <2 x double> poison, double %26, i64 0
%28 = insertelement <2 x double> %27, double %24, i64 1
%29 = fadd <2 x double> %22, %28
%30 = getelementptr inbounds double, double* %0, i64 4
%31 = load double, double* %30
%32 = getelementptr inbounds double, double* %1, i64 4
%33 = load double, double* %32
%34 = insertelement <2 x double> poison, double %33, i64 0
%35 = insertelement <2 x double> %34, double %31, i64 1
%36 = fadd <2 x double> %29, %35
%37 = getelementptr inbounds double, double* %0, i64 5
%38 = load double, double* %37
%39 = getelementptr inbounds double, double* %1, i64 5
%40 = load double, double* %39
%41 = insertelement <2 x double> poison, double %40, i64 0
%42 = insertelement <2 x double> %41, double %38, i64 1
%43 = fadd <2 x double> %36, %42
%44 = getelementptr inbounds double, double* %0, i64 6
%45 = load double, double* %44
%46 = getelementptr inbounds double, double* %1, i64 6
%47 = load double, double* %46
%48 = insertelement <2 x double> poison, double %47, i64 0
%49 = insertelement <2 x double> %48, double %45, i64 1
%50 = fadd <2 x double> %43, %49
%51 = getelementptr inbounds double, double* %0, i64 7
%52 = load double, double* %51
%53 = getelementptr inbounds double, double* %1, i64 7
%54 = load double, double* %53
%55 = insertelement <2 x double> poison, double %54, i64 0
%56 = insertelement <2 x double> %55, double %52, i64 1
%57 = fadd <2 x double> %50, %56
%58 = getelementptr inbounds double, double* %0, i64 8
%59 = load double, double* %58
%60 = getelementptr inbounds double, double* %1, i64 8
%61 = load double, double* %60
%62 = insertelement <2 x double> poison, double %61, i64 0
%63 = insertelement <2 x double> %62, double %59, i64 1
%64 = fadd <2 x double> %57, %63
%65 = getelementptr inbounds double, double* %0, i64 9
%66 = load double, double* %65
%67 = getelementptr inbounds double, double* %1, i64 9
%68 = load double, double* %67
%69 = insertelement <2 x double> poison, double %68, i64 0
%70 = insertelement <2 x double> %69, double %66, i64 1
%71 = fadd <2 x double> %64, %70
%72 = extractelement <2 x double> %71, i64 1
%73 = tail call double @log(double %72)
%74 = fsub double %73, %2
%75 = extractelement <2 x double> %71, i64 0
%76 = fdiv double %75, %72
%77 = fadd double %76, %74
ret double %77
}