#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 approxU(double, double, int, double, double *, double *, double *);
double cos(double);
double sin(double);
double sqrt(double);
void accu_approxU(int NRS, double Rmax, double x1, double y1, double *U0,
                  double *U6, double *U12, double *UU00, double *UU0,
                  double *UU6, double *UU12) {
  double dr2 = Rmax * Rmax / ((double)NRS);
  int NTH = 24;
  double dt = 6.2831853071796f / ((double)NTH);
  for (int j = 0; j < NRS; ++j) {
    double r2 = dr2 * ((double)(j + 1));
    double r = sqrt(r2);
    double u0 = 0.0;
    double u6 = 0.0;
    double u12 = 0.0;
    for (int i = 0; i < NTH; ++i) {
      double t = dt * ((double)i);
      double x = r * cos(t);
      double y = r * sin(t);
      double u;
      u = approxU(x + x1, y + y1, NRS, Rmax, U0, U6, U12);
      u0 += u;
      u6 += u * cos(6.0 * t);
      u12 += u * cos(12.0 * t);
    }
    *UU00 += approxU(x1, y1, NRS, Rmax, U0, U6, U12);
    UU0[j] += u0 / ((double)NTH);
    UU6[j] += u6 / ((double)NTH) * 2.0;
    UU12[j] += u12 / ((double)NTH) * 2.0;
  }
}


