// File: lega911[P]ijson/src/server.cpp
// Function: Loop::_add_worker(Slice, Connect*)
int Loop::_add_worker(Slice name, Connect *worker) {
    if(!name.empty() && name.ptr()[0] == '/') name.remove(1);
    QueueLine *ql = server->get_queue(name, true);
    Queue *q;

    if(worker->info) {
        try {
            ql->info.set(worker->info);
            json::unescape(ql->info);
        } catch (Exception &e) {
            ql->info.clear();
        };
    }

    if(!worker->connection_id) generate_id(worker->connection_id);

    if(!worker->worker_mode && worker->worker_item && worker->worker_sub_name.compare(name)) {
        worker->worker_item->pop();

        GC gc;
        for(auto const &it : worker->direct_message) {
            gc.add(it, GC::DirectMessage);
        }
        worker->direct_message.clear();
    }

    if(!worker->direct_message.empty()) {
        worker->write_mode(true);
        return 1;
    }

    Message *msg = NULL;
    GC gc;
    int result;

    ql->last_worker = get_time_sec();
    std::string sid;

    ql->mutex.lock();
    int rloop = _nloop;
    for(int index=-1;index<server->threads;index++) {
        if(index == _nloop) continue;
        if(index >= 0) rloop = index;
        q = &ql->queue[rloop];

        auto it=q->clients.begin();
        while (it != q->clients.end()) {
            msg = *it;

            if(msg->required_worker) {
                if(msg->required_worker != worker->connection_id) {
                    msg = NULL;
                    it++;
                    continue;
                }
            }
            it = q->clients.erase(it);
            gc.add(msg, GC::Message);

            if(!msg->conn) break;
            Connect *client = msg->conn;
            if(client->is_closed()) {
                if(server->log & 8) std::cout << ltime() << "closed client " << msg->conn << std::endl;
                msg = NULL;
                continue;
            }

            bool skip = true;
            if(client->status == Status::client_wait_result) {
                client->mutex.lock();
                if(client->status == Status::client_wait_result) {
                    client->status = Status::busy;
                    skip = false;
                }
                client->mutex.unlock();
            }

            if(skip) {
                if(server->log & 8) std::cout << ltime() << "client is busy!!! " << client << std::endl;
                msg = NULL;
                continue;
            }

            if(worker->noid) break;
            Slice id = client->id;
            if(id.empty()) {
                try {
                    while(client->json.scan()) {
                        if(client->json.key == "id") {
                            id = client->json.value;
                            client->id.set(id);
                            break;
                        }
                    }
                } catch (const error::InvalidData &e) {
                    client->send.status("400 No Id")->done(-1);
                    if(server->log & 4) std::cout << ltime() << "400 no id " << name.as_string() << std::endl;
                    msg = NULL;
                    continue;
                }
                if(id.empty()) {
                    generate_id(client->id);
                    id = client->id;
                };
            }
            sid = id.as_string();

            server->wait_lock.lock();
            bool busy = server->wait_response.find(sid) != server->wait_response.end();
            server->wait_lock.unlock();
            if(busy) {
                // colision id
                if(server->log & 2) std::cout << ltime() << "collision id\n";
                client->send.status("400 Collision Id")->done(-1);
                client->status = Status::net;
                msg = NULL;
                continue;
            }
            break;
        }
        if(msg) break;
    }

    if(msg) {
        if(!msg->conn) {
            if(worker->worker_mode) worker->status = Status::worker_mode_async;
            else worker->status = Status::net;
            worker->send.status("200 OK")->header("Name", msg->name)->header("Async", Slice("true"))->done(*msg->buf);
        } else {
            auto client = msg->conn;
            if(worker->fail_on_disconnect) {
                worker->client = client;
                worker->client->link();
            }
            if(worker->noid) {
                worker->status = Status::worker_wait_result;
                worker->send.status("200 OK")->header("Name", client->name)->done(client->body);
            } else {
                worker->send.status("200 OK")->header("Id", client->id)->header("Name", client->name)->done(client->body);
                server->wait_lock.lock();
                server->wait_response[sid] = client;
                server->wait_lock.unlock();
                client->link();
                worker->status = Status::net;
            }
            result = 1;
        }
        if(server->log & 32) worker->start_time = get_time();
    } else {
        Queue *q0 = &ql->queue[_nloop];
        if(q0->workers.size()) {
            auto it=q0->workers.begin();
            while (it != q0->workers.end()) {
                Connect *conn = *it;
                if(conn->is_closed() || conn == worker) {
                    it = q0->workers.erase(it);
                    conn->unlink();
                } else {
                    it++;
                }
            }
        }

        q0->workers.push_back(worker);
        worker->link();
        worker->status = Status::worker_wait_job;
        result = 0;
    }

    if(!worker->worker_item) {
        if(worker->worker_mode || worker->noid || worker->status == Status::worker_wait_job) worker->worker_item = ql->workers.push(worker);
        if(!worker->worker_mode && worker->noid) worker->worker_sub_name.set(name);
    }

    ql->mutex.unlock();

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x460, %rsp            # imm = 0x460
movq %rsi, -0x18(%rbp)
movl %edx, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x320(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x1eb40
testb $0x1, %al
jne 0x2b4e1
leaq -0x18(%rbp), %rdi
callq 0x1e6f0
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x2b4e1
leaq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x1ef50
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rsi
movl -0x38(%rbp), %edx
movl $0x1, %ecx
callq 0x281f0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
addq $0x168, %rdi            # imm = 0x168
callq 0x1f770
testb $0x1, %al
jne 0x2b52a
jmp 0x2b5ae
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movq -0x28(%rbp), %rsi
addq $0x168, %rsi            # imm = 0x168
callq 0x1ed20
jmp 0x2b544
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
xorl %esi, %esi
callq 0x23370
jmp 0x2b555
jmp 0x2b594
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2c54f
movq -0x50(%rbp), %rdi
callq 0x19120
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
callq 0x1eab0
jmp 0x2b58f
callq 0x19450
jmp 0x2b5ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
callq 0x19450
jmp 0x2b5a9
jmp 0x2c54f
movq -0x28(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x1f770
testb $0x1, %al
jne 0x2b5d2
movq -0x28(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x36c80
movq -0x28(%rbp), %rax
testb $0x1, 0xf3(%rax)
jne 0x2b6e2
movq -0x28(%rbp), %rax
cmpq $0x0, 0x178(%rax)
je 0x2b6e2
movq -0x28(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
leaq -0x18(%rbp), %rsi
callq 0x21bc0
cmpl $0x0, %eax
je 0x2b6e2
movq -0x28(%rbp), %rax
movq 0x178(%rax), %rdi
callq 0x37930
leaq -0x78(%rbp), %rdi
callq 0x2d200
movq -0x28(%rbp), %rax
addq $0x190, %rax            # imm = 0x190
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x210a0
movq -0x80(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x2d750
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2d780
testb $0x1, %al
jne 0x2b672
jmp 0x2b6c9
leaq -0xa0(%rbp), %rdi
callq 0x210d0
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
movl $0x2, %edx
callq 0x36ce0
jmp 0x2b69f
jmp 0x2b6a1
leaq -0xa0(%rbp), %rdi
callq 0x2d7b0
jmp 0x2b659
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x1e970
jmp 0x2c54f
movq -0x28(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
callq 0x2d800
leaq -0x78(%rbp), %rdi
callq 0x1e970
movq -0x28(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
callq 0x1e780
testb $0x1, %al
jne 0x2b710
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x19a10
movl $0x1, -0x4(%rbp)
jmp 0x2c543
movq $0x0, -0xd0(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x2d200
callq 0x36940
movl %eax, -0x324(%rbp)
jmp 0x2b734
movl -0x324(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
leaq -0x110(%rbp), %rdi
callq 0x193c0
movq -0x30(%rbp), %rdi
addq $0x18, %rdi
callq 0x1fa50
jmp 0x2b761
movq -0x320(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x114(%rbp)
movl $0xffffffff, -0x118(%rbp) # imm = 0xFFFFFFFF
movq -0x320(%rbp), %rcx
movl -0x118(%rbp), %eax
movq 0x18(%rcx), %rcx
cmpl 0x28(%rcx), %eax
jge 0x2bfcb
movq -0x320(%rbp), %rcx
movl -0x118(%rbp), %eax
cmpl 0x4(%rcx), %eax
jne 0x2b7ce
jmp 0x2bfb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2c535
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2c529
cmpl $0x0, -0x118(%rbp)
jl 0x2b7e3
movl -0x118(%rbp), %eax
movl %eax, -0x114(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x114(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
addq $0x50, %rsi
leaq -0x140(%rbp), %rdi
callq 0x2d220
movq -0x48(%rbp), %rsi
addq $0x50, %rsi
leaq -0x160(%rbp), %rdi
callq 0x2d250
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x2d280
testb $0x1, %al
jne 0x2b844
jmp 0x2bfa9
leaq -0x140(%rbp), %rdi
callq 0x2d2b0
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
addq $0x8, %rdi
callq 0x1f770
movb %al, -0x325(%rbp)
jmp 0x2b872
movb -0x325(%rbp), %al
testb $0x1, %al
jne 0x2b87e
jmp 0x2b8d4
movq -0xd0(%rbp), %rdi
addq $0x8, %rdi
movq -0x28(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
callq 0x2d840
movb %al, -0x326(%rbp)
jmp 0x2b8a1
movb -0x326(%rbp), %al
testb $0x1, %al
jne 0x2b8ad
jmp 0x2b8d2
movq $0x0, -0xd0(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x140(%rbp), %rsi
xorl %edx, %edx
callq 0x2d870
jmp 0x2b814
jmp 0x2b8d4
movq -0x48(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x338(%rbp)
leaq -0x1c0(%rbp), %rdi
movq %rdi, -0x330(%rbp)
leaq -0x140(%rbp), %rsi
callq 0x2d910
movq -0x338(%rbp), %rsi
movq -0x330(%rbp), %rdx
leaq -0x1a0(%rbp), %rdi
callq 0x2d8b0
jmp 0x2b919
movups -0x1a0(%rbp), %xmm0
movups -0x190(%rbp), %xmm1
movaps %xmm1, -0x130(%rbp)
movaps %xmm0, -0x140(%rbp)
movq -0xd0(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
movl $0x1, %edx
callq 0x36ce0
jmp 0x2b94f
movq -0xd0(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x2b962
jmp 0x2bfa9
movq -0xd0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0x1fcc0
movb %al, -0x339(%rbp)
jmp 0x2b988
movb -0x339(%rbp), %al
testb $0x1, %al
jne 0x2b997
jmp 0x2ba3a
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x2ba2a
callq 0x36960
movq %rax, -0x348(%rbp)
jmp 0x2b9bb
movq -0x348(%rbp), %rsi
movq 0x1b607(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, -0x350(%rbp)
jmp 0x2b9d7
movq -0x350(%rbp), %rdi
leaq 0xdbbd(%rip), %rsi      # 0x395a2
callq 0x192e0
movq %rax, -0x358(%rbp)
jmp 0x2b9f3
movq -0x358(%rbp), %rdi
movq -0xd0(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x19250
movq %rax, -0x360(%rbp)
jmp 0x2ba13
movq -0x360(%rbp), %rdi
movq 0x1b58f(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x2ba28
jmp 0x2ba2a
movq $0x0, -0xd0(%rbp)
jmp 0x2b814
movb $0x1, -0x1c9(%rbp)
movq -0x1c8(%rbp), %rax
cmpl $0x4, 0xcc(%rax)
jne 0x2ba9f
movq -0x1c8(%rbp), %rdi
addq $0x50, %rdi
callq 0x1fa50
jmp 0x2ba63
movq -0x1c8(%rbp), %rax
cmpl $0x4, 0xcc(%rax)
jne 0x2ba8b
movq -0x1c8(%rbp), %rax
movl $0x5, 0xcc(%rax)
movb $0x0, -0x1c9(%rbp)
movq -0x1c8(%rbp), %rdi
addq $0x50, %rdi
callq 0x1fa80
jmp 0x2ba9d
jmp 0x2ba9f
testb $0x1, -0x1c9(%rbp)
je 0x2bb4b
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x2bb3b
callq 0x36960
movq %rax, -0x368(%rbp)
jmp 0x2bad0
movq -0x368(%rbp), %rsi
movq 0x1b4f2(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, -0x370(%rbp)
jmp 0x2baec
movq -0x370(%rbp), %rdi
leaq 0xdab7(%rip), %rsi      # 0x395b1
callq 0x192e0
movq %rax, -0x378(%rbp)
jmp 0x2bb08
movq -0x378(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
callq 0x19250
movq %rax, -0x380(%rbp)
jmp 0x2bb24
movq -0x380(%rbp), %rdi
movq 0x1b47e(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x2bb39
jmp 0x2bb3b
movq $0x0, -0xd0(%rbp)
jmp 0x2b814
movq -0x28(%rbp), %rax
testb $0x1, 0xf1(%rax)
je 0x2bb5d
jmp 0x2bfa9
movq -0x1c8(%rbp), %rsi
addq $0xe0, %rsi
leaq -0x1e0(%rbp), %rdi
callq 0x1e9f0
jmp 0x2bb79
leaq -0x1e0(%rbp), %rdi
callq 0x1eb40
movb %al, -0x381(%rbp)
jmp 0x2bb8d
movb -0x381(%rbp), %al
testb $0x1, %al
jne 0x2bb9c
jmp 0x2be0f
jmp 0x2bb9e
movq -0x1c8(%rbp), %rdi
addq $0x128, %rdi            # imm = 0x128
callq 0x236d0
movb %al, -0x382(%rbp)
jmp 0x2bbb9
movb -0x382(%rbp), %al
testb $0x1, %al
jne 0x2bbc8
jmp 0x2bd55
movq -0x1c8(%rbp), %rdi
addq $0x128, %rdi            # imm = 0x128
leaq 0xc767(%rip), %rsi      # 0x38344
callq 0x1ee30
movb %al, -0x383(%rbp)
jmp 0x2bbea
movb -0x383(%rbp), %al
testb $0x1, %al
jne 0x2bbf9
jmp 0x2bd50
movq -0x1c8(%rbp), %rax
movl 0x140(%rax), %ecx
movl %ecx, -0x1d8(%rbp)
movq 0x138(%rax), %rax
movq %rax, -0x1e0(%rbp)
movq -0x1c8(%rbp), %rdi
addq $0xe0, %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x1ed20
jmp 0x2bc36
jmp 0x2bd55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x2c529
movq -0x50(%rbp), %rdi
callq 0x19120
movq %rax, -0x1e8(%rbp)
movq -0x1c8(%rbp), %rdi
addq $0x18, %rdi
leaq 0xd94b(%rip), %rsi      # 0x395c4
callq 0x1b6d0
movq %rax, -0x390(%rbp)
jmp 0x2bc87
movq -0x390(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1b770
jmp 0x2bc9a
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2bd7f
callq 0x36960
movq %rax, -0x398(%rbp)
jmp 0x2bcc2
movq -0x398(%rbp), %rsi
movq 0x1b300(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, -0x3a0(%rbp)
jmp 0x2bcde
movq -0x3a0(%rbp), %rdi
leaq 0xd8e2(%rip), %rsi      # 0x395ce
callq 0x192e0
movq %rax, -0x3a8(%rbp)
jmp 0x2bcfa
leaq -0x208(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f340
jmp 0x2bd11
movq -0x3a8(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x19290
movq %rax, -0x3b0(%rbp)
jmp 0x2bd2d
movq -0x3b0(%rbp), %rdi
movq 0x1b275(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x2bd42
leaq -0x208(%rbp), %rdi
callq 0x191e0
jmp 0x2bd7f
jmp 0x2bb9e
jmp 0x2bda2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2bd96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x191e0
jmp 0x2bd96
movq $0x0, -0xd0(%rbp)
callq 0x19450
jmp 0x2bd91
jmp 0x2b814
callq 0x19450
jmp 0x2bd9d
jmp 0x2c529
leaq -0x1e0(%rbp), %rdi
callq 0x1eb40
movb %al, -0x3b1(%rbp)
jmp 0x2bdb6
movb -0x3b1(%rbp), %al
testb $0x1, %al
jne 0x2bdc2
jmp 0x2be0d
movq -0x1c8(%rbp), %rdi
addq $0xe0, %rdi
callq 0x36c80
jmp 0x2bdd7
movq -0x1c8(%rbp), %rsi
addq $0xe0, %rsi
leaq -0x218(%rbp), %rdi
callq 0x1e9f0
jmp 0x2bdf3
movq -0x218(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movl -0x210(%rbp), %eax
movl %eax, -0x1d8(%rbp)
jmp 0x2be0f
leaq -0x238(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f340
jmp 0x2be29
leaq -0x110(%rbp), %rdi
leaq -0x238(%rbp), %rsi
movq %rsi, -0x3c0(%rbp)
callq 0x19370
movq -0x3c0(%rbp), %rdi
callq 0x191e0
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa50
jmp 0x2be68
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x20128, %rdi          # imm = 0x20128
leaq -0x110(%rbp), %rsi
callq 0x2d980
movq %rax, -0x3c8(%rbp)
jmp 0x2be8f
movq -0x320(%rbp), %rax
movq -0x3c8(%rbp), %rcx
movq %rcx, -0x248(%rbp)
movq 0x18(%rax), %rdi
addq $0x20128, %rdi          # imm = 0x20128
callq 0x2d9b0
movq %rax, -0x250(%rbp)
leaq -0x248(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x2d950
movb %al, %cl
movq -0x320(%rbp), %rax
movb %cl, -0x239(%rbp)
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa80
jmp 0x2beef
testb $0x1, -0x239(%rbp)
je 0x2bfa7
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x2bf53
callq 0x36960
movq %rax, -0x3d0(%rbp)
jmp 0x2bf20
movq -0x3d0(%rbp), %rsi
movq 0x1b0a2(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, -0x3d8(%rbp)
jmp 0x2bf3c
movq -0x3d8(%rbp), %rdi
leaq 0xd68f(%rip), %rsi      # 0x395d9
callq 0x192e0
jmp 0x2bf51
jmp 0x2bf53
movq -0x1c8(%rbp), %rdi
addq $0x18, %rdi
leaq 0xd682(%rip), %rsi      # 0x395e7
callq 0x1b6d0
movq %rax, -0x3e0(%rbp)
jmp 0x2bf73
movq -0x3e0(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1b770
jmp 0x2bf86
movq -0x1c8(%rbp), %rax
movl $0x0, 0xcc(%rax)
movq $0x0, -0xd0(%rbp)
jmp 0x2b814
jmp 0x2bfa9
cmpq $0x0, -0xd0(%rbp)
je 0x2bfb5
jmp 0x2bfcb
jmp 0x2bfb7
movl -0x118(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x118(%rbp)
jmp 0x2b77b
cmpq $0x0, -0xd0(%rbp)
je 0x2c2de
movq -0xd0(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x2c0b0
movq -0x28(%rbp), %rax
testb $0x1, 0xf3(%rax)
je 0x2c008
movq -0x28(%rbp), %rax
movl $0x6, 0xcc(%rax)
jmp 0x2c016
movq -0x28(%rbp), %rax
movl $0x0, 0xcc(%rax)
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xc20c(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x3e8(%rbp)
jmp 0x2c033
movq -0x3e8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
addq $0x28, %rdx
leaq 0xd5ac(%rip), %rsi      # 0x395f8
callq 0x1d660
movq %rax, -0x3f0(%rbp)
jmp 0x2c05a
leaq 0xcb17(%rip), %rsi      # 0x38b78
leaq -0x260(%rbp), %rdi
callq 0x1f4b0
jmp 0x2c06f
movq -0x3f0(%rbp), %rdi
leaq 0xd580(%rip), %rsi      # 0x395fd
leaq -0x260(%rbp), %rdx
callq 0x1d660
movq %rax, -0x3f8(%rbp)
jmp 0x2c092
movq -0x3f8(%rbp), %rdi
movq -0xd0(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x1be40
jmp 0x2c0ab
jmp 0x2c2a3
movq -0xd0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x268(%rbp)
movq -0x28(%rbp), %rax
testb $0x1, 0xf0(%rax)
je 0x2c0f5
movq -0x268(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x120(%rax)
movq -0x28(%rbp), %rax
movq 0x120(%rax), %rdi
callq 0x2cf70
jmp 0x2c0f3
jmp 0x2c0f5
movq -0x28(%rbp), %rax
testb $0x1, 0xf1(%rax)
je 0x2c178
movq -0x28(%rbp), %rax
movl $0x2, 0xcc(%rax)
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xc112(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x400(%rbp)
jmp 0x2c12d
movq -0x400(%rbp), %rdi
movq -0x268(%rbp), %rdx
addq $0xb8, %rdx
leaq 0xd4af(%rip), %rsi      # 0x395f8
callq 0x1d660
movq %rax, -0x408(%rbp)
jmp 0x2c157
movq -0x408(%rbp), %rdi
movq -0x268(%rbp), %rsi
addq $0xd0, %rsi
callq 0x1be40
jmp 0x2c173
jmp 0x2c299
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xc0aa(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x410(%rbp)
jmp 0x2c195
movq -0x410(%rbp), %rdi
movq -0x268(%rbp), %rdx
addq $0xe0, %rdx
leaq 0xd444(%rip), %rsi      # 0x395f5
callq 0x1d660
movq %rax, -0x418(%rbp)
jmp 0x2c1bf
movq -0x418(%rbp), %rdi
movq -0x268(%rbp), %rdx
addq $0xb8, %rdx
leaq 0xd41d(%rip), %rsi      # 0x395f8
callq 0x1d660
movq %rax, -0x420(%rbp)
jmp 0x2c1e9
movq -0x420(%rbp), %rdi
movq -0x268(%rbp), %rsi
addq $0xd0, %rsi
callq 0x1be40
jmp 0x2c205
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa50
jmp 0x2c21e
movq -0x320(%rbp), %rax
movq -0x268(%rbp), %rcx
movq %rcx, -0x430(%rbp)
movq 0x18(%rax), %rdi
addq $0x20128, %rdi          # imm = 0x20128
leaq -0x110(%rbp), %rsi
callq 0x2d9e0
movq %rax, -0x428(%rbp)
jmp 0x2c253
movq -0x320(%rbp), %rax
movq -0x428(%rbp), %rcx
movq -0x430(%rbp), %rdx
movq %rdx, (%rcx)
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa80
jmp 0x2c27d
movq -0x268(%rbp), %rdi
callq 0x2cf70
jmp 0x2c28b
movq -0x28(%rbp), %rax
movl $0x0, 0xcc(%rax)
movl $0x1, -0xec(%rbp)
movq -0x320(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x2c2d9
callq 0x36910
movq %rax, -0x438(%rbp)
jmp 0x2c2c7
movq -0x438(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x1e0(%rax)
jmp 0x2c45e
movq -0x320(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq 0x4(%rcx), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x270(%rbp)
movq -0x270(%rbp), %rdi
callq 0x1f940
cmpq $0x0, %rax
je 0x2c429
movq -0x270(%rbp), %rsi
leaq -0x290(%rbp), %rdi
callq 0x1f6c0
movq -0x270(%rbp), %rsi
leaq -0x2b0(%rbp), %rdi
callq 0x1f6f0
leaq -0x290(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x1f720
testb $0x1, %al
jne 0x2c35a
jmp 0x2c427
leaq -0x290(%rbp), %rdi
callq 0x1f750
movq (%rax), %rax
movq %rax, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x1fcc0
movb %al, -0x439(%rbp)
jmp 0x2c384
movb -0x439(%rbp), %al
testb $0x1, %al
jne 0x2c39d
jmp 0x2c390
movq -0x2b8(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x2c40d
movq -0x270(%rbp), %rax
movq %rax, -0x450(%rbp)
leaq -0x2f8(%rbp), %rdi
movq %rdi, -0x448(%rbp)
leaq -0x290(%rbp), %rsi
callq 0x2db20
movq -0x450(%rbp), %rsi
movq -0x448(%rbp), %rdx
leaq -0x2d8(%rbp), %rdi
callq 0x2dac0
jmp 0x2c3e1
movups -0x2d8(%rbp), %xmm0
movups -0x2c8(%rbp), %xmm1
movaps %xmm1, -0x280(%rbp)
movaps %xmm0, -0x290(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0x19950
jmp 0x2c40b
jmp 0x2c422
leaq -0x318(%rbp), %rdi
leaq -0x290(%rbp), %rsi
xorl %edx, %edx
callq 0x2db60
jmp 0x2c32b
jmp 0x2c429
movq -0x270(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x2dba0
jmp 0x2c43b
movq -0x28(%rbp), %rdi
callq 0x2cf70
jmp 0x2c446
movq -0x28(%rbp), %rax
movl $0x1, 0xcc(%rax)
movl $0x0, -0xec(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x178(%rax)
jne 0x2c4f7
movq -0x28(%rbp), %rax
testb $0x1, 0xf3(%rax)
jne 0x2c497
movq -0x28(%rbp), %rax
testb $0x1, 0xf1(%rax)
jne 0x2c497
movq -0x28(%rbp), %rax
cmpl $0x1, 0xcc(%rax)
jne 0x2c4c3
movq -0x30(%rbp), %rdi
addq $0x58, %rdi
movq -0x28(%rbp), %rsi
callq 0x37a00
movq %rax, -0x458(%rbp)
jmp 0x2c4b1
movq -0x458(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x178(%rax)
movq -0x28(%rbp), %rax
testb $0x1, 0xf3(%rax)
jne 0x2c4f5
movq -0x28(%rbp), %rax
testb $0x1, 0xf1(%rax)
je 0x2c4f5
movq -0x28(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
leaq -0x18(%rbp), %rsi
callq 0x1ed20
jmp 0x2c4f3
jmp 0x2c4f5
jmp 0x2c4f7
movq -0x30(%rbp), %rdi
addq $0x18, %rdi
callq 0x1fa80
jmp 0x2c506
movl -0xec(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x191e0
leaq -0xe8(%rbp), %rdi
callq 0x1e970
jmp 0x2c543
leaq -0x110(%rbp), %rdi
callq 0x191e0
leaq -0xe8(%rbp), %rdi
callq 0x1e970
jmp 0x2c54f
movl -0x4(%rbp), %eax
addq $0x460, %rsp            # imm = 0x460
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x194a0
movq %rax, %rdi
callq 0x1eb30