#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 /*<<< orphan*/ calculate_reciprocal_lattice_vectors(double **, double **);
int /*<<< orphan*/ test_double(double const, double, double const, char *);
void test_reciprocal_vectors() {
  double a[3][3], b[3][3];
  const double a0 = 0.5633;
  a[0][0] = a0 / 2;
  a[0][1] = a0 / 2;
  a[0][2] = 0;
  a[1][0] = a0 / 2;
  a[1][1] = 0;
  a[1][2] = a0 / 2;
  a[2][0] = 0;
  a[2][1] = a0 / 2;
  a[2][2] = a0 / 2;
  calculate_reciprocal_lattice_vectors(a, b);
  const double q = 11.15424;
  const double tol = 1E-5;
  test_double(q, b[0][0], tol, "B0_0");
  test_double(q, b[0][1], tol, "B0_1");
  test_double(-q, b[0][2], tol, "B0_2");
  test_double(q, b[1][0], tol, "B1_0");
  test_double(-q, b[1][1], tol, "B1_1");
  test_double(q, b[1][2], tol, "B1_2");
  test_double(-q, b[2][0], tol, "B2_0");
  test_double(q, b[2][1], tol, "B2_1");
  test_double(q, b[2][2], tol, "B2_2");
}


x86 assembly (clang, -O0):
<test_reciprocal_vectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  0xeed(%rip),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe7c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1030 <calculate_reciprocal_lattice_vectors@plt>
movsd  0xe47(%rip),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0xe3f(%rip),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xa0(%rbp),%xmm1
ff
movsd  0xe1f(%rip),%xmm0
movsd  0xe1f(%rip),%xmm2
lea    0xe38(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  0xdfb(%rip),%xmm0
movsd  0xdfb(%rip),%xmm2
lea    0xe19(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x90(%rbp),%xmm1
ff
movsd  0xde7(%rip),%xmm0
movsd  0xdd7(%rip),%xmm2
lea    0xdfa(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x88(%rbp),%xmm1
ff
movsd  0xdb3(%rip),%xmm0
movsd  0xdb3(%rip),%xmm2
lea    0xddb(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x80(%rbp),%xmm1
movsd  0xda2(%rip),%xmm0
movsd  0xd92(%rip),%xmm2
lea    0xdbf(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x78(%rbp),%xmm1
movsd  0xd71(%rip),%xmm0
movsd  0xd71(%rip),%xmm2
lea    0xda3(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x70(%rbp),%xmm1
movsd  0xd60(%rip),%xmm0
movsd  0xd50(%rip),%xmm2
lea    0xd87(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x68(%rbp),%xmm1
movsd  0xd2f(%rip),%xmm0
movsd  0xd2f(%rip),%xmm2
lea    0xd6b(%rip),%rdi
call   1040 <test_double@plt>
movsd  -0x60(%rbp),%xmm1
movsd  0xd0e(%rip),%xmm0
movsd  0xd0e(%rip),%xmm2
lea    0xd4f(%rip),%rdi
call   1040 <test_double@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_reciprocal_vectors>:
sub    $0x98,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
xorps  %xmm0,%xmm0
movhps 0xed3(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movabs $0x3fd2068db8bac711,%rax
06 d2 3f
mov    %rax,0x90(%rsp)
lea    0x50(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <calculate_reciprocal_lattice_vectors@plt>
movsd  (%rsp),%xmm1
lea    0xeb6(%rip),%rdi
movsd  0xe96(%rip),%xmm0
movsd  0xe96(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x8(%rsp),%xmm1
lea    0xe99(%rip),%rdi
movsd  0xe74(%rip),%xmm0
movsd  0xe74(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x10(%rsp),%xmm1
lea    0xe7c(%rip),%rdi
movsd  0xe62(%rip),%xmm0
movsd  0xe52(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x18(%rsp),%xmm1
lea    0xe5f(%rip),%rdi
movsd  0xe30(%rip),%xmm0
movsd  0xe30(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x20(%rsp),%xmm1
lea    0xe42(%rip),%rdi
movsd  0xe1e(%rip),%xmm0
movsd  0xe0e(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x28(%rsp),%xmm1
lea    0xe25(%rip),%rdi
movsd  0xdec(%rip),%xmm0
movsd  0xdec(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x30(%rsp),%xmm1
lea    0xe08(%rip),%rdi
movsd  0xdda(%rip),%xmm0
movsd  0xdca(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x38(%rsp),%xmm1
lea    0xdeb(%rip),%rdi
movsd  0xda8(%rip),%xmm0
movsd  0xda8(%rip),%xmm2
call   1040 <test_double@plt>
movsd  0x40(%rsp),%xmm1
lea    0xdce(%rip),%rdi
movsd  0xd86(%rip),%xmm0
movsd  0xd86(%rip),%xmm2
call   1040 <test_double@plt>
add    $0x98,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"B0_0\00"
@.str.1 = [5 x i8] c"B0_1\00"
@.str.2 = [5 x i8] c"B0_2\00"
@.str.3 = [5 x i8] c"B1_0\00"
@.str.4 = [5 x i8] c"B1_1\00"
@.str.5 = [5 x i8] c"B1_2\00"
@.str.6 = [5 x i8] c"B2_0\00"
@.str.7 = [5 x i8] c"B2_1\00"
@.str.8 = [5 x i8] c"B2_2\00"
define void @test_reciprocal_vectors() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [3 x [3 x double]]
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double 5.633000e-01, double* %3
%6 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%7 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
store double 2.816500e-01, double* %7
%8 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%9 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 1
store double 2.816500e-01, double* %9
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%11 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
store double 0.000000e+00, double* %11
%12 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1
%13 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
store double 2.816500e-01, double* %13
%14 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1
%15 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 1
store double 0.000000e+00, double* %15
%16 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1
%17 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 2
store double 2.816500e-01, double* %17
%18 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2
%19 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 0
store double 0.000000e+00, double* %19
%20 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2
%21 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 1
store double 2.816500e-01, double* %21
%22 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2
%23 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double 2.816500e-01, double* %23
%24 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%25 = bitcast [3 x double]* %24 to double**
%26 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%27 = bitcast [3 x double]* %26 to double**
%28 = call i32 @calculate_reciprocal_lattice_vectors(double** %25, double** %27)
store double 0x40264EF88B977857, double* %4
store double 1.000000e-05, double* %5
%29 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%30 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 0
%31 = load double, double* %30
%32 = call i32 @test_double(double 0x40264EF88B977857, double %31, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%33 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%34 = getelementptr inbounds [3 x double], [3 x double]* %33, i64 0, i64 1
%35 = load double, double* %34
%36 = call i32 @test_double(double 0x40264EF88B977857, double %35, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%37 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0
%38 = getelementptr inbounds [3 x double], [3 x double]* %37, i64 0, i64 2
%39 = load double, double* %38
%40 = call i32 @test_double(double 0xC0264EF88B977857, double %39, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%41 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1
%42 = getelementptr inbounds [3 x double], [3 x double]* %41, i64 0, i64 0
%43 = load double, double* %42
%44 = call i32 @test_double(double 0x40264EF88B977857, double %43, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%45 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1
%46 = getelementptr inbounds [3 x double], [3 x double]* %45, i64 0, i64 1
%47 = load double, double* %46
%48 = call i32 @test_double(double 0xC0264EF88B977857, double %47, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%49 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1
%50 = getelementptr inbounds [3 x double], [3 x double]* %49, i64 0, i64 2
%51 = load double, double* %50
%52 = call i32 @test_double(double 0x40264EF88B977857, double %51, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%53 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2
%54 = getelementptr inbounds [3 x double], [3 x double]* %53, i64 0, i64 0
%55 = load double, double* %54
%56 = call i32 @test_double(double 0xC0264EF88B977857, double %55, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%57 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2
%58 = getelementptr inbounds [3 x double], [3 x double]* %57, i64 0, i64 1
%59 = load double, double* %58
%60 = call i32 @test_double(double 0x40264EF88B977857, double %59, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%61 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2
%62 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 0, i64 2
%63 = load double, double* %62
%64 = call i32 @test_double(double 0x40264EF88B977857, double %63, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"B0_0\00"
@.str.1 = [5 x i8] c"B0_1\00"
@.str.2 = [5 x i8] c"B0_2\00"
@.str.3 = [5 x i8] c"B1_0\00"
@.str.4 = [5 x i8] c"B1_1\00"
@.str.5 = [5 x i8] c"B1_2\00"
@.str.6 = [5 x i8] c"B2_0\00"
@.str.7 = [5 x i8] c"B2_1\00"
@.str.8 = [5 x i8] c"B2_2\00"
define void @test_reciprocal_vectors() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [3 x [3 x double]]
%3 = bitcast [3 x [3 x double]]* %1 to i8*
%4 = bitcast [3 x [3 x double]]* %2 to i8*
%5 = bitcast [3 x [3 x double]]* %1 to <2 x double>*
store <2 x double> <double 2.816500e-01, double 2.816500e-01>, <2 x double>* %5
%6 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0, i64 2
%7 = bitcast double* %6 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 2.816500e-01>, <2 x double>* %7
%8 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 1, i64 1
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 2.816500e-01>, <2 x double>* %9
%10 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2, i64 0
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 2.816500e-01>, <2 x double>* %11
%12 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 2, i64 2
store double 2.816500e-01, double* %12
%13 = bitcast [3 x [3 x double]]* %1 to double**
%14 = bitcast [3 x [3 x double]]* %2 to double**
%15 = call i32 @calculate_reciprocal_lattice_vectors(double** %13, double** %14)
%16 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0, i64 0
%17 = load double, double* %16
%18 = call i32 @test_double(double 0x40264EF88B977857, double %17, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0, i64 1
%20 = load double, double* %19
%21 = call i32 @test_double(double 0x40264EF88B977857, double %20, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 0, i64 2
%23 = load double, double* %22
%24 = call i32 @test_double(double 0xC0264EF88B977857, double %23, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%25 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1, i64 0
%26 = load double, double* %25
%27 = call i32 @test_double(double 0x40264EF88B977857, double %26, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%28 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1, i64 1
%29 = load double, double* %28
%30 = call i32 @test_double(double 0xC0264EF88B977857, double %29, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%31 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 1, i64 2
%32 = load double, double* %31
%33 = call i32 @test_double(double 0x40264EF88B977857, double %32, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%34 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2, i64 0
%35 = load double, double* %34
%36 = call i32 @test_double(double 0xC0264EF88B977857, double %35, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%37 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2, i64 1
%38 = load double, double* %37
%39 = call i32 @test_double(double 0x40264EF88B977857, double %38, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%40 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %2, i64 0, i64 2, i64 2
%41 = load double, double* %40
%42 = call i32 @test_double(double 0x40264EF88B977857, double %41, double 1.000000e-05, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
ret void
}