x86 assembly (clang, -O0):
<accu_approxU>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x18,-0x54(%rbp)
cvtsi2sdl -0x54(%rbp),%xmm1
movsd  0xe5b(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    143e <accu_approxU+0x2fe>
movsd  -0x50(%rbp),%xmm0
mov    -0x64(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    138b <accu_approxU+0x24b>
movsd  -0x60(%rbp),%xmm0
cvtsi2sdl -0x94(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
addsd  -0x18(%rbp),%xmm0
movsd  -0xb0(%rbp),%xmm1
ff
addsd  -0x20(%rbp),%xmm1
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm2
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
call   1040 <approxU@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  0xd11(%rip),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
call   1050 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0xc8(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xcc1(%rip),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
call   1050 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1210 <accu_approxU+0xd0>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm2
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
call   1040 <approxU@plt>
mov    -0x40(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
cvtsi2sdl -0x54(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x88(%rbp),%xmm0
ff
cvtsi2sdl -0x54(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x90(%rbp),%xmm0
ff
cvtsi2sdl -0x54(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11b5 <accu_approxU+0x75>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<accu_approxU>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r9,0x68(%rsp)
mov    %r8,0x60(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,(%rsp)
test   %edi,%edi
jle    13ab <accu_approxU+0x26b>
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %edi,%ebp
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x58(%rsp)
mov    %edi,%eax
mov    %rax,0x50(%rsp)
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r14),%rax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x58(%rsp),%xmm0
ucomisd 0xe5f(%rip),%xmm0
mov    %rax,0x70(%rsp)
jb     11e0 <accu_approxU+0xa0>
sqrtsd %xmm0,%xmm0
jmp    11e5 <accu_approxU+0xa5>
cs nopw 0x0(%rax,%rax,1)
call   1060 <sqrt@plt>
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm0,%xmm0
movapd %xmm0,0x40(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x18,%r15d
xorpd  %xmm2,%xmm2
nopl   0x0(%rax)
movsd  %xmm2,0x78(%rsp)
movapd %xmm2,%xmm0
mulsd  0xdde(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <cos@plt>
mulsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
addsd  0x20(%rsp),%xmm1
mov    %ebp,%edi
movsd  (%rsp),%xmm2
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
call   1040 <approxU@plt>
movapd %xmm0,%xmm1
movapd %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xd6b(%rip),%xmm0
call   1050 <cos@plt>
movapd %xmm0,0x80(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xd57(%rip),%xmm0
call   1050 <cos@plt>
movsd  0x78(%rsp),%xmm2
movapd 0x30(%rsp),%xmm1
unpcklpd %xmm1,%xmm1
movapd 0x80(%rsp),%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
movapd 0x40(%rsp),%xmm0
addpd  %xmm3,%xmm0
movapd %xmm0,0x40(%rsp)
addsd  0xd21(%rip),%xmm2
add    $0xffffffff,%r15d
jne    1210 <accu_approxU+0xd0>
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mov    %ebp,%edi
movsd  (%rsp),%xmm2
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
call   1040 <approxU@plt>
mov    0x60(%rsp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  0xce9(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    0x68(%rsp),%rax
addsd  (%rax,%r14,8),%xmm0
movsd  %xmm0,(%rax,%r14,8)
movapd 0x40(%rsp),%xmm2
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
mov    0xd0(%rsp),%rax
addsd  (%rax,%r14,8),%xmm0
movsd  %xmm0,(%rax,%r14,8)
unpckhpd %xmm2,%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm2,%xmm2
mov    0xd8(%rsp),%rax
addsd  (%rax,%r14,8),%xmm2
movsd  %xmm2,(%rax,%r14,8)
mov    0x70(%rsp),%rax
mov    %rax,%r14
cmp    0x50(%rsp),%rax
jne    11b0 <accu_approxU+0x70>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @accu_approxU(i32 %0, double %1, double %2, double %3, double* %4, double* %5, double* %6, double* %7, double* %8, double* %9, double* %10) {
%12 = alloca i32
%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 double
%24 = alloca i32
%25 = alloca double
%26 = alloca i32
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca i32
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
store i32 %0, i32* %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
%37 = load double, double* %13
%38 = load double, double* %13
%39 = fmul double %37, %38
%40 = load i32, i32* %12
%41 = sitofp i32 %40 to double
%42 = fdiv double %39, %41
store double %42, double* %23
store i32 24, i32* %24
%43 = load i32, i32* %24
%44 = sitofp i32 %43 to double
%45 = fdiv double 0x401921FB60000000, %44
store double %45, double* %25
store i32 0, i32* %26
br label %46
46: ; preds = %147, %11
%47 = load i32, i32* %26
%48 = load i32, i32* %12
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %150
50: ; preds = %46
%51 = load double, double* %23
%52 = load i32, i32* %26
%53 = add nsw i32 %52, 1
%54 = sitofp i32 %53 to double
%55 = fmul double %51, %54
store double %55, double* %27
%56 = load double, double* %27
%57 = call double @sqrt(double %56)
store double %57, double* %28
store double 0.000000e+00, double* %29
store double 0.000000e+00, double* %30
store double 0.000000e+00, double* %31
store i32 0, i32* %32
br label %58
58: ; preds = %102, %50
%59 = load i32, i32* %32
%60 = load i32, i32* %24
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %105
62: ; preds = %58
%63 = load double, double* %25
%64 = load i32, i32* %32
%65 = sitofp i32 %64 to double
%66 = fmul double %63, %65
store double %66, double* %33
%67 = load double, double* %28
%68 = load double, double* %33
%69 = call double @cos(double %68)
%70 = fmul double %67, %69
store double %70, double* %34
%71 = load double, double* %28
%72 = load double, double* %33
%73 = call double @sin(double %72)
%74 = fmul double %71, %73
store double %74, double* %35
%75 = load double, double* %34
%76 = load double, double* %14
%77 = fadd double %75, %76
%78 = load double, double* %35
%79 = load double, double* %15
%80 = fadd double %78, %79
%81 = load i32, i32* %12
%82 = load double, double* %13
%83 = load double*, double** %16
%84 = load double*, double** %17
%85 = load double*, double** %18
%86 = call double @approxU(double %77, double %80, i32 %81, double %82, double* %83, double* %84, double* %85)
store double %86, double* %36
%87 = load double, double* %36
%88 = load double, double* %29
%89 = fadd double %88, %87
store double %89, double* %29
%90 = load double, double* %36
%91 = load double, double* %33
%92 = fmul double 6.000000e+00, %91
%93 = call double @cos(double %92)
%94 = load double, double* %30
%95 = call double @llvm.fmuladd.f64(double %90, double %93, double %94)
store double %95, double* %30
%96 = load double, double* %36
%97 = load double, double* %33
%98 = fmul double 1.200000e+01, %97
%99 = call double @cos(double %98)
%100 = load double, double* %31
%101 = call double @llvm.fmuladd.f64(double %96, double %99, double %100)
store double %101, double* %31
br label %102
102: ; preds = %62
%103 = load i32, i32* %32
%104 = add nsw i32 %103, 1
store i32 %104, i32* %32
br label %58
105: ; preds = %58
%106 = load double, double* %14
%107 = load double, double* %15
%108 = load i32, i32* %12
%109 = load double, double* %13
%110 = load double*, double** %16
%111 = load double*, double** %17
%112 = load double*, double** %18
%113 = call double @approxU(double %106, double %107, i32 %108, double %109, double* %110, double* %111, double* %112)
%114 = load double*, double** %19
%115 = load double, double* %114
%116 = fadd double %115, %113
store double %116, double* %114
%117 = load double, double* %29
%118 = load i32, i32* %24
%119 = sitofp i32 %118 to double
%120 = fdiv double %117, %119
%121 = load double*, double** %20
%122 = load i32, i32* %26
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %121, i64 %123
%125 = load double, double* %124
%126 = fadd double %125, %120
store double %126, double* %124
%127 = load double, double* %30
%128 = load i32, i32* %24
%129 = sitofp i32 %128 to double
%130 = fdiv double %127, %129
%131 = load double*, double** %21
%132 = load i32, i32* %26
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %131, i64 %133
%135 = load double, double* %134
%136 = call double @llvm.fmuladd.f64(double %130, double 2.000000e+00, double %135)
store double %136, double* %134
%137 = load double, double* %31
%138 = load i32, i32* %24
%139 = sitofp i32 %138 to double
%140 = fdiv double %137, %139
%141 = load double*, double** %22
%142 = load i32, i32* %26
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = call double @llvm.fmuladd.f64(double %140, double 2.000000e+00, double %145)
store double %146, double* %144
br label %147
147: ; preds = %105
%148 = load i32, i32* %26
%149 = add nsw i32 %148, 1
store i32 %149, i32* %26
br label %46
150: ; preds = %46
ret void
}

LLVM IR (-O2):
define void @accu_approxU(i32 %0, double %1, double %2, double %3, double* %4, double* %5, double* %6, double* nocapture %7, double* nocapture %8, double* nocapture %9, double* nocapture %10) {
%12 = fmul double %1, %1
%13 = sitofp i32 %0 to double
%14 = fdiv double %12, %13
%15 = icmp sgt i32 %0, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = zext i32 %0 to i64
br label %19
18: ; preds = %26, %11
ret void
19: ; preds = %16, %26
%20 = phi i64 [ 0, %16 ], [ %21, %26 ]
%21 = add nuw nsw i64 %20, 1
%22 = trunc i64 %21 to i32
%23 = sitofp i32 %22 to double
%24 = fmul double %14, %23
%25 = tail call double @sqrt(double %24)
br label %45
26: ; preds = %45
%27 = tail call double @approxU(double %2, double %3, i32 %0, double %1, double* %4, double* %5, double* %6)
%28 = load double, double* %7
%29 = fadd double %27, %28
store double %29, double* %7
%30 = fdiv double %58, 2.400000e+01
%31 = getelementptr inbounds double, double* %8, i64 %20
%32 = load double, double* %31
%33 = fadd double %30, %32
store double %33, double* %31
%34 = extractelement <2 x double> %67, i64 0
%35 = fdiv double %34, 2.400000e+01
%36 = getelementptr inbounds double, double* %9, i64 %20
%37 = load double, double* %36
%38 = tail call double @llvm.fmuladd.f64(double %35, double 2.000000e+00, double %37)
store double %38, double* %36
%39 = extractelement <2 x double> %67, i64 1
%40 = fdiv double %39, 2.400000e+01
%41 = getelementptr inbounds double, double* %10, i64 %20
%42 = load double, double* %41
%43 = tail call double @llvm.fmuladd.f64(double %40, double 2.000000e+00, double %42)
store double %43, double* %41
%44 = icmp eq i64 %21, %17
br i1 %44, label %18, label %19
45: ; preds = %19, %45
%46 = phi double [ 0.000000e+00, %19 ], [ %58, %45 ]
%47 = phi i32 [ 0, %19 ], [ %68, %45 ]
%48 = phi <2 x double> [ zeroinitializer, %19 ], [ %67, %45 ]
%49 = sitofp i32 %47 to double
%50 = fmul double %49, 0x3FD0C15240000000
%51 = tail call double @cos(double %50)
%52 = fmul double %25, %51
%53 = tail call double @sin(double %50)
%54 = fmul double %25, %53
%55 = fadd double %52, %2
%56 = fadd double %54, %3
%57 = tail call double @approxU(double %55, double %56, i32 %0, double %1, double* %4, double* %5, double* %6)
%58 = fadd double %46, %57
%59 = fmul double %50, 6.000000e+00
%60 = tail call double @cos(double %59)
%61 = fmul double %50, 1.200000e+01
%62 = tail call double @cos(double %61)
%63 = insertelement <2 x double> poison, double %57, i64 0
%64 = shufflevector <2 x double> %63, <2 x double> poison, <2 x i32> zeroinitializer
%65 = insertelement <2 x double> poison, double %60, i64 0
%66 = insertelement <2 x double> %65, double %62, i64 1
%67 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %64, <2 x double> %66, <2 x double> %48)
%68 = add nuw nsw i32 %47, 1
%69 = icmp eq i32 %68, 24
br i1 %69, label %26, label %45
}