// File: lega911[P]ijson/src/server.cpp
// Function: Loop::client_request(ISlice, Connect*)
int Loop::client_request(ISlice name, Connect *client) {
    stat_call++;
    QueueLine *ql = server->get_queue(name);
    if(!ql) {
        if(server->log & 4) std::cout << ltime() << "404 no method " << name.as_string() << std::endl;
        client->send.status("404 Not Found")->done(-32601);
        return -1;
    }

    Connect *worker = NULL;
    Queue *q;

    LOCK _l(ql->mutex);
    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->workers.begin();
        while (it != q->workers.end()) {
            worker = *it;
            if(client->required_worker) {
                if(client->required_worker != worker->connection_id) {
                    worker = NULL;
                    it++;
                    continue;
                }
            }
            it = q->workers.erase(it);
            worker->unlink();

            if(worker->is_closed()) {
                if(server->log & 8) std::cout << ltime() << "worker closed " << worker << std::endl;
                worker = NULL;
                continue;
            }

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

            if(busy) {
                if(server->log & 8) std::cout << "worker is not ready " << worker << std::endl;
                worker = NULL;
                continue;
            }
            break;
        };

        if(worker) break;
    }

    if(worker) {
        if(client->no_response) {
            if(worker->worker_mode) worker->status = Status::worker_mode_async;
            else worker->status = Status::net;
            worker->send.status("200 OK")->header("Name", name)->header("Async", Slice("true"))->done(client->body);
            client->send.status("200 OK")->done(1);
        } else if(worker->noid) {
            worker->client = client;
            client->link();
            client->status = Status::client_wait_result;
            worker->status = Status::worker_wait_result;
            worker->send.status("200 OK")->header("Name", name)->done(client->body);
        } else {
            Slice id(client->id);
            if(id.empty()) {
                try {
                    while(client->json.scan()) {
                        if(client->json.key == "id") {
                            id = client->json.value;
                            client->id.set(client->json.value);
                            break;
                        }
                    }
                } catch (const error::InvalidData &e) {
                    worker->link();
                    worker->status = Status::worker_wait_job;
                    ql->queue[worker->nloop].workers.push_front(worker);
                    client->send.status("400 No Id")->done(-1);
                    if(server->log & 4) std::cout << ltime() << "400 no id " << name.as_string() << std::endl;
                    return -3;
                }
            }
            if(id.empty()) {
                generate_id(client->id);
                id.set(client->id);
            }
            std::string 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) {
                worker->link();
                worker->status = Status::worker_wait_job;
                ql->queue[worker->nloop].workers.push_front(worker);
                client->send.status("400 Collision Id")->done(-1);
                if(server->log & 4) std::cout << ltime() << "400 collision id " << name.as_string() << std::endl;
                return -3;
            }
            if(worker->fail_on_disconnect) {
                worker->client = client;
                client->link();
            }
            worker->send.status("200 OK")->header("Id", id)->header("Name", name)->done(client->body);
            server->wait_lock.lock();
            server->wait_response[sid] = client;
            server->wait_lock.unlock();
            client->link();
            client->status = Status::client_wait_result;
            worker->status = Status::net;
        }
        if(server->log & 32) worker->start_time = get_time();
    } else {
        if(client->header_option == "if present" && !ql->workers.head) {
            client->send.status("204 No Content")->done(1);
            return 0;
        }
        bool inserted = false;
        auto *clients = &ql->queue[_nloop].clients;

        Message *msg = new Message();
        msg->priority = client->priority;
        msg->required_worker.move(&client->required_worker);
        if(client->no_response) {
            msg->name.set(name);
            msg->attach_buffer(&client->body);
        } else {
            client->name.set(name);
            msg->attach_client(client);
        }
        for(auto it=clients->crbegin(); it!=clients->crend(); it++) {
            if(msg->priority <= (*it)->priority) {
                clients->insert(it.base(), msg);
                inserted = true;
                break;
            }
        }
        if(!inserted) clients->push_front(msg);
        if(client->no_response) {
            client->send.status("200 OK")->done(1);
        } else {
            client->status = Status::client_wait_result;
        }
    };

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
movq %rsi, -0x18(%rbp)
movl %edx, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x2a0(%rbp)
movq 0x80(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x80(%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
xorl %ecx, %ecx
callq 0x281f0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x29f78
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x29f4b
callq 0x36960
movq %rax, %rsi
movq 0x1d10f(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, %rdi
leaq 0xe7d6(%rip), %rsi      # 0x386a6
callq 0x192e0
movq %rax, -0x2b8(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
leaq -0x18(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f340
movq -0x2b8(%rbp), %rdi
movq -0x2b0(%rbp), %rsi
callq 0x19290
movq %rax, -0x2a8(%rbp)
jmp 0x29f11
movq -0x2a8(%rbp), %rdi
movq 0x1d091(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x29f26
leaq -0x60(%rbp), %rdi
callq 0x191e0
jmp 0x29f4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x191e0
jmp 0x2aea2
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xe75b(%rip), %rsi      # 0x386b5
callq 0x1b6d0
movq %rax, %rdi
movl $0xffff80a7, %esi       # imm = 0xFFFF80A7
callq 0x1b770
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2ae96
movq $0x0, -0x78(%rbp)
movq -0x30(%rbp), %rsi
addq $0x18, %rsi
leaq -0x88(%rbp), %rdi
callq 0x1f5d0
movq -0x2a0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x8c(%rbp)
movl $0xffffffff, -0x90(%rbp) # imm = 0xFFFFFFFF
movq -0x2a0(%rbp), %rcx
movl -0x90(%rbp), %eax
movq 0x18(%rcx), %rcx
cmpl 0x28(%rcx), %eax
jge 0x2a2f8
movq -0x2a0(%rbp), %rcx
movl -0x90(%rbp), %eax
cmpl 0x4(%rcx), %eax
jne 0x29fdf
jmp 0x2a2e4
cmpl $0x0, -0x90(%rbp)
jl 0x29ff4
movl -0x90(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x8c(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x1f6c0
movq -0x80(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x1f6f0
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x1f720
testb $0x1, %al
jne 0x2a04d
jmp 0x2a2d9
leaq -0xb0(%rbp), %rdi
callq 0x1f750
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
callq 0x1f770
movb %al, -0x2b9(%rbp)
jmp 0x2a078
movb -0x2b9(%rbp), %al
testb $0x1, %al
jne 0x2a084
jmp 0x2a0e8
movq -0x28(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
movq -0x78(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
callq 0x2d840
movb %al, -0x2ba(%rbp)
jmp 0x2a0a7
movb -0x2ba(%rbp), %al
testb $0x1, %al
jne 0x2a0b3
jmp 0x2a0e6
movq $0x0, -0x78(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
xorl %edx, %edx
callq 0x2db60
jmp 0x2a021
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2ae88
jmp 0x2a0e8
movq -0x80(%rbp), %rax
movq %rax, -0x2d0(%rbp)
leaq -0x130(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
leaq -0xb0(%rbp), %rsi
callq 0x2db20
movq -0x2d0(%rbp), %rsi
movq -0x2c8(%rbp), %rdx
leaq -0x110(%rbp), %rdi
callq 0x2dac0
jmp 0x2a129
movups -0x110(%rbp), %xmm0
movups -0x100(%rbp), %xmm1
movaps %xmm1, -0xa0(%rbp)
movaps %xmm0, -0xb0(%rbp)
movq -0x78(%rbp), %rdi
callq 0x19950
jmp 0x2a150
movq -0x78(%rbp), %rdi
callq 0x1fcc0
movb %al, -0x2d1(%rbp)
jmp 0x2a161
movb -0x2d1(%rbp), %al
testb $0x1, %al
jne 0x2a170
jmp 0x2a209
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x2a1fc
callq 0x36960
movq %rax, -0x2e0(%rbp)
jmp 0x2a194
movq -0x2e0(%rbp), %rsi
movq 0x1ce2e(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, -0x2e8(%rbp)
jmp 0x2a1b0
movq -0x2e8(%rbp), %rdi
leaq 0xf445(%rip), %rsi      # 0x39603
callq 0x192e0
movq %rax, -0x2f0(%rbp)
jmp 0x2a1cc
movq -0x2f0(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x19250
movq %rax, -0x2f8(%rbp)
jmp 0x2a1e5
movq -0x2f8(%rbp), %rdi
movq 0x1cdbd(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x2a1fa
jmp 0x2a1fc
movq $0x0, -0x78(%rbp)
jmp 0x2a021
movb $0x1, -0x131(%rbp)
movq -0x78(%rbp), %rax
cmpl $0x1, 0xcc(%rax)
jne 0x2a25f
movq -0x78(%rbp), %rdi
addq $0x50, %rdi
callq 0x1fa50
jmp 0x2a22c
movq -0x78(%rbp), %rax
cmpl $0x1, 0xcc(%rax)
jne 0x2a24e
movq -0x78(%rbp), %rax
movl $0x5, 0xcc(%rax)
movb $0x0, -0x131(%rbp)
movq -0x78(%rbp), %rdi
addq $0x50, %rdi
callq 0x1fa80
jmp 0x2a25d
jmp 0x2a25f
testb $0x1, -0x131(%rbp)
je 0x2a2d7
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x2a2ca
movq 0x1cd4b(%rip), %rdi     # 0x46fd0
leaq 0xf386(%rip), %rsi      # 0x39612
callq 0x192e0
movq %rax, -0x300(%rbp)
jmp 0x2a29a
movq -0x300(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x19250
movq %rax, -0x308(%rbp)
jmp 0x2a2b3
movq -0x308(%rbp), %rdi
movq 0x1ccef(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x2a2c8
jmp 0x2a2ca
movq $0x0, -0x78(%rbp)
jmp 0x2a021
jmp 0x2a2d9
cmpq $0x0, -0x78(%rbp)
je 0x2a2e2
jmp 0x2a2f8
jmp 0x2a2e4
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x29fae
cmpq $0x0, -0x78(%rbp)
je 0x2ab52
movq -0x28(%rbp), %rax
testb $0x1, 0xf2(%rax)
je 0x2a402
movq -0x78(%rbp), %rax
testb $0x1, 0xf3(%rax)
je 0x2a331
movq -0x78(%rbp), %rax
movl $0x6, 0xcc(%rax)
jmp 0x2a33f
movq -0x78(%rbp), %rax
movl $0x0, 0xcc(%rax)
movq -0x78(%rbp), %rdi
addq $0x18, %rdi
leaq 0xdee3(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x310(%rbp)
jmp 0x2a35c
movq -0x310(%rbp), %rdi
leaq 0xf28e(%rip), %rsi      # 0x395f8
leaq -0x18(%rbp), %rdx
callq 0x1d660
movq %rax, -0x318(%rbp)
jmp 0x2a37c
leaq 0xe7f5(%rip), %rsi      # 0x38b78
leaq -0x148(%rbp), %rdi
callq 0x1f4b0
jmp 0x2a391
movq -0x318(%rbp), %rdi
leaq 0xf25e(%rip), %rsi      # 0x395fd
leaq -0x148(%rbp), %rdx
callq 0x1d660
movq %rax, -0x320(%rbp)
jmp 0x2a3b4
movq -0x320(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0xd0, %rsi
callq 0x1be40
jmp 0x2a3cd
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xde55(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x328(%rbp)
jmp 0x2a3ea
movq -0x328(%rbp), %rdi
movl $0x1, %esi
callq 0x1b770
jmp 0x2a3fd
jmp 0x2ab17
movq -0x78(%rbp), %rax
testb $0x1, 0xf1(%rax)
je 0x2a4a4
movq -0x28(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, 0x120(%rax)
movq -0x28(%rbp), %rdi
callq 0x2cf70
jmp 0x2a42d
movq -0x28(%rbp), %rax
movl $0x4, 0xcc(%rax)
movq -0x78(%rbp), %rax
movl $0x2, 0xcc(%rax)
movq -0x78(%rbp), %rdi
addq $0x18, %rdi
leaq 0xddd9(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x330(%rbp)
jmp 0x2a466
movq -0x330(%rbp), %rdi
leaq 0xf184(%rip), %rsi      # 0x395f8
leaq -0x18(%rbp), %rdx
callq 0x1d660
movq %rax, -0x338(%rbp)
jmp 0x2a486
movq -0x338(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0xd0, %rsi
callq 0x1be40
jmp 0x2a49f
jmp 0x2ab15
movq -0x28(%rbp), %rsi
addq $0xe0, %rsi
leaq -0x158(%rbp), %rdi
callq 0x1e9f0
jmp 0x2a4bd
leaq -0x158(%rbp), %rdi
callq 0x1eb40
movb %al, -0x339(%rbp)
jmp 0x2a4d1
movb -0x339(%rbp), %al
testb $0x1, %al
jne 0x2a4e0
jmp 0x2a721
jmp 0x2a4e2
movq -0x28(%rbp), %rdi
addq $0x128, %rdi            # imm = 0x128
callq 0x236d0
movb %al, -0x33a(%rbp)
jmp 0x2a4fa
movb -0x33a(%rbp), %al
testb $0x1, %al
jne 0x2a509
jmp 0x2a6cc
movq -0x28(%rbp), %rdi
addq $0x128, %rdi            # imm = 0x128
leaq 0xde29(%rip), %rsi      # 0x38344
callq 0x1ee30
movb %al, -0x33b(%rbp)
jmp 0x2a528
movb -0x33b(%rbp), %al
testb $0x1, %al
jne 0x2a537
jmp 0x2a6c7
movq -0x28(%rbp), %rax
movl 0x140(%rax), %ecx
movl %ecx, -0x150(%rbp)
movq 0x138(%rax), %rax
movq %rax, -0x158(%rbp)
movq -0x28(%rbp), %rsi
movq %rsi, %rdi
addq $0xe0, %rdi
addq $0x138, %rsi            # imm = 0x138
callq 0x1ed20
jmp 0x2a571
jmp 0x2a6cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2ae88
movq -0x68(%rbp), %rdi
callq 0x19120
movq %rax, -0x160(%rbp)
movq -0x78(%rbp), %rdi
callq 0x2cf70
jmp 0x2a5ad
movq -0x78(%rbp), %rax
movl $0x1, 0xcc(%rax)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x78(%rbp), %rax
movslq 0x38(%rax), %rax
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x2dc00
jmp 0x2a5e1
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xefd4(%rip), %rsi      # 0x395c4
callq 0x1b6d0
movq %rax, -0x348(%rbp)
jmp 0x2a5fe
movq -0x348(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1b770
jmp 0x2a611
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2a6f6
callq 0x36960
movq %rax, -0x350(%rbp)
jmp 0x2a639
movq -0x350(%rbp), %rsi
movq 0x1c989(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, -0x358(%rbp)
jmp 0x2a655
movq -0x358(%rbp), %rdi
leaq 0xef6b(%rip), %rsi      # 0x395ce
callq 0x192e0
movq %rax, -0x360(%rbp)
jmp 0x2a671
leaq -0x180(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f340
jmp 0x2a688
movq -0x360(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x19290
movq %rax, -0x368(%rbp)
jmp 0x2a6a4
movq -0x368(%rbp), %rdi
movq 0x1c8fe(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x2a6b9
leaq -0x180(%rbp), %rdi
callq 0x191e0
jmp 0x2a6f6
jmp 0x2a4e2
jmp 0x2a71f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2a713
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x191e0
jmp 0x2a713
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
movl $0x1, -0x184(%rbp)
callq 0x19450
jmp 0x2a70e
jmp 0x2ae7a
callq 0x19450
jmp 0x2a71a
jmp 0x2ae88
jmp 0x2a721
leaq -0x158(%rbp), %rdi
callq 0x1eb40
movb %al, -0x369(%rbp)
jmp 0x2a735
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x2a741
jmp 0x2a76e
movq -0x28(%rbp), %rdi
addq $0xe0, %rdi
callq 0x36c80
jmp 0x2a753
movq -0x28(%rbp), %rsi
addq $0xe0, %rsi
leaq -0x158(%rbp), %rdi
callq 0x1f580
jmp 0x2a76c
jmp 0x2a76e
leaq -0x1a8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f340
jmp 0x2a788
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa50
jmp 0x2a7a1
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x20128, %rdi          # imm = 0x20128
leaq -0x1a8(%rbp), %rsi
callq 0x2d980
movq %rax, -0x378(%rbp)
jmp 0x2a7c8
movq -0x2a0(%rbp), %rax
movq -0x378(%rbp), %rcx
movq %rcx, -0x1b8(%rbp)
movq 0x18(%rax), %rdi
addq $0x20128, %rdi          # imm = 0x20128
callq 0x2d9b0
movq %rax, -0x1c0(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x2d950
movb %al, %cl
movq -0x2a0(%rbp), %rax
movb %cl, -0x1a9(%rbp)
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa80
jmp 0x2a828
testb $0x1, -0x1a9(%rbp)
je 0x2a99e
movq -0x78(%rbp), %rdi
callq 0x2cf70
jmp 0x2a840
movq -0x78(%rbp), %rax
movl $0x1, 0xcc(%rax)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x78(%rbp), %rax
movslq 0x38(%rax), %rax
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x2dc00
jmp 0x2a874
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xed64(%rip), %rsi      # 0x395e7
callq 0x1b6d0
movq %rax, -0x380(%rbp)
jmp 0x2a891
movq -0x380(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x1b770
jmp 0x2a8a4
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x2a988
callq 0x36960
movq %rax, -0x388(%rbp)
jmp 0x2a8cc
movq -0x388(%rbp), %rsi
movq 0x1c6f6(%rip), %rdi     # 0x46fd0
callq 0x192e0
movq %rax, -0x390(%rbp)
jmp 0x2a8e8
movq -0x390(%rbp), %rdi
leaq 0xed31(%rip), %rsi      # 0x39627
callq 0x192e0
movq %rax, -0x398(%rbp)
jmp 0x2a904
leaq -0x1e0(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1f340
jmp 0x2a91b
movq -0x398(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x19290
movq %rax, -0x3a0(%rbp)
jmp 0x2a937
movq -0x3a0(%rbp), %rdi
movq 0x1c66b(%rip), %rsi     # 0x46fb0
callq 0x19320
jmp 0x2a94c
leaq -0x1e0(%rbp), %rdi
callq 0x191e0
jmp 0x2a988
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2ab04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x191e0
jmp 0x2ab04
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
movl $0x1, -0x184(%rbp)
jmp 0x2aae6
movq -0x78(%rbp), %rax
testb $0x1, 0xf0(%rax)
je 0x2a9c7
movq -0x28(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, 0x120(%rax)
movq -0x28(%rbp), %rdi
callq 0x2cf70
jmp 0x2a9c5
jmp 0x2a9c7
movq -0x78(%rbp), %rdi
addq $0x18, %rdi
leaq 0xd85b(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x3a8(%rbp)
jmp 0x2a9e4
movq -0x3a8(%rbp), %rdi
leaq 0xec03(%rip), %rsi      # 0x395f5
leaq -0x158(%rbp), %rdx
callq 0x1d660
movq %rax, -0x3b0(%rbp)
jmp 0x2aa07
movq -0x3b0(%rbp), %rdi
leaq 0xebe3(%rip), %rsi      # 0x395f8
leaq -0x18(%rbp), %rdx
callq 0x1d660
movq %rax, -0x3b8(%rbp)
jmp 0x2aa27
movq -0x3b8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0xd0, %rsi
callq 0x1be40
jmp 0x2aa40
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa50
jmp 0x2aa59
movq -0x2a0(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, -0x3c8(%rbp)
movq 0x18(%rax), %rdi
addq $0x20128, %rdi          # imm = 0x20128
leaq -0x1a8(%rbp), %rsi
callq 0x2d9e0
movq %rax, -0x3c0(%rbp)
jmp 0x2aa8b
movq -0x2a0(%rbp), %rax
movq -0x3c0(%rbp), %rcx
movq -0x3c8(%rbp), %rdx
movq %rdx, (%rcx)
movq 0x18(%rax), %rdi
addq $0x20158, %rdi          # imm = 0x20158
callq 0x1fa80
jmp 0x2aab5
movq -0x28(%rbp), %rdi
callq 0x2cf70
jmp 0x2aac0
movq -0x28(%rbp), %rax
movl $0x4, 0xcc(%rax)
movq -0x78(%rbp), %rax
movl $0x0, 0xcc(%rax)
movl $0x0, -0x184(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x191e0
movl -0x184(%rbp), %eax
testl %eax, %eax
jne 0x2ae7a
jmp 0x2ab02
jmp 0x2ab15
leaq -0x1a8(%rbp), %rdi
callq 0x191e0
jmp 0x2ae88
jmp 0x2ab17
movq -0x2a0(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x2ab4d
callq 0x36910
movq %rax, -0x3d0(%rbp)
jmp 0x2ab3b
movq -0x3d0(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, 0x1e0(%rax)
jmp 0x2ae69
movq -0x28(%rbp), %rdi
addq $0xa8, %rdi
leaq 0xead5(%rip), %rsi      # 0x39639
callq 0x1ee30
movb %al, -0x3d1(%rbp)
jmp 0x2ab71
movb -0x3d1(%rbp), %al
testb $0x1, %al
jne 0x2ab7d
jmp 0x2abd1
movq -0x30(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0x2abd1
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xeaaa(%rip), %rsi      # 0x39644
callq 0x1b6d0
movq %rax, -0x3e0(%rbp)
jmp 0x2aba8
movq -0x3e0(%rbp), %rdi
movl $0x1, %esi
callq 0x1b770
jmp 0x2abbb
movl $0x0, -0x4(%rbp)
movl $0x1, -0x184(%rbp)
jmp 0x2ae7a
movq -0x2a0(%rbp), %rcx
movb $0x0, -0x1e1(%rbp)
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
movslq 0x4(%rcx), %rcx
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
leaq 0x50(%rax,%rcx), %rax
movq %rax, -0x1f0(%rbp)
movl $0x38, %edi
callq 0x27250
movq %rax, -0x3e8(%rbp)
jmp 0x2ac12
movq -0x3e8(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq $0x0, 0x30(%rdi)
callq 0x2dc60
jmp 0x2ac36
movq -0x3e8(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x28(%rbp), %rax
movl 0xf4(%rax), %ecx
movq -0x1f8(%rbp), %rax
movl %ecx, (%rax)
movq -0x1f8(%rbp), %rdi
addq $0x8, %rdi
movq -0x28(%rbp), %rsi
addq $0x110, %rsi            # imm = 0x110
callq 0x2dcd0
jmp 0x2ac74
movq -0x28(%rbp), %rax
testb $0x1, 0xf2(%rax)
je 0x2acd4
movq -0x1f8(%rbp), %rdi
addq $0x28, %rdi
leaq -0x18(%rbp), %rsi
callq 0x1ed20
jmp 0x2ac97
movq -0x1f8(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0xd0, %rsi
callq 0x2c560
jmp 0x2acb0
jmp 0x2acfe
movq -0x3e8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x38, %esi
callq 0x19300
jmp 0x2ae88
movq -0x28(%rbp), %rdi
addq $0xb8, %rdi
leaq -0x18(%rbp), %rsi
callq 0x1ed20
jmp 0x2acea
movq -0x1f8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2c5f0
jmp 0x2acfc
jmp 0x2acfe
movq -0x1f0(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x2dd30
movq -0x1f0(%rbp), %rsi
leaq -0x238(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x2ddc0
movq -0x3f8(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x2dd90
movb %al, -0x3e9(%rbp)
jmp 0x2ad46
movb -0x3e9(%rbp), %al
testb $0x1, %al
jne 0x2ad55
jmp 0x2adfa
movq -0x1f8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x404(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x2de20
movq %rax, -0x400(%rbp)
jmp 0x2ad79
movl -0x404(%rbp), %eax
movq -0x400(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
jg 0x2addc
movq -0x1f0(%rbp), %rax
movq %rax, -0x410(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x2df10
jmp 0x2adb0
movq -0x410(%rbp), %rsi
leaq -0x278(%rbp), %rdi
leaq -0x258(%rbp), %rdx
leaq -0x1f8(%rbp), %rcx
callq 0x2de50
jmp 0x2add3
movb $0x1, -0x1e1(%rbp)
jmp 0x2adfa
jmp 0x2adde
leaq -0x298(%rbp), %rdi
leaq -0x218(%rbp), %rsi
xorl %edx, %edx
callq 0x2df40
jmp 0x2adf5
jmp 0x2ad11
testb $0x1, -0x1e1(%rbp)
jne 0x2ae1a
movq -0x1f0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x2df80
jmp 0x2ae18
jmp 0x2ae1a
movq -0x28(%rbp), %rax
testb $0x1, 0xf2(%rax)
je 0x2ae59
movq -0x28(%rbp), %rdi
addq $0x18, %rdi
leaq 0xd3fb(%rip), %rsi      # 0x38231
callq 0x1b6d0
movq %rax, -0x418(%rbp)
jmp 0x2ae44
movq -0x418(%rbp), %rdi
movl $0x1, %esi
callq 0x1b770
jmp 0x2ae57
jmp 0x2ae67
movq -0x28(%rbp), %rax
movl $0x4, 0xcc(%rax)
jmp 0x2ae69
movl $0x0, -0x4(%rbp)
movl $0x1, -0x184(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x1f880
jmp 0x2ae96
leaq -0x88(%rbp), %rdi
callq 0x1f880
jmp 0x2aea2
movl -0x4(%rbp), %eax
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x194a0
movq %rax, %rdi
callq 0x1eb30
nopw %cs:(%rax,%rax)