#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 exp(double const);
double const pow(double const, double const);
void computeTransitions1(const int transitions, const double *weights,
                         const int *lower, const int *upper,
                         const double *energy, const double *elec_a,
                         const double *elec_b, const double Hdens,
                         const double elecDens, const double T, double **DFDX) {
  int i;
  double coeff, Cul, Clu;
  int li, ui;
  double lw, uw;
  for (i = 1; i <= transitions; i++) {
    li = lower[i];
    ui = upper[i];
    lw = weights[li];
    uw = weights[ui];
    coeff = elec_a[i] * pow(T / 1e4, elec_b[i]);
    Cul = elecDens * coeff + Hdens * 1e-12;
    Clu = (uw / lw) * Cul * exp(-energy[i] / T);
    DFDX[li][li] -= Clu;
    DFDX[li][ui] += Cul;
    DFDX[ui][li] += Clu;
    DFDX[ui][ui] -= Cul;
  }
}


x86 assembly (clang, -O0):
<computeTransitions1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
movsd  %xmm2,-0x48(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1307 <computeTransitions1+0x1e7>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  0xe3a(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  0xdf6(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x80(%rbp),%xmm0
divsd  -0x78(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x48(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm1
mov    0x18(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x6c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    0x18(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x70(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x68(%rbp),%xmm0
mov    0x18(%rbp),%rax
movslq -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x6c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm1
mov    0x18(%rbp),%rax
movslq -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1160 <computeTransitions1+0x40>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeTransitions1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x40(%rsp)
movsd  %xmm0,(%rsp)
mov    %r8,0x38(%rsp)
test   %edi,%edi
jle    1287 <computeTransitions1+0x167>
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%rbp
movsd  0x18(%rsp),%xmm0
divsd  0xe9d(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe92(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %edi,%eax
shl    $0x2,%rax
mov    %rax,0x20(%rsp)
xor    %r15d,%r15d
mov    %r9,0x30(%rsp)
xchg   %ax,%ax
movslq 0x4(%rbx,%r15,1),%r13
movslq 0x4(%r14,%r15,1),%r12
movsd  0x0(%rbp,%r12,8),%xmm0
movsd  0x8(%r9,%r15,2),%xmm1
movsd  %xmm1,0x8(%rsp)
mov    0x80(%rsp),%rax
movsd  0x8(%rax,%r15,2),%xmm1
divsd  0x0(%rbp,%r13,8),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0x40(%rsp),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    0x38(%rsp),%rax
movsd  0x8(%rax,%r15,2),%xmm0
xorpd  0xe00(%rip),%xmm0
divsd  0x18(%rsp),%xmm0
call   1030 <exp@plt>
mov    0x30(%rsp),%r9
mulsd  0x10(%rsp),%xmm0
mov    0x88(%rsp),%rdi
mov    (%rdi,%r13,8),%rax
movsd  (%rax,%r13,8),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rax,%r13,8)
movsd  (%rax,%r12,8),%xmm1
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rax,%r12,8)
mov    (%rdi,%r12,8),%rax
addsd  (%rax,%r13,8),%xmm0
movsd  %xmm0,(%rax,%r13,8)
movsd  (%rax,%r12,8),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,(%rax,%r12,8)
add    $0x4,%r15
cmp    %r15,0x20(%rsp)
jne    1190 <computeTransitions1+0x70>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @computeTransitions1(i32 %0, double* %1, i32* %2, i32* %3, double* %4, double* %5, double* %6, double %7, double %8, double %9, double** %10) {
%12 = alloca i32
%13 = alloca double*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double**
%23 = alloca i32
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca i32
%28 = alloca i32
%29 = alloca double
%30 = alloca double
store i32 %0, i32* %12
store double* %1, double** %13
store i32* %2, i32** %14
store i32* %3, i32** %15
store double* %4, double** %16
store double* %5, double** %17
store double* %6, double** %18
store double %7, double* %19
store double %8, double* %20
store double %9, double* %21
store double** %10, double*** %22
store i32 1, i32* %23
br label %31
31: ; preds = %134, %11
%32 = load i32, i32* %23
%33 = load i32, i32* %12
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %137
35: ; preds = %31
%36 = load i32*, i32** %14
%37 = load i32, i32* %23
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
%40 = load i32, i32* %39
store i32 %40, i32* %27
%41 = load i32*, i32** %15
%42 = load i32, i32* %23
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
store i32 %45, i32* %28
%46 = load double*, double** %13
%47 = load i32, i32* %27
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
%50 = load double, double* %49
store double %50, double* %29
%51 = load double*, double** %13
%52 = load i32, i32* %28
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
%55 = load double, double* %54
store double %55, double* %30
%56 = load double*, double** %17
%57 = load i32, i32* %23
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load double, double* %21
%62 = fdiv double %61, 1.000000e+04
%63 = load double*, double** %18
%64 = load i32, i32* %23
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
%68 = call double @pow(double %62, double %67)
%69 = fmul double %60, %68
store double %69, double* %24
%70 = load double, double* %20
%71 = load double, double* %24
%72 = load double, double* %19
%73 = fmul double %72, 0x3D719799812DEA11
%74 = call double @llvm.fmuladd.f64(double %70, double %71, double %73)
store double %74, double* %25
%75 = load double, double* %30
%76 = load double, double* %29
%77 = fdiv double %75, %76
%78 = load double, double* %25
%79 = fmul double %77, %78
%80 = load double*, double** %16
%81 = load i32, i32* %23
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %80, i64 %82
%84 = load double, double* %83
%85 = fneg double %84
%86 = load double, double* %21
%87 = fdiv double %85, %86
%88 = call double @exp(double %87)
%89 = fmul double %79, %88
store double %89, double* %26
%90 = load double, double* %26
%91 = load double**, double*** %22
%92 = load i32, i32* %27
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double*, double** %91, i64 %93
%95 = load double*, double** %94
%96 = load i32, i32* %27
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
%99 = load double, double* %98
%100 = fsub double %99, %90
store double %100, double* %98
%101 = load double, double* %25
%102 = load double**, double*** %22
%103 = load i32, i32* %27
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double*, double** %102, i64 %104
%106 = load double*, double** %105
%107 = load i32, i32* %28
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = fadd double %110, %101
store double %111, double* %109
%112 = load double, double* %26
%113 = load double**, double*** %22
%114 = load i32, i32* %28
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double*, double** %113, i64 %115
%117 = load double*, double** %116
%118 = load i32, i32* %27
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %117, i64 %119
%121 = load double, double* %120
%122 = fadd double %121, %112
store double %122, double* %120
%123 = load double, double* %25
%124 = load double**, double*** %22
%125 = load i32, i32* %28
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double*, double** %124, i64 %126
%128 = load double*, double** %127
%129 = load i32, i32* %28
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %128, i64 %130
%132 = load double, double* %131
%133 = fsub double %132, %123
store double %133, double* %131
br label %134
134: ; preds = %35
%135 = load i32, i32* %23
%136 = add nsw i32 %135, 1
store i32 %136, i32* %23
br label %31
137: ; preds = %31
ret void
}

LLVM IR (-O2):
define void @computeTransitions1(i32 %0, double* nocapture %1, i32* nocapture %2, i32* nocapture %3, double* nocapture %4, double* nocapture %5, double* nocapture %6, double %7, double %8, double %9, double** nocapture %10) {
%12 = icmp slt i32 %0, 1
br i1 %12, label %63, label %13
13: ; preds = %11
%14 = fdiv double %9, 1.000000e+04
%15 = fmul double %7, 0x3D719799812DEA11
%16 = add nuw i32 %0, 1
%17 = zext i32 %16 to i64
br label %18
18: ; preds = %13, %18
%19 = phi i64 [ 1, %13 ], [ %61, %18 ]
%20 = getelementptr inbounds i32, i32* %2, i64 %19
%21 = load i32, i32* %20
%22 = getelementptr inbounds i32, i32* %3, i64 %19
%23 = load i32, i32* %22
%24 = sext i32 %21 to i64
%25 = getelementptr inbounds double, double* %1, i64 %24
%26 = load double, double* %25
%27 = sext i32 %23 to i64
%28 = getelementptr inbounds double, double* %1, i64 %27
%29 = load double, double* %28
%30 = getelementptr inbounds double, double* %5, i64 %19
%31 = load double, double* %30
%32 = getelementptr inbounds double, double* %6, i64 %19
%33 = load double, double* %32
%34 = tail call double @pow(double %14, double %33)
%35 = fmul double %31, %34
%36 = tail call double @llvm.fmuladd.f64(double %8, double %35, double %15)
%37 = fdiv double %29, %26
%38 = fmul double %37, %36
%39 = getelementptr inbounds double, double* %4, i64 %19
%40 = load double, double* %39
%41 = fneg double %40
%42 = fdiv double %41, %9
%43 = tail call double @exp(double %42)
%44 = fmul double %43, %38
%45 = getelementptr inbounds double*, double** %10, i64 %24
%46 = load double*, double** %45
%47 = getelementptr inbounds double, double* %46, i64 %24
%48 = load double, double* %47
%49 = fsub double %48, %44
store double %49, double* %47
%50 = getelementptr inbounds double, double* %46, i64 %27
%51 = load double, double* %50
%52 = fadd double %36, %51
store double %52, double* %50
%53 = getelementptr inbounds double*, double** %10, i64 %27
%54 = load double*, double** %53
%55 = getelementptr inbounds double, double* %54, i64 %24
%56 = load double, double* %55
%57 = fadd double %44, %56
store double %57, double* %55
%58 = getelementptr inbounds double, double* %54, i64 %27
%59 = load double, double* %58
%60 = fsub double %59, %36
store double %60, double* %58
%61 = add nuw nsw i64 %19, 1
%62 = icmp eq i64 %61, %17
br i1 %62, label %63, label %18
63: ; preds = %18, %11
ret void
}