#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 f_exp(double, double const, double, double, double, double, double);
void Fq(double q, double *F1, double *F2, double sld_core, double radius_core,
        double sld_solvent, double n_shells, double sld_in[], double sld_out[],
        double thickness[], double A[]) {
  int n = (int)(n_shells + 0.5);
  double r_out = radius_core;
  double f = f_exp(q, r_out, sld_core, 0.0, 0.0, 0.0, 0.0);
  for (int i = 0; i < n; i++) {
    const double r_in = r_out;
    r_out += thickness[i];
    f -= f_exp(q, r_in, sld_in[i], sld_out[i], thickness[i], A[i], 0.0);
    f += f_exp(q, r_out, sld_in[i], sld_out[i], thickness[i], A[i], 1.0);
  }
  f -= f_exp(q, r_out, sld_solvent, 0.0, 0.0, 0.0, 0.0);
  *F1 = 1e-2 * f;
  *F2 = 1e-4 * f * f;
}


x86 assembly (clang, -O0):
<Fq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9,-0x58(%rbp)
movsd  0xeac(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
xorps  %xmm6,%xmm6
movaps %xmm6,%xmm3
movaps %xmm6,%xmm4
movaps %xmm6,%xmm5
call   1030 <f_exp@plt>
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jge    127d <Fq+0x16d>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
mov    -0x40(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x48(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x50(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm4
mov    -0x58(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm5
xorps  %xmm6,%xmm6
call   1030 <f_exp@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
mov    -0x40(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x48(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x50(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm4
mov    -0x58(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm5
movsd  0xdb8(%rip),%xmm6
call   1030 <f_exp@plt>
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1196 <Fq+0x86>
movsd  -0x8(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
xorps  %xmm6,%xmm6
movaps %xmm6,%xmm3
movaps %xmm6,%xmm4
movaps %xmm6,%xmm5
call   1030 <f_exp@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xd5a(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xd3d(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%r12
mov    %r8,%r13
mov    %rcx,%rbx
mov    %rdx,%rbp
movsd  %xmm3,0x20(%rsp)
movapd %xmm2,%xmm7
movapd %xmm1,%xmm2
mov    %rsi,0x30(%rsp)
mov    %rdi,0x28(%rsp)
addsd  0xeb6(%rip),%xmm4
cvttsd2si %xmm4,%r14d
xorps  %xmm3,%xmm3
xorpd  %xmm4,%xmm4
xorps  %xmm5,%xmm5
xorps  %xmm6,%xmm6
movsd  %xmm0,0x10(%rsp)
movsd  %xmm7,0x8(%rsp)
movapd %xmm7,%xmm1
call   1030 <f_exp@plt>
test   %r14d,%r14d
jle    1236 <Fq+0x126>
mov    %r14d,%r14d
xor    %r15d,%r15d
movsd  0x8(%rsp),%xmm7
movapd %xmm7,%xmm1
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  0x0(%r13,%r15,8),%xmm4
addsd  %xmm4,%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x0(%rbp,%r15,8),%xmm2
movsd  (%rbx,%r15,8),%xmm3
movsd  (%r12,%r15,8),%xmm5
xorps  %xmm6,%xmm6
movsd  0x10(%rsp),%xmm0
movapd %xmm7,%xmm1
call   1030 <f_exp@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x0(%rbp,%r15,8),%xmm2
movsd  (%rbx,%r15,8),%xmm3
movsd  0x0(%r13,%r15,8),%xmm4
movsd  (%r12,%r15,8),%xmm5
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0xdfe(%rip),%xmm6
call   1030 <f_exp@plt>
movsd  0x18(%rsp),%xmm1
movapd %xmm0,%xmm2
addsd  0x8(%rsp),%xmm2
add    $0x1,%r15
movapd %xmm1,%xmm7
movapd %xmm2,%xmm0
cmp    %r15,%r14
jne    1190 <Fq+0x80>
jmp    1240 <Fq+0x130>
movapd %xmm0,%xmm2
movsd  0x8(%rsp),%xmm1
movsd  %xmm2,0x8(%rsp)
xorps  %xmm3,%xmm3
xorpd  %xmm4,%xmm4
xorps  %xmm5,%xmm5
xorps  %xmm6,%xmm6
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm2
call   1030 <f_exp@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xd9a(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    0x28(%rsp),%rax
movsd  %xmm0,(%rax)
movsd  0xd8d(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mov    0x30(%rsp),%rax
movsd  %xmm0,(%rax)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Fq(double %0, double* %1, double* %2, double %3, double %4, double %5, double %6, double* %7, double* %8, double* %9, double* %10) {
%12 = alloca double
%13 = alloca double*
%14 = alloca double*
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca i32
%24 = alloca double
%25 = alloca double
%26 = alloca i32
%27 = alloca double
store double %0, double* %12
store double* %1, double** %13
store double* %2, double** %14
store double %3, double* %15
store double %4, double* %16
store double %5, double* %17
store double %6, double* %18
store double* %7, double** %19
store double* %8, double** %20
store double* %9, double** %21
store double* %10, double** %22
%28 = load double, double* %18
%29 = fadd double %28, 5.000000e-01
%30 = fptosi double %29 to i32
store i32 %30, i32* %23
%31 = load double, double* %16
store double %31, double* %24
%32 = load double, double* %12
%33 = load double, double* %24
%34 = load double, double* %15
%35 = call double @f_exp(double %32, double %33, double %34, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
store double %35, double* %25
store i32 0, i32* %26
br label %36
36: ; preds = %99, %11
%37 = load i32, i32* %26
%38 = load i32, i32* %23
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %102
40: ; preds = %36
%41 = load double, double* %24
store double %41, double* %27
%42 = load double*, double** %21
%43 = load i32, i32* %26
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = load double, double* %24
%48 = fadd double %47, %46
store double %48, double* %24
%49 = load double, double* %12
%50 = load double, double* %27
%51 = load double*, double** %19
%52 = load i32, i32* %26
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
%55 = load double, double* %54
%56 = load double*, double** %20
%57 = load i32, i32* %26
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load double*, double** %21
%62 = load i32, i32* %26
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
%65 = load double, double* %64
%66 = load double*, double** %22
%67 = load i32, i32* %26
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
%70 = load double, double* %69
%71 = call double @f_exp(double %49, double %50, double %55, double %60, double %65, double %70, double 0.000000e+00)
%72 = load double, double* %25
%73 = fsub double %72, %71
store double %73, double* %25
%74 = load double, double* %12
%75 = load double, double* %24
%76 = load double*, double** %19
%77 = load i32, i32* %26
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
%80 = load double, double* %79
%81 = load double*, double** %20
%82 = load i32, i32* %26
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %81, i64 %83
%85 = load double, double* %84
%86 = load double*, double** %21
%87 = load i32, i32* %26
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %86, i64 %88
%90 = load double, double* %89
%91 = load double*, double** %22
%92 = load i32, i32* %26
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %91, i64 %93
%95 = load double, double* %94
%96 = call double @f_exp(double %74, double %75, double %80, double %85, double %90, double %95, double 1.000000e+00)
%97 = load double, double* %25
%98 = fadd double %97, %96
store double %98, double* %25
br label %99
99: ; preds = %40
%100 = load i32, i32* %26
%101 = add nsw i32 %100, 1
store i32 %101, i32* %26
br label %36
102: ; preds = %36
%103 = load double, double* %12
%104 = load double, double* %24
%105 = load double, double* %17
%106 = call double @f_exp(double %103, double %104, double %105, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%107 = load double, double* %25
%108 = fsub double %107, %106
store double %108, double* %25
%109 = load double, double* %25
%110 = fmul double 1.000000e-02, %109
%111 = load double*, double** %13
store double %110, double* %111
%112 = load double, double* %25
%113 = fmul double 1.000000e-04, %112
%114 = load double, double* %25
%115 = fmul double %113, %114
%116 = load double*, double** %14
store double %115, double* %116
ret void
}

LLVM IR (-O2):
define void @Fq(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2, double %3, double %4, double %5, double %6, double* nocapture %7, double* nocapture %8, double* nocapture %9, double* nocapture %10) {
%12 = fadd double %6, 5.000000e-01
%13 = fptosi double %12 to i32
%14 = tail call double @f_exp(double %0, double %4, double %3, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%15 = icmp sgt i32 %13, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = zext i32 %13 to i64
br label %26
18: ; preds = %26, %11
%19 = phi double [ %14, %11 ], [ %46, %26 ]
%20 = phi double [ %4, %11 ], [ %32, %26 ]
%21 = tail call double @f_exp(double %0, double %20, double %5, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%22 = fsub double %19, %21
%23 = fmul double %22, 1.000000e-02
store double %23, double* %1
%24 = fmul double %22, 1.000000e-04
%25 = fmul double %22, %24
store double %25, double* %2
ret void
26: ; preds = %16, %26
%27 = phi i64 [ 0, %16 ], [ %47, %26 ]
%28 = phi double [ %4, %16 ], [ %32, %26 ]
%29 = phi double [ %14, %16 ], [ %46, %26 ]
%30 = getelementptr inbounds double, double* %9, i64 %27
%31 = load double, double* %30
%32 = fadd double %28, %31
%33 = getelementptr inbounds double, double* %7, i64 %27
%34 = load double, double* %33
%35 = getelementptr inbounds double, double* %8, i64 %27
%36 = load double, double* %35
%37 = getelementptr inbounds double, double* %10, i64 %27
%38 = load double, double* %37
%39 = tail call double @f_exp(double %0, double %28, double %34, double %36, double %31, double %38, double 0.000000e+00)
%40 = fsub double %29, %39
%41 = load double, double* %33
%42 = load double, double* %35
%43 = load double, double* %30
%44 = load double, double* %37
%45 = tail call double @f_exp(double %0, double %32, double %41, double %42, double %43, double %44, double 1.000000e+00)
%46 = fadd double %40, %45
%47 = add nuw nsw i64 %27, 1
%48 = icmp eq i64 %47, %17
br i1 %48, label %18, label %26
}