#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 expm1(double);
double square(double);
double star_polymer_kernel(double q, double radius2, double arms) {
  double u_2 = radius2 * q * q;
  double v = u_2 * arms / (3.0 * arms - 2.0);
  double term1 = v + expm1(-v);
  double term2 = ((arms - 1.0) / 2.0) * square(expm1(-v));
  return (2.0 * (term1 + term2)) / (arms * v * v);
}


x86 assembly (clang, -O0):
<star_polymer_kernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xeae(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xeaa(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <expm1@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe30(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <expm1@plt>
call   1030 <square@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm1
addsd  -0x38(%rbp),%xmm1
movsd  0xdde(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<star_polymer_kernel>:
sub    $0x48,%rsp
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xec6(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xec2(%rip),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd 0xec4(%rip),%xmm0
xorpd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
call   1040 <expm1@plt>
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xe91(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  0xe8b(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0x30(%rsp),%xmm0
call   1040 <expm1@plt>
call   1030 <square@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
movapd 0x20(%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @star_polymer_kernel(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 double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%11 = load double, double* %5
%12 = load double, double* %4
%13 = fmul double %11, %12
%14 = load double, double* %4
%15 = fmul double %13, %14
store double %15, double* %7
%16 = load double, double* %7
%17 = load double, double* %6
%18 = fmul double %16, %17
%19 = load double, double* %6
%20 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %19, double -2.000000e+00)
%21 = fdiv double %18, %20
store double %21, double* %8
%22 = load double, double* %8
%23 = load double, double* %8
%24 = fneg double %23
%25 = call double @expm1(double %24)
%26 = fadd double %22, %25
store double %26, double* %9
%27 = load double, double* %6
%28 = fsub double %27, 1.000000e+00
%29 = fdiv double %28, 2.000000e+00
%30 = load double, double* %8
%31 = fneg double %30
%32 = call double @expm1(double %31)
%33 = call double @square(double %32)
%34 = fmul double %29, %33
store double %34, double* %10
%35 = load double, double* %9
%36 = load double, double* %10
%37 = fadd double %35, %36
%38 = fmul double 2.000000e+00, %37
%39 = load double, double* %6
%40 = load double, double* %8
%41 = fmul double %39, %40
%42 = load double, double* %8
%43 = fmul double %41, %42
%44 = fdiv double %38, %43
ret double %44
}

LLVM IR (-O2):
define double @star_polymer_kernel(double %0, double %1, double %2) {
%4 = fmul double %0, %1
%5 = fmul double %4, %0
%6 = fmul double %5, %2
%7 = tail call double @llvm.fmuladd.f64(double %2, double 3.000000e+00, double -2.000000e+00)
%8 = fdiv double %6, %7
%9 = fneg double %8
%10 = tail call double @expm1(double %9)
%11 = fadd double %8, %10
%12 = fadd double %2, -1.000000e+00
%13 = fmul double %12, 5.000000e-01
%14 = tail call double @expm1(double %9)
%15 = tail call double @square(double %14)
%16 = fmul double %13, %15
%17 = fadd double %11, %16
%18 = fmul double %17, 2.000000e+00
%19 = fmul double %8, %2
%20 = fmul double %8, %19
%21 = fdiv double %18, %20
ret double %21
}