#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 scattering_rate(double, double const, double const);
void ca_compute_nbars(int n, double dt, double gamma, const double *s_of_r,
                      const double *delta, double *nbar) {
  int i;
  for (i = 0; i < n; ++i) {
    nbar[i] = dt * scattering_rate(gamma, s_of_r[i], delta[i]);
  }
}


x86 assembly (clang, -O0):
<ca_compute_nbars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1199 <ca_compute_nbars+0x89>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
call   1030 <scattering_rate@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1138 <ca_compute_nbars+0x28>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ca_compute_nbars>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edi,%edi
jle    1183 <ca_compute_nbars+0x73>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
movapd %xmm1,%xmm3
movapd %xmm0,%xmm1
mov    %edi,%r13d
xor    %ebx,%ebx
movsd  %xmm3,0x8(%rsp)
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rbx,8),%xmm1
movsd  (%r15,%rbx,8),%xmm2
movapd %xmm3,%xmm0
call   1030 <scattering_rate@plt>
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm3
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1150 <ca_compute_nbars+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ca_compute_nbars(i32 %0, double %1, double %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
store i32 %0, i32* %7
store double %1, double* %8
store double %2, double* %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
store i32 0, i32* %13
br label %14
14: ; preds = %37, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %40
18: ; preds = %14
%19 = load double, double* %8
%20 = load double, double* %9
%21 = load double*, double** %10
%22 = load i32, i32* %13
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double*, double** %11
%27 = load i32, i32* %13
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = call double @scattering_rate(double %20, double %25, double %30)
%32 = fmul double %19, %31
%33 = load double*, double** %12
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
store double %32, double* %36
br label %37
37: ; preds = %18
%38 = load i32, i32* %13
%39 = add nsw i32 %38, 1
store i32 %39, i32* %13
br label %14
40: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @ca_compute_nbars(i32 %0, double %1, double %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %21
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %19, %10 ]
%12 = getelementptr inbounds double, double* %3, i64 %11
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %4, i64 %11
%15 = load double, double* %14
%16 = tail call double @scattering_rate(double %2, double %13, double %15)
%17 = fmul double %16, %1
%18 = getelementptr inbounds double, double* %5, i64 %11
store double %17, double* %18
%19 = add nuw nsw i64 %11, 1
%20 = icmp eq i64 %19, %9
br i1 %20, label %21, label %10
21: ; preds = %10, %6
ret void
}