// File: /workspace/github_c_makefile_star2_O3/YunyiQian[P]multitel3/./rayinformation.c
// Function: rayinformation
int rayinformation(
	char *name,		//name of input model, "none" means using default model(prem)
	double sdepth,		//depth of the source in km
	double ddepth,		//depth of the discontinuity in km
	double rdepth,		//depth of the receiver in km
	int indicator[4],	//indicators of ray type
	double Vd[6],		//information of discontinuity structure
	double Vr[2],		//information of receiver side structure, Vr[0] is Vs, Vr[1] is Vp
	char *outfile,		//name of output file
	double dh            //ifferential of hh when generating ray information
	){


	int P1 = indicator[0];	//indicator of first part of ray is P wave(1) or S wave(0)
	int P2 = indicator[1];	//indicator of second part of ray, same as above
	int Turn1 = indicator[2];	//indicator of first part of ray is going to turn(1) or not(0)
	int Turn2 = indicator[3];	//indicator of second part of ray, same as above

	int i,j;
        int kk;
	int ks,ke;	//number of source layer and discontinuity layer in model 1
	int ls,le;	//number of discontinuity layer and receiver layer in model 2
	int error1;
	int error2;
	int num;
	double hh;	//takeoff angle of phase
	double hstart,hend;	//start and end of hh
//	double dh = 0.005;	//differential of hh when generating ray information
	double parameter;	//ray parameter in spherical model
	double xc,ti;		//great circle distance and traveltime
	double Q;		//t star in attenuation

	double V1[2],V2[2];	//V1[0/1] is Vs/Vp of incident side and V2[0/1] is Vs/Vp of another side
	double Rho1,Rho2;	//Rho1 is rho of incident side and Rho2 is another side
	double dhh,dgcarc;	//differential of takeoff angle and great circle distance when calculating geometrical spreading factor
	double R_recv,R_disc;	//Riduals of receiver and discontinuity
	double factor;
	double ii,rr,ll;	//incident, refleced angle at discontinuity and incident angle at receiver
	double temp;
	int temp1;
        int temp2;
        int temp3;
        int temp4;
	int type;
	int sum;


	double HH[MAX],PA[MAX];		//takeoff angle and ray parameter
	double DEG[MAX],XC[MAX],XC1[MAX],XC2[MAX];	//great circle distance at discontinuity and at receiver
	double QQ[MAX],TI[MAX];		//t star in attenuation and traveltime
	double DIFFU[MAX];		//geometrical spreading factor
	double REF_CO[MAX];		//reflection coefficient factor
	MODEL *m1,*m2;
	FILE *fp;

	if ( Turn1 == 0 && sdepth > ddepth ){
		hstart = PI/2. + dh;
		hend   = PI - dh;
	}else{
//		hstart = dh;
//		hend   = PI/2. - dh;
		hstart = 0;
                hend   = PI/2. - dh;
	}
	
	for (i=0,sum=0;i<4;i++){
		sum += indicator[i];
	}

	m1 = (MODEL *)malloc(sizeof(MODEL));
	model_input(name,m1);
	model_init(m1,sdepth,&ks,ddepth,&ke,P1);

	m2 = (MODEL *)malloc(sizeof(MODEL));
	model_input(name,m2);
	model_init(m2,ddepth,&ls,rdepth,&le,P2);

	fp = fopen(outfile,"w");
	if (fp == NULL){
		fprintf(stderr,"Error in opening outfile\n");
		exit(-1);
	}

	R_recv = Rearth - rdepth;
	R_disc = Rearth - ddepth;

	for (hh = hstart,num = 0;hh < hend;hh += dh){
		parameter = m1->p[ks]*sin(hh);
		if (sum != 1){
			error1 = raytrace2(m1,parameter,ks,ke,Turn1,&xc,&Q,&ti);
		}else{
			error1 = raytrace3(m1,parameter,ks,ke,Turn1,&xc,&Q,&ti);
		}

		if (error1 == -1){
			continue;
		}

		HH[num] = hh;
		PA[num] = parameter;
		XC1[num]=xc;
		XC[num] = xc;
		DEG[num] = XC[num];
		TI[num] = ti;
		QQ[num] = Q;

		if (sum != 1){
			error2 = raytrace2(m2,parameter,ls,le,Turn2,&xc,&Q,&ti);
		}else{
			error2 = raytrace3(m2,parameter,ls,le,Turn2,&xc,&Q,&ti);
		}

		if (error2 == -1){
			continue;
		}
		XC2[num] =xc;
		XC[num] += xc;
		TI[num] += ti;
		QQ[num] += Q;

		if ( XC[num] < gcarc_min || XC[num] > gcarc_max || XC[num] != XC[num] ){
//                if ( XC[num] < gcarc_min || XC[num] > gcarc_max){
			continue;
		}

		num++;
	}

//	for (i=1;i<num-1;i++){
//		printf("dist1=%f\tdist2=%f\n",XC1[i],XC2[i]);
//		}	

	for (i=1;i<num-1;i++){
		/* determine which side the ray is approach to discontinuity */
		if (Turn1 == 0 && sdepth < ddepth){
			V1[0] = Vd[0];		//V1[0] is Vs of incident side
			V1[1] = Vd[1];		//V1[1] is Vp of incident side
			Rho1  = Vd[2];		//rho of incident side
			
			V2[0] = Vd[3];		//V2[0] is Vs of another side
			V2[1] = Vd[4];		//V2[1] is Vp of another side
			Rho2  = Vd[5];		//rho of another side
		}else{
			V1[0] = Vd[3];		//the same as describe above
			V1[1] = Vd[4];
			Rho1  = Vd[5];

			V2[0] = Vd[0];
			V2[1] = Vd[1];
			Rho2  = Vd[2];
		}

                dgcarc = (XC[i+1] - XC[i-1])/2    ;
                dhh  = (HH[i+1]-HH[i])        ;



		ii = asin( PA[i]*V1[P1]/R_disc );
		rr = asin( PA[i]*V1[P2]/R_disc );
		ll = asin( PA[i]*Vr[P2]/R_recv );

                temp = rad2deg*dhh*sin(HH[i])/( sin(deg2rad*XC[i])*cos(ll)*dgcarc );
		DIFFU[i] = sqrt( fabs(temp) )/R_recv;
// printf("gcarc=%f\ttheta=%f\ti0=%f\tsin(theta)=%f\tcos(i0)=%f\tsin(gcarc)=%f\tsin(theta)/sin(gcarc)/cos(i0)=%f\tdtheta=%f\tdgcarc=%f\tdtheta/dgcarc=%f\tG=%f\n",XC[i],HH[i]*180/PI,ll*180/PI,sin(HH[i]),cos(ll),sin(deg2rad*XC[i]),sin(HH[i])/(sin(deg2rad*XC[i])*cos(ll)),dhh*180/PI,dgcarc,dhh*180/PI/dgcarc,DIFFU[i]*1e5);
		/* determine type of reflection, no Sv to Sv reflection */
		if ( P1 == 1 && P2 == 1 ){
			type = 1;
		}else if ( P1 == 1 && P2 == 0 ){
			type = 2;
		}else if ( P1 == 0 && P2 == 1 ){
			type = 3;
		}else if ( P1 == 0 && P2 == 0 ){
			type = 5;
		}

		REF_CO[i] = Reflection_Coefficient(V1[1],V1[0],V2[1],V2[0],Rho1,Rho2,ii,type);
//		if ( REF_CO[i] != REF_CO[i] ) printf ("%lf\t%d\t%d\t%d\t%d\n",V1[0],V2[0],P2,Turn1,Turn2);
	}


                                               
	
//	DIFFU[1]=(17*DIFFU[i-4]+14*DIFFU[i-3]+11*DIFFU[i-2]+8*DIFFU[i-1]+5*DIFFU[i]+2*DIFFU[i+1]-DIFFU[i+2]-4*DIFFU[i+3]-7*DIFFU[i+4])/45;
//	DIFFU[2]=(56*DIFFU[i-4]+47*DIFFU[i-3]+38*DIFFU[i-2]+29*DIFFU[i-1]+20*DIFFU[i]+11*DIFFU[i+1]+2*DIFFU[i+2]-7*DIFFU[i+3]-16*DIFFU[i+4])/180;
//	DIFFU[3]=(22*DIFFU[i-4]+19*DIFFU[i-3]+16*DIFFU[i-2]+13*DIFFU[i-1]+10*DIFFU[i]+7*DIFFU[i+1]+4*DIFFU[i+2]+DIFFU[i+3]-2*DIFFU[i+4])/90;
//	DIFFU[4]=(32*DIFFU[i-4]+29*DIFFU[i-3]+26*DIFFU[i-2]+23*DIFFU[i-1]+20*DIFFU[i]+17*DIFFU[i+1]+14*DIFFU[i+2]+11*DIFFU[i+3]+8*DIFFU[i+4])/180;
	for (i=25;i<num-16;i++){
        	DIFFU[i]=(DIFFU[i-4]+DIFFU[i-3]+DIFFU[i-2]+DIFFU[i-1]+DIFFU[i]+DIFFU[i+1]+DIFFU[i+2]+DIFFU[i+3]+DIFFU[i+4])/9;
        }//9 for all

        for (j=1;j<30;j++){
        	for (i=1;i<num-1;i++){
			if(XC[i]>=26 && XC[i]<=40)
                        	DIFFU[i]=(DIFFU[i-4]+DIFFU[i-3]+DIFFU[i-2]+DIFFU[i-1]+DIFFU[i]+DIFFU[i+1]+DIFFU[i+2]+DIFFU[i+3]+DIFFU[i+4])/9;
        	}
        }
        for (j=1;j<30;j++){
                for (i=1;i<num-1;i++){
                        if(XC[i]>=35 && XC[i]<=50)
                                DIFFU[i]=(DIFFU[i-4]+DIFFU[i-3]+DIFFU[i-2]+DIFFU[i-1]+DIFFU[i]+DIFFU[i+1]+DIFFU[i+2]+DIFFU[i+3]+DIFFU[i+4])/9;
                }
        }

        for (j=1;j<30;j++){
                for (i=1;i<num-1;i++){
                        if(XC[i]>=85 && XC[i]<=95)
                                DIFFU[i]=(DIFFU[i-4]+DIFFU[i-3]+DIFFU[i-2]+DIFFU[i-1]+DIFFU[i]+DIFFU[i+1]+DIFFU[i+2]+DIFFU[i+3]+DIFFU[i+4])/9;
                }
        }
        for (j=1;j<30;j++){
                for (i=1;i<num-1;i++){
                        if(XC[i]>=80 && XC[i]<=90)
                                DIFFU[i]=(DIFFU[i-4]+DIFFU[i-3]+DIFFU[i-2]+DIFFU[i-1]+DIFFU[i]+DIFFU[i+1]+DIFFU[i+2]+DIFFU[i+3]+DIFFU[i+4])/9;
                }
        }

//	DIFFU[num-5]=(8*DIFFU[i-4]+11*DIFFU[i-3]+14*DIFFU[i-2]+17*DIFFU[i-1]+20*DIFFU[i]+23*DIFFU[i+1]+26*DIFFU[i+2]+29*DIFFU[i+3]+32*DIFFU[i+4])/180;
//        DIFFU[num-4]=(-2*DIFFU[i-4]+DIFFU[i-3]+4*DIFFU[i-2]+7*DIFFU[i-1]+10*DIFFU[i]+13*DIFFU[i+1]+16*DIFFU[i+2]+19*DIFFU[i+3]+22*DIFFU[i+4])/90;
//        DIFFU[num-3]=(-16*DIFFU[i-4]-7*DIFFU[i-3]+2*DIFFU[i-2]+11*DIFFU[i-1]+20*DIFFU[i]+29*DIFFU[i+1]+38*DIFFU[i+2]+47*DIFFU[i+3]+56*DIFFU[i+4])/180;
//        DIFFU[num-2]=(-7*DIFFU[i-4]-4*DIFFU[i-3]-DIFFU[i-2]+2*DIFFU[i-1]+5*DIFFU[i]+8*DIFFU[i+1]+11*DIFFU[i+2]+14*DIFFU[i+3]+17*DIFFU[i+4])/45;

	fprintf(fp,"%d\n",num-2);
	for (i=1;i<num-1;i++){
		fprintf(fp,"%f\t%f\t%e\t%f\t%f\t%f\t%f\n",XC[i],PA[i],DIFFU[i]*1.e5,TI[i],QQ[i],REF_CO[i],HH[i]*rad2deg);
//		fprintf(fp,"%f\t%f\t%f\n",HH[i],TI[i],XC[i]);
	}
	fclose(fp);
	fp = NULL;
	free (m1);
	free (m2);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x557448, %rsp         # imm = 0x557448
movq %r8, %r15
movq %rcx, %r13
movq %rdx, -0xc0(%rbp)
movsd %xmm2, -0x40(%rbp)
movl 0x8(%rsi), %eax
movl %eax, -0x70(%rbp)
testl %eax, %eax
sete %cl
movsd %xmm1, -0x58(%rbp)
movsd %xmm0, -0x90(%rbp)
ucomisd %xmm1, %xmm0
movq %rdi, %r14
seta %al
andb %cl, %al
jne 0x2d5f
xorpd %xmm0, %xmm0
jmp 0x2d6b
movsd 0x1369(%rip), %xmm0     # 0x40d0
addsd %xmm3, %xmm0
movsd %xmm0, -0x50(%rbp)
movslq (%rsi), %rdx
movslq 0x4(%rsi), %rcx
movq %rcx, -0x100(%rbp)
movl 0xc(%rsi), %ecx
movl %ecx, -0xa0(%rbp)
xorl %ecx, %ecx
xorl %ebx, %ebx
addl (%rsi,%rcx,4), %ebx
incq %rcx
cmpq $0x4, %rcx
jne 0x2d8b
testb %al, %al
movsd %xmm3, -0xb0(%rbp)
movq %rdx, -0xc8(%rbp)
jne 0x2db4
movsd 0x131e(%rip), %xmm0     # 0x40d0
jmp 0x2dbc
movsd 0x131c(%rip), %xmm0     # 0x40d8
movsd %xmm0, -0x68(%rbp)
movl $0x13890, %edi          # imm = 0x13890
callq 0x10b0
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0x150c
leaq -0xf4(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
movq %r12, -0x110(%rbp)
movq %r12, %rdi
movsd -0x90(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movq -0xc8(%rbp), %rcx
callq 0x167c
movl $0x13890, %edi          # imm = 0x13890
callq 0x10b0
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0x150c
leaq -0xec(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
movq %r12, -0xd0(%rbp)
movq %r12, %rdi
movsd -0x58(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movq -0x100(%rbp), %rcx
callq 0x167c
leaq 0x1442(%rip), %rsi      # 0x4299
movq %r15, %rdi
callq 0x10c0
testq %rax, %rax
je 0x3882
movq %rax, %r12
movsd -0x68(%rbp), %xmm1
subsd -0xb0(%rbp), %xmm1
movsd -0x50(%rbp), %xmm0
movsd %xmm1, -0x68(%rbp)
ucomisd %xmm0, %xmm1
jbe 0x34d3
movq %r13, -0x160(%rbp)
movq %r12, -0xb8(%rbp)
movsd 0x11ee(%rip), %xmm1     # 0x4090
movapd %xmm1, %xmm2
subsd -0x40(%rbp), %xmm2
subsd -0x58(%rbp), %xmm1
movslq -0xf4(%rbp), %r12
movl -0xf0(%rbp), %r15d
movl -0xec(%rbp), %eax
movl %eax, -0x98(%rbp)
movq $0x0, -0xa8(%rbp)
movl -0xe8(%rbp), %eax
movl %eax, -0x60(%rbp)
leaq -0x118(%rbp), %r13
movsd %xmm1, -0x40(%rbp)
movsd %xmm2, -0x108(%rbp)
movq -0x110(%rbp), %r14
movsd 0xfa08(%r14,%r12,8), %xmm1
movsd %xmm1, -0x38(%rbp)
movsd %xmm0, -0x50(%rbp)
callq 0x10d0
mulsd -0x38(%rbp), %xmm0
cmpl $0x1, %ebx
movsd %xmm0, -0x38(%rbp)
leaq -0x78(%rbp), %rax
jne 0x2f43
movq %rax, (%rsp)
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl -0x70(%rbp), %ecx
leaq -0x80(%rbp), %r8
movq %r13, %r9
callq 0x24c4
jmp 0x2f5f
movq %rax, (%rsp)
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl -0x70(%rbp), %ecx
leaq -0x80(%rbp), %r8
movq %r13, %r9
callq 0x2094
cmpl $-0x1, %eax
movsd -0x40(%rbp), %xmm1
movsd -0x50(%rbp), %xmm0
je 0x30bb
movslq -0xa8(%rbp), %r14
movsd %xmm0, -0x24a060(%rbp,%r14,8)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x493f60(%rbp,%r14,8)
movsd -0x80(%rbp), %xmm1
movaps %xmm1, -0x130(%rbp)
movsd %xmm1, -0x186b60(%rbp,%r14,8)
movsd -0x78(%rbp), %xmm1
movsd %xmm1, -0xd8(%rbp)
movsd %xmm1, -0x30d560(%rbp,%r14,8)
movsd -0x118(%rbp), %xmm1
movsd %xmm1, -0xe0(%rbp)
movsd %xmm1, -0x3d0a60(%rbp,%r14,8)
leaq -0x78(%rbp), %rax
cmpl $0x1, %ebx
jne 0x300a
movq %rax, (%rsp)
movq -0xd0(%rbp), %rdi
movl -0x98(%rbp), %esi
movl -0x60(%rbp), %edx
movl -0xa0(%rbp), %ecx
leaq -0x80(%rbp), %r8
movq %r13, %r9
callq 0x24c4
jmp 0x3030
movq %rax, (%rsp)
movq -0xd0(%rbp), %rdi
movl -0x98(%rbp), %esi
movl -0x60(%rbp), %edx
movl -0xa0(%rbp), %ecx
leaq -0x80(%rbp), %r8
movq %r13, %r9
callq 0x2094
cmpl $-0x1, %eax
movsd -0x40(%rbp), %xmm1
movsd -0x50(%rbp), %xmm0
je 0x30bb
movapd -0x130(%rbp), %xmm5
addsd -0x80(%rbp), %xmm5
movsd %xmm5, -0x186b60(%rbp,%r14,8)
movsd -0xd8(%rbp), %xmm3
addsd -0x78(%rbp), %xmm3
movsd %xmm3, -0x30d560(%rbp,%r14,8)
movsd -0xe0(%rbp), %xmm3
addsd -0x118(%rbp), %xmm3
movsd %xmm3, -0x3d0a60(%rbp,%r14,8)
movsd 0x1051(%rip), %xmm3     # 0x40e0
cmpnltpd %xmm5, %xmm3
ucomisd %xmm5, %xmm5
xorpd %xmm4, %xmm4
cmpnltpd %xmm4, %xmm5
andpd %xmm3, %xmm5
movd %xmm5, %eax
setnp %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, %r14d
movq %r14, -0xa8(%rbp)
addsd -0xb0(%rbp), %xmm0
movsd -0x68(%rbp), %xmm3
ucomisd %xmm0, %xmm3
ja 0x2ef2
movq -0xa8(%rbp), %rdx
leal -0x1(%rdx), %r11d
cmpl $0x3, %edx
setge %r14b
jl 0x34e0
cmpl $0x0, -0x70(%rbp)
sete -0x50(%rbp)
movsd -0x58(%rbp), %xmm0
ucomisd -0x90(%rbp), %xmm0
seta -0x38(%rbp)
movq -0xc0(%rbp), %r13
leaq 0x18(%r13), %rcx
leaq 0x20(%r13), %rsi
leaq 0x28(%r13), %rbx
leaq 0x8(%r13), %r15
leaq 0x10(%r13), %rdx
movq -0xc8(%rbp), %rax
cmpl $0x1, %eax
sete %r8b
movq -0x100(%rbp), %r12
cmpl $0x1, %r12d
sete %r9b
movl %r8d, %r10d
andb %r9b, %r10b
testl %eax, %eax
sete %dil
andb %r9b, %dil
movb %dil, -0x2b(%rbp)
movl %eax, %r9d
orl %r12d, %r9d
sete -0x2a(%rbp)
movl %r11d, -0x84(%rbp)
movl %r11d, %r9d
cmpl $0x2, %r12d
setb %al
andb %r8b, %al
movb %al, -0x29(%rbp)
movzbl %r10b, %r8d
movl $0x2, %eax
subl %r8d, %eax
movl %eax, -0xe4(%rbp)
movb -0x38(%rbp), %al
testb %al, -0x50(%rbp)
movq %rsi, %rax
cmovneq %r15, %rax
movq %rax, -0x158(%rbp)
movq %rcx, %rax
cmovneq %r13, %rax
movq %rax, -0x150(%rbp)
movq %rdx, %rax
cmovneq %rbx, %rax
movq %rax, -0x148(%rbp)
cmovneq %rdx, %rbx
movq %rbx, -0x58(%rbp)
cmovneq %rcx, %r13
cmovneq %rsi, %r15
movq %r15, -0x90(%rbp)
leaq -0x8(,%r9,8), %rax
movq %rax, -0xc0(%rbp)
xorl %r15d, %r15d
movq -0x150(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd %xmm0, -0x140(%rbp)
movq -0x158(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd %xmm0, -0x138(%rbp)
movq -0x90(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd (%r13), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x58(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x130(%rbp)
movq -0x148(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0x186b50(%rbp,%r15), %xmm0
subsd -0x186b60(%rbp,%r15), %xmm0
mulsd 0xe7e(%rip), %xmm0      # 0x40e8
movsd %xmm0, -0x98(%rbp)
movsd -0x24a058(%rbp,%r15), %xmm2
movsd %xmm2, -0x60(%rbp)
movsd -0x24a050(%rbp,%r15), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x493f58(%rbp,%r15), %xmm2
movsd %xmm2, -0x38(%rbp)
movq -0xc8(%rbp), %rax
movsd -0x140(%rbp,%rax,8), %xmm0
mulsd %xmm2, %xmm0
divsd %xmm1, %xmm0
callq 0x10f0
movsd %xmm0, -0xa0(%rbp)
movsd -0x140(%rbp,%r12,8), %xmm0
mulsd -0x38(%rbp), %xmm0
divsd -0x40(%rbp), %xmm0
callq 0x10f0
movq -0x160(%rbp), %rax
movsd -0x38(%rbp), %xmm0
mulsd (%rax,%r12,8), %xmm0
divsd -0x108(%rbp), %xmm0
callq 0x10f0
movsd %xmm0, -0x38(%rbp)
movsd -0x50(%rbp), %xmm0
mulsd 0xdde(%rip), %xmm0      # 0x40f0
movsd %xmm0, -0x50(%rbp)
movsd -0x60(%rbp), %xmm0
callq 0x10d0
mulsd -0x50(%rbp), %xmm0
movapd %xmm0, -0x50(%rbp)
movsd -0x186b58(%rbp,%r15), %xmm0
mulsd 0xdbb(%rip), %xmm0      # 0x40f8
callq 0x10d0
movsd %xmm0, -0x60(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0x1080
mulsd -0x60(%rbp), %xmm0
mulsd -0x98(%rbp), %xmm0
movapd -0x50(%rbp), %xmm1
divsd %xmm0, %xmm1
andpd 0xca1(%rip), %xmm1      # 0x4010
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
cmpb $0x0, -0x2a(%rbp)
movl $0x5, %eax
cmovnel %eax, %ebx
divsd -0x108(%rbp), %xmm0
cmpb $0x0, -0x2b(%rbp)
movl $0x3, %eax
cmovnel %eax, %ebx
cmpb $0x0, -0x29(%rbp)
cmovnel -0xe4(%rbp), %ebx
movsd %xmm0, -0xc3658(%rbp,%r15)
movsd -0xd8(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
movsd -0xb0(%rbp), %xmm2
movsd -0x70(%rbp), %xmm3
movsd -0x130(%rbp), %xmm4
movsd -0xe0(%rbp), %xmm5
movsd -0xa0(%rbp), %xmm6
movl %ebx, %edi
callq 0x2938
movsd -0x40(%rbp), %xmm1
movsd %xmm0, -0x557458(%rbp,%r15)
addq $0x8, %r15
cmpq %r15, -0xc0(%rbp)
jne 0x31da
movq -0xa8(%rbp), %rdx
cmpl $0x2a, %edx
jl 0x34ec
leal -0x10(%rdx), %eax
movsd -0xc35b8(%rbp), %xmm2
movsd -0xc35b0(%rbp), %xmm0
movsd -0xc35a8(%rbp), %xmm1
movsd -0xc35a0(%rbp), %xmm9
movsd -0xc3598(%rbp), %xmm6
movsd -0xc3590(%rbp), %xmm7
movsd -0xc3588(%rbp), %xmm3
movsd -0xc3580(%rbp), %xmm4
addq $-0x19, %rax
xorl %ecx, %ecx
movsd 0xc9a(%rip), %xmm5      # 0x4100
movq -0xb8(%rbp), %r12
movapd %xmm0, %xmm8
movapd %xmm1, %xmm0
movapd %xmm9, %xmm1
addsd %xmm8, %xmm2
addsd %xmm0, %xmm2
addsd %xmm9, %xmm2
addsd %xmm6, %xmm2
addsd %xmm7, %xmm2
movapd %xmm7, %xmm6
movapd %xmm3, %xmm7
movapd %xmm4, %xmm3
addsd %xmm7, %xmm2
addsd %xmm4, %xmm2
movsd -0xc3578(%rbp,%rcx,8), %xmm4
addsd %xmm4, %xmm2
divsd %xmm5, %xmm2
movsd %xmm2, -0xc3598(%rbp,%rcx,8)
incq %rcx
movapd %xmm2, %xmm9
movapd %xmm8, %xmm2
cmpq %rcx, %rax
jne 0x346d
jmp 0x34f3
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %r14d, %r14d
jmp 0x34fa
xorl %r14d, %r14d
movq -0xb8(%rbp), %r12
jmp 0x34fa
movq -0xb8(%rbp), %r12
movl -0x84(%rbp), %r11d
movl %r11d, %r15d
movl $0x1, %eax
movsd 0xbfe(%rip), %xmm1      # 0x4108
movsd 0xbfe(%rip), %xmm2      # 0x4110
movsd 0xbe6(%rip), %xmm0      # 0x4100
testb %r14b, %r14b
je 0x35a8
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x35a0
ucomisd %xmm3, %xmm2
jb 0x35a0
movsd -0xc3680(%rbp,%rcx,8), %xmm3
addsd -0xc3678(%rbp,%rcx,8), %xmm3
addsd -0xc3670(%rbp,%rcx,8), %xmm3
addsd -0xc3668(%rbp,%rcx,8), %xmm3
addsd -0xc3660(%rbp,%rcx,8), %xmm3
addsd -0xc3658(%rbp,%rcx,8), %xmm3
addsd -0xc3650(%rbp,%rcx,8), %xmm3
addsd -0xc3648(%rbp,%rcx,8), %xmm3
addsd -0xc3640(%rbp,%rcx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rcx,8)
incq %rcx
jmp 0x35a3
incq %rcx
cmpq %r15, %rcx
jne 0x3528
incl %eax
cmpl $0x1e, %eax
jne 0x351a
movl $0x1, %eax
movsd 0xb58(%rip), %xmm1      # 0x4118
movsd 0xb58(%rip), %xmm2      # 0x4120
testb %r14b, %r14b
je 0x3656
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x364e
ucomisd %xmm3, %xmm2
jb 0x364e
movsd -0xc3680(%rbp,%rcx,8), %xmm3
addsd -0xc3678(%rbp,%rcx,8), %xmm3
addsd -0xc3670(%rbp,%rcx,8), %xmm3
addsd -0xc3668(%rbp,%rcx,8), %xmm3
addsd -0xc3660(%rbp,%rcx,8), %xmm3
addsd -0xc3658(%rbp,%rcx,8), %xmm3
addsd -0xc3650(%rbp,%rcx,8), %xmm3
addsd -0xc3648(%rbp,%rcx,8), %xmm3
addsd -0xc3640(%rbp,%rcx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rcx,8)
incq %rcx
jmp 0x3651
incq %rcx
cmpq %r15, %rcx
jne 0x35d6
incl %eax
cmpl $0x1e, %eax
jne 0x35c8
movl $0x1, %eax
movsd 0xaba(%rip), %xmm1      # 0x4128
movsd 0xaba(%rip), %xmm2      # 0x4130
testb %r14b, %r14b
je 0x3704
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x36fc
ucomisd %xmm3, %xmm2
jb 0x36fc
movsd -0xc3680(%rbp,%rcx,8), %xmm3
addsd -0xc3678(%rbp,%rcx,8), %xmm3
addsd -0xc3670(%rbp,%rcx,8), %xmm3
addsd -0xc3668(%rbp,%rcx,8), %xmm3
addsd -0xc3660(%rbp,%rcx,8), %xmm3
addsd -0xc3658(%rbp,%rcx,8), %xmm3
addsd -0xc3650(%rbp,%rcx,8), %xmm3
addsd -0xc3648(%rbp,%rcx,8), %xmm3
addsd -0xc3640(%rbp,%rcx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rcx,8)
incq %rcx
jmp 0x36ff
incq %rcx
cmpq %r15, %rcx
jne 0x3684
incl %eax
cmpl $0x1e, %eax
jne 0x3676
movl $0x1, %eax
movsd 0xa1c(%rip), %xmm1      # 0x4138
movsd 0xa1c(%rip), %xmm2      # 0x4140
testb %r14b, %r14b
je 0x37b2
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x37aa
ucomisd %xmm3, %xmm2
jb 0x37aa
movsd -0xc3680(%rbp,%rcx,8), %xmm3
addsd -0xc3678(%rbp,%rcx,8), %xmm3
addsd -0xc3670(%rbp,%rcx,8), %xmm3
addsd -0xc3668(%rbp,%rcx,8), %xmm3
addsd -0xc3660(%rbp,%rcx,8), %xmm3
addsd -0xc3658(%rbp,%rcx,8), %xmm3
addsd -0xc3650(%rbp,%rcx,8), %xmm3
addsd -0xc3648(%rbp,%rcx,8), %xmm3
addsd -0xc3640(%rbp,%rcx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rcx,8)
incq %rcx
jmp 0x37ad
incq %rcx
cmpq %r15, %rcx
jne 0x3732
incl %eax
cmpl $0x1e, %eax
jne 0x3724
addl $-0x2, %edx
leaq 0xaee(%rip), %rsi       # 0x42b5
movq %r12, %rdi
xorl %eax, %eax
callq 0x10a0
testb %r14b, %r14b
je 0x384e
decq %r15
xorl %r14d, %r14d
leaq 0xad6(%rip), %rbx       # 0x42b9
movsd -0x186b58(%rbp,%r14,8), %xmm0
movsd -0x493f58(%rbp,%r14,8), %xmm1
movsd -0xc3658(%rbp,%r14,8), %xmm2
mulsd 0x93f(%rip), %xmm2      # 0x4148
movsd -0x30d558(%rbp,%r14,8), %xmm3
movsd -0x3d0a58(%rbp,%r14,8), %xmm4
movsd -0x557458(%rbp,%r14,8), %xmm5
movsd -0x24a058(%rbp,%r14,8), %xmm6
mulsd 0x8b7(%rip), %xmm6      # 0x40f0
movq %r12, %rdi
movq %rbx, %rsi
movb $0x7, %al
callq 0x10a0
incq %r14
cmpq %r14, %r15
jne 0x37e3
movq %r12, %rdi
callq 0x1060
movq -0x110(%rbp), %rdi
callq 0x1030
movq -0xd0(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
addq $0x557448, %rsp         # imm = 0x557448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1379