#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 const expm1(double const);
double sas_3j1x_x(double);
double sas_sinx_x(double);
double square(double const);
double micelle_spherical_kernel(double q, double ndensity, double v_core,
                                double v_corona, double solvent_sld,
                                double core_sld, double corona_sld,
                                double radius_core, double rg,
                                double d_penetration, double n_aggreg) {
  const double rho_solv = solvent_sld;
  const double rho_core = core_sld;
  const double rho_corona = corona_sld;
  const double beta_core = v_core * (rho_core - rho_solv);
  const double beta_corona = v_corona * (rho_corona - rho_solv);
  const double bes_core = sas_3j1x_x(q * radius_core);
  const double term1 = square(n_aggreg * beta_core * bes_core);
  const double qrg2 = square(q * rg);
  const double debye_chain =
      (qrg2 == 0.0) ? 1.0 : 2.0 * (expm1(-qrg2) + qrg2) / (qrg2 * qrg2);
  const double term2 = n_aggreg * beta_corona * beta_corona * debye_chain;
  const double chain_ampl = (qrg2 == 0.0) ? 1.0 : -expm1(-qrg2) / qrg2;
  const double bes_corona = sas_sinx_x(q * (radius_core + d_penetration * rg));
  const double term3 = 2.0 * n_aggreg * n_aggreg * beta_core * beta_corona *
                       bes_core * chain_ampl * bes_corona;
  const double term4 = n_aggreg * (n_aggreg - 1.0) *
                       square(beta_corona * chain_ampl * bes_corona);
  double i_micelle = term1 + term2 + term3 + term4;
  i_micelle *= 1.0e-13;
  i_micelle *= ndensity;
  return (i_micelle);
}


