#include <stdlib.h>
#include <math.h>

#include "constants.cuh"
#include "mesh.cuh"
#include "material.cuh"

//------------------------------------------------------PROTOTIPES--------------------------------
void stiffness_init(double *ke, struct mesh *mesh, struct material *material);
void mass_init(double *me, struct mesh *mesh, struct material *material);
void init_stiff_t_array(double *t, struct mesh *mesh, struct material *material);
void populate_stiff_mat(double *t, double *ke, struct mesh *mesh);
void init_mass_t_array(double *t, struct mesh *mesh, struct material *material);
void populate_mass_mat(double *t, double *ke);

//------------------------------------------------------BODIES-------------------------------------
void stiffness_mass_init(double **ke, double **me, struct mesh *mesh, struct material *material) {
	(*ke) = (double*)malloc(KEROW*KECOL * sizeof(double));
	(*me) = (double*)malloc(MEROW*MECOL * sizeof(double));

	stiffness_init((*ke), mesh, material);
	mass_init((*me), mesh, material);
}

void stiffness_init(double *ke, struct mesh *mesh, struct material *material) {
	double *t;
	t = (double*)malloc(31 * sizeof(double));
	init_stiff_t_array(t, mesh, material);
	populate_stiff_mat(t, ke, mesh);
	free(t);

}

void mass_init(double *me, struct mesh *mesh, struct material *material) {
	double *t;
	t = (double*)malloc(3 * sizeof(double));
	init_mass_t_array(t, mesh, material);
	populate_mass_mat(t, me);

	free(t);
	
}

void init_stiff_t_array(double *t, struct mesh *mesh, struct material *material) {
	t[0] = material->nu + 1.0; //t2
	t[1] = 1.0 / t[0];	//t3
	t[2] = material->nu * 2.0; //t4
	t[3] = t[2] - 1; //t5
	t[4] = 1.0 / t[3];//t6
	t[5] = 1.0 / mesh->by; //t7
	t[6] = 1.0 / mesh->ax; //t8
	t[7] = material->nu - 1.0; //t9
	t[8] = mesh->by*t[1] * t[4] * t[6] * t[7] * (1.0 / 3.0); //t10
	t[9] = mesh->ax *t[1] * t[5] * (1.0 / (2.4 * pow(10, 1))); //t11
	t[10] = mesh->ax *t[1] * t[5] * (1.0 / (1.2 * pow(10, 1))); //t12
	t[11] = t[4] * (1.0 / (1.2 * pow(10, 1))); //t13
	t[12] = t[1] * (1.0 / (4.8 * pow(10, 1))); //t14
	t[13] = t[1] * (7.0 / (4.8 * pow(10, 1))); //t15
	t[14] = t[11] + t[13]; //t16
	t[15] = mesh->by*t[1] * t[6] * (1.0 / (1.2 * pow(10, 1))); //t17
	t[16] = t[11] + t[12]; //t18
	t[17] = mesh->ax*t[1] * t[4] * t[5] * t[7] * (1.0 / 6.0); //t19
	t[18] = mesh->ax*t[1] * t[4] * t[5] * t[7] * (1.0 / 3.0); //t20
	t[19] = -t[8] + t[9]; //t21
	t[20] = t[8] + t[10]; //t22
	t[21] = mesh->by*t[1] * t[4] * t[6] * t[7] * (1.0 / 6.0); //t23
	t[22] = -t[10] + t[21]; //t24
	t[23] = -t[11] - t[13]; //t25
	t[24] = -t[11] - t[12]; //t26
	t[25] = -t[15] + t[17]; //t27
	t[26] = t[15] + t[18]; //t28
	t[27] = mesh->by*t[1] * t[6] * (1.0 / (2.4*pow(10, 1))); //t29
	t[28] = -t[18] + t[27]; //t30
	t[29] = -t[9] - t[21]; //t31
	t[30] = -t[17] - t[27]; //t32

}

void populate_stiff_mat(double *t, double *ke, struct mesh *mesh ) {
	int row_index=0,col_index=0;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[29]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[1]*(-1.0/(4.8*pow(10,1)))-t[4]*(1.0/(1.2*pow(10,1))); col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[25]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[30]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[29]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[1] * (-7.0 / (4.8*pow(10, 1))) - t[4] * (1.0 / (1.2*pow(10, 1))); col_index += 8;
	ke[row_index + col_index] = t[25]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[30]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = -t[9] - mesh->by*t[1]*t[4]*t[6]*t[7]*(1.0/6.0); col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = - t[17] - mesh->by * t[1] * t[6] * (1.0/(2.4*pow(10,1))); col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[25]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[29]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index = 0; row_index++;

	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[30]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[25]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
}

void init_mass_t_array(double *t, struct mesh *mesh, struct material *material) {
	t[0] = mesh->ax*mesh->by*(2.0 / 9.0);
	t[1] = mesh->ax*mesh->by*(4.0 / 9.0);
	t[2] = mesh->ax*mesh->by*(1.0 / 9.0);

}

void populate_mass_mat(double *t, double *me) {
	int row_index = 0, col_index = 0;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index = 0; row_index++;

	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index = 0; row_index++;

	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index = 0; row_index++;

	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
}




	.file	"tmpxft_003387d6_00000000-6_stiffness_mass_init.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2018:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2018:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z18init_stiff_t_arrayPdP4meshP8material
	.type	_Z18init_stiff_t_arrayPdP4meshP8material, @function
