// File: zkl94[P]distributed-key-value-store/MP2Node.cpp
// Function: MP2Node::checkMessages()
void MP2Node::checkMessages() {
    char *data;
    int size;

    /*
     * Declare your local variables here
     */

    // dequeue all messages and handle them
    while ( !memberNode->mp2q.empty() ) {
        /*
         * Pop a message from the queue
         */
        data = (char *)memberNode->mp2q.front().elt;
        size = memberNode->mp2q.front().size;
        memberNode->mp2q.pop();

        string message(data, data + size);

        /*
         * Handle the message types here
         */

        Message *msg = new Message(message);
        int transID = msg->transID;
        ReplicaType replica = msg->replica;
        string key = msg->key;
        string value = msg->value;
        Address fromAddr = msg->fromAddr;
        MessageType t = msg->type;
        bool success = msg->success;

        // MessageType {CREATE, READ, UPDATE, DELETE, REPLY, READREPLY};
        switch(msg->type) {
        case CREATE:
            // cout << "received a CREATE message" << endl;
            createKeyValue(fromAddr, key, value, replica, transID, t);
            break;
        case READ:
            readKey(fromAddr, key, transID, t);
            break;
        case UPDATE:
            updateKeyValue(fromAddr, key, value, replica, transID, t);
            break;
        case DELETE:
            cout << "received a DELETE message" << endl;
            deletekey(fromAddr, key, transID, t);
            break;
        case REPLY:
            handleReply(transID, success);
            break;
        case READREPLY:
            handleReadReply(value, transID);
            break;
        }
    }

    /*
     * This function should also ensure all READ and UPDATE operation
     * get QUORUM replies
     */

#define PROPOGATE_ITERATION_LIMIT 5

    std::map<int, Bundle *>::iterator it = this->transID2Bundle.begin();

    while(it != this->transID2Bundle.end()) {
        if (((it->second->success_responses + it->second->failure_responses) == 3) || (it->second->iteration >= PROPOGATE_ITERATION_LIMIT)) {
            int transID = it->first;
            MessageType t = it->second->t;
            string key = it->second->key;
            string value = it->second->value;

            // static char s[1024];
            // sprintf(s, "successful response %d\n", it->second->success_responses);
            // log->LOG(&memberNode->addr, s);
            // sprintf(s, "failure response %d\n", it->second->failure_responses);
            // log->LOG(&memberNode->addr, s);

            // 2 (out of 3) is quorum
            if (it->second->success_responses >= 2) {
                if (t == READ) {
                    // read
                    // @TODO: need to aggregate read return values, can't just use handleReply
                    log->logReadSuccess(&(this->memberNode->addr), true, transID, key, value);
                } else if (t == UPDATE) {
                    log->logUpdateSuccess(&(this->memberNode->addr), true, transID, key, value);
                } else if (t == CREATE) {
                    log->logCreateSuccess(&(this->memberNode->addr), true, transID, key, value);
                } else if (t == DELETE) {
                    log->logDeleteSuccess(&(this->memberNode->addr), true, transID, key);
                }
            } else {
                if (t == READ) {
                    // read
                    log->logReadFail(&(this->memberNode->addr), true, transID, key);
                } else if (t == UPDATE) {
                    log->logUpdateFail(&(this->memberNode->addr), true, transID, key, value);
                } else if (t == CREATE) {
                    log->logCreateFail(&(this->memberNode->addr), true, transID, key, value);
                } else if (t == DELETE) {
                    log->logDeleteFail(&(this->memberNode->addr), true, transID, key);
                }
            }

            delete it->second;
            it = this->transID2Bundle.erase(it);
        } else {
            it->second->iteration++;
            ++it;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x520, %rsp            # imm = 0x520
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x408(%rbp)
movq -0x408(%rbp), %rax
movq 0x50(%rax), %rdi
addq $0x98, %rdi
callq 0x6e10
xorb $-0x1, %al
testb $0x1, %al
jne 0x1d12c
jmp 0x1d6ed
movq -0x408(%rbp), %rax
movq 0x50(%rax), %rdi
addq $0x98, %rdi
callq 0x6e30
movq %rax, %rcx
movq -0x408(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0x10(%rbp)
movq 0x50(%rax), %rdi
addq $0x98, %rdi
callq 0x6e30
movq %rax, %rcx
movq -0x408(%rbp), %rax
movl 0x8(%rcx), %ecx
movl %ecx, -0x14(%rbp)
movq 0x50(%rax), %rdi
addq $0x98, %rdi
callq 0x6e50
movq -0x10(%rbp), %rax
movq %rax, -0x420(%rbp)
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x418(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x410(%rbp)
callq 0x4560
movq -0x420(%rbp), %rsi
movq -0x418(%rbp), %rdx
movq -0x410(%rbp), %rcx
leaq -0x38(%rbp), %rdi
callq 0x1eb90
jmp 0x1d1cd
leaq -0x39(%rbp), %rdi
callq 0x4370
movl $0x78, %edi
callq 0x4310
movq %rax, -0x428(%rbp)
jmp 0x1d1e9
movb $0x1, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x4150
jmp 0x1d1fc
movq -0x428(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x25e90
jmp 0x1d20e
movb $0x0, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x41e0
movq -0x428(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x80(%rbp)
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x84(%rbp)
movq -0x58(%rbp), %rsi
addq $0x8, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x4150
jmp 0x1d253
movq -0x58(%rbp), %rsi
addq $0x28, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x4150
jmp 0x1d269
movq -0x58(%rbp), %rsi
addq $0x48, %rsi
leaq -0xce(%rbp), %rdi
callq 0x15070
jmp 0x1d27f
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xd4(%rbp)
movq -0x58(%rbp), %rax
movb 0x54(%rax), %al
andb $0x1, %al
movb %al, -0xd5(%rbp)
movq -0x58(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x430(%rbp)
subq $0x5, %rax
ja 0x1d6a1
movq -0x430(%rbp), %rax
leaq 0xa96d(%rip), %rcx      # 0x27c2c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x4370
jmp 0x1dfa6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d6df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d316
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x41e0
testb $0x1, -0x79(%rbp)
jne 0x1d31e
jmp 0x1d32f
movq -0x428(%rbp), %rdi
movl $0x78, %esi
callq 0x4320
jmp 0x1d6df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d6d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d6c7
leaq -0xdb(%rbp), %rdi
leaq -0xce(%rbp), %rsi
callq 0x15070
jmp 0x1d36b
leaq -0x100(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4150
jmp 0x1d380
leaq -0x120(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4150
jmp 0x1d395
movq -0x408(%rbp), %rdi
movl -0x84(%rbp), %r8d
movl -0x80(%rbp), %r9d
movl -0xd4(%rbp), %ecx
movq %rsp, %rax
movl %ecx, (%rax)
leaq -0xdb(%rbp), %rsi
leaq -0x100(%rbp), %rdx
leaq -0x120(%rbp), %rcx
callq 0x1c050
jmp 0x1d3ce
leaq -0x120(%rbp), %rdi
callq 0x41e0
leaq -0x100(%rbp), %rdi
callq 0x41e0
jmp 0x1d6a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d411
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x41e0
leaq -0x100(%rbp), %rdi
callq 0x41e0
jmp 0x1d6c7
leaq -0x146(%rbp), %rdi
leaq -0xce(%rbp), %rsi
callq 0x15070
jmp 0x1d437
leaq -0x168(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4150
jmp 0x1d44c
movq -0x408(%rbp), %rsi
movl -0x80(%rbp), %r8d
movl -0xd4(%rbp), %r9d
leaq -0x140(%rbp), %rdi
leaq -0x146(%rbp), %rdx
leaq -0x168(%rbp), %rcx
callq 0x1c360
jmp 0x1d47a
leaq -0x140(%rbp), %rdi
callq 0x41e0
leaq -0x168(%rbp), %rdi
callq 0x41e0
jmp 0x1d6a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x41e0
jmp 0x1d6c7
leaq -0x16e(%rbp), %rdi
leaq -0xce(%rbp), %rsi
callq 0x15070
jmp 0x1d4c9
leaq -0x190(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4150
jmp 0x1d4de
leaq -0x1b0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4150
jmp 0x1d4f3
movq -0x408(%rbp), %rdi
movl -0x84(%rbp), %r8d
movl -0x80(%rbp), %r9d
movl -0xd4(%rbp), %ecx
movq %rsp, %rax
movl %ecx, (%rax)
leaq -0x16e(%rbp), %rsi
leaq -0x190(%rbp), %rdx
leaq -0x1b0(%rbp), %rcx
callq 0x1c870
jmp 0x1d52c
leaq -0x1b0(%rbp), %rdi
callq 0x41e0
leaq -0x190(%rbp), %rdi
callq 0x41e0
jmp 0x1d6a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d56f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x41e0
leaq -0x190(%rbp), %rdi
callq 0x41e0
jmp 0x1d6c7
movq 0x18a41(%rip), %rdi     # 0x35fc8
leaq 0xa6b6(%rip), %rsi      # 0x27c44
callq 0x42f0
movq %rax, -0x438(%rbp)
jmp 0x1d59c
movq -0x438(%rbp), %rdi
movq 0x18a0e(%rip), %rsi     # 0x35fb8
callq 0x4350
jmp 0x1d5b1
leaq -0x1b6(%rbp), %rdi
leaq -0xce(%rbp), %rsi
callq 0x15070
jmp 0x1d5c6
leaq -0x1d8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x4150
jmp 0x1d5db
movq -0x408(%rbp), %rdi
movl -0x80(%rbp), %ecx
movl -0xd4(%rbp), %r8d
leaq -0x1b6(%rbp), %rsi
leaq -0x1d8(%rbp), %rdx
callq 0x1cd10
jmp 0x1d601
leaq -0x1d8(%rbp), %rdi
callq 0x41e0
jmp 0x1d6a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x41e0
jmp 0x1d6c7
movq -0x408(%rbp), %rdi
movl -0x80(%rbp), %esi
movzbl -0xd5(%rbp), %edx
andl $0x1, %edx
callq 0x1bf40
jmp 0x1d64a
jmp 0x1d6a1
leaq -0x1f8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4150
jmp 0x1d661
movq -0x408(%rbp), %rdi
movl -0x80(%rbp), %edx
leaq -0x1f8(%rbp), %rsi
callq 0x1bfb0
jmp 0x1d679
leaq -0x1f8(%rbp), %rdi
callq 0x41e0
jmp 0x1d6a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x41e0
jmp 0x1d6c7
leaq -0xc8(%rbp), %rdi
callq 0x41e0
leaq -0xa8(%rbp), %rdi
callq 0x41e0
leaq -0x38(%rbp), %rdi
callq 0x41e0
jmp 0x1d10a
leaq -0xc8(%rbp), %rdi
callq 0x41e0
leaq -0xa8(%rbp), %rdi
callq 0x41e0
leaq -0x38(%rbp), %rdi
callq 0x41e0
jmp 0x1dfa6
movq -0x408(%rbp), %rdi
addq $0x90, %rdi
callq 0x1ec00
movq %rax, -0x200(%rbp)
movq -0x408(%rbp), %rdi
addq $0x90, %rdi
callq 0x1ec60
movq %rax, -0x208(%rbp)
leaq -0x200(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x1ec30
testb $0x1, %al
jne 0x1d73d
jmp 0x1df9d
leaq -0x200(%rbp), %rdi
callq 0x1ec90
movq 0x8(%rax), %rax
movl (%rax), %eax
movl %eax, -0x43c(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x1ec90
movq %rax, %rcx
movl -0x43c(%rbp), %eax
movq 0x8(%rcx), %rcx
addl 0x4(%rcx), %eax
cmpl $0x3, %eax
je 0x1d790
leaq -0x200(%rbp), %rdi
callq 0x1ec90
movq 0x8(%rax), %rax
cmpl $0x5, 0x50(%rax)
jl 0x1df73
leaq -0x200(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x1ec90
movq -0x448(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x20c(%rbp)
callq 0x1ec90
movq -0x448(%rbp), %rdi
movq 0x8(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x210(%rbp)
callq 0x1ec90
movq 0x8(%rax), %rsi
addq $0x10, %rsi
leaq -0x230(%rbp), %rdi
callq 0x4150
movq -0x448(%rbp), %rdi
callq 0x1ec90
movq 0x8(%rax), %rsi
addq $0x30, %rsi
leaq -0x250(%rbp), %rdi
callq 0x4150
jmp 0x1d806
leaq -0x200(%rbp), %rdi
callq 0x1ec90
movq 0x8(%rax), %rax
cmpl $0x2, (%rax)
jl 0x1db9f
cmpl $0x1, -0x210(%rbp)
jne 0x1d927
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x460(%rbp)
addq $0x8, %rax
movq %rax, -0x458(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x44c(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1d86e
leaq -0x290(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x4150
jmp 0x1d883
movl -0x44c(%rbp), %ecx
movq -0x458(%rbp), %rsi
movq -0x460(%rbp), %rdi
movl $0x1, %edx
leaq -0x270(%rbp), %r8
leaq -0x290(%rbp), %r9
callq 0x145e0
jmp 0x1d8b1
leaq -0x290(%rbp), %rdi
callq 0x41e0
leaq -0x270(%rbp), %rdi
callq 0x41e0
jmp 0x1db9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1df65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1df59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d916
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x41e0
leaq -0x270(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
cmpl $0x2, -0x210(%rbp)
jne 0x1da0d
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x478(%rbp)
addq $0x8, %rax
movq %rax, -0x470(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x464(%rbp)
leaq -0x2b0(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1d976
leaq -0x2d0(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x4150
jmp 0x1d98b
movl -0x464(%rbp), %ecx
movq -0x470(%rbp), %rsi
movq -0x478(%rbp), %rdi
movl $0x1, %edx
leaq -0x2b0(%rbp), %r8
leaq -0x2d0(%rbp), %r9
callq 0x14730
jmp 0x1d9b9
leaq -0x2d0(%rbp), %rdi
callq 0x41e0
leaq -0x2b0(%rbp), %rdi
callq 0x41e0
jmp 0x1db98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1d9fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x41e0
leaq -0x2b0(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
cmpl $0x0, -0x210(%rbp)
jne 0x1daf3
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x490(%rbp)
addq $0x8, %rax
movq %rax, -0x488(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x47c(%rbp)
leaq -0x2f0(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1da5c
leaq -0x310(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x4150
jmp 0x1da71
movl -0x47c(%rbp), %ecx
movq -0x488(%rbp), %rsi
movq -0x490(%rbp), %rdi
movl $0x1, %edx
leaq -0x2f0(%rbp), %r8
leaq -0x310(%rbp), %r9
callq 0x14490
jmp 0x1da9f
leaq -0x310(%rbp), %rdi
callq 0x41e0
leaq -0x2f0(%rbp), %rdi
callq 0x41e0
jmp 0x1db96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1dae2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x41e0
leaq -0x2f0(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
cmpl $0x3, -0x210(%rbp)
jne 0x1db94
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x4a8(%rbp)
addq $0x8, %rax
movq %rax, -0x4a0(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x494(%rbp)
leaq -0x330(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1db42
movl -0x494(%rbp), %ecx
movq -0x4a0(%rbp), %rsi
movq -0x4a8(%rbp), %rdi
movl $0x1, %edx
leaq -0x330(%rbp), %r8
callq 0x14880
jmp 0x1db69
leaq -0x330(%rbp), %rdi
callq 0x41e0
jmp 0x1db94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
jmp 0x1db96
jmp 0x1db98
jmp 0x1db9a
jmp 0x1deb8
cmpl $0x1, -0x210(%rbp)
jne 0x1dc43
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x4c0(%rbp)
addq $0x8, %rax
movq %rax, -0x4b8(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x4ac(%rbp)
leaq -0x350(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1dbee
movl -0x4ac(%rbp), %ecx
movq -0x4b8(%rbp), %rsi
movq -0x4c0(%rbp), %rdi
movl $0x1, %edx
leaq -0x350(%rbp), %r8
callq 0x14ae0
jmp 0x1dc15
leaq -0x350(%rbp), %rdi
callq 0x41e0
jmp 0x1deb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x350(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
cmpl $0x2, -0x210(%rbp)
jne 0x1dd29
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x4d8(%rbp)
addq $0x8, %rax
movq %rax, -0x4d0(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x4c4(%rbp)
leaq -0x370(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1dc92
leaq -0x390(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x4150
jmp 0x1dca7
movl -0x4c4(%rbp), %ecx
movq -0x4d0(%rbp), %rsi
movq -0x4d8(%rbp), %rdi
movl $0x1, %edx
leaq -0x370(%rbp), %r8
leaq -0x390(%rbp), %r9
callq 0x14bf0
jmp 0x1dcd5
leaq -0x390(%rbp), %rdi
callq 0x41e0
leaq -0x370(%rbp), %rdi
callq 0x41e0
jmp 0x1deb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1dd18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x390(%rbp), %rdi
callq 0x41e0
leaq -0x370(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
cmpl $0x0, -0x210(%rbp)
jne 0x1de0f
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x4f0(%rbp)
addq $0x8, %rax
movq %rax, -0x4e8(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x4dc(%rbp)
leaq -0x3b0(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1dd78
leaq -0x3d0(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x4150
jmp 0x1dd8d
movl -0x4dc(%rbp), %ecx
movq -0x4e8(%rbp), %rsi
movq -0x4f0(%rbp), %rdi
movl $0x1, %edx
leaq -0x3b0(%rbp), %r8
leaq -0x3d0(%rbp), %r9
callq 0x14990
jmp 0x1ddbb
leaq -0x3d0(%rbp), %rdi
callq 0x41e0
leaq -0x3b0(%rbp), %rdi
callq 0x41e0
jmp 0x1deb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1ddfe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x41e0
leaq -0x3b0(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
cmpl $0x3, -0x210(%rbp)
jne 0x1deb0
movq -0x408(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x68(%rcx), %rcx
movq %rcx, -0x508(%rbp)
addq $0x8, %rax
movq %rax, -0x500(%rbp)
movl -0x20c(%rbp), %eax
movl %eax, -0x4f4(%rbp)
leaq -0x3f0(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4150
jmp 0x1de5e
movl -0x4f4(%rbp), %ecx
movq -0x500(%rbp), %rsi
movq -0x508(%rbp), %rdi
movl $0x1, %edx
leaq -0x3f0(%rbp), %r8
callq 0x14d40
jmp 0x1de85
leaq -0x3f0(%rbp), %rdi
callq 0x41e0
jmp 0x1deb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x41e0
jmp 0x1df59
jmp 0x1deb2
jmp 0x1deb4
jmp 0x1deb6
jmp 0x1deb8
leaq -0x200(%rbp), %rdi
callq 0x1ec90
movq 0x8(%rax), %rax
movq %rax, -0x510(%rbp)
cmpq $0x0, %rax
je 0x1def2
movq -0x510(%rbp), %rdi
callq 0x1ecb0
movq -0x510(%rbp), %rdi
movl $0x58, %esi
callq 0x4320
movq -0x408(%rbp), %rdi
addq $0x90, %rdi
movq -0x200(%rbp), %rax
movq %rax, -0x400(%rbp)
movq -0x400(%rbp), %rsi
callq 0x1ece0
movq %rax, -0x518(%rbp)
jmp 0x1df23
movq -0x518(%rbp), %rax
movq %rax, -0x3f8(%rbp)
movq -0x3f8(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x41e0
leaq -0x230(%rbp), %rdi
callq 0x41e0
jmp 0x1df98
leaq -0x250(%rbp), %rdi
callq 0x41e0
leaq -0x230(%rbp), %rdi
callq 0x41e0
jmp 0x1dfa6
leaq -0x200(%rbp), %rdi
callq 0x1ec90
movq 0x8(%rax), %rax
movl 0x50(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x50(%rax)
leaq -0x200(%rbp), %rdi
callq 0x1ed20
jmp 0x1d707
addq $0x520, %rsp            # imm = 0x520
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x4550
nop