// File: /workspace/github_c_makefile_star2_O2/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, -0x158(%rbp)
movq %rdx, -0xd8(%rbp)
movl 0x8(%rsi), %eax
movl %eax, -0x78(%rbp)
testl %eax, %eax
sete %cl
movsd %xmm1, -0x70(%rbp)
movsd %xmm0, -0x98(%rbp)
ucomisd %xmm1, %xmm0
movq %rdi, %r14
seta %al
andb %cl, %al
jne 0x2a03
xorpd %xmm0, %xmm0
jmp 0x2a0f
movsd 0x16c5(%rip), %xmm0     # 0x40d0
addsd %xmm3, %xmm0
movslq (%rsi), %rcx
movq %rcx, -0xd0(%rbp)
movslq 0x4(%rsi), %rcx
movq %rcx, -0xc8(%rbp)
movl 0xc(%rsi), %ecx
movl %ecx, -0xa8(%rbp)
xorl %ecx, %ecx
xorl %r12d, %r12d
cmpq $0x4, %rcx
je 0x2a41
addl (%rsi,%rcx,4), %r12d
incq %rcx
jmp 0x2a32
testb %al, %al
movsd %xmm3, -0x80(%rbp)
movsd %xmm0, -0x50(%rbp)
movsd %xmm2, -0x38(%rbp)
jne 0x2a5e
movsd 0x1674(%rip), %xmm0     # 0x40d0
jmp 0x2a66
movsd 0x1672(%rip), %xmm0     # 0x40d8
movsd %xmm0, -0x68(%rbp)
movl $0x13890, %edi          # imm = 0x13890
callq 0x10b0
movq %rax, %r13
movq %r14, %rdi
movq %rax, %rsi
callq 0x123c
leaq -0xfc(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
movq %r13, %rdi
movsd -0x98(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
movq -0xd0(%rbp), %rcx
callq 0x13df
movl $0x13890, %edi          # imm = 0x13890
callq 0x10b0
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x123c
leaq -0xf4(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
movq %r15, -0xb8(%rbp)
movq %r15, %rdi
movsd -0x70(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movq -0xc8(%rbp), %rcx
callq 0x13df
leaq 0x179f(%rip), %rsi      # 0x4299
movq %rbx, %rdi
callq 0x10c0
movq %rax, -0x138(%rbp)
testq %rax, %rax
je 0x34ca
movsd -0x68(%rbp), %xmm0
subsd -0x80(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd 0x1567(%rip), %xmm0     # 0x4090
movsd %xmm0, -0xb0(%rbp)
subsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movslq -0xfc(%rbp), %r15
movl -0xf8(%rbp), %r14d
movl -0xf4(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq $0x0, -0x58(%rbp)
movl -0xf0(%rbp), %eax
movl %eax, -0x60(%rbp)
leaq -0x110(%rbp), %rbx
movq %r13, -0xc0(%rbp)
movsd -0x50(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x2d7e
movsd 0xfa08(%r13,%r15,8), %xmm1
movsd %xmm1, -0x38(%rbp)
movsd %xmm0, -0x50(%rbp)
callq 0x10d0
mulsd -0x38(%rbp), %xmm0
cmpl $0x1, %r12d
movsd %xmm0, -0x38(%rbp)
leaq -0x88(%rbp), %rax
jne 0x2bdc
movq %rax, (%rsp)
movq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl -0x78(%rbp), %ecx
leaq -0x90(%rbp), %r8
movq %rbx, %r9
callq 0x2194
jmp 0x2bfb
movq %rax, (%rsp)
movq %r13, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl -0x78(%rbp), %ecx
leaq -0x90(%rbp), %r8
movq %rbx, %r9
callq 0x1d8e
cmpl $-0x1, %eax
movsd -0x80(%rbp), %xmm1
movsd -0x50(%rbp), %xmm0
je 0x2d75
movslq -0x58(%rbp), %r13
movsd %xmm0, -0x24a060(%rbp,%r13,8)
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x493f60(%rbp,%r13,8)
movsd -0x90(%rbp), %xmm1
movaps %xmm1, -0x120(%rbp)
movsd %xmm1, -0x186b60(%rbp,%r13,8)
movsd -0x88(%rbp), %xmm1
movsd %xmm1, -0xe0(%rbp)
movsd %xmm1, -0x30d560(%rbp,%r13,8)
movsd -0x110(%rbp), %xmm1
movsd %xmm1, -0xe8(%rbp)
movsd %xmm1, -0x3d0a60(%rbp,%r13,8)
leaq -0x88(%rbp), %rax
cmpl $0x1, %r12d
jne 0x2cb0
movq %rax, (%rsp)
movq -0xb8(%rbp), %rdi
movl -0xa0(%rbp), %esi
movl -0x60(%rbp), %edx
movl -0xa8(%rbp), %ecx
leaq -0x90(%rbp), %r8
movq %rbx, %r9
callq 0x2194
jmp 0x2cd9
movq %rax, (%rsp)
movq -0xb8(%rbp), %rdi
movl -0xa0(%rbp), %esi
movl -0x60(%rbp), %edx
movl -0xa8(%rbp), %ecx
leaq -0x90(%rbp), %r8
movq %rbx, %r9
callq 0x1d8e
cmpl $-0x1, %eax
movsd -0x80(%rbp), %xmm1
je 0x2d69
movapd -0x120(%rbp), %xmm3
addsd -0x90(%rbp), %xmm3
movsd -0xe0(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm3, -0x186b60(%rbp,%r13,8)
movsd %xmm0, -0x30d560(%rbp,%r13,8)
movsd -0xe8(%rbp), %xmm0
addsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x3d0a60(%rbp,%r13,8)
movsd 0x140b(%rip), %xmm0     # 0x4148
ucomisd %xmm3, %xmm3
cmpnltpd %xmm3, %xmm0
xorpd %xmm2, %xmm2
cmpnltpd %xmm2, %xmm3
andpd %xmm0, %xmm3
movd %xmm3, %eax
setnp %cl
andb %al, %cl
movzbl %cl, %eax
movq -0x58(%rbp), %rcx
addl %eax, %ecx
movq %rcx, -0x58(%rbp)
movq -0xc0(%rbp), %r13
movsd -0x50(%rbp), %xmm0
addsd %xmm1, %xmm0
jmp 0x2b7c
cmpl $0x0, -0x78(%rbp)
sete %sil
movsd -0xb0(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
ucomisd -0x98(%rbp), %xmm1
seta %r8b
movq -0x58(%rbp), %rax
decl %eax
movl %eax, -0x50(%rbp)
movq -0xd8(%rbp), %rbx
leaq 0x18(%rbx), %rdx
leaq 0x20(%rbx), %rcx
leaq 0x28(%rbx), %r12
leaq 0x8(%rbx), %r13
leaq 0x10(%rbx), %rdi
movq -0xd0(%rbp), %r14
cmpl $0x1, %r14d
sete %r9b
movq -0xc8(%rbp), %r15
cmpl $0x1, %r15d
sete %r10b
movl %r9d, %r11d
andb %r10b, %r11b
testl %r14d, %r14d
sete %al
andb %r10b, %al
movb %al, -0x2b(%rbp)
movl %r14d, %r10d
orl %r15d, %r10d
sete -0x2a(%rbp)
cmpl $0x2, %r15d
setb %al
andb %r9b, %al
movb %al, -0x29(%rbp)
movzbl %r11b, %r9d
pushq $0x2
popq %rax
subl %r9d, %eax
movl %eax, -0xec(%rbp)
testb %sil, %r8b
movq %rcx, %rax
cmovneq %r13, %rax
movq %rax, -0x150(%rbp)
movq %rdx, %rax
cmovneq %rbx, %rax
movq %rax, -0x148(%rbp)
movq %rdi, %rax
cmovneq %r12, %rax
movq %rax, -0x140(%rbp)
cmovneq %rdi, %r12
movq %r12, -0x70(%rbp)
cmovneq %rdx, %rbx
movq %rbx, -0xd8(%rbp)
cmovneq %rcx, %r13
movq %r13, -0x98(%rbp)
movslq -0x50(%rbp), %r14
pushq $0x1
popq %r13
movq -0xc8(%rbp), %r12
cmpq %r14, %r13
jge 0x30a8
movq -0x148(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd %xmm0, -0x130(%rbp)
movq -0x150(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd %xmm0, -0x128(%rbp)
movq -0x98(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0xd8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x70(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x120(%rbp)
movq -0x140(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0xe8(%rbp)
leaq 0x1(%r13), %r15
movsd -0x186b58(%rbp,%r13,8), %xmm0
subsd -0x186b68(%rbp,%r13,8), %xmm0
mulsd 0x1219(%rip), %xmm0     # 0x4138
movsd %xmm0, -0xa0(%rbp)
movsd -0x24a060(%rbp,%r13,8), %xmm1
movsd %xmm1, -0x60(%rbp)
movsd -0x24a058(%rbp,%r13,8), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x493f60(%rbp,%r13,8), %xmm1
movsd %xmm1, -0x38(%rbp)
movq -0xd0(%rbp), %rax
movsd -0x130(%rbp,%rax,8), %xmm0
mulsd %xmm1, %xmm0
divsd -0xb0(%rbp), %xmm0
callq 0x10f0
movsd %xmm0, -0xa8(%rbp)
movsd -0x130(%rbp,%r12,8), %xmm0
mulsd -0x38(%rbp), %xmm0
divsd -0xb0(%rbp), %xmm0
callq 0x10f0
movq -0x158(%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 0x1162(%rip), %xmm0     # 0x4130
movsd %xmm0, -0x50(%rbp)
movsd -0x60(%rbp), %xmm0
callq 0x10d0
mulsd -0x50(%rbp), %xmm0
movapd %xmm0, -0x50(%rbp)
movsd -0x186b60(%rbp,%r13,8), %xmm0
mulsd 0x1147(%rip), %xmm0     # 0x4140
callq 0x10d0
movsd %xmm0, -0x60(%rbp)
movsd -0x38(%rbp), %xmm0
callq 0x1080
mulsd -0x60(%rbp), %xmm0
mulsd -0xa0(%rbp), %xmm0
movapd -0x50(%rbp), %xmm1
divsd %xmm0, %xmm1
andpd 0xfe5(%rip), %xmm1      # 0x4010
sqrtsd %xmm1, %xmm0
cmpb $0x0, -0x2a(%rbp)
pushq $0x5
popq %rax
cmovnel %eax, %ebx
divsd -0x108(%rbp), %xmm0
cmpb $0x0, -0x2b(%rbp)
pushq $0x3
popq %rax
cmovnel %eax, %ebx
movsd %xmm0, -0xc3660(%rbp,%r13,8)
cmpb $0x0, -0x29(%rbp)
cmovnel -0xec(%rbp), %ebx
movsd -0xe0(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
movsd -0x68(%rbp), %xmm2
movsd -0x78(%rbp), %xmm3
movsd -0x120(%rbp), %xmm4
movsd -0xe8(%rbp), %xmm5
movsd -0xa8(%rbp), %xmm6
movl %ebx, %edi
callq 0x25c7
movsd %xmm0, -0x557460(%rbp,%r13,8)
movq %r15, %r13
jmp 0x2e80
movq -0x58(%rbp), %rax
addl $-0x10, %eax
cltq
pushq $0x1d
popq %rcx
movsd 0x1034(%rip), %xmm0     # 0x40f0
movq -0xc0(%rbp), %r12
movq -0x138(%rbp), %r13
leaq -0x4(%rcx), %rdx
cmpq %rax, %rdx
jge 0x3136
movsd -0xc36a0(%rbp,%rcx,8), %xmm1
addsd -0xc3698(%rbp,%rcx,8), %xmm1
addsd -0xc3690(%rbp,%rcx,8), %xmm1
addsd -0xc3688(%rbp,%rcx,8), %xmm1
addsd -0xc3680(%rbp,%rcx,8), %xmm1
addsd -0xc3678(%rbp,%rcx,8), %xmm1
addsd -0xc3670(%rbp,%rcx,8), %xmm1
addsd -0xc3668(%rbp,%rcx,8), %xmm1
addsd -0xc3660(%rbp,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0xc3680(%rbp,%rcx,8)
incq %rcx
jmp 0x30ca
pushq $0x1
popq %rax
pushq $0x1
popq %rcx
movsd 0xf9c(%rip), %xmm1      # 0x40e0
movsd 0xf9c(%rip), %xmm2      # 0x40e8
cmpl $0x1e, %eax
je 0x31eb
movq %rcx, %rdx
cmpq %r14, %rdx
jge 0x31e4
movsd -0x186b60(%rbp,%rdx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x31dc
ucomisd %xmm3, %xmm2
jb 0x31dc
movsd -0xc3680(%rbp,%rdx,8), %xmm3
addsd -0xc3678(%rbp,%rdx,8), %xmm3
addsd -0xc3670(%rbp,%rdx,8), %xmm3
addsd -0xc3668(%rbp,%rdx,8), %xmm3
addsd -0xc3660(%rbp,%rdx,8), %xmm3
addsd -0xc3658(%rbp,%rdx,8), %xmm3
addsd -0xc3650(%rbp,%rdx,8), %xmm3
addsd -0xc3648(%rbp,%rdx,8), %xmm3
addsd -0xc3640(%rbp,%rdx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rdx,8)
incq %rdx
jmp 0x3158
incq %rdx
jmp 0x3158
incl %eax
jmp 0x314c
pushq $0x1
popq %rax
pushq $0x1
popq %rcx
movsd 0xeff(%rip), %xmm1      # 0x40f8
movsd 0xeff(%rip), %xmm2      # 0x4100
cmpl $0x1e, %eax
je 0x32a0
movq %rcx, %rdx
cmpq %r14, %rdx
jge 0x3299
movsd -0x186b60(%rbp,%rdx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x3291
ucomisd %xmm3, %xmm2
jb 0x3291
movsd -0xc3680(%rbp,%rdx,8), %xmm3
addsd -0xc3678(%rbp,%rdx,8), %xmm3
addsd -0xc3670(%rbp,%rdx,8), %xmm3
addsd -0xc3668(%rbp,%rdx,8), %xmm3
addsd -0xc3660(%rbp,%rdx,8), %xmm3
addsd -0xc3658(%rbp,%rdx,8), %xmm3
addsd -0xc3650(%rbp,%rdx,8), %xmm3
addsd -0xc3648(%rbp,%rdx,8), %xmm3
addsd -0xc3640(%rbp,%rdx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rdx,8)
incq %rdx
jmp 0x320d
incq %rdx
jmp 0x320d
incl %eax
jmp 0x3201
pushq $0x1
popq %rax
pushq $0x1
popq %rcx
movsd 0xe5a(%rip), %xmm1      # 0x4108
movsd 0xe5a(%rip), %xmm2      # 0x4110
cmpl $0x1e, %eax
je 0x3355
movq %rcx, %rdx
cmpq %r14, %rdx
jge 0x334e
movsd -0x186b60(%rbp,%rdx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x3346
ucomisd %xmm3, %xmm2
jb 0x3346
movsd -0xc3680(%rbp,%rdx,8), %xmm3
addsd -0xc3678(%rbp,%rdx,8), %xmm3
addsd -0xc3670(%rbp,%rdx,8), %xmm3
addsd -0xc3668(%rbp,%rdx,8), %xmm3
addsd -0xc3660(%rbp,%rdx,8), %xmm3
addsd -0xc3658(%rbp,%rdx,8), %xmm3
addsd -0xc3650(%rbp,%rdx,8), %xmm3
addsd -0xc3648(%rbp,%rdx,8), %xmm3
addsd -0xc3640(%rbp,%rdx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rdx,8)
incq %rdx
jmp 0x32c2
incq %rdx
jmp 0x32c2
incl %eax
jmp 0x32b6
pushq $0x1
popq %rax
pushq $0x1
popq %rcx
movsd 0xdb5(%rip), %xmm1      # 0x4118
movsd 0xdb5(%rip), %xmm2      # 0x4120
cmpl $0x1e, %eax
je 0x340a
movq %rcx, %rdx
cmpq %r14, %rdx
jge 0x3403
movsd -0x186b60(%rbp,%rdx,8), %xmm3
ucomisd %xmm1, %xmm3
jb 0x33fb
ucomisd %xmm3, %xmm2
jb 0x33fb
movsd -0xc3680(%rbp,%rdx,8), %xmm3
addsd -0xc3678(%rbp,%rdx,8), %xmm3
addsd -0xc3670(%rbp,%rdx,8), %xmm3
addsd -0xc3668(%rbp,%rdx,8), %xmm3
addsd -0xc3660(%rbp,%rdx,8), %xmm3
addsd -0xc3658(%rbp,%rdx,8), %xmm3
addsd -0xc3650(%rbp,%rdx,8), %xmm3
addsd -0xc3648(%rbp,%rdx,8), %xmm3
addsd -0xc3640(%rbp,%rdx,8), %xmm3
divsd %xmm0, %xmm3
movsd %xmm3, -0xc3660(%rbp,%rdx,8)
incq %rdx
jmp 0x3377
incq %rdx
jmp 0x3377
incl %eax
jmp 0x336b
movq -0x58(%rbp), %rdx
addl $-0x2, %edx
leaq 0xe9d(%rip), %rsi       # 0x42b5
movq %r13, %rdi
xorl %eax, %eax
callq 0x10a0
pushq $0x1
popq %r15
leaq 0xe8c(%rip), %rbx       # 0x42b9
cmpq %r14, %r15
jge 0x349a
movsd -0x186b60(%rbp,%r15,8), %xmm0
movsd -0x493f60(%rbp,%r15,8), %xmm1
movsd -0xc3660(%rbp,%r15,8), %xmm2
mulsd 0xcd0(%rip), %xmm2      # 0x4128
movsd -0x30d560(%rbp,%r15,8), %xmm3
movsd -0x3d0a60(%rbp,%r15,8), %xmm4
movsd -0x557460(%rbp,%r15,8), %xmm5
movsd -0x24a060(%rbp,%r15,8), %xmm6
mulsd 0xca8(%rip), %xmm6      # 0x4130
movq %r13, %rdi
movq %rbx, %rsi
movb $0x7, %al
callq 0x10a0
incq %r15
jmp 0x342d
movq %r13, %rdi
callq 0x1060
movq %r12, %rdi
callq 0x1030
movq -0xb8(%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
movq 0x2b27(%rip), %rax      # 0x5ff8
movq (%rax), %rcx
leaq 0xdc0(%rip), %rdi       # 0x429b
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x1120
pushq $-0x1
popq %rdi
callq 0x1110