_Z18init_stiff_t_arrayPdP4meshP8material:
.LFB2011:
	.cfi_startproc
	endbr64
	movsd	32(%rdx), %xmm1
	movsd	.LC0(%rip), %xmm2
	movsd	.LC2(%rip), %xmm7
	movsd	.LC5(%rip), %xmm10
	addsd	%xmm2, %xmm1
	movaps	%xmm2, %xmm0
	movaps	%xmm2, %xmm14
	movsd	.LC4(%rip), %xmm9
	movaps	%xmm2, %xmm15
	movaps	%xmm2, %xmm6
	divsd	%xmm1, %xmm0
	movsd	%xmm1, (%rdi)
	movsd	%xmm0, 8(%rdi)
	movsd	32(%rdx), %xmm1
	mulsd	%xmm0, %xmm10
	mulsd	%xmm0, %xmm9
	addsd	%xmm1, %xmm1
	movsd	%xmm1, 16(%rdi)
	subsd	%xmm2, %xmm1
	divsd	%xmm1, %xmm14
	movsd	%xmm1, 24(%rdi)
	movsd	.LC3(%rip), %xmm1
	movsd	%xmm14, 32(%rdi)
	divsd	48(%rsi), %xmm15
	movaps	%xmm14, %xmm11
	movsd	%xmm15, 40(%rdi)
	divsd	40(%rsi), %xmm6
	mulsd	%xmm1, %xmm11
	movsd	%xmm6, 48(%rdi)
	movsd	32(%rdx), %xmm13
	subsd	%xmm2, %xmm13
	movsd	%xmm13, 56(%rdi)
	movsd	48(%rsi), %xmm3
	mulsd	%xmm0, %xmm3
	mulsd	%xmm14, %xmm3
	mulsd	%xmm6, %xmm3
	mulsd	%xmm13, %xmm3
	mulsd	.LC1(%rip), %xmm3
	movsd	%xmm3, 64(%rdi)
	movsd	40(%rsi), %xmm2
	mulsd	%xmm0, %xmm2
	mulsd	%xmm15, %xmm2
	mulsd	%xmm2, %xmm7
	movaps	%xmm11, %xmm2
	addsd	%xmm10, %xmm2
	movsd	%xmm7, 72(%rdi)
	movsd	40(%rsi), %xmm8
	movsd	%xmm11, 88(%rdi)
	mulsd	%xmm0, %xmm8
	movsd	%xmm2, 112(%rdi)
	movaps	%xmm7, %xmm2
	movsd	%xmm9, 96(%rdi)
	subsd	%xmm3, %xmm2
	movsd	%xmm10, 104(%rdi)
	mulsd	%xmm15, %xmm8
	mulsd	%xmm1, %xmm8
	movsd	%xmm8, 80(%rdi)
	movsd	48(%rsi), %xmm5
	addsd	%xmm8, %xmm3
	mulsd	%xmm0, %xmm5
	mulsd	%xmm6, %xmm5
	mulsd	%xmm1, %xmm5
	movaps	%xmm11, %xmm1
	addsd	%xmm9, %xmm1
	movsd	%xmm1, 128(%rdi)
	movsd	%xmm5, 120(%rdi)
	movsd	40(%rsi), %xmm1
	movsd	.LC6(%rip), %xmm12
	mulsd	%xmm0, %xmm1
	mulsd	%xmm14, %xmm1
	mulsd	%xmm15, %xmm1
	mulsd	%xmm13, %xmm1
	mulsd	%xmm12, %xmm1
	movsd	%xmm1, 136(%rdi)
	movsd	40(%rsi), %xmm4
	movsd	%xmm2, 152(%rdi)
	mulsd	%xmm0, %xmm4
	movsd	%xmm3, 160(%rdi)
	mulsd	%xmm14, %xmm4
	mulsd	%xmm15, %xmm4
	mulsd	%xmm13, %xmm4
	mulsd	.LC1(%rip), %xmm4
	movsd	%xmm4, 144(%rdi)
	movsd	48(%rsi), %xmm3
	mulsd	%xmm0, %xmm3
	mulsd	%xmm14, %xmm3
	mulsd	%xmm6, %xmm3
	mulsd	%xmm13, %xmm3
	mulsd	%xmm12, %xmm3
	movaps	%xmm3, %xmm2
	movsd	%xmm3, 168(%rdi)
	subsd	%xmm8, %xmm2
	movq	.LC7(%rip), %xmm8
	xorps	%xmm8, %xmm7
	movsd	%xmm2, 176(%rdi)
	movaps	%xmm11, %xmm2
	xorps	%xmm8, %xmm2
	movaps	%xmm2, %xmm11
	subsd	%xmm9, %xmm2
	subsd	%xmm10, %xmm11
	movsd	%xmm2, 192(%rdi)
	movaps	%xmm1, %xmm2
	xorps	%xmm8, %xmm1
	movsd	%xmm11, 184(%rdi)
	subsd	%xmm5, %xmm2
	addsd	%xmm4, %xmm5
	movsd	%xmm2, 200(%rdi)
	movsd	%xmm5, 208(%rdi)
	mulsd	48(%rsi), %xmm0
	mulsd	%xmm6, %xmm0
	mulsd	.LC2(%rip), %xmm0
	movaps	%xmm0, %xmm2
	subsd	%xmm0, %xmm1
	movsd	%xmm0, 216(%rdi)
	subsd	%xmm4, %xmm2
	movsd	%xmm1, 240(%rdi)
	movsd	%xmm2, 224(%rdi)
	movaps	%xmm7, %xmm2
	subsd	%xmm3, %xmm2
	movsd	%xmm2, 232(%rdi)
	ret
	.cfi_endproc
.LFE2011:
	.size	_Z18init_stiff_t_arrayPdP4meshP8material, .-_Z18init_stiff_t_arrayPdP4meshP8material
	.globl	_Z18populate_stiff_matPdS_P4mesh
	.type	_Z18populate_stiff_matPdS_P4mesh, @function
