// File: /workspace/github_cpp_makefile_star2_O3/ADAPTLab[P]MuDBSCAN/partition.cpp
// Function: get_extra_points(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, int*, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, vectorc*, vectorc*, int*)
void get_extra_points(vector< vector<double> >& objects, int* num_points, vector< vector<double> >& remote_objects, vectorc* remote_PrIDs, vectorc* remote_Indices, int* remote_number)
{

#ifdef _DEBUG_GP
	MPI_Barrier(MPI_COMM_WORLD);
	double end, start = MPI_Wtime();
#endif

	int k, rank, nproc, i, j;
	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
	MPI_Comm_size(MPI_COMM_WORLD, &nproc);

#ifdef _DEBUG
	if(rank == proc_of_interest) cout << "extra point time part 0 strating " << endl;
#endif

	interval* local_box = new interval[DIMENSION];
	compute_local_bounding_box(objects, num_points, local_box);
	double eps = EPS;

	for(i = 0; i < DIMENSION; i++)
	{
		local_box[i].upper += eps;
		local_box[i].lower -= eps; 
	}

	interval* gather_local_box = new interval[DIMENSION * nproc];

	MPI_Allgather(local_box, sizeof(interval) * DIMENSION, MPI_BYTE, gather_local_box,
			sizeof(interval) * DIMENSION, MPI_BYTE, MPI_COMM_WORLD);

	bool if_inside, overlap;
	int count = 0, gcount;

	vector <double> empty;
	vector <vector <double> > send_buf;
	vector <vector <double> > recv_buf;
	send_buf.resize(nproc, empty);
	recv_buf.resize(nproc, empty);

	vector <int> empty_i;
	vector <vector <int> > send_buf_ind;
	vector <vector <int> > recv_buf_ind;
	send_buf_ind.resize(nproc, empty_i);
	recv_buf_ind.resize(nproc, empty_i);

#ifdef _DEBUG_GP
	MPI_Barrier(MPI_COMM_WORLD);
	end = MPI_Wtime();
#ifdef _DEBUG
	if(rank == proc_of_interest) cout << "extra point time part 1: " << end - start << endl;	
#endif
	start = end;
#endif

	for(k = 0; k < nproc; k++)
	{
		if (k == rank) // self
			continue;

		overlap = true;
		for(j = 0; j < DIMENSION; j++)
		{
			if(gather_local_box[rank * DIMENSION + j].lower < gather_local_box[k * DIMENSION +j].lower)
			{
				if(gather_local_box[rank * DIMENSION + j].upper - gather_local_box[k * DIMENSION + j].lower < eps)	
				{
					overlap = false;
					break;
				}
			}
			else
			{
				if(gather_local_box[k * DIMENSION + j].upper - gather_local_box[rank * DIMENSION + j].lower < eps)
				{
					overlap = false;
					break;
				}
			}
		}

		if(overlap == false)
			continue;

		// printf("EXTRA POINTS \t %d\n", send_buf[0].size());
		for(i = 0; i < *num_points; i++)
		{
			if_inside = true;
			for(j = 0; j < DIMENSION; j++)
			{
				if(objects[i][j] < gather_local_box[k * DIMENSION + j].lower || 
						objects[i][j] > gather_local_box[k * DIMENSION + j].upper)
				{
					if_inside = false;
					break;
				}
			}

			if(if_inside == true)
			{

				for(j = 0; j < DIMENSION; j++)
				{
					// printf("%lf ", objects[i][j]);
					send_buf[k].push_back(objects[i][j]);
				}

				// printf("\t%d\n", rank);
				send_buf_ind[k].push_back(i);
				count++;
			}
		}
	}

#ifdef _DEBUG_GP
	MPI_Barrier(MPI_COMM_WORLD);
	end = MPI_Wtime();
#ifdef _DEBUG
	if(rank == proc_of_interest) cout << "extra point time part 2: " << end - start << endl;        
#endif
	start = end;
#endif

	vector <int> send_buf_size, recv_buf_size;
	send_buf_size.resize(nproc, 0);
	recv_buf_size.resize(nproc, 0);

	for(i = 0; i < nproc; i++)
		send_buf_size[i] = send_buf[i].size();

	MPI_Alltoall(&send_buf_size[0], 1, MPI_INT, &recv_buf_size[0], 1, MPI_INT, MPI_COMM_WORLD);

	int tag = 200, send_count, recv_count;
	MPI_Request req_send[2 * nproc], req_recv[2 * nproc];
	MPI_Status stat_send[2 * nproc], stat_recv;

	recv_count = 0;
	for(i = 0; i < nproc; i++)
	{
		if(recv_buf_size[i] > 0)
		{
			recv_buf[i].resize(recv_buf_size[i], 0);
			recv_buf_ind[i].resize(recv_buf_size[i] / DIMENSION, -1);

			MPI_Irecv(&recv_buf[i][0], recv_buf_size[i], MPI_DOUBLE, i, tag, MPI_COMM_WORLD, &req_recv[recv_count++]);
			MPI_Irecv(&recv_buf_ind[i][0], recv_buf_size[i] / DIMENSION, MPI_INT, i, tag + 1, MPI_COMM_WORLD, &req_recv[recv_count++]);
		}
	}

	send_count = 0;

	for(i = 0; i < nproc; i++)
	{
		if(send_buf_size[i] > 0)
		{
			MPI_Isend(&send_buf[i][0], send_buf_size[i], MPI_DOUBLE, i, tag, MPI_COMM_WORLD, &req_send[send_count++]);
			MPI_Isend(&send_buf_ind[i][0], send_buf_size[i] / DIMENSION, MPI_INT, i, tag + 1, MPI_COMM_WORLD, &req_send[send_count++]);
		}
	}

	int rtag, rsource, rpos;


	for(i = 0; i < recv_count; i++)
	{
		MPI_Waitany(recv_count, &req_recv[0], &rpos, &stat_recv);

		rtag = stat_recv.MPI_TAG;
		rsource = stat_recv.MPI_SOURCE;

		if(rtag == tag)
		{
			// #if _GET_EXTRA_POINT_STAT == 0  // WHY THIS IS HERE??????????????????????????????????????????????????????????????
			addPoints(rsource, recv_buf_size[rsource], DIMENSION, recv_buf[rsource], remote_objects, remote_PrIDs, remote_number);
			// #endif
			recv_buf[rsource].clear();
		}
		else if(rtag == tag + 1)
		{
			// postpond this computation and call update points later
			// processing immediately might lead to invalid computation
		}
	}	

	if(send_count > 0)
		MPI_Waitall(send_count, &req_send[0], &stat_send[0]);

#ifdef _DEBUG_GP
	MPI_Barrier(MPI_COMM_WORLD);
	end = MPI_Wtime();
#ifdef _DEBUG
	if(rank == proc_of_interest) cout << "extra point time part 3: " << end - start << endl;        
#endif
	start = end;
#endif

	updatePoints(recv_buf_ind, remote_Indices, remote_PrIDs, *remote_number);

	MPI_Reduce(&count, &gcount, 1, MPI_INT, MPI_SUM, proc_of_interest, MPI_COMM_WORLD);

#ifdef _DEBUG
	if(rank == proc_of_interest)
	{
		cout << "Total extra point " << gcount << endl;
		cout << "Extra point per processor " << gcount/nproc << endl;
	}
#endif

#ifdef _DEBUG_GP
	MPI_Barrier(MPI_COMM_WORLD);
	end = MPI_Wtime();
#ifdef _DEBUG

	if(rank == proc_of_interest) cout << "extra point time part 4: " << end - start << endl;        
#endif
	start = end;
#endif


	empty.clear();
	send_buf.clear();
	recv_buf.clear();
	send_buf_size.clear();
	recv_buf_size.clear();
	send_buf_ind.clear();
	recv_buf_ind.clear();

	delete [] gather_local_box;
	delete [] local_box;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r9, -0x100(%rbp)
movq %r8, -0x150(%rbp)
movq %rcx, -0x108(%rbp)
movq %rdx, -0x158(%rbp)
movq %rsi, %r14
movq %rdi, %r15
movq 0xc635(%rip), %rbx      # 0x16fa8
leaq -0x94(%rbp), %rsi
movq %rbx, %rdi
callq 0x33e0
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
callq 0x32e0
leaq 0xc9cf(%rip), %rbx      # 0x17364
movslq (%rbx), %rax
movq %rax, %rdi
shlq $0x4, %rdi
testq %rax, %rax
movq $-0x1, %r13
cmovsq %r13, %rdi
callq 0x3030
movq %r15, %rdi
movq %r14, -0x48(%rbp)
movq %r14, %rsi
movq %rax, -0x88(%rbp)
movq %rax, %rdx
callq 0x9809
leaq 0xc986(%rip), %rax      # 0x17358
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movslq (%rbx), %r12
testq %r12, %r12
jle 0xaa24
movq %r12, %rax
shlq $0x4, %rax
xorl %ecx, %ecx
movq -0x88(%rbp), %rdx
movsd -0x38(%rbp), %xmm1
movsd 0x8(%rdx,%rcx), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rdx,%rcx)
movsd (%rdx,%rcx), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%rcx)
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0xa9f8
movl %r12d, %eax
jmp 0xaa26
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
movslq -0x30(%rbp), %rax
imulq %r12, %rax
movq %rax, %rdi
shlq $0x4, %rdi
testl %eax, %eax
cmovsq %r13, %rdi
callq 0x3030
shll $0x4, %r12d
subq $0x8, %rsp
movq 0xc546(%rip), %rdx      # 0x16f98
movq -0x88(%rbp), %rdi
movl %r12d, %esi
movq %rax, -0xf8(%rbp)
movq %rax, %rcx
movl %r12d, %r8d
movq %rdx, %r9
pushq 0xc536(%rip)            # 0x16fa8
callq 0x3060
addq $0x10, %rsp
movl $0x0, -0x3c(%rbp)
xorl %eax, %eax
leaq -0x140(%rbp), %rdx
movq %rax, 0x10(%rdx)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdx)
leaq -0xf0(%rbp), %rdi
movq %rax, 0x10(%rdi)
movapd %xmm0, (%rdi)
movq %rax, -0x70(%rbp)
movapd %xmm0, -0x80(%rbp)
movslq -0x30(%rbp), %rsi
callq 0xb5a0
movslq -0x30(%rbp), %rsi
leaq -0x80(%rbp), %rdi
leaq -0x140(%rbp), %rdx
callq 0xb5a0
xorpd %xmm0, %xmm0
leaq -0x190(%rbp), %rdx
movapd %xmm0, (%rdx)
xorl %eax, %eax
movq %rax, 0x10(%rdx)
leaq -0x120(%rbp), %rdi
movq %rax, 0x10(%rdi)
movapd %xmm0, (%rdi)
movq %rax, -0xa0(%rbp)
movapd %xmm0, -0xb0(%rbp)
movslq -0x30(%rbp), %rsi
callq 0xb622
movslq -0x30(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x190(%rbp), %rdx
callq 0xb622
movslq -0x30(%rbp), %rsi
testq %rsi, %rsi
jle 0xad06
movq -0xf8(%rbp), %rax
leaq 0x8(%rax), %r13
xorl %r12d, %r12d
movl %esi, %eax
movl -0x94(%rbp), %edx
cmpq %rdx, %r12
je 0xacf7
leaq 0xc812(%rip), %rcx      # 0x17364
movslq (%rcx), %rcx
testq %rcx, %rcx
jle 0xabc9
imull %ecx, %edx
movslq %edx, %rdx
movl %ecx, %esi
imull %r12d, %esi
movslq %esi, %rsi
shlq $0x4, %rsi
addq %r13, %rsi
shlq $0x4, %rdx
addq %r13, %rdx
shlq $0x4, %rcx
xorl %edi, %edi
movsd -0x8(%rdx,%rdi), %xmm0
movsd -0x8(%rsi,%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xaba8
movsd (%rdx,%rdi), %xmm0
subsd %xmm1, %xmm0
movsd -0x38(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xabc0
jmp 0xacf7
movsd (%rsi,%rdi), %xmm1
subsd %xmm0, %xmm1
movsd -0x38(%rbp), %xmm0
ucomisd %xmm1, %xmm0
ja 0xacf7
addq $0x10, %rdi
cmpq %rdi, %rcx
jne 0xab7d
movl $0x0, -0x2c(%rbp)
movq -0x48(%rbp), %rcx
movl (%rcx), %edx
testl %edx, %edx
jle 0xacf7
xorl %ecx, %ecx
leaq 0xc77d(%rip), %rax      # 0x17364
movslq (%rax), %rax
testq %rax, %rax
jle 0xacaa
movslq %ecx, %rsi
movq (%r15), %rdi
leaq (%rsi,%rsi,2), %rsi
movq (%rdi,%rsi,8), %rsi
movl %r12d, %edi
imull %eax, %edi
movslq %edi, %rdi
shlq $0x4, %rdi
addq %r13, %rdi
movq %rax, %r8
shlq $0x3, %r8
xorl %r9d, %r9d
movsd (%rsi,%r9), %xmm0
movsd -0x8(%rdi,%r9,2), %xmm1
ucomisd %xmm0, %xmm1
ja 0xace7
ucomisd (%rdi,%r9,2), %xmm0
ja 0xace7
addq $0x8, %r9
cmpq %r9, %r8
jne 0xac1b
testl %eax, %eax
jle 0xacaa
xorl %r14d, %r14d
xorl %ebx, %ebx
movq -0xf0(%rbp), %rcx
leaq (%r12,%r12,2), %rdx
leaq (%rcx,%rdx,8), %rdi
movslq -0x2c(%rbp), %rcx
movq (%r15), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rdx
addq %r14, %rdx
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xac8d
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xac9b
callq 0xbd32
leaq 0xc6cb(%rip), %rax      # 0x17364
movl (%rax), %eax
incq %rbx
movslq %eax, %rcx
addq $0x8, %r14
cmpq %rcx, %rbx
jl 0xac50
movq -0x120(%rbp), %rax
leaq (%r12,%r12,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xacd2
movl -0x2c(%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xacde
leaq -0x2c(%rbp), %rdx
callq 0x5002
movl -0x2c(%rbp), %ecx
incl -0x3c(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %edx
incl %ecx
movl %ecx, -0x2c(%rbp)
cmpl %edx, %ecx
jl 0xabe0
movl -0x30(%rbp), %eax
incq %r12
movslq %eax, %rsi
cmpq %rsi, %r12
jl 0xab3c
xorpd %xmm0, %xmm0
leaq -0xd0(%rbp), %rdi
movapd %xmm0, (%rdi)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
movq %rax, -0x50(%rbp)
movapd %xmm0, -0x60(%rbp)
leaq -0x178(%rbp), %rdx
movl $0x0, (%rdx)
callq 0xb52c
movslq -0x30(%rbp), %rsi
leaq -0x178(%rbp), %rdx
movl $0x0, (%rdx)
leaq -0x60(%rbp), %rdi
callq 0xb52c
movl $0x0, -0x2c(%rbp)
cmpl $0x0, -0x30(%rbp)
movq -0xd0(%rbp), %rdi
jle 0xad91
xorl %ecx, %ecx
movq -0xf0(%rbp), %rax
movslq %ecx, %rcx
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rsi
subq (%rax,%rdx,8), %rsi
shrq $0x3, %rsi
movl %esi, (%rdi,%rcx,4)
movl -0x2c(%rbp), %ecx
incl %ecx
movl %ecx, -0x2c(%rbp)
cmpl -0x30(%rbp), %ecx
jl 0xad6d
movq -0x60(%rbp), %rcx
subq $0x8, %rsp
movq 0xc230(%rip), %rdx      # 0x16fd0
movl $0x1, %esi
movl $0x1, %r8d
movq %rdx, %r9
pushq 0xc1f4(%rip)            # 0x16fa8
callq 0x3170
addq $0x10, %rsp
movq %rsp, -0x48(%rbp)
movl -0x30(%rbp), %eax
addl %eax, %eax
movq %rsp, %rcx
shlq $0x3, %rax
subq %rax, %rcx
movq %rcx, -0x38(%rbp)
movq %rcx, %rsp
movl -0x30(%rbp), %eax
leal (%rax,%rax), %ecx
movq %rsp, %r12
shlq $0x3, %rcx
subq %rcx, %r12
movq %r12, %rsp
movq %rsp, %rdx
leaq (%rcx,%rcx,2), %rcx
subq %rcx, %rdx
movq %rdx, %rsp
movl $0x0, -0x2c(%rbp)
testl %eax, %eax
jle 0xb0b5
movq %rdx, -0x148(%rbp)
xorl %r13d, %r13d
leaq -0x90(%rbp), %r15
movq 0xc18a(%rip), %r14      # 0x16fa8
xorl %ecx, %ecx
movslq %ecx, %rdx
movq -0x60(%rbp), %rsi
movslq (%rsi,%rdx,4), %rsi
testq %rsi, %rsi
jle 0xaf1a
leaq (%rdx,%rdx,2), %rdi
shlq $0x3, %rdi
addq -0x80(%rbp), %rdi
movq $0x0, -0x90(%rbp)
movq %r15, %rdx
callq 0xb566
movslq -0x2c(%rbp), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
addq -0xb0(%rbp), %rdi
movq -0x60(%rbp), %rcx
movl (%rcx,%rax,4), %eax
cltd
leaq 0xc4ef(%rip), %rcx      # 0x17364
idivl (%rcx)
movslq %eax, %rsi
movl $0xffffffff, -0x90(%rbp) # imm = 0xFFFFFFFF
movq %r15, %rdx
callq 0xb52c
movslq -0x2c(%rbp), %rcx
movq -0x80(%rbp), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rdi
movq -0x60(%rbp), %rax
movl (%rax,%rcx,4), %esi
movslq %r13d, %rax
leaq (%r12,%rax,8), %rbx
subq $0x8, %rsp
movq 0xc103(%rip), %rdx      # 0x16fb8
movl $0xc8, %r8d
movq %r14, %r9
pushq %rbx
callq 0x33c0
addq $0x10, %rsp
movslq -0x2c(%rbp), %rcx
movq -0xb0(%rbp), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rdi
movq -0x60(%rbp), %rax
movl (%rax,%rcx,4), %eax
cltd
leaq 0xc47a(%rip), %rsi      # 0x17364
idivl (%rsi)
addq $0x8, %rbx
subq $0x8, %rsp
movl %eax, %esi
movq 0xc0d3(%rip), %rdx      # 0x16fd0
movl $0xc9, %r8d
movq %r14, %r9
pushq %rbx
callq 0x33c0
addq $0x10, %rsp
addl $0x2, %r13d
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %eax
incl %ecx
movl %ecx, -0x2c(%rbp)
cmpl %eax, %ecx
jl 0xae20
movl $0x0, -0x2c(%rbp)
xorl %r15d, %r15d
testl %eax, %eax
jle 0xaff1
movq 0xc068(%rip), %r14      # 0x16fa8
xorl %edx, %edx
movslq %edx, %rcx
movq -0xd0(%rbp), %rsi
movl (%rsi,%rcx,4), %esi
testl %esi, %esi
jle 0xafe4
movq -0xf0(%rbp), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rdi
movslq %r15d, %rax
movq -0x38(%rbp), %rdx
leaq (%rdx,%rax,8), %rbx
subq $0x8, %rsp
movq 0xc03c(%rip), %rdx      # 0x16fb8
movl $0xc8, %r8d
movq %r14, %r9
pushq %rbx
callq 0x3130
addq $0x10, %rsp
movslq -0x2c(%rbp), %rcx
movq -0x120(%rbp), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rdi
movq -0xd0(%rbp), %rax
movl (%rax,%rcx,4), %eax
cltd
leaq 0xc3b0(%rip), %rsi      # 0x17364
idivl (%rsi)
addq $0x8, %rbx
subq $0x8, %rsp
movl %eax, %esi
movq 0xc009(%rip), %rdx      # 0x16fd0
movl $0xc9, %r8d
movq %r14, %r9
pushq %rbx
callq 0x3130
addq $0x10, %rsp
addl $0x2, %r15d
movl -0x2c(%rbp), %edx
movl -0x30(%rbp), %eax
incl %edx
movl %edx, -0x2c(%rbp)
cmpl %eax, %edx
jl 0xaf42
movl $0x0, -0x2c(%rbp)
testl %r13d, %r13d
jle 0xb09b
leaq -0x178(%rbp), %r14
movl %r13d, %edi
movq %r12, %rsi
leaq -0x90(%rbp), %rdx
movq %r14, %rcx
callq 0x3390
cmpl $0xc8, -0x174(%rbp)
jne 0xb08a
movl -0x178(%rbp), %eax
movslq %eax, %rdi
movq -0x60(%rbp), %rax
movl (%rax,%rdi,4), %esi
leaq 0xc324(%rip), %rax      # 0x17364
movl (%rax), %edx
leaq (%rdi,%rdi,2), %rbx
leaq (,%rbx,8), %rcx
addq -0x80(%rbp), %rcx
subq $0x8, %rsp
movq -0x158(%rbp), %r8
movq -0x108(%rbp), %r9
pushq -0x100(%rbp)
callq 0xa77d
addq $0x10, %rsp
movq -0x80(%rbp), %rcx
movq (%rcx,%rbx,8), %rax
cmpq %rax, 0x8(%rcx,%rbx,8)
je 0xb08a
leaq (%rcx,%rbx,8), %rcx
movq %rax, 0x8(%rcx)
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
cmpl %r13d, %eax
jl 0xb008
testl %r15d, %r15d
jle 0xb0bc
movl %r15d, %edi
movq -0x38(%rbp), %rsi
movq -0x148(%rbp), %rdx
callq 0x3320
jmp 0xb0bc
movl $0x0, -0x2c(%rbp)
movq -0x100(%rbp), %rax
movl (%rax), %ecx
leaq -0xb0(%rbp), %rdi
movq -0x150(%rbp), %rsi
movq -0x108(%rbp), %rdx
callq 0xa8ac
subq $0x8, %rsp
movq 0xbee6(%rip), %rcx      # 0x16fd0
movq 0xbe9f(%rip), %r8       # 0x16f90
leaq -0x3c(%rbp), %rdi
leaq -0x15c(%rbp), %rsi
movl $0x1, %edx
xorl %r9d, %r9d
pushq 0xbe9e(%rip)            # 0x16fa8
callq 0x3380
addq $0x10, %rsp
movq -0x140(%rbp), %rax
cmpq %rax, -0x138(%rbp)
je 0xb12a
movq %rax, -0x138(%rbp)
movq -0xf0(%rbp), %rbx
movq -0xe8(%rbp), %r14
cmpq %rbx, %r14
je 0xb15d
movq %rbx, %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0xb14d
callq 0x3270
addq $0x18, %r15
cmpq %r14, %r15
jne 0xb140
movq %rbx, -0xe8(%rbp)
movq -0x80(%rbp), %rbx
movq -0x78(%rbp), %r14
cmpq %rbx, %r14
je 0xb187
movq %rbx, %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0xb17a
callq 0x3270
addq $0x18, %r15
cmpq %r14, %r15
jne 0xb16d
movq %rbx, -0x78(%rbp)
movq -0xd0(%rbp), %rax
cmpq %rax, -0xc8(%rbp)
je 0xb19e
movq %rax, -0xc8(%rbp)
movq -0x60(%rbp), %rax
cmpq %rax, -0x58(%rbp)
je 0xb1ac
movq %rax, -0x58(%rbp)
movq -0x120(%rbp), %rbx
movq -0x118(%rbp), %r14
cmpq %rbx, %r14
je 0xb1df
movq %rbx, %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0xb1cf
callq 0x3270
addq $0x18, %r15
cmpq %r14, %r15
jne 0xb1c2
movq %rbx, -0x118(%rbp)
movq -0xb0(%rbp), %rbx
movq -0xa8(%rbp), %r14
cmpq %rbx, %r14
je 0xb212
movq %rbx, %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0xb202
callq 0x3270
addq $0x18, %r15
cmpq %r14, %r15
jne 0xb1f5
movq %rbx, -0xa8(%rbp)
movq -0xf8(%rbp), %rdi
callq 0x3370
movq -0x88(%rbp), %rdi
callq 0x3370
movq -0x48(%rbp), %rsp
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0xb23c
callq 0x3270
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0xb24d
callq 0x3270
leaq -0xb0(%rbp), %rdi
callq 0xb6a4
leaq -0x120(%rbp), %rdi
callq 0xb6a4
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0xb276
callq 0x3270
leaq -0x80(%rbp), %rdi
callq 0x41b4
leaq -0xf0(%rbp), %rdi
callq 0x41b4
movq -0x140(%rbp), %rdi
testq %rdi, %rdi
je 0xb29c
callq 0x3270
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb2c2
jmp 0xb2c2
jmp 0xb2c2
jmp 0xb2e8
movq %rax, %rbx
jmp 0xb314
jmp 0xb2c2
jmp 0xb2c2
jmp 0xb2c2
jmp 0xb2c2
jmp 0xb2c2
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0xb2d3
callq 0x3270
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0xb2eb
callq 0x3270
jmp 0xb2eb
jmp 0xb2e8
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0xb6a4
leaq -0x120(%rbp), %rdi
callq 0xb6a4
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0xb314
callq 0x3270
leaq -0x80(%rbp), %rdi
callq 0x41b4
leaq -0xf0(%rbp), %rdi
callq 0x41b4
movq -0x140(%rbp), %rdi
testq %rdi, %rdi
je 0xb33a
callq 0x3270
movq %rbx, %rdi
callq 0x34c0