// File: /workspace/github_c_makefile_star2_O2/stefpant[P]TCPserver/PantoulasStefanosProject2/jobExec/child.c
// Function: mergeNodeInfo
void mergeNodeInfo(int ***A,int *Ac,int **B,int Bc){
	if((*A) == NULL){//copy B array to A
		(*A) = malloc(Bc*sizeof(int*));
		for(int i=0;i<Bc;i++){
			(*A)[i] = malloc(2*sizeof(int));
			(*A)[i][0] = B[i][0];
			(*A)[i][1] = B[i][1];
		}
		*Ac = Bc;
		return;
	}
	else if(Bc == 0) return;
	int p1=0,p2=0;
	int fcounter=0;
	int **final = malloc((*Ac + Bc)*sizeof(int*));//allocate for max elements
	while(1){
		if(flagUSR1 == 1) break;//reached deadline stop
		if(p1==*Ac){
			while(p2!=Bc){
				final[fcounter] = malloc(2*sizeof(int));
				final[fcounter][0] = B[p2][0];
				final[fcounter][1] = B[p2][1];
				p2++;fcounter++;
			}
			break;
		}
		if(p2==Bc){
			while(p1!=*Ac){
				final[fcounter] = malloc(2*sizeof(int));
				final[fcounter][0] = (*A)[p1][0];
				final[fcounter][1] = (*A)[p1][1];
				p1++;fcounter++;
			}
			break;
		}
		final[fcounter] = malloc(2*sizeof(int));
		if((*A)[p1][0]<B[p2][0]){//insert in final sorted
			final[fcounter][0] = (*A)[p1][0];
			final[fcounter++][1] = (*A)[p1++][1];
		}
		else if((*A)[p1][0]>B[p2][0]){
			final[fcounter][0] = B[p2][0];
			final[fcounter++][1] = B[p2++][1];
		}
		else{//now lets check second member of array
			if((*A)[p1][1]<B[p2][1]){
				final[fcounter][0] = (*A)[p1][0];
				final[fcounter++][1] = (*A)[p1++][1];
			}
			else if((*A)[p1][1]>B[p2][1]){
				final[fcounter][0] = B[p2][0];
				final[fcounter++][1] = B[p2++][1];
			}
			else{
				final[fcounter][0] = (*A)[p1][0];
				final[fcounter++][1] = (*A)[p1++][1];
				p2++;
			}
		}
	}
	if(flagUSR1 == 1){//reached deadline free(final) and return
		for(int i=0;i<fcounter;i++)
			free(final[i]);
		free(final);
		return;//and in childs main check flag and stop!
	}
	if(!fcounter) return;
	for(int h=0;h<*Ac;h++) free((*A)[h]);
	if(*Ac!=0) free(*A);
	*A = realloc(final,fcounter*sizeof(int*));//in the end resize the array
	*Ac = fcounter;
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebx
movq %rdx, -0x48(%rbp)
movq %rdi, %r12
movq (%rdi), %rax
movq %rax, -0x60(%rbp)
testq %rax, %rax
movq %rdi, -0x40(%rbp)
je 0x406c
testl %ebx, %ebx
je 0x41dd
movq %rsi, -0x38(%rbp)
movl (%rsi), %eax
movslq %eax, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, -0x58(%rbp)
movq %rbx, -0x50(%rbp)
addl %ebx, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x2200
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %r14d, %r14d
movl 0x61e3(%rip), %eax      # 0xa1b8
cmpl $0x1, %eax
je 0x40d7
movslq %r14d, %r15
cmpl -0x58(%rbp), %ebx
je 0x40dd
movslq %ebx, %r12
cmpl -0x50(%rbp), %r14d
je 0x4114
pushq $0x8
popq %rdi
callq 0x2200
movq -0x30(%rbp), %rcx
movq %rax, (%rcx,%r13,8)
movq -0x60(%rbp), %rcx
movq (%rcx,%r12,8), %rcx
movl (%rcx), %esi
movq -0x48(%rbp), %rdx
movq (%rdx,%r15,8), %rdx
movl (%rdx), %edi
cmpl %edi, %esi
jge 0x402f
movl %esi, (%rax)
incl %ebx
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%rax)
movq -0x40(%rbp), %r12
jmp 0x4053
movq -0x40(%rbp), %r12
jle 0x403f
movl %edi, (%rax)
incl %r14d
movl 0x4(%rdx), %ecx
jmp 0x4050
movl 0x4(%rdx), %r8d
cmpl %r8d, 0x4(%rcx)
jge 0x405b
movl %esi, (%rax)
incl %ebx
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%rax)
incq %r13
jmp 0x3fcf
jg 0x4035
movl %esi, (%rax)
incl %ebx
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%rax)
incl %r14d
jmp 0x4053
movq %rsi, -0x38(%rbp)
movslq %ebx, %rdi
shlq $0x3, %rdi
callq 0x2200
movq %rax, %r15
movq %rax, (%r12)
xorl %r14d, %r14d
testl %ebx, %ebx
movl $0x0, %r12d
movq %rbx, %r13
cmovgl %ebx, %r12d
pushq $0x8
popq %rbx
cmpq %r14, %r12
je 0x40cb
movq %rbx, %rdi
callq 0x2200
movq %rax, (%r15,%r14,8)
movq -0x48(%rbp), %rax
movq (%rax,%r14,8), %rax
movl (%rax), %ecx
movq -0x40(%rbp), %rdx
movq (%rdx), %r15
movq (%r15,%r14,8), %rdx
movl %ecx, (%rdx)
movl 0x4(%rax), %eax
movl %eax, 0x4(%rdx)
incq %r14
jmp 0x4098
movq -0x38(%rbp), %rax
movl %r13d, (%rax)
jmp 0x41dd
movq -0x38(%rbp), %r14
jmp 0x414f
movslq -0x50(%rbp), %rbx
movq -0x38(%rbp), %r14
cmpq %r15, %rbx
je 0x414f
pushq $0x8
popq %rdi
callq 0x2200
movq -0x30(%rbp), %rcx
movq %rax, (%rcx,%r13,8)
movq -0x48(%rbp), %rcx
movq (%rcx,%r15,8), %rcx
movl (%rcx), %edx
movl %edx, (%rax)
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%rax)
incq %r15
incq %r13
jmp 0x40e5
pushq $0x8
popq %rbx
movq -0x38(%rbp), %r14
cmpq %r12, -0x68(%rbp)
je 0x414b
movq %rbx, %rdi
callq 0x2200
movq -0x30(%rbp), %rcx
movq %rax, (%rcx,%r13,8)
movq -0x60(%rbp), %rcx
movq (%rcx,%r12,8), %rcx
movl (%rcx), %edx
movl %edx, (%rax)
movl 0x4(%rcx), %ecx
movl %ecx, 0x4(%rax)
incq %r12
incq %r13
jmp 0x411b
movq -0x40(%rbp), %r12
movl 0x6063(%rip), %eax      # 0xa1b8
cmpl $0x1, %eax
jne 0x4177
movl %r13d, %ebx
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x41a2
movq -0x30(%rbp), %rax
movq (%rax,%r14,8), %rdi
callq 0x2030
incq %r14
jmp 0x4160
testl %r13d, %r13d
movq -0x58(%rbp), %rax
je 0x41dd
xorl %ebx, %ebx
movq %rax, %rcx
movslq %ecx, %rax
cmpq %rax, %rbx
jge 0x41b9
movq (%r12), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2030
incq %rbx
movl (%r14), %eax
jmp 0x4182
movq -0x30(%rbp), %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
testl %ecx, %ecx
je 0x41c6
movq (%r12), %rdi
callq 0x2030
movslq %r13d, %rsi
shlq $0x3, %rsi
movq -0x30(%rbp), %rdi
callq 0x2220
movq %rax, (%r12)
movl %r13d, (%r14)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq