#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 pow(double, int);
void T_bare(double *dip, int ld, const double *r) {
  double rx2 = r[0] * r[0];
  double ry2 = r[1] * r[1];
  double rz2 = r[2] * r[2];
  double r2 = rx2 + ry2 + rz2;
  double r5 = pow(r2, 5. / 2);
  dip[0] = (r2 - 3 * rx2) / r5;
  dip[ld + 1] = (r2 - 3 * ry2) / r5;
  dip[ld * 2 + 2] = (r2 - 3 * rz2) / r5;
  dip[1] = -3 * r[0] * r[1] / r5;
  dip[2] = -3 * r[0] * r[2] / r5;
  dip[ld + 2] = -3 * r[1] * r[2] / r5;
  dip[ld] = dip[1];
  dip[ld * 2] = dip[2];
  dip[ld * 2 + 1] = dip[2 + ld];
}


x86 assembly (clang, -O0):
<T_bare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xe60(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xe39(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xe08(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movsd  0xdda(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x8(%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  0xdb3(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
movsd  0xd8c(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<T_bare>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm2
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm2,%xmm2
movsd  %xmm2,0x10(%rsp)
movsd  0x10(%rdx),%xmm1
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x18(%rsp)
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  0xe95(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm1,%xmm2
movsd  (%rsp),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,(%rbx)
movsd  0x10(%rsp),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm0,%xmm2
movslq %ebp,%rax
movsd  %xmm2,0x8(%rbx,%rax,8)
movsd  0x18(%rsp),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm0,%xmm2
lea    (%rax,%rax,1),%ecx
movslq %ecx,%rcx
movsd  %xmm2,0x10(%rbx,%rcx,8)
movsd  (%r14),%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x8(%r14),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rbx)
movsd  (%r14),%xmm2
mulsd  %xmm1,%xmm2
mulsd  0x10(%r14),%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rbx)
mulsd  0x8(%r14),%xmm1
mulsd  0x10(%r14),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rbx,%rax,8)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,(%rbx,%rax,8)
movsd  0x10(%rbx),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  0x10(%rbx,%rax,8),%xmm0
add    %eax,%eax
add    $0x1,%eax
cltq
movsd  %xmm0,(%rbx,%rax,8)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @T_bare(double* %0, i32 %1, double* %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store double* %2, double** %6
%12 = load double*, double** %6
%13 = getelementptr inbounds double, double* %12, i64 0
%14 = load double, double* %13
%15 = load double*, double** %6
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = fmul double %14, %17
store double %18, double* %7
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 1
%24 = load double, double* %23
%25 = fmul double %21, %24
store double %25, double* %8
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = load double, double* %27
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = fmul double %28, %31
store double %32, double* %9
%33 = load double, double* %7
%34 = load double, double* %8
%35 = fadd double %33, %34
%36 = load double, double* %9
%37 = fadd double %35, %36
store double %37, double* %10
%38 = load double, double* %10
%39 = call double @pow(double %38, i32 2)
store double %39, double* %11
%40 = load double, double* %10
%41 = load double, double* %7
%42 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %41, double %40)
%43 = load double, double* %11
%44 = fdiv double %42, %43
%45 = load double*, double** %4
%46 = getelementptr inbounds double, double* %45, i64 0
store double %44, double* %46
%47 = load double, double* %10
%48 = load double, double* %8
%49 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %48, double %47)
%50 = load double, double* %11
%51 = fdiv double %49, %50
%52 = load double*, double** %4
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %52, i64 %55
store double %51, double* %56
%57 = load double, double* %10
%58 = load double, double* %9
%59 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %58, double %57)
%60 = load double, double* %11
%61 = fdiv double %59, %60
%62 = load double*, double** %4
%63 = load i32, i32* %5
%64 = mul nsw i32 %63, 2
%65 = add nsw i32 %64, 2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %62, i64 %66
store double %61, double* %67
%68 = load double*, double** %6
%69 = getelementptr inbounds double, double* %68, i64 0
%70 = load double, double* %69
%71 = fmul double -3.000000e+00, %70
%72 = load double*, double** %6
%73 = getelementptr inbounds double, double* %72, i64 1
%74 = load double, double* %73
%75 = fmul double %71, %74
%76 = load double, double* %11
%77 = fdiv double %75, %76
%78 = load double*, double** %4
%79 = getelementptr inbounds double, double* %78, i64 1
store double %77, double* %79
%80 = load double*, double** %6
%81 = getelementptr inbounds double, double* %80, i64 0
%82 = load double, double* %81
%83 = fmul double -3.000000e+00, %82
%84 = load double*, double** %6
%85 = getelementptr inbounds double, double* %84, i64 2
%86 = load double, double* %85
%87 = fmul double %83, %86
%88 = load double, double* %11
%89 = fdiv double %87, %88
%90 = load double*, double** %4
%91 = getelementptr inbounds double, double* %90, i64 2
store double %89, double* %91
%92 = load double*, double** %6
%93 = getelementptr inbounds double, double* %92, i64 1
%94 = load double, double* %93
%95 = fmul double -3.000000e+00, %94
%96 = load double*, double** %6
%97 = getelementptr inbounds double, double* %96, i64 2
%98 = load double, double* %97
%99 = fmul double %95, %98
%100 = load double, double* %11
%101 = fdiv double %99, %100
%102 = load double*, double** %4
%103 = load i32, i32* %5
%104 = add nsw i32 %103, 2
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %102, i64 %105
store double %101, double* %106
%107 = load double*, double** %4
%108 = getelementptr inbounds double, double* %107, i64 1
%109 = load double, double* %108
%110 = load double*, double** %4
%111 = load i32, i32* %5
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %110, i64 %112
store double %109, double* %113
%114 = load double*, double** %4
%115 = getelementptr inbounds double, double* %114, i64 2
%116 = load double, double* %115
%117 = load double*, double** %4
%118 = load i32, i32* %5
%119 = mul nsw i32 %118, 2
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %117, i64 %120
store double %116, double* %121
%122 = load double*, double** %4
%123 = load i32, i32* %5
%124 = add nsw i32 2, %123
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %122, i64 %125
%127 = load double, double* %126
%128 = load double*, double** %4
%129 = load i32, i32* %5
%130 = mul nsw i32 %129, 2
%131 = add nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %128, i64 %132
store double %127, double* %133
ret void
}

LLVM IR (-O2):
define void @T_bare(double* nocapture %0, i32 %1, double* nocapture %2) {
%4 = load double, double* %2
%5 = fmul double %4, %4
%6 = getelementptr inbounds double, double* %2, i64 1
%7 = load double, double* %6
%8 = fmul double %7, %7
%9 = getelementptr inbounds double, double* %2, i64 2
%10 = load double, double* %9
%11 = fmul double %10, %10
%12 = fadd double %5, %8
%13 = fadd double %12, %11
%14 = tail call double @pow(double %13, i32 2)
%15 = tail call double @llvm.fmuladd.f64(double %5, double -3.000000e+00, double %13)
%16 = fdiv double %15, %14
store double %16, double* %0
%17 = tail call double @llvm.fmuladd.f64(double %8, double -3.000000e+00, double %13)
%18 = fdiv double %17, %14
%19 = add nsw i32 %1, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %0, i64 %20
store double %18, double* %21
%22 = tail call double @llvm.fmuladd.f64(double %11, double -3.000000e+00, double %13)
%23 = fdiv double %22, %14
%24 = shl nsw i32 %1, 1
%25 = add nsw i32 %24, 2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %0, i64 %26
store double %23, double* %27
%28 = load double, double* %2
%29 = fmul double %28, -3.000000e+00
%30 = load double, double* %6
%31 = fmul double %29, %30
%32 = fdiv double %31, %14
%33 = getelementptr inbounds double, double* %0, i64 1
store double %32, double* %33
%34 = load double, double* %2
%35 = fmul double %34, -3.000000e+00
%36 = load double, double* %9
%37 = fmul double %35, %36
%38 = fdiv double %37, %14
%39 = getelementptr inbounds double, double* %0, i64 2
store double %38, double* %39
%40 = load double, double* %6
%41 = fmul double %40, -3.000000e+00
%42 = load double, double* %9
%43 = fmul double %41, %42
%44 = fdiv double %43, %14
%45 = add nsw i32 %1, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %0, i64 %46
store double %44, double* %47
%48 = load double, double* %33
%49 = sext i32 %1 to i64
%50 = getelementptr inbounds double, double* %0, i64 %49
store double %48, double* %50
%51 = load double, double* %39
%52 = sext i32 %24 to i64
%53 = getelementptr inbounds double, double* %0, i64 %52
store double %51, double* %53
%54 = load double, double* %47
%55 = or i32 %24, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %0, i64 %56
store double %54, double* %57
ret void
}