// File: /workspace/github_cpp_makefile_star2_O2/JainamS1996[P]Btree_DataStructure/final.cpp
// Function: main
int main(int argc, char *argv[]) {
    int z;
    ifstream file(argv[1]);

    if (file.fail()) {
        //cout<<"File not found";
        exit(1);
    }
    ofstream o_file("output_file.txt");

    string line;
    //PARSING THE INPUT
    
    while (getline(file, line)) {
        
        int i=0;
        int x=0;
        int y=0;
        double a=0;
        double b=0;
        string temp = "";
        string temp2 = "";

        if (isdigit(line[0])) {
      		istringstream buffer(line);
        	int value;
        	buffer >> value;
        	order = value;
        }

        if (line.substr(0,1)=="I")
        {
            if(line.substr(7,1)=="-")
            {
                for (i = 8;line.substr(i,1)!= ",";i++)
                {
                    x++;
                    
                }
                temp = line.substr(8,x);
                a = -stod(temp);
            }
            else {
                for (i = 7;line.substr(i,1)!= ",";i++)
                {
                    x++;
                }
                temp = line.substr(7,x);
                a = stod(temp);
            }
            
			y=i+1;
            x=0;
            
			for (i = y; line.substr(i,1)!=")";i++)
            {
                x++;
            }

            temp2 = line.substr(y,x);
			//cout << "inserting " << a << " "<< temp2 << " " <<endl; 
            insertNode(rootNode,a,temp2);
        }
        if (line.substr(0,1)=="S")
        {
            if(line.substr(7,1)=="-")
            {
                for (i = 8;line.substr(i,1)!= "," && line.substr(i,1)!=")";i++)
                {
                    x++;
                }
                temp = line.substr(8,x);
                a = -stod(temp);
            }
            else {
                for (i = 7;line.substr(i,1)!= "," && line.substr(i,1)!=")";i++)
                {
                    x++;
                }
                temp = line.substr(7,x);
                a = stod(temp);
            }

            if (line.substr(i,1)==",") {
                y=i+1;
                x=0;
                if (line.substr(y,1)=="-") {
                    y=y+1;
                    for (i = y; line.substr(i,1)!=")";i++)
                    {
                        x++;
                    }
                    temp2 = line.substr(y,x);
                    b = -stod(temp2);
                }
                else {
                    for (i = y; line.substr(i,1)!=")";i++)
                    {
                        x++;
                    }
                    temp2 = line.substr(y,x);
                    b = stod(temp2);
                }
				search(rootNode,a,b,o_file);
            }
            else {
				search(rootNode,a,o_file);
            }
        }
    }
    
    file.close();
    o_file.close();
    
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x648, %rsp            # imm = 0x648
movq 0x8(%rsi), %rsi
leaq -0x4e8(%rbp), %rbx
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x22b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x4c8(%rbp,%rax)
jne 0x366b
leaq 0x305e(%rip), %rsi      # 0x602a
leaq -0x2e0(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x21b0
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x60(%rbp), %r15
leaq 0x3033(%rip), %r14      # 0x6029
leaq -0x668(%rbp), %r13
leaq -0x4e8(%rbp), %rdi
movq %r15, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x361e
leaq -0x80(%rbp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x20b0
leaq -0xa0(%rbp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x20b0
movq -0x60(%rbp), %rax
movsbl (%rax), %eax
addl $-0x30, %eax
cmpl $0x9, %eax
ja 0x307f
movq %r13, %rdi
movq %r15, %rsi
pushq $0x8
popq %rdx
callq 0x2290
movq %r13, %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2120
movl -0xc0(%rbp), %eax
movl %eax, 0x6101(%rip)      # 0x9178
movq %r13, %rdi
callq 0x20e0
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2fa1(%rip), %rsi      # 0x603a
callq 0x3937
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
xorl %r12d, %r12d
testb %bl, %bl
je 0x3271
movq %r13, %rdi
movq %r15, %rsi
pushq $0x7
popq %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2f6e(%rip), %rsi      # 0x603c
callq 0x3937
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x3118
pushq $0x8
popq %r12
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2f20(%rip), %rsi      # 0x6020
callq 0x3947
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x314f
incq %r12
jmp 0x30e5
pushq $0x7
popq %r12
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2ee9(%rip), %rsi      # 0x6020
callq 0x3947
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x318c
incq %r12
jmp 0x311c
leaq -0x8(%r12), %rcx
movq %r13, %rdi
movq %r15, %rsi
pushq $0x8
popq %rdx
callq 0x21a0
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
callq 0x20d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3954
xorps 0x2e86(%rip), %xmm0     # 0x6010
jmp 0x31c0
leaq -0x7(%r12), %rcx
movq %r13, %rdi
movq %r15, %rsi
pushq $0x7
popq %rdx
callq 0x21a0
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
callq 0x20d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3954
movaps %xmm0, -0x40(%rbp)
leaq 0x1(%r12), %r14
movl %r12d, %r15d
incq %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rdx
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2ea4(%rip), %rsi      # 0x6093
callq 0x3947
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x3207
incq %r12
jmp 0x31d2
movl %r14d, %edx
movq %r13, %rdi
leaq -0x60(%rbp), %r15
movq %r15, %rsi
movq %r12, %rcx
callq 0x21a0
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
callq 0x20d0
movq 0x5f5b(%rip), %rbx      # 0x9198
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0x21f0
leaq 0x2dd6(%rip), %r14      # 0x6029
movaps -0x40(%rbp), %xmm0
movq %rbx, %rdi
leaq -0xe0(%rbp), %rbx
movq %rbx, %rsi
callq 0x29b7
movq %rbx, %rdi
callq 0x20d0
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2db3(%rip), %rsi      # 0x603e
callq 0x3937
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x3604
movq %r13, %rdi
movq %r15, %rsi
pushq $0x7
popq %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2d7f(%rip), %rsi      # 0x603c
callq 0x3937
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
movl %r12d, %eax
movq %rax, -0x40(%rbp)
testb %bl, %bl
je 0x3345
pushq $0x8
popq %r12
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2d2a(%rip), %rsi      # 0x6020
callq 0x3947
testb %al, %al
je 0x33b3
leaq -0xc0(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r14, %rdi
leaq 0x2d6e(%rip), %rsi      # 0x6093
callq 0x3947
movl %eax, %ebx
movq %r14, %rdi
callq 0x20d0
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x33bb
incq %r12
jmp 0x32db
pushq $0x7
popq %r12
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2cbc(%rip), %rsi      # 0x6020
callq 0x3947
testb %al, %al
je 0x3406
leaq -0xc0(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r14, %rdi
leaq 0x2d00(%rip), %rsi      # 0x6093
callq 0x3947
movl %eax, %ebx
movq %r14, %rdi
callq 0x20d0
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x340e
incq %r12
jmp 0x3349
movq %r13, %rdi
callq 0x20d0
movq -0x40(%rbp), %rax
leaq (%rax,%r12), %rcx
addq $-0x8, %rcx
movq %r13, %rdi
movq %r15, %rsi
pushq $0x8
popq %rdx
callq 0x21a0
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
callq 0x20d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3954
leaq 0x2c2c(%rip), %r14      # 0x6029
xorps 0x2c0c(%rip), %xmm0     # 0x6010
jmp 0x3450
movq %r13, %rdi
callq 0x20d0
movq -0x40(%rbp), %rax
leaq (%rax,%r12), %rcx
addq $-0x7, %rcx
movq %r13, %rdi
movq %r15, %rsi
pushq $0x7
popq %rdx
callq 0x21a0
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
callq 0x20d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3954
leaq 0x2bd9(%rip), %r14      # 0x6029
movaps %xmm0, -0x40(%rbp)
movl %r12d, %r15d
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
movq %r15, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2bad(%rip), %rsi      # 0x6020
callq 0x3937
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x34fb
leal 0x1(%r12), %r14d
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
movq %r14, %rdx
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2b95(%rip), %rsi      # 0x603c
callq 0x3937
movl %eax, %ebx
movq %r13, %rdi
callq 0x20d0
testb %bl, %bl
je 0x351b
addq $0x2, %r12
addq $0x2, %r15
xorl %ebx, %ebx
leaq (%r15,%rbx), %rdx
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2bb2(%rip), %rsi      # 0x6093
callq 0x3947
movl %eax, %r14d
movq %r13, %rdi
callq 0x20d0
testb %r14b, %r14b
je 0x355a
incq %rbx
jmp 0x34c4
movq 0x5c96(%rip), %rdi      # 0x9198
movaps -0x40(%rbp), %xmm0
leaq -0x2e0(%rbp), %rsi
callq 0x2bd2
leaq -0x60(%rbp), %r15
jmp 0x3604
movq %r14, %r12
incq %r15
xorl %ebx, %ebx
leaq (%r15,%rbx), %rdx
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
pushq $0x1
popq %rcx
callq 0x21a0
movq %r13, %rdi
leaq 0x2b53(%rip), %rsi      # 0x6093
callq 0x3947
movl %eax, %r14d
movq %r13, %rdi
callq 0x20d0
testb %r14b, %r14b
je 0x35aa
incq %rbx
jmp 0x3523
movl %r12d, %edx
movq %r13, %rdi
leaq -0x60(%rbp), %r15
movq %r15, %rsi
movq %rbx, %rcx
callq 0x21a0
leaq 0x2ab3(%rip), %r14      # 0x6029
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
callq 0x20d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3954
movaps %xmm0, %xmm1
movaps -0x40(%rbp), %xmm0
xorps 0x2a68(%rip), %xmm1     # 0x6010
jmp 0x35f1
movq %r13, %rdi
leaq -0x60(%rbp), %r15
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x21a0
leaq 0x2a63(%rip), %r14      # 0x6029
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d0
movq %r13, %rdi
callq 0x20d0
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3954
movaps %xmm0, %xmm1
movaps -0x40(%rbp), %xmm0
movq 0x5ba0(%rip), %rdi      # 0x9198
leaq -0x2e0(%rbp), %rsi
callq 0x2d9d
leaq -0xa0(%rbp), %rdi
callq 0x20d0
leaq -0x80(%rbp), %rdi
callq 0x20d0
jmp 0x2ffd
leaq -0x4e8(%rbp), %rdi
callq 0x2060
leaq -0x2e0(%rbp), %rdi
callq 0x2200
leaq -0x60(%rbp), %rdi
callq 0x20d0
leaq -0x2e0(%rbp), %rdi
callq 0x2230
leaq -0x4e8(%rbp), %rdi
callq 0x2070
xorl %eax, %eax
addq $0x648, %rsp            # imm = 0x648
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdi
callq 0x21c0
movq %rax, %rbx
jmp 0x3710
jmp 0x36bd
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
jmp 0x36d0
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
movq %rax, %rbx
leaq -0x668(%rbp), %rdi
callq 0x20e0
jmp 0x36e6
jmp 0x36e3
jmp 0x36e3
jmp 0x36bd
jmp 0x36e3
movq %rax, %rbx
jmp 0x36f2
movq %rax, %rbx
jmp 0x36fb
jmp 0x36e3
jmp 0x36c6
movq %rax, %rbx
leaq -0x668(%rbp), %rdi
callq 0x20d0
jmp 0x36e6
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
jmp 0x36e3
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x20d0
leaq -0x80(%rbp), %rdi
callq 0x20d0
leaq -0x60(%rbp), %rdi
callq 0x20d0
leaq -0x2e0(%rbp), %rdi
callq 0x2230
leaq -0x4e8(%rbp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x22a0