// File: kiudee[P]VAHD-Projekt/Node.cpp
// Function: Node::FinishSearch(SearchJob*)
Action Node::FinishSearch(SearchJob *sj)
{
    //TO DO dont insert data on leaving nodes! num > MAX! => fixed in Search
    if (sj->type == LOOKUP || sj->type == INSERT || sj->type == DELETE) {
        std::cout << "(" << sj->_debugID << ") " << num << "<-FinishSearch(" << sj->sid << ")\n";
    }

    double hashedkey = sj->sid;
    if (sj->type == JOIN // SearchJob is a Join
            || (isReal && right == NULL && num <= hashedkey) // There is no right node and this node is responsible
            || (isReal && num <= hashedkey)// There is a right node but not responsible
            || (isReal && sj->sid == MAX)) { //The searchjob was delegated to the last node and now we reached the last node
        if (sj->type == LOOKUP || sj->type == INSERT || sj->type == DELETE) {
            std::cout << "(" << sj->_debugID << ") " << num << ": Search terminated!(" << sj->sid << ") after " << sj->hopcount << " hops  \n";
        }
        switch (sj->type) {
        case DATAINSERT:
            data[sj->dob->num] = sj->dob->date;
            break;
        case INSERT:
            data[sj->dob->num] = sj->dob->date;
            //Save hopcount to csv file:
            *csvFile << "Insert," << sj->hopcount << "," << std::abs(sj->startID - num) << "," << sj->startID << "," << num << "," << sj->bound << "," << "\n";
            csvFile->flush();
            break;
        case DELETE:
            data.erase(sj->key);
            //Save hopcount to csv file:
            *csvFile << "Delete," << sj->hopcount << "," << std::abs(sj->startID - num) << "," << sj->startID << "," << num << "," << sj->bound << "," << "\n";
            csvFile->flush();
            break;
        case LOOKUP: {
            DATATYPE obj = data[sj->key]; //TODO replace by unordered_map.at() and catch the exception. than pack an empty string or so.
            //std::cout << "Lookup reached key:" << sj->key << " data: " << obj << "\n";
            Relay *temprelay = new Relay(sj->ido->id);
            DateObj *dob = new DateObj(sj->key, obj);

            //Save hopcount to csv file:
            *csvFile << "Lookup," << sj->hopcount << "," << std::abs(sj->startID - num) << "," << sj->startID << "," << num << "," << sj->bound << "," << "\n";
            csvFile->flush();

            temprelay->call(Node::ReceiveLookUp, dob);
            //delete temprelay;
            break;
        }
        case JOIN: {
            IdObj *ido = sj->ido;
            //std::cout << ido->num << " joins at " << num << "\n";
            BuildList(ido); // just connect to given reference;

            if (ido->num > num && right != NULL) {
                //std::cout << num << " triggers a data transfer for " << ido->num << " (to right) \n";
                IdObj *tempido =
                    new IdObj(right->num, new Identity(right->out), right->debugID);
                TriggerDataTransfer(tempido);

            } else if (ido->num <= num && left != NULL) {//this case matches iff we are joining the new node in front of the first node.
                //std::cout << num << " triggers a data transfer for " << ido->num << " (to left)\n";
                if (!(right == NULL && !isReal)) { //we know that the joined node is the first from now on. if the actual node has no right neighbor and is not real, there is no data to transfer (because FinishSearch will determine that the joined node is responsible)
                    IdObj *tempido = new IdObj(left->num, new Identity(left->out), left->debugID);
                    SearchJob *newsj = new SearchJob(MAX, DATATRANSFER,
                                                     Node::calcRoutingBound(), tempido);
                    Search(newsj);
                }
            }

            break;
        }
        case DATATRANSFER: {
            IdObj *tempido = sj->ido;
            TriggerDataTransfer(tempido);
            break;
        }
        }
        //std::cout << "(" << sj->_debugID << ") " << "delete searchjob\n";
        delete sj;
        return;
    } else {
        //the actual node is the end of the list. send searchjob to the other end.
        if (left == NULL) {
            if (sj->sid < MAX) { //break recursion
                delegateSearchJobToLastNode(sj);
            }
        } else if (leftstable) {
            sj->round++;
            sj->hopcount++;
            left->out->call(Node::FinishSearch, sj);
            return;
        } else {
            call(Node::FinishSearch, sj);
            return;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, 0x38(%rax)
je 0x11b7c
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0x11b7c
movq -0x10(%rbp), %rax
cmpl $0x1, 0x38(%rax)
jne 0x11bf3
movq 0xf44d(%rip), %rdi      # 0x20fd0
leaq 0x5923(%rip), %rsi      # 0x174ad
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x3060
movq %rax, %rdi
leaq 0x58de(%rip), %rsi      # 0x17486
callq 0x31b0
movq %rax, %rdi
movq -0xe0(%rbp), %rax
movsd 0xb0(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x58bb(%rip), %rsi      # 0x17489
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x5882(%rip), %rsi      # 0x17470
callq 0x31b0
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x3, 0x38(%rax)
je 0x11ca9
movq -0xe0(%rbp), %rax
testb $0x1, 0xb8(%rax)
je 0x11c4a
movq -0xe0(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
jne 0x11c4a
movq -0xe0(%rbp), %rax
movsd 0xb0(%rax), %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jae 0x11ca9
movq -0xe0(%rbp), %rax
testb $0x1, 0xb8(%rax)
je 0x11c74
movq -0xe0(%rbp), %rax
movsd 0xb0(%rax), %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jae 0x11ca9
movq -0xe0(%rbp), %rax
testb $0x1, 0xb8(%rax)
je 0x12747
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd 0x576f(%rip), %xmm1     # 0x17408
ucomisd %xmm1, %xmm0
jne 0x12747
jp 0x12747
movq -0x10(%rbp), %rax
cmpl $0x2, 0x38(%rax)
je 0x11ccb
movq -0x10(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0x11ccb
movq -0x10(%rbp), %rax
cmpl $0x1, 0x38(%rax)
jne 0x11d60
movq 0xf2fe(%rip), %rdi      # 0x20fd0
leaq 0x57d4(%rip), %rsi      # 0x174ad
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x3060
movq %rax, %rdi
leaq 0x578f(%rip), %rsi      # 0x17486
callq 0x31b0
movq %rax, %rdi
movq -0xe0(%rbp), %rax
movsd 0xb0(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x577c(%rip), %rsi      # 0x17499
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x5772(%rip), %rsi      # 0x174af
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %esi
callq 0x3320
movq %rax, %rdi
leaq 0x575d(%rip), %rsi      # 0x174b8
callq 0x31b0
movq -0x10(%rbp), %rax
movl 0x38(%rax), %eax
movq %rax, -0xe8(%rbp)
subq $0x5, %rax
ja 0x12720
movq -0xe8(%rbp), %rax
leaq 0x56ba(%rip), %rcx      # 0x17440
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x28, %rax
movq %rax, -0xf0(%rbp)
addq $0x68, %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
addq $0x20, %rsi
callq 0x15890
movq -0xf0(%rbp), %rsi
movq %rax, %rdi
callq 0x3030
jmp 0x12720
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq $0x28, %rax
movq %rax, -0x100(%rbp)
addq $0x68, %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
addq $0x20, %rsi
callq 0x15890
movq -0x100(%rbp), %rsi
movq %rax, %rdi
callq 0x3030
movq -0xe0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x158c0
movq %rax, %rdi
leaq 0x5694(%rip), %rsi      # 0x174c1
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %esi
callq 0x3320
movq %rax, %rdi
leaq 0x5684(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rcx
movq -0xe0(%rbp), %rax
movq %rcx, -0xf8(%rbp)
movq -0x10(%rbp), %rcx
movsd 0x58(%rcx), %xmm0
subsd 0xb0(%rax), %xmm0
callq 0x158f0
movq -0xf8(%rbp), %rdi
callq 0x3370
movq %rax, %rdi
leaq 0x5642(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movsd 0x58(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x5622(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
movq -0xe0(%rbp), %rax
movsd 0xb0(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x55fc(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movsd 0x40(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x55dc(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
leaq 0x55bd(%rip), %rsi      # 0x174bf
callq 0x31b0
movq -0xe0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x15910
movq %rax, %rdi
callq 0x3110
jmp 0x12720
movq -0xe0(%rbp), %rdi
addq $0x68, %rdi
movq -0x10(%rbp), %rsi
addq $0x50, %rsi
callq 0x15930
movq -0xe0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x158c0
movq %rax, %rdi
leaq 0x556d(%rip), %rsi      # 0x174c9
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %esi
callq 0x3320
movq %rax, %rdi
leaq 0x5555(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rcx
movq -0xe0(%rbp), %rax
movq %rcx, -0x108(%rbp)
movq -0x10(%rbp), %rcx
movsd 0x58(%rcx), %xmm0
subsd 0xb0(%rax), %xmm0
callq 0x158f0
movq -0x108(%rbp), %rdi
callq 0x3370
movq %rax, %rdi
leaq 0x5513(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movsd 0x58(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x54f3(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
movq -0xe0(%rbp), %rax
movsd 0xb0(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x54cd(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movsd 0x40(%rax), %xmm0
callq 0x3370
movq %rax, %rdi
leaq 0x54ad(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, %rdi
leaq 0x548e(%rip), %rsi      # 0x174bf
callq 0x31b0
movq -0xe0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x15910
movq %rax, %rdi
callq 0x3110
jmp 0x12720
movq -0xe0(%rbp), %rdi
addq $0x68, %rdi
movq -0x10(%rbp), %rsi
addq $0x50, %rsi
callq 0x15890
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x30c0
movl $0x48, %edi
callq 0x31c0
movq %rax, -0x110(%rbp)
jmp 0x1208d
movq -0x110(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
addq $0x28, %rsi
callq 0x5890
jmp 0x120a7
movq -0x110(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x48, %edi
callq 0x31c0
movq %rax, -0x118(%rbp)
jmp 0x120c5
movb $0x1, -0x79(%rbp)
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x11c(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x30c0
jmp 0x120e5
movl -0x11c(%rbp), %esi
movq -0x118(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x5dd0
jmp 0x120fd
movb $0x0, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3100
movq -0x118(%rbp), %rax
movq -0xe0(%rbp), %rdi
movq %rax, -0x58(%rbp)
addq $0xa0, %rdi
callq 0x158c0
movq %rax, %rdi
leaq 0x539f(%rip), %rsi      # 0x174d1
callq 0x31b0
movq %rax, -0x128(%rbp)
jmp 0x12140
movq -0x128(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %esi
callq 0x3320
movq %rax, -0x130(%rbp)
jmp 0x1215c
movq -0x130(%rbp), %rdi
leaq 0x5365(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, -0x138(%rbp)
jmp 0x12178
movq -0xe0(%rbp), %rax
movq -0x10(%rbp), %rcx
movsd 0x58(%rcx), %xmm0
movsd 0xb0(%rax), %xmm1
subsd %xmm1, %xmm0
callq 0x158f0
movsd %xmm0, -0x140(%rbp)
jmp 0x121a3
movsd -0x140(%rbp), %xmm0
movq -0x138(%rbp), %rdi
callq 0x3370
movq %rax, -0x148(%rbp)
jmp 0x121c0
movq -0x148(%rbp), %rdi
leaq 0x5301(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, -0x150(%rbp)
jmp 0x121dc
movq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rax
movsd 0x58(%rax), %xmm0
callq 0x3370
movq %rax, -0x158(%rbp)
jmp 0x121fa
movq -0x158(%rbp), %rdi
leaq 0x52c7(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, -0x160(%rbp)
jmp 0x12216
movq -0x160(%rbp), %rdi
movq -0xe0(%rbp), %rax
movsd 0xb0(%rax), %xmm0
callq 0x3370
movq %rax, -0x168(%rbp)
jmp 0x1223a
movq -0x168(%rbp), %rdi
leaq 0x5287(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, -0x170(%rbp)
jmp 0x12256
movq -0x170(%rbp), %rdi
movq -0x10(%rbp), %rax
movsd 0x40(%rax), %xmm0
callq 0x3370
movq %rax, -0x178(%rbp)
jmp 0x12274
movq -0x178(%rbp), %rdi
leaq 0x524d(%rip), %rsi      # 0x174cf
callq 0x31b0
movq %rax, -0x180(%rbp)
jmp 0x12290
movq -0x180(%rbp), %rdi
leaq 0x5221(%rip), %rsi      # 0x174bf
callq 0x31b0
jmp 0x122a5
movq -0xe0(%rbp), %rdi
addq $0xa0, %rdi
callq 0x15910
movq %rax, %rdi
callq 0x3110
jmp 0x122c2
movq -0x40(%rbp), %rax
movq %rax, -0x190(%rbp)
movl $0x38, %edi
callq 0x31c0
movq %rax, -0x188(%rbp)
jmp 0x122e0
movq -0x188(%rbp), %rdi
leaq 0x602(%rip), %rax       # 0x128f0
movq %rax, -0x90(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
leaq -0x58(%rbp), %rcx
callq 0x5ae0
jmp 0x12319
movq -0x188(%rbp), %rdx
movq -0xe0(%rbp), %rsi
movq -0x190(%rbp), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
jmp 0x12339
leaq -0x38(%rbp), %rdi
callq 0x3100
jmp 0x12720
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x123cf
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x48, %esi
callq 0x31d0
jmp 0x123cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12397
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3100
testb $0x1, -0x79(%rbp)
jne 0x1239f
jmp 0x123b0
movq -0x118(%rbp), %rdi
movl $0x48, %esi
callq 0x31d0
jmp 0x123cf
movq -0x188(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x38, %esi
callq 0x31d0
leaq -0x38(%rbp), %rdi
callq 0x3100
jmp 0x128d9
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rsi
callq 0xfa20
movq -0xe0(%rbp), %rax
movq -0x98(%rbp), %rcx
movsd 0x20(%rcx), %xmm0
ucomisd 0xb0(%rax), %xmm0
jbe 0x1252c
movq -0xe0(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
je 0x1252c
movl $0x38, %edi
callq 0x31c0
movq %rax, %rcx
movq -0xe0(%rbp), %rax
movq %rcx, -0x1a8(%rbp)
movq 0xd0(%rax), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movl $0x28, %edi
callq 0x31c0
movq %rax, -0x198(%rbp)
jmp 0x12477
movq -0x198(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq 0xd0(%rax), %rax
movq 0x28(%rax), %rsi
callq 0x153e0
jmp 0x12497
movq -0x198(%rbp), %rsi
movsd -0x1a0(%rbp), %xmm0
movq -0x1a8(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq 0xd0(%rax), %rax
movl 0x30(%rax), %edx
callq 0x15520
jmp 0x124c5
movq -0xe0(%rbp), %rdi
movq -0x1a8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rsi
callq 0x12a20
jmp 0x126fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12516
movq -0x198(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x28, %esi
callq 0x31d0
movq -0x1a8(%rbp), %rdi
movl $0x38, %esi
callq 0x31d0
jmp 0x128d9
movq -0xe0(%rbp), %rax
movq -0x98(%rbp), %rcx
movsd 0x20(%rcx), %xmm1
movsd 0xb0(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x126fa
movq -0xe0(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
je 0x126fa
movq -0xe0(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
jne 0x1258b
movq -0xe0(%rbp), %rax
testb $0x1, 0xb8(%rax)
je 0x126f8
movl $0x38, %edi
callq 0x31c0
movq %rax, %rcx
movq -0xe0(%rbp), %rax
movq %rcx, -0x1c0(%rbp)
movq 0xc8(%rax), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x1b8(%rbp)
movl $0x28, %edi
callq 0x31c0
movq %rax, -0x1b0(%rbp)
jmp 0x125cd
movq -0x1b0(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq 0xc8(%rax), %rax
movq 0x28(%rax), %rsi
callq 0x153e0
jmp 0x125ed
movq -0x1b0(%rbp), %rsi
movsd -0x1b8(%rbp), %xmm0
movq -0x1c0(%rbp), %rdi
movq -0xe0(%rbp), %rax
movq 0xc8(%rax), %rax
movl 0x30(%rax), %edx
callq 0x15520
jmp 0x1261b
movq -0x1c0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl $0x60, %edi
callq 0x31c0
movq -0xe0(%rbp), %rdi
movq %rax, -0x1c8(%rbp)
movq %rax, -0x1d0(%rbp)
callq 0x102b0
movq -0x1c8(%rbp), %rdi
movaps %xmm0, %xmm1
movq -0xa8(%rbp), %rdx
movsd 0x4da2(%rip), %xmm0     # 0x17408
movl $0x4, %esi
callq 0x15960
jmp 0x12672
movq -0xe0(%rbp), %rdi
movq -0x1d0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rsi
callq 0x11880
jmp 0x126f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x126c0
movq -0x1b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x28, %esi
callq 0x31d0
movq -0x1c0(%rbp), %rdi
movl $0x38, %esi
callq 0x31d0
jmp 0x128d9
movq -0x1d0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x60, %esi
callq 0x31d0
jmp 0x128d9
jmp 0x126fa
jmp 0x126fc
jmp 0x12720
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rsi
callq 0x12a20
movq -0x10(%rbp), %rax
movq %rax, -0x1d8(%rbp)
cmpq $0x0, %rax
je 0x12742
movq -0x1d8(%rbp), %rdi
movl $0x60, %esi
callq 0x31d0
jmp 0x128d0
movq -0xe0(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
jne 0x12780
movq -0x10(%rbp), %rax
movsd 0x4ca4(%rip), %xmm0     # 0x17408
ucomisd 0x20(%rax), %xmm0
jbe 0x1277b
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x12e70
jmp 0x128ce
movq -0xe0(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x1284d
movq -0xe0(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x48(%rcx), %edx
incl %edx
movl %edx, 0x48(%rcx)
movq -0x10(%rbp), %rcx
movl 0x4c(%rcx), %edx
incl %edx
movl %edx, 0x4c(%rcx)
movq 0xc8(%rax), %rax
movq 0x28(%rax), %rax
movq %rax, -0x1e8(%rbp)
movl $0x38, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x1e0(%rbp)
leaq -0xca0(%rip), %rax      # 0x11b40
movq %rax, -0xc8(%rbp)
movq $0x0, -0xc0(%rbp)
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x10(%rbp), %rcx
callq 0x5ae0
jmp 0x1280b
movq -0x1e0(%rbp), %rdx
movq -0xe0(%rbp), %rsi
movq -0x1e8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x128d0
movq -0x1e0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x38, %esi
callq 0x31d0
jmp 0x128d9
movl $0x38, %edi
callq 0x31c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x1f0(%rbp)
leaq -0xd2b(%rip), %rax      # 0x11b40
movq %rax, -0xd8(%rbp)
movq $0x0, -0xd0(%rbp)
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
leaq -0x10(%rbp), %rcx
callq 0x5ae0
jmp 0x12896
movq -0x1f0(%rbp), %rdx
movq -0xe0(%rbp), %rsi
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x48(%rax)
jmp 0x128d0
movq -0x1f0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x38, %esi
callq 0x31d0
jmp 0x128d9
jmp 0x128d0
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3330
nopw %cs:(%rax,%rax)