// File: /workspace/github_cpp_makefile_star2_O1/meghanamreddy[P]Range-trees-and-Interval-Trees/binaryRangeTree.cpp
// Function: BinaryRangeTree::twodquery(int, int, int, int)
void BinaryRangeTree::twodquery(int x1, int x2, int y1, int y2) {
	BinaryRangeNode* splitnode = findSplitNode(root, x1, x2);
	BinaryRangeNode* v;
	int i;
	isPointInRange(splitnode, x1, x2, y1, y2);
	if (!isLeaf(splitnode)) {
		// go to left
		v = splitnode->left;
		while (!isLeaf(v)) { // is not a leaf
			if (x1 <= v->data) {
				isPointInRange(v, x1, x2, y1, y2); //report the point itself
				if (v->right != NULL )
					onedqueryYtree(v->right->ytree, y1, y2);
				v = v->left;
			}
			else
				v = v->right;
		}
		if (v != NULL) {
			isPointInRange(v, x1, x2, y1, y2); 
		}

		v = splitnode->right;
		while (!isLeaf(v)) { // is not a leaf
			if (x2 >= v->data) {
				isPointInRange(v, x1, x2, y1, y2); 
				if (v->left != NULL) {
					onedqueryYtree(v->left->ytree, y1, y2);
				}
				v = v->right;
			}
			else
				v = v->left;
		}
		if (v != NULL) {
			isPointInRange(v, x1, x2, y1, y2); 
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r9d
movl %ecx, %r8d
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, -0x38(%rbp)
movq %rdi, %rax
movq (%rax), %r13
testq %r13, %r13
je 0x380b
movq 0x20(%r13), %rax
orq 0x28(%r13), %rax
sete %cl
jmp 0x380d
movb $0x1, %cl
movl 0x4(%r13), %eax
cmpl %r15d, %eax
setle %dl
cmpl %r12d, %eax
setge %sil
testb %cl, %cl
jne 0x383c
andb %sil, %dl
jne 0x383c
xorl %ecx, %ecx
cmpl %r12d, %eax
setl %cl
leaq 0x20(,%rcx,8), %rax
addq %r13, %rax
jmp 0x37f6
movq %r13, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
callq 0x3654
testq %r13, %r13
je 0x395a
movq 0x20(%r13), %rax
orq 0x28(%r13), %rax
je 0x395a
movq 0x20(%r13), %rbx
testq %rbx, %rbx
sete %al
je 0x38e3
movq 0x20(%rbx), %rcx
orq 0x28(%rbx), %rcx
je 0x38c9
movl $0x28, %r14d
cmpl %r12d, 0x4(%rbx)
jl 0x38c3
movq %rbx, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movl -0x2c(%rbp), %r8d
movl -0x30(%rbp), %r9d
callq 0x3654
movq 0x28(%rbx), %rax
movl $0x20, %r14d
testq %rax, %rax
je 0x38c3
movq 0x30(%rax), %rsi
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x30(%rbp), %ecx
callq 0x34fe
movq (%rbx,%r14), %rbx
jmp 0x386d
testb %al, %al
jne 0x38e3
movq %rbx, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movl -0x2c(%rbp), %r8d
movl -0x30(%rbp), %r9d
callq 0x3654
movq 0x28(%r13), %rbx
testq %rbx, %rbx
sete %al
je 0x395a
movq 0x20(%rbx), %rcx
orq 0x28(%rbx), %rcx
je 0x3956
movl -0x30(%rbp), %r13d
movl $0x20, %r14d
cmpl %r15d, 0x4(%rbx)
jg 0x3940
movq %rbx, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movl -0x2c(%rbp), %r8d
movl %r13d, %r9d
callq 0x3654
movq 0x20(%rbx), %rax
movl $0x28, %r14d
testq %rax, %rax
je 0x3940
movq 0x30(%rax), %rsi
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl %r13d, %ecx
callq 0x34fe
movq (%rbx,%r14), %rbx
testq %rbx, %rbx
sete %al
je 0x395a
movq 0x20(%rbx), %rcx
orq 0x28(%rbx), %rcx
jne 0x38fd
testb %al, %al
je 0x3969
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rsi
movl %r12d, %edx
movl %r15d, %ecx
movl -0x2c(%rbp), %r8d
movl -0x30(%rbp), %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3654
nop