#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 M_PI;
double atan(int);
double pow(int /*<<< orphan*/, int);
int /*<<< orphan*/ sin(int);
double sqrt(double);
double g(double *t, size_t dim, void *params) {
  double dist2, delta;
  double rho1, rho2;
  int sdim = ((int)dim) / 2;
  double r = *(double *)params;
  dist2 = 0.;
  for (int i = 0; i < sdim; i++) {
    delta = t[i] - t[i + sdim];
    if (i == 0) {
      delta += r;
    }
    dist2 += delta * delta;
  }
  double norm = 512. / (9. * (M_PI - 2.));
  rho1 = norm * atan(2 * (t[0] - .5)) * pow(sin(M_PI * t[1]), 4.) *
         pow(sin(M_PI * t[2]), 4.);
  rho2 = norm * atan(2 * (t[3] - .5)) * pow(sin(M_PI * t[4]), 4.) *
         pow(sin(M_PI * t[5]), 4.);
  r += 0.5;
  return rho1 * rho2 / sqrt(dist2);
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    11f5 <g+0xb5>
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    11cb <g+0x8b>
movsd  -0x48(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1182 <g+0x42>
mov    0x2dec(%rip),%rax
cvtsi2sdl (%rax),%xmm0
movsd  0xe00(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe04(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xdf0(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  0xdba(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xdb6(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x2d6b(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    0x2d2e(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
movsd  0xcf8(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xcf4(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    0x2caf(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x20(%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    0x2c75(%rip),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x28(%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xc52(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbx
xorpd  %xmm5,%xmm5
cmp    $0x2,%esi
jl     11a3 <g+0x63>
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
movsd  (%rdx),%xmm0
cltq
mov    %eax,%r8d
and    $0xfffffffe,%esi
cmp    $0x2,%esi
jne    132f <g+0x1ef>
xorpd  %xmm5,%xmm5
xor    %edx,%edx
test   $0x1,%r8b
je     11a3 <g+0x63>
movsd  (%rbx,%rdx,8),%xmm1
add    %rdx,%rax
subsd  (%rbx,%rax,8),%xmm1
test   %rdx,%rdx
je     1197 <g+0x57>
movsd  0xe69(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm5
movsd  %xmm5,0x28(%rsp)
mov    0x2e38(%rip),%r14
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
addsd  0xe48(%rip),%xmm0
mulsd  0xe48(%rip),%xmm0
movsd  0xe48(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movsd  (%rbx),%xmm0
addsd  0xe3b(%rip),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <atan@plt>
movapd %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x8(%rbx),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movapd %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x10(%rbx),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movsd  0xdd6(%rip),%xmm1
addsd  0x18(%rbx),%xmm1
movapd %xmm0,0x40(%rsp)
addsd  %xmm1,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <atan@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd (%rsp),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x20(%rbx),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  (%rsp),%xmm1
movapd %xmm1,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  0x28(%rbx),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1050 <pow@plt>
movsd  0x28(%rsp),%xmm1
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
ucomisd 0xd27(%rip),%xmm1
jb     130c <g+0x1cc>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    131f <g+0x1df>
movapd %xmm1,%xmm0
movapd %xmm3,(%rsp)
call   1060 <sqrt@plt>
movapd (%rsp),%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret
mov    %r8d,%esi
and    $0xfffffffe,%esi
lea    0x8(%rbx),%rdi
lea    (%rbx,%rax,8),%rcx
add    $0x8,%rcx
xorpd  %xmm2,%xmm2
xor    %edx,%edx
movsd  0xcb1(%rip),%xmm1
jmp    139b <g+0x25b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rdi,%rdx,8),%xmm4
movsd  (%rdi,%rdx,8),%xmm5
subsd  -0x8(%rcx,%rdx,8),%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm4,%xmm4
addsd  %xmm4,%xmm2
subsd  (%rcx,%rdx,8),%xmm5
mulsd  %xmm5,%xmm5
addsd  %xmm2,%xmm5
add    $0x2,%rdx
movapd %xmm5,%xmm2
cmp    %rdx,%rsi
je     1177 <g+0x37>
movapd %xmm0,%xmm3
test   %rdx,%rdx
je     1360 <g+0x220>
movapd %xmm1,%xmm3
jmp    1360 <g+0x220>

LLVM IR (-O0):
@M_PI = global i32 0
define double @g(double* %0, i64 %1, i8* %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca double
store double* %0, double** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%15 = load i64, i64* %5
%16 = trunc i64 %15 to i32
%17 = sdiv i32 %16, 2
store i32 %17, i32* %11
%18 = load i8*, i8** %6
%19 = bitcast i8* %18 to double*
%20 = load double, double* %19
store double %20, double* %12
store double 0.000000e+00, double* %7
store i32 0, i32* %13
br label %21
21: ; preds = %50, %3
%22 = load i32, i32* %13
%23 = load i32, i32* %11
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %53
25: ; preds = %21
%26 = load double*, double** %4
%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 = load double*, double** %4
%32 = load i32, i32* %13
%33 = load i32, i32* %11
%34 = add nsw i32 %32, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %31, i64 %35
%37 = load double, double* %36
%38 = fsub double %30, %37
store double %38, double* %8
%39 = load i32, i32* %13
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %25
%42 = load double, double* %12
%43 = load double, double* %8
%44 = fadd double %43, %42
store double %44, double* %8
br label %45
45: ; preds = %41, %25
%46 = load double, double* %8
%47 = load double, double* %8
%48 = load double, double* %7
%49 = call double @llvm.fmuladd.f64(double %46, double %47, double %48)
store double %49, double* %7
br label %50
50: ; preds = %45
%51 = load i32, i32* %13
%52 = add nsw i32 %51, 1
store i32 %52, i32* %13
br label %21
53: ; preds = %21
%54 = load i32, i32* @M_PI
%55 = sitofp i32 %54 to double
%56 = fsub double %55, 2.000000e+00
%57 = fmul double 9.000000e+00, %56
%58 = fdiv double 5.120000e+02, %57
store double %58, double* %14
%59 = load double, double* %14
%60 = load double*, double** %4
%61 = getelementptr inbounds double, double* %60, i64 0
%62 = load double, double* %61
%63 = fsub double %62, 5.000000e-01
%64 = fmul double 2.000000e+00, %63
%65 = fptosi double %64 to i32
%66 = call double @atan(i32 %65)
%67 = fmul double %59, %66
%68 = load i32, i32* @M_PI
%69 = sitofp i32 %68 to double
%70 = load double*, double** %4
%71 = getelementptr inbounds double, double* %70, i64 1
%72 = load double, double* %71
%73 = fmul double %69, %72
%74 = fptosi double %73 to i32
%75 = call i32 @sin(i32 %74)
%76 = call double @pow(i32 %75, i32 4)
%77 = fmul double %67, %76
%78 = load i32, i32* @M_PI
%79 = sitofp i32 %78 to double
%80 = load double*, double** %4
%81 = getelementptr inbounds double, double* %80, i64 2
%82 = load double, double* %81
%83 = fmul double %79, %82
%84 = fptosi double %83 to i32
%85 = call i32 @sin(i32 %84)
%86 = call double @pow(i32 %85, i32 4)
%87 = fmul double %77, %86
store double %87, double* %9
%88 = load double, double* %14
%89 = load double*, double** %4
%90 = getelementptr inbounds double, double* %89, i64 3
%91 = load double, double* %90
%92 = fsub double %91, 5.000000e-01
%93 = fmul double 2.000000e+00, %92
%94 = fptosi double %93 to i32
%95 = call double @atan(i32 %94)
%96 = fmul double %88, %95
%97 = load i32, i32* @M_PI
%98 = sitofp i32 %97 to double
%99 = load double*, double** %4
%100 = getelementptr inbounds double, double* %99, i64 4
%101 = load double, double* %100
%102 = fmul double %98, %101
%103 = fptosi double %102 to i32
%104 = call i32 @sin(i32 %103)
%105 = call double @pow(i32 %104, i32 4)
%106 = fmul double %96, %105
%107 = load i32, i32* @M_PI
%108 = sitofp i32 %107 to double
%109 = load double*, double** %4
%110 = getelementptr inbounds double, double* %109, i64 5
%111 = load double, double* %110
%112 = fmul double %108, %111
%113 = fptosi double %112 to i32
%114 = call i32 @sin(i32 %113)
%115 = call double @pow(i32 %114, i32 4)
%116 = fmul double %106, %115
store double %116, double* %10
%117 = load double, double* %12
%118 = fadd double %117, 5.000000e-01
store double %118, double* %12
%119 = load double, double* %9
%120 = load double, double* %10
%121 = fmul double %119, %120
%122 = load double, double* %7
%123 = call double @sqrt(double %122)
%124 = fdiv double %121, %123
ret double %124
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @g(double* nocapture %0, i64 %1, i8* nocapture %2) {
%4 = trunc i64 %1 to i32
%5 = sdiv i32 %4, 2
%6 = bitcast i8* %2 to double*
%7 = load double, double* %6
%8 = icmp sgt i32 %4, 1
br i1 %8, label %9, label %33
9: ; preds = %3
%10 = sext i32 %5 to i64
%11 = zext i32 %5 to i64
%12 = and i64 %11, 1
%13 = and i32 %4, -2
%14 = icmp eq i32 %13, 2
br i1 %14, label %17, label %15
15: ; preds = %9
%16 = and i64 %11, 4294967294
br label %99
17: ; preds = %99, %9
%18 = phi double [ undef, %9 ], [ %120, %99 ]
%19 = phi i64 [ 0, %9 ], [ %121, %99 ]
%20 = phi double [ 0.000000e+00, %9 ], [ %120, %99 ]
%21 = icmp eq i64 %12, 0
br i1 %21, label %33, label %22
22: ; preds = %17
%23 = getelementptr inbounds double, double* %0, i64 %19
%24 = load double, double* %23
%25 = add nsw i64 %19, %10
%26 = getelementptr inbounds double, double* %0, i64 %25
%27 = load double, double* %26
%28 = fsub double %24, %27
%29 = icmp eq i64 %19, 0
%30 = select i1 %29, double %7, double -0.000000e+00
%31 = fadd double %30, %28
%32 = tail call double @llvm.fmuladd.f64(double %31, double %31, double %20)
br label %33
33: ; preds = %22, %17, %3
%34 = phi double [ 0.000000e+00, %3 ], [ %18, %17 ], [ %32, %22 ]
%35 = load i32, i32* @M_PI
%36 = sitofp i32 %35 to double
%37 = fadd double %36, -2.000000e+00
%38 = fmul double %37, 9.000000e+00
%39 = fdiv double 5.120000e+02, %38
%40 = load double, double* %0
%41 = fadd double %40, -5.000000e-01
%42 = fmul double %41, 2.000000e+00
%43 = fptosi double %42 to i32
%44 = tail call double @atan(i32 %43)
%45 = load i32, i32* @M_PI
%46 = sitofp i32 %45 to double
%47 = getelementptr inbounds double, double* %0, i64 1
%48 = load double, double* %47
%49 = fmul double %48, %46
%50 = fptosi double %49 to i32
%51 = tail call i32 @sin(i32 %50)
%52 = tail call double @pow(i32 %51, i32 4)
%53 = load i32, i32* @M_PI
%54 = sitofp i32 %53 to double
%55 = getelementptr inbounds double, double* %0, i64 2
%56 = load double, double* %55
%57 = fmul double %56, %54
%58 = fptosi double %57 to i32
%59 = tail call i32 @sin(i32 %58)
%60 = tail call double @pow(i32 %59, i32 4)
%61 = getelementptr inbounds double, double* %0, i64 3
%62 = load double, double* %61
%63 = fadd double %62, -5.000000e-01
%64 = fmul double %63, 2.000000e+00
%65 = fptosi double %64 to i32
%66 = tail call double @atan(i32 %65)
%67 = insertelement <2 x double> poison, double %44, i64 0
%68 = insertelement <2 x double> %67, double %66, i64 1
%69 = insertelement <2 x double> poison, double %39, i64 0
%70 = shufflevector <2 x double> %69, <2 x double> poison, <2 x i32> zeroinitializer
%71 = fmul <2 x double> %68, %70
%72 = load i32, i32* @M_PI
%73 = sitofp i32 %72 to double
%74 = getelementptr inbounds double, double* %0, i64 4
%75 = load double, double* %74
%76 = fmul double %75, %73
%77 = fptosi double %76 to i32
%78 = tail call i32 @sin(i32 %77)
%79 = tail call double @pow(i32 %78, i32 4)
%80 = insertelement <2 x double> poison, double %52, i64 0
%81 = insertelement <2 x double> %80, double %79, i64 1
%82 = fmul <2 x double> %71, %81
%83 = load i32, i32* @M_PI
%84 = sitofp i32 %83 to double
%85 = getelementptr inbounds double, double* %0, i64 5
%86 = load double, double* %85
%87 = fmul double %86, %84
%88 = fptosi double %87 to i32
%89 = tail call i32 @sin(i32 %88)
%90 = tail call double @pow(i32 %89, i32 4)
%91 = insertelement <2 x double> poison, double %60, i64 0
%92 = insertelement <2 x double> %91, double %90, i64 1
%93 = fmul <2 x double> %82, %92
%94 = shufflevector <2 x double> %93, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%95 = fmul <2 x double> %93, %94
%96 = extractelement <2 x double> %95, i64 0
%97 = tail call double @sqrt(double %34)
%98 = fdiv double %96, %97
ret double %98
99: ; preds = %99, %15
%100 = phi i64 [ 0, %15 ], [ %121, %99 ]
%101 = phi double [ 0.000000e+00, %15 ], [ %120, %99 ]
%102 = phi i64 [ 0, %15 ], [ %122, %99 ]
%103 = getelementptr inbounds double, double* %0, i64 %100
%104 = load double, double* %103
%105 = add nsw i64 %100, %10
%106 = getelementptr inbounds double, double* %0, i64 %105
%107 = load double, double* %106
%108 = fsub double %104, %107
%109 = icmp eq i64 %100, 0
%110 = select i1 %109, double %7, double -0.000000e+00
%111 = fadd double %110, %108
%112 = tail call double @llvm.fmuladd.f64(double %111, double %111, double %101)
%113 = or i64 %100, 1
%114 = getelementptr inbounds double, double* %0, i64 %113
%115 = load double, double* %114
%116 = add nsw i64 %113, %10
%117 = getelementptr inbounds double, double* %0, i64 %116
%118 = load double, double* %117
%119 = fsub double %115, %118
%120 = tail call double @llvm.fmuladd.f64(double %119, double %119, double %112)
%121 = add nuw nsw i64 %100, 2
%122 = add i64 %102, 2
%123 = icmp eq i64 %122, %16
br i1 %123, label %17, label %99
}