#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 atan(double);
double pow(double, double const);
double sas_3j1x_x(double);
double sas_gamma(double const);
double sin(double const);
double square(double);
double _surface_fractal_kernel(double q, double radius, double fractal_dim_surf,
                               double cutoff_length) {
  const double pq = square(sas_3j1x_x(q * radius));
  const double mmo = 5.0 - fractal_dim_surf;
  const double sq = sas_gamma(mmo) * pow(cutoff_length, mmo) *
                    pow(1.0 + square(q * cutoff_length), -0.5 * mmo) *
                    sin(-mmo * atan(q * cutoff_length)) / q;
  double result = pq * sq;
  return result > 0. ? result : 0.;
}


x86 assembly (clang, -O0):
<_surface_fractal_kernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1080 <sas_3j1x_x@plt>
call   1030 <square@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xe73(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1060 <sas_gamma@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1070 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <square@plt>
movaps %xmm0,%xmm1
movsd  0xe18(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe04(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
call   1070 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    129e <_surface_fractal_kernel+0x13e>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    12ab <_surface_fractal_kernel+0x14b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    12ab <_surface_fractal_kernel+0x14b>
movsd  -0x68(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_surface_fractal_kernel>:
sub    $0x38,%rsp
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm0,0x28(%rsp)
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1080 <sas_3j1x_x@plt>
call   1030 <square@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0xe6a(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
call   1060 <sas_gamma@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
call   1070 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <square@plt>
addsd  0xe23(%rip),%xmm0
movsd  0xe23(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
call   1070 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
xorps  0xe12(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <atan@plt>
mulsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
divsd  0x28(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
xorpd  %xmm1,%xmm1
maxsd  %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @_surface_fractal_kernel(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%13 = load double, double* %5
%14 = load double, double* %6
%15 = fmul double %13, %14
%16 = call double @sas_3j1x_x(double %15)
%17 = call double @square(double %16)
store double %17, double* %9
%18 = load double, double* %7
%19 = fsub double 5.000000e+00, %18
store double %19, double* %10
%20 = load double, double* %10
%21 = call double @sas_gamma(double %20)
%22 = load double, double* %8
%23 = load double, double* %10
%24 = call double @pow(double %22, double %23)
%25 = fmul double %21, %24
%26 = load double, double* %5
%27 = load double, double* %8
%28 = fmul double %26, %27
%29 = call double @square(double %28)
%30 = fadd double 1.000000e+00, %29
%31 = load double, double* %10
%32 = fmul double -5.000000e-01, %31
%33 = call double @pow(double %30, double %32)
%34 = fmul double %25, %33
%35 = load double, double* %10
%36 = fneg double %35
%37 = load double, double* %5
%38 = load double, double* %8
%39 = fmul double %37, %38
%40 = call double @atan(double %39)
%41 = fmul double %36, %40
%42 = call double @sin(double %41)
%43 = fmul double %34, %42
%44 = load double, double* %5
%45 = fdiv double %43, %44
store double %45, double* %11
%46 = load double, double* %9
%47 = load double, double* %11
%48 = fmul double %46, %47
store double %48, double* %12
%49 = load double, double* %12
%50 = fcmp ogt double %49, 0.000000e+00
br i1 %50, label %51, label %53
51: ; preds = %4
%52 = load double, double* %12
br label %54
53: ; preds = %4
br label %54
54: ; preds = %53, %51
%55 = phi double [ %52, %51 ], [ 0.000000e+00, %53 ]
ret double %55
}

LLVM IR (-O2):
define double @_surface_fractal_kernel(double %0, double %1, double %2, double %3) {
%5 = fmul double %0, %1
%6 = tail call double @sas_3j1x_x(double %5)
%7 = tail call double @square(double %6)
%8 = fsub double 5.000000e+00, %2
%9 = tail call double @sas_gamma(double %8)
%10 = tail call double @pow(double %3, double %8)
%11 = fmul double %9, %10
%12 = fmul double %0, %3
%13 = tail call double @square(double %12)
%14 = fadd double %13, 1.000000e+00
%15 = fmul double %8, -5.000000e-01
%16 = tail call double @pow(double %14, double %15)
%17 = fmul double %11, %16
%18 = fneg double %8
%19 = tail call double @atan(double %12)
%20 = fmul double %19, %18
%21 = tail call double @sin(double %20)
%22 = fmul double %17, %21
%23 = fdiv double %22, %0
%24 = fmul double %7, %23
%25 = fcmp ogt double %24, 0.000000e+00
%26 = select i1 %25, double %24, double 0.000000e+00
ret double %26
}