#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 */
int fabs(double);
void get_weights_rhop(double *r, double s, int n, double rhoc, double *w) {
  register int i;
  double a;
  for (i = 0; i < n; i++) {
    a = r[i] / s / rhoc;
    if (fabs(a) > 1)
      w[i] = 0;
    else
      w[i] = (1. - a * a) * (1. - a * a);
  };
}


x86 assembly (clang, -O0):
<get_weights_rhop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120a <get_weights_rhop+0xfa>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x10(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
cmp    $0x1,%eax
jle    1184 <get_weights_rhop+0x74>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    11f7 <get_weights_rhop+0xe7>
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe4f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe1e(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11fc <get_weights_rhop+0xec>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1134 <get_weights_rhop+0x24>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_weights_rhop>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
test   %esi,%esi
jle    1190 <get_weights_rhop+0x80>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
jmp    114f <get_weights_rhop+0x3f>
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1190 <get_weights_rhop+0x80>
movsd  (%r15,%rbx,8),%xmm0
divsd  (%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1030 <fabs@plt>
xorpd  %xmm0,%xmm0
cmp    $0x2,%eax
jge    1140 <get_weights_rhop+0x30>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movsd  0xe7a(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
jmp    1140 <get_weights_rhop+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @get_weights_rhop(double* %0, double %1, i32 %2, double %3, double* %4) {
%6 = alloca double*
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
store double* %0, double** %6
store double %1, double* %7
store i32 %2, i32* %8
store double %3, double* %9
store double* %4, double** %10
store i32 0, i32* %11
br label %13
13: ; preds = %50, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %53
17: ; preds = %13
%18 = load double*, double** %6
%19 = load i32, i32* %11
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = load double, double* %7
%24 = fdiv double %22, %23
%25 = load double, double* %9
%26 = fdiv double %24, %25
store double %26, double* %12
%27 = load double, double* %12
%28 = call i32 @fabs(double %27)
%29 = icmp sgt i32 %28, 1
br i1 %29, label %30, label %35
30: ; preds = %17
%31 = load double*, double** %10
%32 = load i32, i32* %11
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
store double 0.000000e+00, double* %34
br label %49
35: ; preds = %17
%36 = load double, double* %12
%37 = load double, double* %12
%38 = fneg double %36
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double 1.000000e+00)
%40 = load double, double* %12
%41 = load double, double* %12
%42 = fneg double %40
%43 = call double @llvm.fmuladd.f64(double %42, double %41, double 1.000000e+00)
%44 = fmul double %39, %43
%45 = load double*, double** %10
%46 = load i32, i32* %11
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
store double %44, double* %48
br label %49
49: ; preds = %35, %30
br label %50
50: ; preds = %49
%51 = load i32, i32* %11
%52 = add nsw i32 %51, 1
store i32 %52, i32* %11
br label %13
53: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @get_weights_rhop(double* nocapture %0, double %1, i32 %2, double %3, double* nocapture writeonly %4) {
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %24
7: ; preds = %5
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %22, %9 ]
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = fdiv double %12, %1
%14 = fdiv double %13, %3
%15 = tail call i32 @fabs(double %14)
%16 = icmp sgt i32 %15, 1
%17 = fneg double %14
%18 = tail call double @llvm.fmuladd.f64(double %17, double %14, double 1.000000e+00)
%19 = fmul double %18, %18
%20 = select i1 %16, double 0.000000e+00, double %19
%21 = getelementptr inbounds double, double* %4, i64 %10
store double %20, double* %21
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, %8
br i1 %23, label %24, label %9
24: ; preds = %9, %5
ret void
}