_Z18populate_stiff_matPdS_P4mesh:
.LFB2013:
	.cfi_startproc
	endbr64
	movsd	160(%rdi), %xmm0
	movsd	.LC3(%rip), %xmm1
	movsd	%xmm0, (%rsi)
	movsd	192(%rdi), %xmm0
	movsd	%xmm0, 64(%rsi)
	movsd	152(%rdi), %xmm0
	movsd	%xmm0, 128(%rsi)
	movsd	184(%rdi), %xmm0
	movsd	%xmm0, 192(%rsi)
	movsd	232(%rdi), %xmm0
	movsd	%xmm0, 256(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 320(%rsi)
	movsd	176(%rdi), %xmm0
	movsd	%xmm0, 384(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 448(%rsi)
	movsd	32(%rdi), %xmm2
	movsd	.LC8(%rip), %xmm0
	mulsd	8(%rdi), %xmm0
	mulsd	%xmm1, %xmm2
	subsd	%xmm2, %xmm0
	movsd	%xmm0, 8(%rsi)
	movsd	208(%rdi), %xmm0
	movsd	%xmm0, 72(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 136(%rsi)
	movsd	200(%rdi), %xmm0
	movsd	%xmm0, 200(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 264(%rsi)
	movsd	240(%rdi), %xmm0
	movsd	%xmm0, 328(%rsi)
	movsd	184(%rdi), %xmm0
	movsd	%xmm0, 392(%rsi)
	movsd	224(%rdi), %xmm0
	movsd	%xmm0, 456(%rsi)
	movsd	152(%rdi), %xmm0
	movsd	%xmm0, 16(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 80(%rsi)
	movsd	160(%rdi), %xmm0
	movsd	%xmm0, 144(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 208(%rsi)
	movsd	176(%rdi), %xmm0
	movsd	%xmm0, 272(%rsi)
	movsd	184(%rdi), %xmm0
	movsd	%xmm0, 336(%rsi)
	movsd	232(%rdi), %xmm0
	movsd	%xmm0, 400(%rsi)
	movsd	192(%rdi), %xmm0
	movsd	%xmm0, 464(%rsi)
	movsd	.LC9(%rip), %xmm0
	mulsd	32(%rdi), %xmm1
	mulsd	8(%rdi), %xmm0
	subsd	%xmm1, %xmm0
	movsd	%xmm0, 24(%rsi)
	movsd	200(%rdi), %xmm0
	movsd	%xmm0, 88(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 152(%rsi)
	movsd	208(%rdi), %xmm0
	movsd	%xmm0, 216(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 280(%rsi)
	movsd	224(%rdi), %xmm0
	movsd	%xmm0, 344(%rsi)
	movsd	192(%rdi), %xmm0
	movq	.LC7(%rip), %xmm2
	movsd	%xmm0, 408(%rsi)
	movsd	240(%rdi), %xmm0
	movsd	%xmm0, 472(%rsi)
	movsd	72(%rdi), %xmm0
	movaps	%xmm0, %xmm1
	movsd	48(%rdx), %xmm0
	mulsd	8(%rdi), %xmm0
	xorps	%xmm2, %xmm1
	mulsd	32(%rdi), %xmm0
	mulsd	48(%rdi), %xmm0
	mulsd	56(%rdi), %xmm0
	mulsd	.LC6(%rip), %xmm0
	subsd	%xmm0, %xmm1
	movsd	%xmm1, 32(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 96(%rsi)
	movsd	176(%rdi), %xmm0
	movsd	%xmm0, 160(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 224(%rsi)
	movsd	160(%rdi), %xmm0
	movsd	%xmm0, 288(%rsi)
	movsd	192(%rdi), %xmm0
	movsd	%xmm0, 352(%rsi)
	movsd	152(%rdi), %xmm0
	movsd	%xmm0, 416(%rsi)
	movsd	184(%rdi), %xmm0
	movsd	%xmm0, 480(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 40(%rsi)
	movsd	136(%rdi), %xmm0
	movaps	%xmm0, %xmm1
	movsd	48(%rdx), %xmm0
	mulsd	8(%rdi), %xmm0
	xorps	%xmm2, %xmm1
	mulsd	48(%rdi), %xmm0
	mulsd	.LC2(%rip), %xmm0
	subsd	%xmm0, %xmm1
	movsd	%xmm1, 104(%rsi)
	movsd	184(%rdi), %xmm0
	movsd	%xmm0, 168(%rsi)
	movsd	224(%rdi), %xmm0
	movsd	%xmm0, 232(%rsi)
	movsd	192(%rdi), %xmm0
	movsd	%xmm0, 296(%rsi)
	movsd	208(%rdi), %xmm0
	movsd	%xmm0, 360(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 424(%rsi)
	movsd	200(%rdi), %xmm0
	movsd	%xmm0, 488(%rsi)
	movsd	176(%rdi), %xmm0
	movsd	%xmm0, 48(%rsi)
	movsd	184(%rdi), %xmm0
	movsd	%xmm0, 112(%rsi)
	movsd	232(%rdi), %xmm0
	movsd	%xmm0, 176(%rsi)
	movsd	192(%rdi), %xmm0
	movsd	%xmm0, 240(%rsi)
	movsd	152(%rdi), %xmm0
	movsd	%xmm0, 304(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 368(%rsi)
	movsd	160(%rdi), %xmm0
	movsd	%xmm0, 432(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 496(%rsi)
	movsd	112(%rdi), %xmm0
	movsd	%xmm0, 56(%rsi)
	movsd	224(%rdi), %xmm0
	movsd	%xmm0, 120(%rsi)
	movsd	192(%rdi), %xmm0
	movsd	%xmm0, 184(%rsi)
	movsd	240(%rdi), %xmm0
	movsd	%xmm0, 248(%rsi)
	movsd	184(%rdi), %xmm0
	movsd	%xmm0, 312(%rsi)
	movsd	200(%rdi), %xmm0
	movsd	%xmm0, 376(%rsi)
	movsd	128(%rdi), %xmm0
	movsd	%xmm0, 440(%rsi)
	movsd	208(%rdi), %xmm0
	movsd	%xmm0, 504(%rsi)
	ret
	.cfi_endproc
.LFE2013:
	.size	_Z18populate_stiff_matPdS_P4mesh, .-_Z18populate_stiff_matPdS_P4mesh
	.globl	_Z14stiffness_initPdP4meshP8material
	.type	_Z14stiffness_initPdP4meshP8material, @function
_Z14stiffness_initPdP4meshP8material:
.LFB2009:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	movl	$248, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rsi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%rdx, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdx
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_Z18init_stiff_t_arrayPdP4meshP8material
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	call	_Z18populate_stiff_matPdS_P4mesh
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE2009:
	.size	_Z14stiffness_initPdP4meshP8material, .-_Z14stiffness_initPdP4meshP8material
	.globl	_Z17init_mass_t_arrayPdP4meshP8material
	.type	_Z17init_mass_t_arrayPdP4meshP8material, @function
_Z17init_mass_t_arrayPdP4meshP8material:
.LFB2014:
	.cfi_startproc
	endbr64
	movsd	40(%rsi), %xmm0
	mulsd	48(%rsi), %xmm0
	mulsd	.LC10(%rip), %xmm0
	movsd	%xmm0, (%rdi)
	movsd	40(%rsi), %xmm0
	mulsd	48(%rsi), %xmm0
	mulsd	.LC11(%rip), %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	40(%rsi), %xmm0
	mulsd	48(%rsi), %xmm0
	mulsd	.LC12(%rip), %xmm0
	movsd	%xmm0, 16(%rdi)
	ret
	.cfi_endproc
.LFE2014:
	.size	_Z17init_mass_t_arrayPdP4meshP8material, .-_Z17init_mass_t_arrayPdP4meshP8material
	.globl	_Z17populate_mass_matPdS_
	.type	_Z17populate_mass_matPdS_, @function
_Z17populate_mass_matPdS_:
.LFB2015:
	.cfi_startproc
	endbr64
	movsd	8(%rdi), %xmm0
	movq	$0x000000000, 64(%rsi)
	movsd	%xmm0, (%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 192(%rsi)
	movsd	%xmm0, 128(%rsi)
	movsd	16(%rdi), %xmm0
	movq	$0x000000000, 320(%rsi)
	movsd	%xmm0, 256(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 448(%rsi)
	movq	$0x000000000, 8(%rsi)
	movsd	%xmm0, 384(%rsi)
	movsd	8(%rdi), %xmm0
	movq	$0x000000000, 136(%rsi)
	movsd	%xmm0, 72(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 264(%rsi)
	movsd	%xmm0, 200(%rsi)
	movsd	16(%rdi), %xmm0
	movq	$0x000000000, 392(%rsi)
	movsd	%xmm0, 328(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 80(%rsi)
	movsd	%xmm0, 456(%rsi)
	movsd	%xmm0, 16(%rsi)
	movsd	8(%rdi), %xmm0
	movq	$0x000000000, 208(%rsi)
	movsd	%xmm0, 144(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 336(%rsi)
	movsd	%xmm0, 272(%rsi)
	movsd	16(%rdi), %xmm0
	movq	$0x000000000, 464(%rsi)
	movq	$0x000000000, 24(%rsi)
	movsd	%xmm0, 400(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 152(%rsi)
	movsd	%xmm0, 88(%rsi)
	movsd	8(%rdi), %xmm0
	movq	$0x000000000, 280(%rsi)
	movsd	%xmm0, 216(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 408(%rsi)
	movsd	%xmm0, 344(%rsi)
	movsd	16(%rdi), %xmm0
	movq	$0x000000000, 96(%rsi)
	movsd	%xmm0, 472(%rsi)
	movsd	%xmm0, 32(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 224(%rsi)
	movsd	%xmm0, 160(%rsi)
	movsd	8(%rdi), %xmm0
	movq	$0x000000000, 352(%rsi)
	movsd	%xmm0, 288(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 480(%rsi)
	movq	$0x000000000, 40(%rsi)
	movsd	%xmm0, 416(%rsi)
	movsd	16(%rdi), %xmm0
	movq	$0x000000000, 168(%rsi)
	movsd	%xmm0, 104(%rsi)
	movsd	(%rdi), %xmm0
	movsd	%xmm0, 232(%rsi)
	movq	$0x000000000, 296(%rsi)
	movsd	8(%rdi), %xmm0
	movq	$0x000000000, 424(%rsi)
	movsd	%xmm0, 360(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 112(%rsi)
	movsd	%xmm0, 488(%rsi)
	movsd	%xmm0, 48(%rsi)
	movsd	16(%rdi), %xmm0
	movq	$0x000000000, 240(%rsi)
	movsd	%xmm0, 176(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 368(%rsi)
	movsd	%xmm0, 304(%rsi)
	movsd	8(%rdi), %xmm0
	movq	$0x000000000, 496(%rsi)
	movq	$0x000000000, 56(%rsi)
	movsd	%xmm0, 432(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 184(%rsi)
	movsd	%xmm0, 120(%rsi)
	movsd	16(%rdi), %xmm0
	movq	$0x000000000, 312(%rsi)
	movsd	%xmm0, 248(%rsi)
	movsd	(%rdi), %xmm0
	movq	$0x000000000, 440(%rsi)
	movsd	%xmm0, 376(%rsi)
	movsd	8(%rdi), %xmm0
	movsd	%xmm0, 504(%rsi)
	ret
	.cfi_endproc
.LFE2015:
	.size	_Z17populate_mass_matPdS_, .-_Z17populate_mass_matPdS_
	.globl	_Z9mass_initPdP4meshP8material
	.type	_Z9mass_initPdP4meshP8material, @function
_Z9mass_initPdP4meshP8material:
.LFB2010:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	movl	$24, %edi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%rsi, 8(%rsp)
	movq	%rdx, (%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdx
	movq	%rax, %rdi
	call	_Z17init_mass_t_arrayPdP4meshP8material
	movq	%rbx, %rsi
	call	_Z17populate_mass_matPdS_
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE2010:
	.size	_Z9mass_initPdP4meshP8material, .-_Z9mass_initPdP4meshP8material
	.globl	_Z19stiffness_mass_initPPdS0_P4meshP8material
	.type	_Z19stiffness_mass_initPPdS0_P4meshP8material, @function
_Z19stiffness_mass_initPPdS0_P4meshP8material:
.LFB2008:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	movl	$512, %edi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rcx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	malloc@PLT
	movl	$512, %edi
	movq	%rax, 0(%r13)
	call	malloc@PLT
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rax, (%r14)
	movq	0(%r13), %rdi
	movq	%rax, %rbx
	call	_Z14stiffness_initPdP4meshP8material
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_Z9mass_initPdP4meshP8material
	.cfi_endproc
.LFE2008:
	.size	_Z19stiffness_mass_initPPdS0_P4meshP8material, .-_Z19stiffness_mass_initPPdS0_P4meshP8material
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2041:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2041:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1072693248
	.align 8
.LC1:
	.long	1431655765
	.long	1070945621
	.align 8
.LC2:
	.long	1431655765
	.long	1067799893
	.align 8
.LC3:
	.long	1431655765
	.long	1068848469
	.align 8
.LC4:
	.long	1431655765
	.long	1066751317
	.align 8
.LC5:
	.long	-1431655765
	.long	1069722282
	.align 8
.LC6:
	.long	1431655765
	.long	1069897045
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC7:
	.long	0
	.long	-2147483648
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC8:
	.long	1431655765
	.long	-1080732331
	.align 8
.LC9:
	.long	-1431655765
	.long	-1077761366
	.align 8
.LC10:
	.long	477218588
	.long	1070363079
	.align 8
.LC11:
	.long	477218588
	.long	1071411655
	.align 8
.LC12:
	.long	477218588
	.long	1069314503
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdlib.h>
#include <math.h>

#include "constants.cuh"
#include "mesh.cuh"
#include "material.cuh"

//------------------------------------------------------PROTOTIPES--------------------------------
void stiffness_init(double *ke, struct mesh *mesh, struct material *material);
void mass_init(double *me, struct mesh *mesh, struct material *material);
void init_stiff_t_array(double *t, struct mesh *mesh, struct material *material);
void populate_stiff_mat(double *t, double *ke, struct mesh *mesh);
void init_mass_t_array(double *t, struct mesh *mesh, struct material *material);
void populate_mass_mat(double *t, double *ke);

//------------------------------------------------------BODIES-------------------------------------
void stiffness_mass_init(double **ke, double **me, struct mesh *mesh, struct material *material) {
	(*ke) = (double*)malloc(KEROW*KECOL * sizeof(double));
	(*me) = (double*)malloc(MEROW*MECOL * sizeof(double));

	stiffness_init((*ke), mesh, material);
	mass_init((*me), mesh, material);
}

void stiffness_init(double *ke, struct mesh *mesh, struct material *material) {
	double *t;
	t = (double*)malloc(31 * sizeof(double));
	init_stiff_t_array(t, mesh, material);
	populate_stiff_mat(t, ke, mesh);
	free(t);

}

void mass_init(double *me, struct mesh *mesh, struct material *material) {
	double *t;
	t = (double*)malloc(3 * sizeof(double));
	init_mass_t_array(t, mesh, material);
	populate_mass_mat(t, me);

	free(t);
	
}

void init_stiff_t_array(double *t, struct mesh *mesh, struct material *material) {
	t[0] = material->nu + 1.0; //t2
	t[1] = 1.0 / t[0];	//t3
	t[2] = material->nu * 2.0; //t4
	t[3] = t[2] - 1; //t5
	t[4] = 1.0 / t[3];//t6
	t[5] = 1.0 / mesh->by; //t7
	t[6] = 1.0 / mesh->ax; //t8
	t[7] = material->nu - 1.0; //t9
	t[8] = mesh->by*t[1] * t[4] * t[6] * t[7] * (1.0 / 3.0); //t10
	t[9] = mesh->ax *t[1] * t[5] * (1.0 / (2.4 * pow(10, 1))); //t11
	t[10] = mesh->ax *t[1] * t[5] * (1.0 / (1.2 * pow(10, 1))); //t12
	t[11] = t[4] * (1.0 / (1.2 * pow(10, 1))); //t13
	t[12] = t[1] * (1.0 / (4.8 * pow(10, 1))); //t14
	t[13] = t[1] * (7.0 / (4.8 * pow(10, 1))); //t15
	t[14] = t[11] + t[13]; //t16
	t[15] = mesh->by*t[1] * t[6] * (1.0 / (1.2 * pow(10, 1))); //t17
	t[16] = t[11] + t[12]; //t18
	t[17] = mesh->ax*t[1] * t[4] * t[5] * t[7] * (1.0 / 6.0); //t19
	t[18] = mesh->ax*t[1] * t[4] * t[5] * t[7] * (1.0 / 3.0); //t20
	t[19] = -t[8] + t[9]; //t21
	t[20] = t[8] + t[10]; //t22
	t[21] = mesh->by*t[1] * t[4] * t[6] * t[7] * (1.0 / 6.0); //t23
	t[22] = -t[10] + t[21]; //t24
	t[23] = -t[11] - t[13]; //t25
	t[24] = -t[11] - t[12]; //t26
	t[25] = -t[15] + t[17]; //t27
	t[26] = t[15] + t[18]; //t28
	t[27] = mesh->by*t[1] * t[6] * (1.0 / (2.4*pow(10, 1))); //t29
	t[28] = -t[18] + t[27]; //t30
	t[29] = -t[9] - t[21]; //t31
	t[30] = -t[17] - t[27]; //t32

}

void populate_stiff_mat(double *t, double *ke, struct mesh *mesh ) {
	int row_index=0,col_index=0;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[29]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[1]*(-1.0/(4.8*pow(10,1)))-t[4]*(1.0/(1.2*pow(10,1))); col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[25]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[30]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[29]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[1] * (-7.0 / (4.8*pow(10, 1))) - t[4] * (1.0 / (1.2*pow(10, 1))); col_index += 8;
	ke[row_index + col_index] = t[25]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[30]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = -t[9] - mesh->by*t[1]*t[4]*t[6]*t[7]*(1.0/6.0); col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = - t[17] - mesh->by * t[1] * t[6] * (1.0/(2.4*pow(10,1))); col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[25]; col_index = 0; row_index++;
	
	ke[row_index + col_index] = t[22]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[29]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[19]; col_index += 8;
	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[20]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index = 0; row_index++;

	ke[row_index + col_index] = t[14]; col_index += 8;
	ke[row_index + col_index] = t[28]; col_index += 8;
	ke[row_index + col_index] = t[24]; col_index += 8;
	ke[row_index + col_index] = t[30]; col_index += 8;
	ke[row_index + col_index] = t[23]; col_index += 8;
	ke[row_index + col_index] = t[25]; col_index += 8;
	ke[row_index + col_index] = t[16]; col_index += 8;
	ke[row_index + col_index] = t[26]; col_index += 8;
}

void init_mass_t_array(double *t, struct mesh *mesh, struct material *material) {
	t[0] = mesh->ax*mesh->by*(2.0 / 9.0);
	t[1] = mesh->ax*mesh->by*(4.0 / 9.0);
	t[2] = mesh->ax*mesh->by*(1.0 / 9.0);

}

void populate_mass_mat(double *t, double *me) {
	int row_index = 0, col_index = 0;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index = 0; row_index++;

	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index = 0; row_index++;

	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index = 0; row_index++;

	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
	me[row_index + col_index] = 0; col_index = 0; row_index++;

	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[2]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[0]; col_index += 8;
	me[row_index + col_index] = 0; col_index += 8;
	me[row_index + col_index] = t[1]; col_index += 8;
}




	.text
	.file	"stiffness_mass_init.hip"
	.globl	_Z19stiffness_mass_initPPdS0_P4meshP8material # -- Begin function _Z19stiffness_mass_initPPdS0_P4meshP8material
	.type	_Z19stiffness_mass_initPPdS0_P4meshP8material,@function
_Z19stiffness_mass_initPPdS0_P4meshP8material: # @_Z19stiffness_mass_initPPdS0_P4meshP8material
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rcx, %rbx
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r12
	movl	$512, %edi                      # imm = 0x200
	callq	malloc
	movq	%rax, (%r12)
	movl	$512, %edi                      # imm = 0x200
	callq	malloc
	movq	%rax, (%r15)
	movq	(%r12), %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_Z14stiffness_initPdP4meshP8material
	movq	(%r15), %rdi
	movq	%r14, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	_Z9mass_initPdP4meshP8material  # TAILCALL
.Lfunc_end0:
	.size	_Z19stiffness_mass_initPPdS0_P4meshP8material, .Lfunc_end0-_Z19stiffness_mass_initPPdS0_P4meshP8material
	.cfi_endproc
                                        # -- End function
	.globl	_Z14stiffness_initPdP4meshP8material # -- Begin function _Z14stiffness_initPdP4meshP8material
	.type	_Z14stiffness_initPdP4meshP8material,@function
_Z14stiffness_initPdP4meshP8material:   # @_Z14stiffness_initPdP4meshP8material
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	movl	$248, %edi
	callq	malloc
	movq	%rax, %r12
	movq	%rax, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_Z18init_stiff_t_arrayPdP4meshP8material
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_Z18populate_stiff_matPdS_P4mesh
	movq	%r12, %rdi
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end1:
	.size	_Z14stiffness_initPdP4meshP8material, .Lfunc_end1-_Z14stiffness_initPdP4meshP8material
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z9mass_initPdP4meshP8material
.LCPI2_0:
	.quad	0x3fcc71c71c71c71c              # double 0.22222222222222221
.LCPI2_1:
	.quad	0x3fdc71c71c71c71c              # double 0.44444444444444442
.LCPI2_2:
	.quad	0x3fbc71c71c71c71c              # double 0.1111111111111111
	.text
	.globl	_Z9mass_initPdP4meshP8material
	.type	_Z9mass_initPdP4meshP8material,@function
_Z9mass_initPdP4meshP8material:         # @_Z9mass_initPdP4meshP8material
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	$24, %edi
	callq	malloc
	movq	%rax, %r15
	movsd	40(%rbx), %xmm0                 # xmm0 = mem[0],zero
	mulsd	48(%rbx), %xmm0
	movsd	.LCPI2_0(%rip), %xmm1           # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, (%rax)
	movsd	.LCPI2_1(%rip), %xmm1           # xmm1 = mem[0],zero
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rax)
	mulsd	.LCPI2_2(%rip), %xmm0
	movsd	%xmm0, 16(%rax)
	movq	%rax, %rdi
	movq	%r14, %rsi
	callq	_Z17populate_mass_matPdS_
	movq	%r15, %rdi
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	free                            # TAILCALL
.Lfunc_end2:
	.size	_Z9mass_initPdP4meshP8material, .Lfunc_end2-_Z9mass_initPdP4meshP8material
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z18init_stiff_t_arrayPdP4meshP8material
.LCPI3_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI3_1:
	.quad	0xbff0000000000000              # double -1
.LCPI3_2:
	.quad	0x3fd5555555555555              # double 0.33333333333333331
.LCPI3_3:
	.quad	0x3fa5555555555555              # double 0.041666666666666664
.LCPI3_4:
	.quad	0x3fb5555555555555              # double 0.083333333333333329
.LCPI3_5:
	.quad	0x3f95555555555555              # double 0.020833333333333332
.LCPI3_6:
	.quad	0x3fc2aaaaaaaaaaab              # double 0.14583333333333334
.LCPI3_7:
	.quad	0x3fc5555555555555              # double 0.16666666666666666
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0
.LCPI3_8:
	.quad	0x8000000000000000              # double -0
	.quad	0x8000000000000000              # double -0
	.text
	.globl	_Z18init_stiff_t_arrayPdP4meshP8material
	.type	_Z18init_stiff_t_arrayPdP4meshP8material,@function
_Z18init_stiff_t_arrayPdP4meshP8material: # @_Z18init_stiff_t_arrayPdP4meshP8material
	.cfi_startproc
# %bb.0:
	movsd	.LCPI3_0(%rip), %xmm1           # xmm1 = mem[0],zero
	movsd	32(%rdx), %xmm2                 # xmm2 = mem[0],zero
	addsd	%xmm1, %xmm2
	movsd	%xmm2, (%rdi)
	movapd	%xmm1, %xmm0
	divsd	%xmm2, %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	32(%rdx), %xmm2                 # xmm2 = mem[0],zero
	addsd	%xmm2, %xmm2
	movsd	%xmm2, 16(%rdi)
	movsd	.LCPI3_1(%rip), %xmm4           # xmm4 = mem[0],zero
	addsd	%xmm4, %xmm2
	movsd	%xmm2, 24(%rdi)
	movapd	%xmm1, %xmm8
	divsd	%xmm2, %xmm8
	movsd	%xmm8, 32(%rdi)
	movapd	%xmm1, %xmm14
	divsd	48(%rsi), %xmm14
	movsd	%xmm14, 40(%rdi)
	divsd	40(%rsi), %xmm1
	movsd	%xmm1, 48(%rdi)
	addsd	32(%rdx), %xmm4
	movsd	%xmm4, 56(%rdi)
	movsd	48(%rsi), %xmm12                # xmm12 = mem[0],zero
	mulsd	%xmm0, %xmm12
	mulsd	%xmm8, %xmm12
	mulsd	%xmm1, %xmm12
	mulsd	%xmm4, %xmm12
	movsd	.LCPI3_2(%rip), %xmm15          # xmm15 = mem[0],zero
	mulsd	%xmm15, %xmm12
	movsd	%xmm12, 64(%rdi)
	movsd	40(%rsi), %xmm2                 # xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	mulsd	%xmm14, %xmm2
	mulsd	.LCPI3_3(%rip), %xmm2
	movsd	%xmm2, 72(%rdi)
	movsd	40(%rsi), %xmm5                 # xmm5 = mem[0],zero
	mulsd	%xmm0, %xmm5
	mulsd	%xmm14, %xmm5
	movsd	.LCPI3_4(%rip), %xmm9           # xmm9 = mem[0],zero
	mulsd	%xmm9, %xmm5
	movsd	%xmm5, 80(%rdi)
	movapd	%xmm8, %xmm6
	mulsd	%xmm9, %xmm6
	movsd	%xmm6, 88(%rdi)
	movsd	.LCPI3_5(%rip), %xmm7           # xmm7 = mem[0],zero
	mulsd	%xmm0, %xmm7
	movsd	%xmm7, 96(%rdi)
	movsd	.LCPI3_6(%rip), %xmm11          # xmm11 = mem[0],zero
	mulsd	%xmm0, %xmm11
	movsd	%xmm11, 104(%rdi)
	movapd	%xmm11, %xmm10
	addsd	%xmm6, %xmm10
	movsd	%xmm10, 112(%rdi)
	movsd	48(%rsi), %xmm10                # xmm10 = mem[0],zero
	mulsd	%xmm0, %xmm10
	mulsd	%xmm1, %xmm10
	mulsd	%xmm9, %xmm10
	movsd	%xmm10, 120(%rdi)
	movapd	%xmm7, %xmm9
	addsd	%xmm6, %xmm9
	movsd	%xmm9, 128(%rdi)
	movsd	40(%rsi), %xmm9                 # xmm9 = mem[0],zero
	mulsd	%xmm0, %xmm9
	mulsd	%xmm8, %xmm9
	mulsd	%xmm14, %xmm9
	mulsd	%xmm4, %xmm9
	movsd	.LCPI3_7(%rip), %xmm3           # xmm3 = mem[0],zero
	mulsd	%xmm3, %xmm9
	movsd	%xmm9, 136(%rdi)
	movsd	40(%rsi), %xmm13                # xmm13 = mem[0],zero
	mulsd	%xmm0, %xmm13
	mulsd	%xmm8, %xmm13
	mulsd	%xmm14, %xmm13
	mulsd	%xmm4, %xmm13
	mulsd	%xmm15, %xmm13
	movsd	%xmm13, 144(%rdi)
	movapd	%xmm2, %xmm14
	subsd	%xmm12, %xmm14
	movsd	%xmm14, 152(%rdi)
	addsd	%xmm5, %xmm12
	movsd	%xmm12, 160(%rdi)
	movsd	48(%rsi), %xmm12                # xmm12 = mem[0],zero
	mulsd	%xmm0, %xmm12
	mulsd	%xmm8, %xmm12
	mulsd	%xmm1, %xmm12
	mulsd	%xmm4, %xmm12
	mulsd	%xmm3, %xmm12
	movsd	%xmm12, 168(%rdi)
	movapd	.LCPI3_8(%rip), %xmm4           # xmm4 = [-0.0E+0,-0.0E+0]
	xorpd	%xmm4, %xmm2
	subsd	%xmm12, %xmm2
	subsd	%xmm5, %xmm12
	movsd	%xmm12, 176(%rdi)
	xorpd	%xmm4, %xmm6
	movapd	%xmm6, %xmm3
	subsd	%xmm11, %xmm3
	movsd	%xmm3, 184(%rdi)
	subsd	%xmm7, %xmm6
	movsd	%xmm6, 192(%rdi)
	movapd	%xmm9, %xmm3
	subsd	%xmm10, %xmm3
	movsd	%xmm3, 200(%rdi)
	addsd	%xmm13, %xmm10
	movsd	%xmm10, 208(%rdi)
	mulsd	48(%rsi), %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	.LCPI3_3(%rip), %xmm0
	xorpd	%xmm4, %xmm9
	movsd	%xmm0, 216(%rdi)
	subsd	%xmm0, %xmm9
	subsd	%xmm13, %xmm0
	movsd	%xmm0, 224(%rdi)
	movsd	%xmm2, 232(%rdi)
	movsd	%xmm9, 240(%rdi)
	retq
.Lfunc_end3:
	.size	_Z18init_stiff_t_arrayPdP4meshP8material, .Lfunc_end3-_Z18init_stiff_t_arrayPdP4meshP8material
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z18populate_stiff_matPdS_P4mesh
.LCPI4_0:
	.quad	0xbf95555555555555              # double -0.020833333333333332
.LCPI4_1:
	.quad	0x3fb5555555555555              # double 0.083333333333333329
.LCPI4_2:
	.quad	0xbfc2aaaaaaaaaaab              # double -0.14583333333333334
.LCPI4_3:
	.quad	0xbfc5555555555555              # double -0.16666666666666666
.LCPI4_4:
	.quad	0xbfa5555555555555              # double -0.041666666666666664
	.text
	.globl	_Z18populate_stiff_matPdS_P4mesh
	.type	_Z18populate_stiff_matPdS_P4mesh,@function
_Z18populate_stiff_matPdS_P4mesh:       # @_Z18populate_stiff_matPdS_P4mesh
	.cfi_startproc
# %bb.0:
	movsd	160(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, (%rsi)
	movsd	192(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 64(%rsi)
	movsd	152(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 128(%rsi)
	movsd	184(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 192(%rsi)
	movsd	232(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 256(%rsi)
	movsd	128(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 320(%rsi)
	movsd	176(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 384(%rsi)
	movsd	112(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 448(%rsi)
	movsd	8(%rdi), %xmm1                  # xmm1 = mem[0],zero
	mulsd	.LCPI4_0(%rip), %xmm1
	movsd	.LCPI4_1(%rip), %xmm0           # xmm0 = mem[0],zero
	movsd	32(%rdi), %xmm2                 # xmm2 = mem[0],zero
	mulsd	%xmm0, %xmm2
	subsd	%xmm2, %xmm1
	movsd	%xmm1, 8(%rsi)
	movsd	208(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 72(%rsi)
	movsd	112(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 136(%rsi)
	movsd	200(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 200(%rsi)
	movsd	128(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 264(%rsi)
	movsd	240(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 328(%rsi)
	movsd	184(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 392(%rsi)
	movsd	224(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 456(%rsi)
	movsd	152(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 16(%rsi)
	movsd	112(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 80(%rsi)
	movsd	160(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 144(%rsi)
	movsd	128(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 208(%rsi)
	movsd	176(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 272(%rsi)
	movsd	184(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 336(%rsi)
	movsd	232(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 400(%rsi)
	movsd	192(%rdi), %xmm1                # xmm1 = mem[0],zero
	movsd	%xmm1, 464(%rsi)
	movsd	8(%rdi), %xmm1                  # xmm1 = mem[0],zero
	mulsd	.LCPI4_2(%rip), %xmm1
	mulsd	32(%rdi), %xmm0
	subsd	%xmm0, %xmm1
	movsd	%xmm1, 24(%rsi)
	movsd	200(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 88(%rsi)
	movsd	128(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 152(%rsi)
	movsd	208(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 216(%rsi)
	movsd	112(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 280(%rsi)
	movsd	224(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 344(%rsi)
	movsd	192(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 408(%rsi)
	movsd	240(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 472(%rsi)
	movsd	48(%rdx), %xmm0                 # xmm0 = mem[0],zero
	mulsd	8(%rdi), %xmm0
	mulsd	32(%rdi), %xmm0
	mulsd	48(%rdi), %xmm0
	mulsd	56(%rdi), %xmm0
	mulsd	.LCPI4_3(%rip), %xmm0
	subsd	72(%rdi), %xmm0
	movsd	%xmm0, 32(%rsi)
	movsd	128(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 96(%rsi)
	movsd	176(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 160(%rsi)
	movsd	112(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 224(%rsi)
	movsd	160(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 288(%rsi)
	movsd	192(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 352(%rsi)
	movsd	152(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 416(%rsi)
	movsd	184(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 480(%rsi)
	movsd	128(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 40(%rsi)
	movsd	48(%rdx), %xmm0                 # xmm0 = mem[0],zero
	mulsd	8(%rdi), %xmm0
	mulsd	48(%rdi), %xmm0
	mulsd	.LCPI4_4(%rip), %xmm0
	subsd	136(%rdi), %xmm0
	movsd	%xmm0, 104(%rsi)
	movsd	184(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 168(%rsi)
	movsd	224(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 232(%rsi)
	movsd	192(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 296(%rsi)
	movsd	208(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 360(%rsi)
	movsd	112(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 424(%rsi)
	movsd	200(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 488(%rsi)
	movsd	176(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 48(%rsi)
	movsd	184(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 112(%rsi)
	movsd	232(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 176(%rsi)
	movsd	192(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 240(%rsi)
	movsd	152(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 304(%rsi)
	movsd	112(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 368(%rsi)
	movsd	160(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 432(%rsi)
	movsd	128(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 496(%rsi)
	movsd	112(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 56(%rsi)
	movsd	224(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 120(%rsi)
	movsd	192(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 184(%rsi)
	movsd	240(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 248(%rsi)
	movsd	184(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 312(%rsi)
	movsd	200(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 376(%rsi)
	movsd	128(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 440(%rsi)
	movsd	208(%rdi), %xmm0                # xmm0 = mem[0],zero
	movsd	%xmm0, 504(%rsi)
	retq
.Lfunc_end4:
	.size	_Z18populate_stiff_matPdS_P4mesh, .Lfunc_end4-_Z18populate_stiff_matPdS_P4mesh
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z17init_mass_t_arrayPdP4meshP8material
.LCPI5_0:
	.quad	0x3fcc71c71c71c71c              # double 0.22222222222222221
.LCPI5_1:
	.quad	0x3fdc71c71c71c71c              # double 0.44444444444444442
.LCPI5_2:
	.quad	0x3fbc71c71c71c71c              # double 0.1111111111111111
	.text
	.globl	_Z17init_mass_t_arrayPdP4meshP8material
	.type	_Z17init_mass_t_arrayPdP4meshP8material,@function
_Z17init_mass_t_arrayPdP4meshP8material: # @_Z17init_mass_t_arrayPdP4meshP8material
	.cfi_startproc
# %bb.0:
	movsd	40(%rsi), %xmm0                 # xmm0 = mem[0],zero
	mulsd	48(%rsi), %xmm0
	mulsd	.LCPI5_0(%rip), %xmm0
	movsd	%xmm0, (%rdi)
	movsd	40(%rsi), %xmm0                 # xmm0 = mem[0],zero
	mulsd	48(%rsi), %xmm0
	mulsd	.LCPI5_1(%rip), %xmm0
	movsd	%xmm0, 8(%rdi)
	movsd	40(%rsi), %xmm0                 # xmm0 = mem[0],zero
	mulsd	48(%rsi), %xmm0
	mulsd	.LCPI5_2(%rip), %xmm0
	movsd	%xmm0, 16(%rdi)
	retq
.Lfunc_end5:
	.size	_Z17init_mass_t_arrayPdP4meshP8material, .Lfunc_end5-_Z17init_mass_t_arrayPdP4meshP8material
	.cfi_endproc
                                        # -- End function
	.globl	_Z17populate_mass_matPdS_       # -- Begin function _Z17populate_mass_matPdS_
	.type	_Z17populate_mass_matPdS_,@function
_Z17populate_mass_matPdS_:              # @_Z17populate_mass_matPdS_
	.cfi_startproc
# %bb.0:
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, (%rsi)
	xorl	%eax, %eax
	movq	%rax, 64(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 128(%rsi)
	movq	%rax, 192(%rsi)
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 256(%rsi)
	movq	%rax, 320(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 384(%rsi)
	movq	%rax, 448(%rsi)
	movq	%rax, 8(%rsi)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 72(%rsi)
	movq	%rax, 136(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 200(%rsi)
	movq	%rax, 264(%rsi)
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 328(%rsi)
	movq	%rax, 392(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 456(%rsi)
	movsd	%xmm0, 16(%rsi)
	movq	%rax, 80(%rsi)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 144(%rsi)
	movq	%rax, 208(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 272(%rsi)
	movq	%rax, 336(%rsi)
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 400(%rsi)
	movq	%rax, 464(%rsi)
	movq	%rax, 24(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 88(%rsi)
	movq	%rax, 152(%rsi)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 216(%rsi)
	movq	%rax, 280(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 344(%rsi)
	movq	%rax, 408(%rsi)
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 472(%rsi)
	movsd	%xmm0, 32(%rsi)
	movq	%rax, 96(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 160(%rsi)
	movq	%rax, 224(%rsi)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 288(%rsi)
	movq	%rax, 352(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 416(%rsi)
	movq	%rax, 480(%rsi)
	movq	%rax, 40(%rsi)
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 104(%rsi)
	movq	%rax, 168(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 232(%rsi)
	movq	%rax, 296(%rsi)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 360(%rsi)
	movq	%rax, 424(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 488(%rsi)
	movsd	%xmm0, 48(%rsi)
	movq	%rax, 112(%rsi)
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 176(%rsi)
	movq	%rax, 240(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 304(%rsi)
	movq	%rax, 368(%rsi)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 432(%rsi)
	movq	%rax, 496(%rsi)
	movq	%rax, 56(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 120(%rsi)
	movq	%rax, 184(%rsi)
	movsd	16(%rdi), %xmm0                 # xmm0 = mem[0],zero
	movsd	%xmm0, 248(%rsi)
	movq	%rax, 312(%rsi)
	movsd	(%rdi), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, 376(%rsi)
	movq	%rax, 440(%rsi)
	movsd	8(%rdi), %xmm0                  # xmm0 = mem[0],zero
	movsd	%xmm0, 504(%rsi)
	retq
.Lfunc_end6:
	.size	_Z17populate_mass_matPdS_, .Lfunc_end6-_Z17populate_mass_matPdS_
	.cfi_endproc
                                        # -- End function
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
