#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 cos(double);
double square(double);
double paraCryst_sn(double ww, double qval, double davg, int Nlayers,
                    double an) {
  double Snq;
  Snq = an /
        ((double)Nlayers * square(1.0 + ww * ww - 2.0 * ww * cos(qval * davg)));
  return Snq;
}


x86 assembly (clang, -O0):
<paraCryst_sn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe86(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <square@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paraCryst_sn>:
sub    $0x28,%rsp
movsd  %xmm3,0x20(%rsp)
movapd %xmm0,%xmm3
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm3,%xmm3
addsd  0xeb3(%rip),%xmm3
movsd  %xmm3,0x10(%rsp)
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xe9a(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
call   1030 <square@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @paraCryst_sn(double %0, double %1, double %2, i32 %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store i32 %3, i32* %9
store double %4, double* %10
%12 = load double, double* %10
%13 = load i32, i32* %9
%14 = sitofp i32 %13 to double
%15 = load double, double* %6
%16 = load double, double* %6
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double 1.000000e+00)
%18 = load double, double* %6
%19 = fmul double 2.000000e+00, %18
%20 = load double, double* %7
%21 = load double, double* %8
%22 = fmul double %20, %21
%23 = call double @cos(double %22)
%24 = fneg double %19
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double %17)
%26 = call double @square(double %25)
%27 = fmul double %14, %26
%28 = fdiv double %12, %27
store double %28, double* %11
%29 = load double, double* %11
ret double %29
}

LLVM IR (-O2):
define double @paraCryst_sn(double %0, double %1, double %2, i32 %3, double %4) {
%6 = sitofp i32 %3 to double
%7 = tail call double @llvm.fmuladd.f64(double %0, double %0, double 1.000000e+00)
%8 = fmul double %1, %2
%9 = tail call double @cos(double %8)
%10 = fmul double %0, -2.000000e+00
%11 = tail call double @llvm.fmuladd.f64(double %10, double %9, double %7)
%12 = tail call double @square(double %11)
%13 = fmul double %12, %6
%14 = fdiv double %4, %13
ret double %14
}