x86 assembly (clang, -O0):
<micelle_spherical_kernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
subsd  -0x48(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x48(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1050 <sas_3j1x_x@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  0x20(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
call   1030 <square@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  0x10(%rbp),%xmm0
call   1030 <square@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1241 <micelle_spherical_kernel+0x101>
jp     1241 <micelle_spherical_kernel+0x101>
movsd  0xdd4(%rip),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
jmp    128c <micelle_spherical_kernel+0x14c>
movsd  -0x80(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <expm1@plt>
movaps %xmm0,%xmm1
addsd  -0x80(%rbp),%xmm1
movsd  0xd8e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x80(%rbp),%xmm1
mulsd  -0x80(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0x20(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12e8 <micelle_spherical_kernel+0x1a8>
jp     12e8 <micelle_spherical_kernel+0x1a8>
movsd  0xd2d(%rip),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
jmp    132d <micelle_spherical_kernel+0x1ed>
movsd  -0x80(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <expm1@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  0x18(%rbp),%xmm1
movsd  0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1060 <sas_sinx_x@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xc8e(%rip),%xmm0
mulsd  0x20(%rbp),%xmm0
mulsd  0x20(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
mulsd  -0x98(%rbp),%xmm0
ff
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0x20(%rbp),%xmm0
movsd  0x20(%rbp),%xmm1
movsd  0xc53(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
mulsd  -0x98(%rbp),%xmm0
ff
mulsd  -0xa0(%rbp),%xmm0
ff
call   1030 <square@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
addsd  -0xa8(%rbp),%xmm0
ff
addsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xbed(%rip),%xmm0
mulsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
mulsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<micelle_spherical_kernel>:
sub    $0x98,%rsp
movsd  %xmm1,0x38(%rsp)
movsd  %xmm0,(%rsp)
subsd  %xmm4,%xmm5
mulsd  %xmm2,%xmm5
movapd %xmm5,0x20(%rsp)
subsd  %xmm4,%xmm6
mulsd  %xmm3,%xmm6
movapd %xmm6,0x80(%rsp)
movsd  %xmm7,0x8(%rsp)
mulsd  %xmm7,%xmm0
call   1050 <sas_3j1x_x@plt>
movapd 0x20(%rsp),%xmm1
movsd  0xb0(%rsp),%xmm2
mulsd  %xmm2,%xmm1
movapd %xmm0,0x70(%rsp)
mulsd  %xmm1,%xmm0
call   1030 <square@plt>
movsd  %xmm0,0x30(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xa0(%rsp),%xmm0
call   1030 <square@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    11db <micelle_spherical_kernel+0x9b>
jp     11db <micelle_spherical_kernel+0x9b>
movapd 0xe2d(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
jmp    1249 <micelle_spherical_kernel+0x109>
movapd %xmm1,%xmm0
xorpd  0xe29(%rip),%xmm0
movapd %xmm0,0x60(%rsp)
movapd %xmm1,0x40(%rsp)
call   1040 <expm1@plt>
movapd 0x40(%rsp),%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
movapd %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm1
movapd %xmm1,0x50(%rsp)
movapd 0x60(%rsp),%xmm0
call   1040 <expm1@plt>
xorpd  0xde7(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0x50(%rsp),%xmm0
unpcklpd 0x40(%rsp),%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0xa8(%rsp),%xmm0
mulsd  0xa0(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  (%rsp),%xmm0
call   1060 <sas_sinx_x@plt>
movapd %xmm0,%xmm5
movsd  %xmm0,(%rsp)
movsd  0xb0(%rsp),%xmm3
movapd %xmm3,%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm0
movapd 0x20(%rsp),%xmm4
mulsd  %xmm0,%xmm4
movapd 0x80(%rsp),%xmm2
movapd %xmm2,%xmm0
unpcklpd %xmm2,%xmm0
movapd %xmm3,%xmm1
unpcklpd %xmm4,%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm2,%xmm4
unpcklpd 0x70(%rsp),%xmm4
mulpd  %xmm1,%xmm4
movapd 0x10(%rsp),%xmm0
mulpd  %xmm0,%xmm4
movapd %xmm4,0x20(%rsp)
movsd  0xd4a(%rip),%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm3,%xmm1
movsd  %xmm1,0x8(%rsp)
unpckhpd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm5,%xmm0
call   1030 <square@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
addsd  %xmm2,%xmm1
unpckhpd %xmm2,%xmm2
mulsd  (%rsp),%xmm2
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
mulsd  0xd04(%rip),%xmm0
mulsd  0x38(%rsp),%xmm0
add    $0x98,%rsp
ret

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

LLVM IR (-O2):
define double @micelle_spherical_kernel(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10) {
%12 = fsub double %5, %4
%13 = fmul double %12, %2
%14 = fsub double %6, %4
%15 = fmul double %14, %3
%16 = fmul double %0, %7
%17 = tail call double @sas_3j1x_x(double %16)
%18 = fmul double %13, %10
%19 = fmul double %18, %17
%20 = tail call double @square(double %19)
%21 = fmul double %0, %8
%22 = tail call double @square(double %21)
%23 = fcmp oeq double %22, 0.000000e+00
br i1 %23, label %37, label %24
24: ; preds = %11
%25 = fneg double %22
%26 = tail call double @expm1(double %25)
%27 = fadd double %22, %26
%28 = fmul double %27, 2.000000e+00
%29 = fmul double %22, %22
%30 = tail call double @expm1(double %25)
%31 = fneg double %30
%32 = insertelement <2 x double> poison, double %28, i64 0
%33 = insertelement <2 x double> %32, double %31, i64 1
%34 = insertelement <2 x double> poison, double %29, i64 0
%35 = insertelement <2 x double> %34, double %22, i64 1
%36 = fdiv <2 x double> %33, %35
br label %37
37: ; preds = %11, %24
%38 = phi <2 x double> [ %36, %24 ], [ <double 1.000000e+00, double 1.000000e+00>, %11 ]
%39 = tail call double @llvm.fmuladd.f64(double %9, double %8, double %7)
%40 = fmul double %39, %0
%41 = tail call double @sas_sinx_x(double %40)
%42 = fmul double %10, 2.000000e+00
%43 = fmul double %42, %10
%44 = fmul double %13, %43
%45 = insertelement <2 x double> poison, double %15, i64 0
%46 = shufflevector <2 x double> %45, <2 x double> poison, <2 x i32> zeroinitializer
%47 = insertelement <2 x double> poison, double %10, i64 0
%48 = insertelement <2 x double> %47, double %44, i64 1
%49 = fmul <2 x double> %46, %48
%50 = insertelement <2 x double> %45, double %17, i64 1
%51 = fmul <2 x double> %50, %49
%52 = fmul <2 x double> %51, %38
%53 = fadd double %10, -1.000000e+00
%54 = fmul double %53, %10
%55 = extractelement <2 x double> %38, i64 1
%56 = fmul double %15, %55
%57 = fmul double %56, %41
%58 = tail call double @square(double %57)
%59 = fmul double %54, %58
%60 = extractelement <2 x double> %52, i64 0
%61 = fadd double %20, %60
%62 = extractelement <2 x double> %52, i64 1
%63 = fmul double %41, %62
%64 = fadd double %61, %63
%65 = fadd double %64, %59
%66 = fmul double %65, 1.000000e-13
%67 = fmul double %66, %1
ret double %67
}