// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq %rcx, -0x160(%rbp)
movq %rdx, -0xf0(%rbp)
movsd %xmm2, -0x88(%rbp)
movl 0x8(%rsi), %eax
movl %eax, -0x58(%rbp)
testl %eax, %eax
sete %cl
movsd %xmm1, -0x40(%rbp)
movsd %xmm0, -0x90(%rbp)
ucomisd %xmm1, %xmm0
movq %rdi, %r14
seta %al
andb %cl, %al
jne 0x2d35
xorpd %xmm0, %xmm0
jmp 0x2d41
movsd 0x1393(%rip), %xmm0     # 0x40d0
addsd %xmm3, %xmm0
movslq (%rsi), %rcx
movq %rcx, -0xc0(%rbp)
movslq 0x4(%rsi), %rcx
movq %rcx, -0xb8(%rbp)
movl 0xc(%rsi), %ecx
movl %ecx, -0xa8(%rbp)
xorl %ecx, %ecx
xorl %r12d, %r12d
addl (%rsi,%rcx,4), %r12d
incq %rcx
cmpq $0x4, %rcx
jne 0x2d64
testb %al, %al
movsd %xmm3, -0x50(%rbp)
movsd %xmm0, -0x80(%rbp)
jne 0x2d89
movsd 0x1349(%rip), %xmm0     # 0x40d0
jmp 0x2d91
movsd 0x1347(%rip), %xmm0     # 0x40d8
movsd %xmm0, -0x48(%rbp)
movl $0x13890, %edi          # imm = 0x13890
callq 0x10b0
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x14dc
leaq -0xe4(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
movq %r15, %rdi
movsd -0x90(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movq -0xc0(%rbp), %rcx
callq 0x1649
movl $0x13890, %edi          # imm = 0x13890
callq 0x10b0
movq %rax, %r13
movq %r14, %rdi
movq %rax, %rsi
callq 0x14dc
leaq -0xdc(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
movq %r13, -0xb0(%rbp)
movq %r13, %rdi
movsd -0x40(%rbp), %xmm0
movsd -0x88(%rbp), %xmm1
movq -0xb8(%rbp), %rcx
callq 0x1649
leaq 0x1471(%rip), %rsi      # 0x4299
movq %rbx, %rdi
callq 0x10c0
movq %rax, -0x128(%rbp)
testq %rax, %rax
je 0x37d7
movq %r15, -0xf8(%rbp)
movsd -0x48(%rbp), %xmm1
subsd -0x50(%rbp), %xmm1
xorl %r13d, %r13d
movsd -0x80(%rbp), %xmm0
movsd %xmm1, -0x48(%rbp)
ucomisd %xmm0, %xmm1
jbe 0x3068
movslq -0xe4(%rbp), %r14
movl -0xe0(%rbp), %ebx
movl -0xdc(%rbp), %eax
movl %eax, -0xa0(%rbp)
xorl %r13d, %r13d
movl -0xd8(%rbp), %eax
movl %eax, -0x98(%rbp)
movq -0xf8(%rbp), %r15
movsd 0xfa08(%r15,%r14,8), %xmm1
movsd %xmm1, -0x38(%rbp)
movsd %xmm0, -0x80(%rbp)
callq 0x10d0
mulsd -0x38(%rbp), %xmm0
cmpl $0x1, %r12d
movsd %xmm0, -0x38(%rbp)
leaq -0x68(%rbp), %rax
jne 0x2ee2
movq %rax, (%rsp)
movq %r15, %rdi
movl %r14d, %esi
movl %ebx, %edx
movl -0x58(%rbp), %ecx
leaq -0x70(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x2492
jmp 0x2efe
movq %rax, (%rsp)
movq %r15, %rdi
movl %r14d, %esi
movl %ebx, %edx
movl -0x58(%rbp), %ecx
leaq -0x70(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x2061
cmpl $-0x1, %eax
movsd -0x50(%rbp), %xmm1
je 0x3050
movslq %r13d, %r15
movsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x24a060(%rbp,%r15,8)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x493f60(%rbp,%r15,8)
movsd -0x70(%rbp), %xmm1
movaps %xmm1, -0x120(%rbp)
movsd %xmm1, -0x186b60(%rbp,%r15,8)
movsd -0x68(%rbp), %xmm1
movsd %xmm1, -0xc8(%rbp)
movsd %xmm1, -0x30d560(%rbp,%r15,8)
movsd -0x60(%rbp), %xmm1
movsd %xmm1, -0xd0(%rbp)
movsd %xmm1, -0x3d0a60(%rbp,%r15,8)
leaq -0x68(%rbp), %rax
cmpl $0x1, %r12d
jne 0x2fa7
movq %rax, (%rsp)
movq -0xb0(%rbp), %rdi
movl -0xa0(%rbp), %esi
movl -0x98(%rbp), %edx
movl -0xa8(%rbp), %ecx
leaq -0x70(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x2492
jmp 0x2fd1
movq %rax, (%rsp)
movq -0xb0(%rbp), %rdi
movl -0xa0(%rbp), %esi
movl -0x98(%rbp), %edx
movl -0xa8(%rbp), %ecx
leaq -0x70(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x2061
cmpl $-0x1, %eax
movsd -0x50(%rbp), %xmm1
je 0x3050
movapd -0x120(%rbp), %xmm3
addsd -0x70(%rbp), %xmm3
movsd %xmm3, -0x186b60(%rbp,%r15,8)
movsd -0xc8(%rbp), %xmm0
addsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x30d560(%rbp,%r15,8)
movsd -0xd0(%rbp), %xmm0
addsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x3d0a60(%rbp,%r15,8)
movsd 0x10b8(%rip), %xmm0     # 0x40e0
cmpnltpd %xmm3, %xmm0
ucomisd %xmm3, %xmm3
xorpd %xmm2, %xmm2
cmpnltpd %xmm2, %xmm3
andpd %xmm0, %xmm3
movd %xmm3, %eax
setnp %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, %r15d
movl %r15d, %r13d
movsd -0x80(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd -0x48(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x2e90
leal -0x1(%r13), %eax
movl %eax, %r14d
cmpl $0x3, %r13d
jl 0x33ce
movsd 0x100f(%rip), %xmm1     # 0x4090
movapd %xmm1, %xmm0
subsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
cmpl $0x0, -0x58(%rbp)
sete %al
movsd -0x40(%rbp), %xmm0
ucomisd -0x90(%rbp), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, -0x50(%rbp)
seta %cl
andb %al, %cl
movb %cl, -0x90(%rbp)
movq -0xc0(%rbp), %rsi
cmpl $0x1, %esi
sete %al
movq -0xb8(%rbp), %rdi
cmpl $0x1, %edi
sete %cl
movl %eax, %edx
andb %cl, %dl
testl %esi, %esi
sete %r8b
andb %cl, %r8b
movb %r8b, -0x88(%rbp)
movl %esi, %ecx
orl %edi, %ecx
sete -0x2a(%rbp)
cmpl $0x2, %edi
setb %cl
andb %al, %cl
movb %cl, -0x29(%rbp)
movzbl %dl, %eax
movl $0x2, %ecx
subl %eax, %ecx
movl %ecx, -0xd4(%rbp)
leaq -0x8(,%r14,8), %rax
movq %rax, -0x158(%rbp)
xorl %r12d, %r12d
movq -0xf0(%rbp), %rax
leaq 0x18(%rax), %rcx
movq %rcx, -0x150(%rbp)
leaq 0x20(%rax), %rcx
movq %rcx, -0x148(%rbp)
leaq 0x8(%rax), %rcx
movq %rcx, -0x140(%rbp)
leaq 0x28(%rax), %rcx
movq %rcx, -0x138(%rbp)
addq $0x10, %rax
movq %rax, -0x130(%rbp)
movq -0xb8(%rbp), %r15
cmpb $0x0, -0x90(%rbp)
movq -0x150(%rbp), %rdx
movq %rdx, %rax
movq -0xf0(%rbp), %rcx
cmovneq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd %xmm0, -0x110(%rbp)
movq -0x148(%rbp), %rsi
movq %rsi, %rax
movq -0x140(%rbp), %rdi
cmovneq %rdi, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x108(%rbp)
movq %rdi, %rax
cmovneq %rsi, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x120(%rbp)
movq %rcx, %rax
cmovneq %rdx, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xd0(%rbp)
movq -0x138(%rbp), %rcx
movq %rcx, %rax
movq -0x130(%rbp), %rdx
cmovneq %rdx, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq %rdx, %rax
cmovneq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x186b50(%rbp,%r12), %xmm0
subsd -0x186b60(%rbp,%r12), %xmm0
mulsd 0xec2(%rip), %xmm0      # 0x40e8
movsd %xmm0, -0x98(%rbp)
movsd -0x24a058(%rbp,%r12), %xmm1
movsd %xmm1, -0x40(%rbp)
movsd -0x24a050(%rbp,%r12), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x493f58(%rbp,%r12), %xmm1
movsd %xmm1, -0x38(%rbp)
movq -0xc0(%rbp), %rax
movsd -0x110(%rbp,%rax,8), %xmm0
mulsd %xmm1, %xmm0
divsd -0x50(%rbp), %xmm0
callq 0x10f0
movsd %xmm0, -0xa0(%rbp)
movsd -0x110(%rbp,%r15,8), %xmm0
mulsd -0x38(%rbp), %xmm0
divsd -0x50(%rbp), %xmm0
callq 0x10f0
movq -0x160(%rbp), %rax
movsd -0x38(%rbp), %xmm0
mulsd (%rax,%r15,8), %xmm0
divsd -0x48(%rbp), %xmm0
callq 0x10f0
movsd %xmm0, -0x38(%rbp)
movsd -0x80(%rbp), %xmm0
mulsd 0xe24(%rip), %xmm0      # 0x40f0
movsd %xmm0, -0x80(%rbp)
movsd -0x40(%rbp), %xmm0
callq 0x10d0
mulsd -0x80(%rbp), %xmm0
movapd %xmm0, -0x80(%rbp)
movsd -0x186b58(%rbp,%r12), %xmm0
mulsd 0xe01(%rip), %xmm0      # 0x40f8
callq 0x10d0
movsd %xmm0, -0x40(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0x1080
mulsd -0x40(%rbp), %xmm0
mulsd -0x98(%rbp), %xmm0
movapd -0x80(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
andpd 0xce3(%rip), %xmm0      # 0x4010
ucomisd 0xd83(%rip), %xmm0      # 0x40b8
jb 0x333d
sqrtsd %xmm0, %xmm0
jmp 0x3342
callq 0x1130
divsd -0x48(%rbp), %xmm0
cmpb $0x0, -0x2a(%rbp)
movl $0x5, %eax
cmovnel %eax, %ebx
movsd %xmm0, -0xc3658(%rbp,%r12)
cmpb $0x0, -0x88(%rbp)
movl $0x3, %eax
cmovnel %eax, %ebx
cmpb $0x0, -0x29(%rbp)
cmovnel -0xd4(%rbp), %ebx
movsd -0x108(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x120(%rbp), %xmm2
movsd -0xd0(%rbp), %xmm3
movsd -0xc8(%rbp), %xmm4
movsd -0xa8(%rbp), %xmm5
movsd -0xa0(%rbp), %xmm6
movl %ebx, %edi
callq 0x2907
movsd %xmm0, -0x557458(%rbp,%r12)
addq $0x8, %r12
cmpq %r12, -0x158(%rbp)
jne 0x3162
cmpl $0x2a, %r13d
jl 0x3453
leal -0x10(%r13), %eax
movsd -0xc35a0(%rbp), %xmm1
addq $-0x19, %rax
xorl %ecx, %ecx
movsd 0xd12(%rip), %xmm0      # 0x4100
movsd -0xc35b8(%rbp,%rcx,8), %xmm2
addsd -0xc35b0(%rbp,%rcx,8), %xmm2
addsd -0xc35a8(%rbp,%rcx,8), %xmm2
addsd %xmm1, %xmm2
addsd -0xc3598(%rbp,%rcx,8), %xmm2
addsd -0xc3590(%rbp,%rcx,8), %xmm2
addsd -0xc3588(%rbp,%rcx,8), %xmm2
addsd -0xc3580(%rbp,%rcx,8), %xmm2
addsd -0xc3578(%rbp,%rcx,8), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, -0xc3598(%rbp,%rcx,8)
incq %rcx
movapd %xmm2, %xmm1
cmpq %rcx, %rax
jne 0x33ee
movl $0x1, %eax
movsd 0xca8(%rip), %xmm1      # 0x4108
movsd 0xca8(%rip), %xmm2      # 0x4110
movsd 0xc90(%rip), %xmm0      # 0x4100
movq -0x128(%rbp), %r12
cmpl $0x3, %r13d
jl 0x3501
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x34f9
ucomisd %xmm3, %xmm2
jb 0x34f9
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
cmpq %rcx, %r14
jne 0x3486
incl %eax
cmpl $0x1e, %eax
jne 0x3477
movl $0x1, %eax
movsd 0xbff(%rip), %xmm1      # 0x4118
movsd 0xbff(%rip), %xmm2      # 0x4120
cmpl $0x3, %r13d
jl 0x35ab
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x35a3
ucomisd %xmm3, %xmm2
jb 0x35a3
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
cmpq %rcx, %r14
jne 0x3530
incl %eax
cmpl $0x1e, %eax
jne 0x3521
movl $0x1, %eax
movsd 0xb65(%rip), %xmm1      # 0x4128
movsd 0xb65(%rip), %xmm2      # 0x4130
cmpl $0x3, %r13d
jl 0x3655
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x364d
ucomisd %xmm3, %xmm2
jb 0x364d
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
cmpq %rcx, %r14
jne 0x35da
incl %eax
cmpl $0x1e, %eax
jne 0x35cb
movl $0x1, %eax
movsd 0xacb(%rip), %xmm1      # 0x4138
movsd 0xacb(%rip), %xmm2      # 0x4140
cmpl $0x3, %r13d
jl 0x36ff
movl $0x1, %ecx
movsd -0x186b60(%rbp,%rcx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x36f7
ucomisd %xmm3, %xmm2
jb 0x36f7
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
cmpq %rcx, %r14
jne 0x3684
incl %eax
cmpl $0x1e, %eax
jne 0x3675
leal -0x2(%r13), %edx
leaq 0xba0(%rip), %rsi       # 0x42b5
movq %r12, %rdi
xorl %eax, %eax
callq 0x10a0
cmpl $0x3, %r13d
jl 0x37a3
leaq -0x8(,%r14,8), %r14
xorl %r15d, %r15d
leaq 0xb82(%rip), %rbx       # 0x42b9
movsd -0x186b58(%rbp,%r15), %xmm0
movsd -0x493f58(%rbp,%r15), %xmm1
movsd -0xc3658(%rbp,%r15), %xmm2
mulsd 0x9eb(%rip), %xmm2      # 0x4148
movsd -0x30d558(%rbp,%r15), %xmm3
movsd -0x3d0a58(%rbp,%r15), %xmm4
movsd -0x557458(%rbp,%r15), %xmm5
movsd -0x24a058(%rbp,%r15), %xmm6
mulsd 0x963(%rip), %xmm6      # 0x40f0
movq %r12, %rdi
movq %rbx, %rsi
movb $0x7, %al
callq 0x10a0
addq $0x8, %r15
cmpq %r15, %r14
jne 0x3737
movq %r12, %rdi
callq 0x1060
movq -0xf8(%rbp), %rdi
callq 0x1030
movq -0xb0(%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