LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::event_dispatch<dasynq::v2::epoll_traits, dasynq::v2::default_traits<dasynq::null_mutex>>::issue_delete(dasynq::v2::dprivate::base_bidi_fd_watcher*)
void issue_delete(base_bidi_fd_watcher *watcher) noexcept
        {
            lock.lock();
            
            if (watcher->active) {
                watcher->deleteme = true;
                release_watcher(watcher);
            }
            else {
                dequeue_watcher(watcher);
                release_watcher(watcher);
                watcher->read_removed = true;
            }
            
            base_watcher *secondary = &(watcher->out_watcher);
            if (secondary->active) {
                secondary->deleteme = true;
                release_watcher(watcher);
            }
            else {
                dequeue_watcher(secondary);
                release_watcher(watcher);
                watcher->write_removed = true;
            }
            
            if (watcher->read_removed && watcher->write_removed) {
                lock.unlock();
                watcher->watch_removed();
            }
            else {
                lock.unlock();
            }
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
addq $0x28, %rdi
callq 0x11130
movq -0x10(%rbp), %rax
movb 0xc(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x6afd1
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movb 0xc(%rax), %cl
andb $-0x3, %cl
orb $0x2, %cl
movb %cl, 0xc(%rax)
movq -0x10(%rbp), %rsi
callq 0x12ea0
jmp 0x6affb
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x12660
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x12ea0
movq -0x10(%rbp), %rax
movb 0x48(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x48(%rax)
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb 0xc(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x6b037
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0xc(%rax), %cl
andb $-0x3, %cl
orb $0x2, %cl
movb %cl, 0xc(%rax)
movq -0x10(%rbp), %rsi
callq 0x12ea0
jmp 0x6b061
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x12660
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x12ea0
movq -0x10(%rbp), %rax
movb 0x48(%rax), %cl
andb $-0x3, %cl
orb $0x2, %cl
movb %cl, 0x48(%rax)
movq -0x10(%rbp), %rax
movb 0x48(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x6b09e
movq -0x10(%rbp), %rax
movb 0x48(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x6b09e
movq -0x20(%rbp), %rdi
addq $0x28, %rdi
callq 0x11120
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
jmp 0x6b0ab
movq -0x20(%rbp), %rdi
addq $0x28, %rdi
callq 0x11120
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: enable_console_log(bool)
void enable_console_log(bool enable) noexcept
{
    bool log_to_console = ! log_stream[DLOG_CONS].is_release_set();
    if (enable && ! log_to_console) {
        // Set non-blocking IO:
        int flags = fcntl(STDOUT_FILENO, F_GETFL, 0);
        fcntl(STDOUT_FILENO, F_SETFL, flags | O_NONBLOCK);
        // Activate watcher:
        log_stream[DLOG_CONS].init(STDOUT_FILENO);
        log_stream[DLOG_CONS].set_enabled(event_loop, true);
    }
    else if (! enable && log_to_console) {
        log_stream[DLOG_CONS].flush_for_release();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %dil, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
leaq 0x3ecd9(%rip), %rdi     # 0xa9ed0
callq 0x6b3e0
movb %al, -0x9(%rbp)
jmp 0x6b201
movb -0x9(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x2(%rbp)
testb $0x1, -0x1(%rbp)
je 0x6b285
testb $0x1, -0x2(%rbp)
jne 0x6b285
xorl %edx, %edx
movb %dl, %al
movl $0x1, %edi
movl $0x3, %esi
callq 0xa3f0
movl %eax, -0x10(%rbp)
jmp 0x6b22f
movl -0x10(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %edx
orl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
movl $0x1, %edi
movl $0x4, %esi
callq 0xa3f0
jmp 0x6b251
leaq 0x3ec78(%rip), %rdi     # 0xa9ed0
movl $0x1, %esi
callq 0x6b380
jmp 0x6b264
leaq 0x3dc15(%rip), %rdi     # 0xa8e80
addq $0x1050, %rdi           # imm = 0x1050
leaq 0x3d8e7(%rip), %rsi     # 0xa8b60
movl $0x1, %edx
callq 0x17c00
jmp 0x6b2a3
testb $0x1, -0x1(%rbp)
jne 0x6b2a1
testb $0x1, -0x2(%rbp)
je 0x6b2a1
leaq 0x3ec38(%rip), %rdi     # 0xa9ed0
callq 0x6b400
jmp 0x6b29f
jmp 0x6b2a1
jmp 0x6b2a3
addq $0x10, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: (anonymous namespace)::buffered_log_stream::flush_for_release()
void buffered_log_stream::flush_for_release()
{
    if (release) return;

    release = true;
    
    // Try to flush any messages that are currently buffered. (Console is non-blocking
    // so it will fail gracefully).
    rearm rearm_val = fd_event(event_loop, fd, dasynq::OUT_EVENTS);
    if (rearm_val == rearm::DISARM) {
        // Console has already been released at this point.
        set_enabled(event_loop, false);
    }
    if (rearm_val == rearm::REMOVE) {
        deregister(event_loop);
    }
    // fd_event didn't want to disarm, so must be partway through a message; will
    // release when it's finished.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
testb $0x1, 0x2a(%rax)
je 0x6b41c
jmp 0x6b46c
movq -0x18(%rbp), %rdi
movb $0x1, 0x2a(%rdi)
movl 0x1048(%rdi), %edx
leaq 0x3d72f(%rip), %rsi     # 0xa8b60
movl $0x2, %ecx
callq 0x6bd80
movl %eax, -0xc(%rbp)
cmpl $0x1, -0xc(%rbp)
jne 0x6b456
movq -0x18(%rbp), %rdi
leaq 0x3d711(%rip), %rsi     # 0xa8b60
xorl %edx, %edx
callq 0x17c00
cmpl $0x3, -0xc(%rbp)
jne 0x6b46c
movq -0x18(%rbp), %rdi
leaq 0x3d6f9(%rip), %rsi     # 0xa8b60
callq 0x17d20
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: discard_console_log_buffer()
void discard_console_log_buffer() noexcept
{
    // Only discard if more than a second has passed since we released the console.
    dasynq::time_val current_time;
    event_loop.get_time(current_time, clock_type::MONOTONIC);
    if (current_time - release_time >= dasynq::time_val(1, 0)) {
        log_stream[DLOG_CONS].discard();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq -0x10(%rbp), %rdi
callq 0x18380
leaq 0x3d6c8(%rip), %rdi     # 0xa8b60
leaq -0x10(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x53720
leaq -0x10(%rbp), %rdi
leaq 0x3d9b5(%rip), %rsi     # 0xa8e68
callq 0x1d430
movq %rax, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x1c100
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x6c7a0
testb $0x1, %al
jne 0x6b4e5
jmp 0x6b4f5
leaq 0x3e9e4(%rip), %rdi     # 0xa9ed0
callq 0x6b510
jmp 0x6b4f3
jmp 0x6b4f5
addq $0x30, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: void do_log<char const*, char const*, char const*>(loglevel_t, bool, char const*, char const*, char const*)
static void do_log(loglevel_t lvl, bool to_cons, T ... args) noexcept
{
    log_current_line[DLOG_CONS] = (lvl >= log_level[DLOG_CONS]) && to_cons;
    log_current_line[DLOG_MAIN] = (lvl >= log_level[DLOG_MAIN]);
    push_to_log(DLOG_CONS, args...);
    
    if (log_current_line[DLOG_MAIN]) {
        if (log_format_syslog[DLOG_MAIN]) {
            char svcbuf[10];
            snprintf(svcbuf, 10, "<%d>", LOG_DAEMON | log_level_to_syslog_level(lvl));
            push_to_log(DLOG_MAIN, svcbuf, args...);
        }
        else {
            push_to_log(DLOG_MAIN, args...);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %sil, %al
movl %edi, -0x4(%rbp)
andb $0x1, %al
movb %al, -0x5(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl -0x4(%rbp), %ecx
xorl %eax, %eax
cmpl 0x3d252(%rip), %ecx     # 0xa87fc
movb %al, -0x2b(%rbp)
jl 0x6b5b5
movb -0x5(%rbp), %al
movb %al, -0x2b(%rbp)
movb -0x2b(%rbp), %al
andb $0x1, %al
movb %al, 0x3f969(%rip)      # 0xaaf29
movl -0x4(%rbp), %eax
cmpl 0x3d22f(%rip), %eax     # 0xa87f8
setge %al
andb $0x1, %al
movb %al, 0x3f954(%rip)      # 0xaaf28
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x1, %edi
callq 0x6c450
testb $0x1, 0x3f937(%rip)     # 0xaaf28
je 0x6b656
testb $0x1, 0x3d207(%rip)     # 0xa8801
je 0x6b641
leaq -0x2a(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x4(%rbp), %edi
callq 0x6b770
movq -0x38(%rbp), %rdi
movl %eax, %ecx
orl $0x18, %ecx
movl $0xa, %esi
leaq 0xe043(%rip), %rdx      # 0x79664
movb $0x0, %al
callq 0xabc0
leaq -0x2a(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
xorl %edi, %edi
callq 0x6c520
jmp 0x6b654
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
xorl %edi, %edi
callq 0x6c450
jmp 0x6b656
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: log_msg_begin(loglevel_t, char const*)
void log_msg_begin(loglevel_t lvl, const char *msg) noexcept
{
    log_current_line[DLOG_CONS] = lvl >= log_level[DLOG_CONS];
    log_current_line[DLOG_MAIN] = lvl >= log_level[DLOG_MAIN];

    // Prepend the syslog priority level string ("<N>") for the main log:
    if (log_current_line[DLOG_MAIN]) {
        if (log_format_syslog[DLOG_MAIN]) {
            char svcbuf[10];
            snprintf(svcbuf, 10, "<%d>", LOG_DAEMON | log_level_to_syslog_level(lvl));
            do_log_part(DLOG_MAIN, svcbuf);
        }
    }

    for (int i = 0; i < DLOG_NUM; i++) {
        do_log_part(i, "dinit: ");
        do_log_part(i, msg);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x3d144(%rip), %eax     # 0xa87fc
setge %al
andb $0x1, %al
movb %al, 0x3f866(%rip)      # 0xaaf29
movl -0x4(%rbp), %eax
cmpl 0x3d12c(%rip), %eax     # 0xa87f8
setge %al
andb $0x1, %al
movb %al, 0x3f851(%rip)      # 0xaaf28
testb $0x1, 0x3f84a(%rip)     # 0xaaf28
je 0x6b728
testb $0x1, 0x3d11a(%rip)     # 0xa8801
je 0x6b726
leaq -0x1a(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x4(%rbp), %edi
callq 0x6b770
movl %eax, -0x24(%rbp)
jmp 0x6b6fe
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %ecx
orl $0x18, %ecx
movl $0xa, %esi
leaq 0xdf50(%rip), %rdx      # 0x79664
movb $0x0, %al
callq 0xabc0
leaq -0x1a(%rbp), %rsi
xorl %edi, %edi
callq 0x6b7d0
jmp 0x6b728
movl $0x0, -0x20(%rbp)
cmpl $0x2, -0x20(%rbp)
jge 0x6b75b
movl -0x20(%rbp), %edi
leaq 0xdf1d(%rip), %rsi      # 0x7965c
callq 0x6b7d0
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x6b7d0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x6b72f
addq $0x30, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopl (%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: log_level_to_syslog_level(loglevel_t)
static int log_level_to_syslog_level(loglevel_t l)
{
    switch (l) {
    case loglevel_t::DEBUG:
        return LOG_DEBUG;
    case loglevel_t::NOTICE:
        return LOG_NOTICE;
    case loglevel_t::WARN:
        return LOG_WARNING;
    case loglevel_t::ERROR:
        return LOG_ERR;
    default: ;
    }
    
    return LOG_CRIT;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %eax
movq %rax, -0x10(%rbp)
subq $0x3, %rax
ja 0x6b7bc
movq -0x10(%rbp), %rax
leaq 0xddf9(%rip), %rcx      # 0x79588
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x7, -0x4(%rbp)
jmp 0x6b7c5
movl $0x5, -0x4(%rbp)
jmp 0x6b7c5
movl $0x4, -0x4(%rbp)
jmp 0x6b7c5
movl $0x3, -0x4(%rbp)
jmp 0x6b7c5
jmp 0x6b7be
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: do_log_part(int, char const*)
static void do_log_part(int idx, const char *arg) noexcept
{
    if (log_current_line[idx]) {
        int amount = sum_length(arg);
        if (log_stream[idx].get_free() >= amount) {
            append(log_stream[idx], arg);
        }
        else {
            // we have to discard the message
            log_stream[idx].rollback_msg();
            log_current_line[idx] = false;
            log_stream[idx].mark_discarded();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x3f73e(%rip), %rax     # 0xaaf28
testb $0x1, (%rax,%rcx)
je 0x6b894
movq -0x10(%rbp), %rdi
callq 0x6c2d0
movl %eax, -0x14(%rbp)
movslq -0x4(%rbp), %rax
imulq $0x1050, %rax, %rax     # imm = 0x1050
leaq 0x3d66e(%rip), %rdi     # 0xa8e80
addq %rax, %rdi
callq 0x6c2f0
movl %eax, -0x18(%rbp)
jmp 0x6b81f
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x6b849
movslq -0x4(%rbp), %rax
imulq $0x1050, %rax, %rax     # imm = 0x1050
leaq 0x3d647(%rip), %rdi     # 0xa8e80
addq %rax, %rdi
movq -0x10(%rbp), %rsi
callq 0x6c310
jmp 0x6b847
jmp 0x6b892
movslq -0x4(%rbp), %rax
imulq $0x1050, %rax, %rax     # imm = 0x1050
leaq 0x3d625(%rip), %rdi     # 0xa8e80
addq %rax, %rdi
callq 0x6c350
jmp 0x6b865
movslq -0x4(%rbp), %rax
leaq 0x3f6b8(%rip), %rcx     # 0xaaf28
movb $0x0, (%rax,%rcx)
movslq -0x4(%rbp), %rax
imulq $0x1050, %rax, %rax     # imm = 0x1050
leaq 0x3d5fa(%rip), %rdi     # 0xa8e80
addq %rax, %rdi
callq 0x6c380
jmp 0x6b890
jmp 0x6b892
jmp 0x6b894
addq $0x20, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: log_msg_end(char const*)
void log_msg_end(const char *msg) noexcept
{
    for (int i = 0; i < DLOG_NUM; i++) {
        do_log_part(i, msg);
        do_log_part(i, "\n");
        do_log_commit(i);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x2, -0xc(%rbp)
jge 0x6b927
movl -0xc(%rbp), %edi
movq -0x8(%rbp), %rsi
callq 0x6b7d0
movl -0xc(%rbp), %edi
leaq 0xb1d9(%rip), %rsi      # 0x76ae8
callq 0x6b7d0
movl -0xc(%rbp), %edi
callq 0x6b930
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x6b8f3
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: void do_log_cons<char const*, char const*, char const*>(loglevel_t, char const*, char const*, char const*)
static void do_log_cons(loglevel_t lvl, T ... args) noexcept
{
    if (console_service_status || lvl >= log_level[DLOG_CONS]) {
        log_current_line[DLOG_CONS] = true;
        log_current_line[DLOG_MAIN] = false;
        push_to_log(DLOG_CONS, args...);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
testb $0x1, 0x3ce12(%rip)     # 0xa8800
jne 0x6b9fb
movl -0x4(%rbp), %eax
cmpl 0x3ce03(%rip), %eax     # 0xa87fc
jl 0x6ba1f
movb $0x1, 0x3f527(%rip)     # 0xaaf29
movb $0x0, 0x3f51f(%rip)     # 0xaaf28
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x1, %edi
callq 0x6c450
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: void do_log_main<char const*, char const*, char const*>(loglevel_t, char const*, char const*, char const*)
static void do_log_main(loglevel_t lvl, T ... args) noexcept
{
    if (lvl < log_level[DLOG_MAIN]) {
        return;
    }

    log_current_line[DLOG_CONS] = false;
    log_current_line[DLOG_MAIN] = true;

    if (log_format_syslog[DLOG_MAIN]) {
        char svcbuf[10];
        snprintf(svcbuf, 10, "<%d>", LOG_DAEMON | LOG_NOTICE);
        push_to_log(DLOG_MAIN, svcbuf, args...);
    }
    else {
        push_to_log(DLOG_MAIN, args...);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x3cda8(%rip), %eax     # 0xa87f8
jge 0x6ba54
jmp 0x6bab3
movb $0x0, 0x3f4ce(%rip)     # 0xaaf29
movb $0x1, 0x3f4c6(%rip)     # 0xaaf28
testb $0x1, 0x3cd98(%rip)     # 0xa8801
je 0x6baa0
leaq -0x2a(%rbp), %rdi
movl $0xa, %esi
leaq 0xdbe9(%rip), %rdx      # 0x79664
movl $0x1d, %ecx
movb $0x0, %al
callq 0xabc0
leaq -0x2a(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
xorl %edi, %edi
callq 0x6c520
jmp 0x6bab3
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
xorl %edi, %edi
callq 0x6c450
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: (anonymous namespace)::buffered_log_stream::watch_removed()
void buffered_log_stream::watch_removed() noexcept
{
    if (fd > STDERR_FILENO) {
        bp_sys::close(fd);
    }
    fd = -1;
    release = true; // prevent attempt to enable watch

    // Here we rely on there only being two logs, console and "main"; we can check if we are the
    // main log via identity:
    if (&log_stream[DLOG_MAIN] == this) {
        external_log_open = false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpl $0x2, 0x1048(%rax)
jle 0x6bcf0
movq -0x10(%rbp), %rax
movl 0x1048(%rax), %edi
callq 0xad80
jmp 0x6bcee
jmp 0x6bcf0
movq -0x10(%rbp), %rcx
movl $0xffffffff, 0x1048(%rcx) # imm = 0xFFFFFFFF
movb $0x1, 0x2a(%rcx)
leaq 0x3d177(%rip), %rax     # 0xa8e80
cmpq %rcx, %rax
jne 0x6bd18
leaq 0x3cfb3(%rip), %rax     # 0xa8cc8
movb $0x0, (%rax)
addq $0x10, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: (anonymous namespace)::buffered_log_stream::release_console()
void buffered_log_stream::release_console()
{
    if (release) {
        int flags = fcntl(1, F_GETFL, 0);
        fcntl(1, F_SETFL, flags & ~O_NONBLOCK);
        if (services != nullptr) {
            services->pull_console_queue();
        }
        if (release) {
            // release still set, we didn't immediately get the console back; record the
            // time at which we released:
            event_loop.get_time(release_time, clock_type::MONOTONIC);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
testb $0x1, 0x2a(%rax)
je 0x6c2c6
movl $0x1, %edi
movl $0x3, %esi
xorl %edx, %edx
movb $0x0, %al
callq 0xa3f0
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %edx
andl $0xfffff7ff, %edx       # imm = 0xFFFFF7FF
movl $0x1, %edi
movl $0x4, %esi
movb $0x0, %al
callq 0xa3f0
cmpq $0x0, 0x3ec8e(%rip)     # 0xaaf20
je 0x6c2a0
movq 0x3ec85(%rip), %rdi     # 0xaaf20
callq 0x4e650
movq -0x18(%rbp), %rax
testb $0x1, 0x2a(%rax)
je 0x6c2c4
leaq 0x3c8af(%rip), %rdi     # 0xa8b60
leaq 0x3cbb0(%rip), %rsi     # 0xa8e68
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x53720
jmp 0x6c2c6
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: (anonymous namespace)::buffered_log_stream::commit_msg()
void commit_msg()
    {
        bool was_first = current_index == 0;
        current_index = log_buffer.get_length();
        if (was_first && ! release) {
            set_enabled(event_loop, true);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
cmpl $0x0, 0x1044(%rdi)
sete %al
andb $0x1, %al
movb %al, -0x9(%rbp)
addq $0x3c, %rdi
callq 0x6c920
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1044(%rax)
testb $0x1, -0x9(%rbp)
je 0x6c43d
movq -0x18(%rbp), %rax
testb $0x1, 0x2a(%rax)
jne 0x6c43d
movq -0x18(%rbp), %rdi
leaq 0x3c72d(%rip), %rsi     # 0xa8b60
movl $0x1, %edx
callq 0x17c00
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/dinit-log.cc
// Function: void push_to_log<char const*, char const*, char const*>(int, char const*, char const*, char const*)
static void push_to_log(int idx, T ... args) noexcept
{
    if (! log_current_line[idx]) return;
    int amount = sum_length(args...);
    if (log_stream[idx].get_free() >= amount) {
        append(log_stream[idx], args...);
        log_stream[idx].commit_msg();
    }
    else {
        log_stream[idx].mark_discarded();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x3eab6(%rip), %rax     # 0xaaf28
testb $0x1, (%rax,%rcx)
jne 0x6c47d
jmp 0x6c50e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x6c600
movl %eax, -0x24(%rbp)
movslq -0x4(%rbp), %rax
leaq 0x3c9e4(%rip), %rdi     # 0xa8e80
imulq $0x1050, %rax, %rax     # imm = 0x1050
addq %rax, %rdi
callq 0x6c2f0
cmpl -0x24(%rbp), %eax
jl 0x6c4f4
movslq -0x4(%rbp), %rax
imulq $0x1050, %rax, %rax     # imm = 0x1050
leaq 0x3c9be(%rip), %rdi     # 0xa8e80
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x6c640
jmp 0x6c4d8
movslq -0x4(%rbp), %rax
leaq 0x3c99d(%rip), %rdi     # 0xa8e80
imulq $0x1050, %rax, %rax     # imm = 0x1050
addq %rax, %rdi
callq 0x6c3e0
jmp 0x6c50e
movslq -0x4(%rbp), %rax
leaq 0x3c981(%rip), %rdi     # 0xa8e80
imulq $0x1050, %rax, %rax     # imm = 0x1050
addq %rax, %rdi
callq 0x6c380
addq $0x30, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopl (%rax)
// File: davmac314[P]dinit/src/dinit-main.cc
// Function: main
int main(int argc, char **argv)
{
    try {
        return dinit_main(argc, argv);
    }
    catch (std::bad_alloc &badalloc) {
        std::cout << "dinit: out-of-memory during initialisation" << std::endl;
        return 1;
    }
    catch (std::system_error &syserr) {
        std::cout << "dinit: unexpected system error during initialisation: " << syserr.what() << std::endl;
        return 1;
    }
    catch (...) {
        std::cout << "dinit: unexpected error during initialisation" << std::endl;
        return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xb530
movl %eax, -0x34(%rbp)
jmp 0x6cd27
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6ce8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl $0x3, %ecx
cmpl %ecx, %eax
jne 0x6cd96
movq -0x18(%rbp), %rdi
callq 0xa240
movq %rax, -0x30(%rbp)
movq 0x3b207(%rip), %rdi     # 0xa7f68
leaq 0xc9f6(%rip), %rsi      # 0x7975e
callq 0xa6e0
movq %rax, -0x40(%rbp)
jmp 0x6cd73
movq -0x40(%rbp), %rdi
movq 0x3b1a2(%rip), %rsi     # 0xa7f20
callq 0xa750
jmp 0x6cd85
movl $0x1, -0x4(%rbp)
callq 0xac30
jmp 0x6ce8b
movl -0x38(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x6ce0a
movq -0x18(%rbp), %rdi
callq 0xa240
movq %rax, -0x28(%rbp)
movq 0x3b1b2(%rip), %rdi     # 0xa7f68
leaq 0xc96a(%rip), %rsi      # 0x79727
callq 0xa6e0
movq %rax, -0x48(%rbp)
jmp 0x6cdc8
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0xa6e0
movq %rax, -0x50(%rbp)
jmp 0x6cde7
movq -0x50(%rbp), %rdi
movq 0x3b12e(%rip), %rsi     # 0xa7f20
callq 0xa750
jmp 0x6cdf9
movl $0x1, -0x4(%rbp)
callq 0xac30
jmp 0x6ce8b
movq -0x18(%rbp), %rdi
callq 0xa240
movq 0x3b14e(%rip), %rdi     # 0xa7f68
leaq 0xc8d8(%rip), %rsi      # 0x796f9
callq 0xa6e0
movq %rax, -0x58(%rbp)
jmp 0x6ce2c
movq -0x58(%rbp), %rdi
movq 0x3b0e9(%rip), %rsi     # 0xa7f20
callq 0xa750
jmp 0x6ce3e
movl $0x1, -0x4(%rbp)
callq 0xac30
jmp 0x6ce8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0xac30
jmp 0x6ce5f
jmp 0x6ce94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0xac30
jmp 0x6ce74
jmp 0x6ce94
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0xac30
jmp 0x6ce89
jmp 0x6ce94
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0xacc0
movq %rax, %rdi
callq 0xfa30
nopw %cs:(%rax,%rax)
nop
// File: davmac314[P]dinit/src/run-child-proc.cc
// Function: move_fd(int, int)
static int move_fd(int fd, int dest)
{
    if (fd == -1) return -1;
    if (fd == dest) return 0;

    if (dup2(fd, dest) == -1) {
        return -1;
    }

    close(fd);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $-0x1, -0x8(%rbp)
jne 0x6e0bd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6e0f6
movl -0x8(%rbp), %eax
cmpl -0xc(%rbp), %eax
jne 0x6e0ce
movl $0x0, -0x4(%rbp)
jmp 0x6e0f6
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0xa690
cmpl $-0x1, %eax
jne 0x6e0e7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6e0f6
movl -0x8(%rbp), %edi
callq 0xad80
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/run-child-proc.cc
// Function: move_reserved_fd(int*, int)
static int move_reserved_fd(int *fd, int min_fd)
{
    int new_fd = fcntl(*fd, F_DUPFD_CLOEXEC, min_fd);
    if (new_fd != -1) {
        close(*fd);
        *fd = new_fd;
    }
    return new_fd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
movl -0xc(%rbp), %edx
movl $0x406, %esi            # imm = 0x406
movb $0x0, %al
callq 0xa3f0
movl %eax, -0x10(%rbp)
cmpl $-0x1, -0x10(%rbp)
je 0x6e141
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0xad80
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::ReadBitWrap(unsigned char*, unsigned int, unsigned int, int)
uint32_t CBitBuffer::ReadBitWrap(uint8_t *buf, uint32_t bufwrap, uint32_t bitpos, int bitcnt)
{
	uint32_t res;

	// slow read mode if buffer would wrap around during reading, otherwise use fast read
	if (bitpos + bitcnt > bufwrap) {
		// slow mode; read bit by bit
		res = 0;

		// read all bits
		while (bitcnt-- > 0) {
			// shift in the next bit
			res <<= 1;
			if (ReadBit(buf, bitpos))
				res |= 1;

			// advance bit position
			bitpos++;

			// handle buffer wrap around
			if (bitpos >= bufwrap)
				bitpos -= bufwrap;
		}
	} else {
		// fast mode; read at once
		res = ReadBit(buf, bitpos, bitcnt);
	}

	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl -0x10(%rbp), %eax
addl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jbe 0x4d99
movl $0x0, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x14(%rbp)
cmpl $0x0, %eax
jle 0x4d97
movl -0x18(%rbp), %eax
shll %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x5530
cmpl $0x0, %eax
je 0x4d79
movl -0x18(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jb 0x4d95
movl -0xc(%rbp), %ecx
movl -0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x10(%rbp)
jmp 0x4d47
jmp 0x4dab
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x4dc0
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::ReadBit(unsigned char*, unsigned int, int)
uint32_t CBitBuffer::ReadBit(uint8_t *buf, uint32_t bitpos, int bitcnt)
{
	// result is 0 if bit count is 0 or less
	if (bitcnt <= 0)
		return 0;

	uint32_t res = 0;

	// byte offset in buffer
	uint32_t bytepos = bitpos >> 3;

	// bit mask for current byte
	uint8_t bitmask = 1 << ((bitpos & 7) ^ 7);

	// current data byte from buffer
	uint8_t value = buf[bytepos++];

	// read all bits
	while (bitcnt-- > 0) {
		// if all bits have been processed
		if (!bitmask) {
			// reset bit mask to b7 (reading b7...b0)
			bitmask = 0x80;

			// read next data byte from buffer
			value = buf[bytepos++];
		}

		// shift in the masked bit
		res <<= 1;
		if (value & bitmask)
			res |= 1;

		// advance bit mask to next position
		bitmask >>= 1;
	}

	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jg 0x4de0
movl $0x0, -0x4(%rbp)
jmp 0x4e7c
movl $0x0, -0x1c(%rbp)
movl -0x14(%rbp), %eax
shrl $0x3, %eax
movl %eax, -0x20(%rbp)
movl -0x14(%rbp), %ecx
andl $0x7, %ecx
xorl $0x7, %ecx
movl $0x1, %eax
shll %cl, %eax
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, -0x22(%rbp)
movl -0x18(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x18(%rbp)
cmpl $0x0, %eax
jle 0x4e76
cmpb $0x0, -0x21(%rbp)
jne 0x4e4b
movb $-0x80, -0x21(%rbp)
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, -0x22(%rbp)
movl -0x1c(%rbp), %eax
shll %eax
movl %eax, -0x1c(%rbp)
movzbl -0x22(%rbp), %eax
movzbl -0x21(%rbp), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x4e6b
movl -0x1c(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x1c(%rbp)
movzbl -0x21(%rbp), %eax
sarl %eax
movb %al, -0x21(%rbp)
jmp 0x4e1a
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::WriteBit(unsigned char*, unsigned int, unsigned int, int)
void CBitBuffer::WriteBit(uint8_t *buf, uint32_t bitpos, uint32_t value, int bitcnt)
{
	// write buffer position
	uint8_t *wpos = buf + (bitpos >> 3);

	while (bitcnt > 0) {
		// start bit offset in byte
		int bofs = bitpos & 7;

		// number of bits to be written in this byte
		int bcnt = 8 - bofs;
		if (bcnt > bitcnt)
			bcnt = bitcnt;

		// next bit position
		bitpos += bcnt;

		// remaining bits
		bitcnt -= bcnt;

		// move the data bits to be written right justified to bit#0
		uint32_t data = value >> bitcnt;

		// process partial byte if needed
		if (bcnt != 8) {
			// left justify data to start from bofs, clear unused bits
			data <<= (8 - (bofs + bcnt));

			// mask for bcnt number of bits left justified
			uint32_t mask = (0xff00 >> bcnt) & 0xff;

			// move mask to the write position, keep any other bit cleared
			mask >>= bofs;

			// clear bitfield value where original content should be kept
			data &= mask;

			// merge original byte value with data
			data |= (*wpos & ~mask);
		}

		// commit data
		*wpos++ = (uint8_t)data;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
shrl $0x3, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x50c0
movl -0xc(%rbp), %eax
andl $0x7, %eax
movl %eax, -0x24(%rbp)
movl $0x8, %eax
subl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x5030
movl -0x14(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x28(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x10(%rbp), %eax
movl -0x14(%rbp), %ecx
shrl %cl, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x8, -0x28(%rbp)
je 0x50a5
movl -0x24(%rbp), %eax
addl -0x28(%rbp), %eax
movl $0x8, %ecx
subl %eax, %ecx
movl -0x2c(%rbp), %eax
shll %cl, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %ecx
movl $0xff00, %eax           # imm = 0xFF00
sarl %cl, %eax
andl $0xff, %eax
movl %eax, -0x30(%rbp)
movl -0x24(%rbp), %ecx
movl -0x30(%rbp), %eax
shrl %cl, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
andl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl -0x30(%rbp), %ecx
xorl $-0x1, %ecx
andl %ecx, %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
jmp 0x5004
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::ClearBitWrap(unsigned char*, unsigned int, unsigned int, int)
void CBitBuffer::ClearBitWrap(uint8_t *buf, uint32_t bufwrap, uint32_t bitpos, int bitcnt)
{
	// slow write mode if buffer would wrap around during writing, otherwise use fast write
	if (bitpos + bitcnt > bufwrap) {
		while (bitcnt > 0) {
			// write largest possible bitfield
			int writebc = (bitcnt >= MAX_BITBUFFER_LEN) ? MAX_BITBUFFER_LEN : bitcnt;

			// write 0 as bitfield
			WriteBitWrap(buf, bufwrap, bitpos, 0, writebc);

			// next write position
			bitcnt -= writebc;
			bitpos += writebc;

			// handle buffer wrap around
			if (bitpos >= bufwrap)
				bitpos -= bufwrap;
		}
	}	else {
		// fast mode; write at once
		ClearBit(buf, bitpos, bitcnt);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl -0x10(%rbp), %eax
addl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jbe 0x5154
jmp 0x50f2
cmpl $0x0, -0x14(%rbp)
jle 0x5152
cmpl $0x20, -0x14(%rbp)
jl 0x5108
movl $0x20, %eax
movl %eax, -0x1c(%rbp)
jmp 0x510e
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x18(%rbp), %r8d
xorl %ecx, %ecx
callq 0x4e90
movl -0x18(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jb 0x5150
movl -0xc(%rbp), %ecx
movl -0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x10(%rbp)
jmp 0x50f2
jmp 0x5163
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x5170
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::ClearBit(unsigned char*, unsigned int, int)
void CBitBuffer::ClearBit(uint8_t *buf, uint32_t bitpos, int bitcnt)
{
	while (bitcnt > 0) {
		// write largest possible bitfield
		int writebc = (bitcnt >= MAX_BITBUFFER_LEN) ? MAX_BITBUFFER_LEN : bitcnt;

		// write 0 as bitfield
		WriteBit(buf, bitpos, 0, writebc);

		// next write position
		bitcnt -= writebc;
		bitpos += writebc;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jle 0x51cb
cmpl $0x20, -0x10(%rbp)
jl 0x5198
movl $0x20, %eax
movl %eax, -0x18(%rbp)
jmp 0x519e
movl -0x10(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x14(%rbp), %ecx
xorl %edx, %edx
callq 0x4fe0
movl -0x14(%rbp), %ecx
movl -0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x5182
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CompareBit(unsigned char*, unsigned int, unsigned char*, unsigned int, int)
int CBitBuffer::CompareBit(uint8_t *buf1, uint32_t buf1pos, uint8_t *buf2, uint32_t buf2pos, int bitcnt)
{
	// compare every bit in the two fields, 32 bit at a time, and finally the remaining bits
	while (bitcnt > 0) {
		uint32_t s1, s2;

		if (bitcnt >= 32) {
			// read 32 bits from each field if the remaining field size is at least 32
			s1 = ReadBit32(buf1, buf1pos);
			s2 = ReadBit32(buf2, buf2pos);
			bitcnt -= 32;
			buf1pos += 32;
			buf2pos += 32;
		} else {
			// read the remaining 1...31 bits
			s1 = ReadBit(buf1, buf1pos, bitcnt);
			s2 = ReadBit(buf2, buf2pos, bitcnt);
			bitcnt = 0;
		}

		// error if fields are different
		if (s1 != s2)
			return -1;
	}

	// all bits compared, the fields are identical
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x5286
cmpl $0x20, -0x28(%rbp)
jl 0x5245
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x5560
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x5560
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
subl $0x20, %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x14(%rbp)
movl -0x24(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x24(%rbp)
jmp 0x5270
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x4dc0
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x4dc0
movl %eax, -0x30(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0x5281
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x528d
jmp 0x51fa
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CompareAndCountBit(unsigned char*, unsigned int, unsigned char*, unsigned int, int)
int CBitBuffer::CompareAndCountBit(uint8_t *buf1, uint32_t buf1pos, uint8_t *buf2, uint32_t buf2pos, int bitcnt)
{
	// number of bits processed, size of current block
	int bitproc = 0, blocksize;
	uint32_t diff;

	// compare every bit in the two fields, in 32 bit blocks, and finally the remaining 1...31 bits
	while (bitcnt > 0) {
		uint32_t s1, s2;

		if (bitcnt >= 32) {
			// process 32 bits if the remaining field size is at least 32
			blocksize = 32;

			// read 32 bits from each field 
			s1 = ReadBit32(buf1, buf1pos);
			s2 = ReadBit32(buf2, buf2pos);
		} else {
			// process the remaining 1...31 bits
			blocksize = bitcnt;

			// read the remaining 1...31 bits from each field
			s1 = ReadBit(buf1, buf1pos, blocksize);
			s2 = ReadBit(buf2, buf2pos, blocksize);
		}

		// bits that are different in the two fiels are set to 1
		diff = s1 ^ s2;

		// stop if fields are different (any of the bits set)
		if (diff)
			break;

		// advance to the next block
		buf1pos += blocksize;
		buf2pos += blocksize;
		bitproc += blocksize;
		bitcnt -= blocksize;
	}

	// difference found, count the remaining identical bits
	if (bitcnt > 0) {
		// find the first bit set from b<blocksize-1>...0
		for (uint32_t mask = 1U << (blocksize - 1); mask; mask >>= 1) {
			if (diff & mask)
				break;

			// bit not set, another identical bit
			bitproc++;
		}
	}

	// return the number of bits processed and found to be identical
	return bitproc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x20(%rbp)
jle 0x535e
cmpl $0x20, -0x20(%rbp)
jl 0x52f8
movl $0x20, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5560
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5560
movl %eax, -0x34(%rbp)
jmp 0x5322
movl -0x20(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x4dc0
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x4dc0
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
xorl -0x34(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x5333
jmp 0x535e
movl -0x28(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x28(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x28(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x52c1
cmpl $0x0, -0x20(%rbp)
jle 0x539c
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x539a
movl -0x2c(%rbp), %eax
andl -0x38(%rbp), %eax
cmpl $0x0, %eax
je 0x5387
jmp 0x539a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x38(%rbp), %eax
shrl %eax
movl %eax, -0x38(%rbp)
jmp 0x5374
jmp 0x539c
movl -0x24(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CopyBitWrap(unsigned char*, unsigned int, unsigned int, unsigned char*, unsigned int, unsigned int, int)
void CBitBuffer::CopyBitWrap(uint8_t *srcbuf, uint32_t srcwrap, uint32_t srcpos, uint8_t *dstbuf, uint32_t dstwrap, uint32_t dstpos, int bitcnt)
{
	// copy areas in largest possible size up to the track wrap points
	while (bitcnt > 0) {
		// clamp size to largest size to copy until the destination wrap point
		int csize = (dstpos + bitcnt > dstwrap) ? dstwrap - dstpos : bitcnt;

		// clamp size to largest size to copy until the source wrap point
		if (srcpos + csize > srcwrap)
			csize = srcwrap - srcpos;

		// copy the field; it is guaranteed that source or destionation does not wrap
		CopyBit(srcbuf, srcpos, dstbuf, dstpos, csize);

		// advance bit positions forward
		srcpos += csize;
		dstpos += csize;
		bitcnt -= csize;

		// handle buffer wrap around
		if (srcpos >= srcwrap)
			srcpos -= srcwrap;

		if (dstpos >= dstwrap)
			dstpos -= dstwrap;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
cmpl $0x0, 0x10(%rbp)
jle 0x5470
movl -0x20(%rbp), %eax
addl 0x10(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x53f1
movl -0x1c(%rbp), %eax
subl -0x20(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x53f7
movl 0x10(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x10(%rbp), %eax
addl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jbe 0x5411
movl -0xc(%rbp), %eax
subl -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
movq -0x18(%rbp), %rdx
movl -0x20(%rbp), %ecx
movl -0x24(%rbp), %r8d
callq 0x5480
movl -0x24(%rbp), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x24(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %ecx
movl 0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jb 0x5458
movl -0xc(%rbp), %ecx
movl -0x10(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x10(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jb 0x546b
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x53d1
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/BitBuffer.cpp
// Function: CBitBuffer::CopyBit(unsigned char*, unsigned int, unsigned char*, unsigned int, int)
void CBitBuffer::CopyBit(uint8_t *srcbuf, uint32_t srcpos, uint8_t *dstbuf, uint32_t dstpos, int bitcnt)
{
	// copy the field in 32 bit blocks, and finally the remaining 1...31 bits
	while (bitcnt > 0) {
		uint32_t value;
		int blocksize;

		if (bitcnt >= 32) {
			// process 32 bits if the remaining field size is at least 32
			blocksize = 32;

			// read 32 bits from source
			value = ReadBit32(srcbuf, srcpos);
		} else {
			// process the remaining 1...31 bits
			blocksize = bitcnt;

			// read the remaining 1...31 bits from each field
			value = ReadBit(srcbuf, srcpos, blocksize);
		}

		// write the field
		WriteBit(dstbuf, dstpos, value, blocksize);

		// advance to the next block
		srcpos += blocksize;
		dstpos += blocksize;
		bitcnt -= blocksize;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jle 0x5507
cmpl $0x20, -0x20(%rbp)
jl 0x54be
movl $0x20, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5560
movl %eax, -0x24(%rbp)
jmp 0x54d6
movl -0x20(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x28(%rbp), %edx
callq 0x4dc0
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
callq 0x4fe0
movl -0x28(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x28(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x28(%rbp), %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x549a
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: OpenFodder[P]SOS_Unpacker/./capsimg/Core/BitBuffer.h
// Function: CBitBuffer::ReadBit32(unsigned char*, unsigned int)
inline uint32_t CBitBuffer::ReadBit32(uint8_t *buf, uint32_t bitpos)
{
	int shf = bitpos & 7;
	uint32_t pos = bitpos >> 3;
	uint32_t res = buf[pos] << 24 | buf[pos + 1] << 16 | buf[pos + 2] << 8 | buf[pos + 3];

	if (!shf)
		return res;

	return ((res << shf) | (buf[pos + 4] >> (8 - shf)));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0x7, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
shrl $0x3, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
shll $0x18, %eax
movq -0x10(%rbp), %rcx
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x1c(%rbp), %edx
addl $0x2, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x1c(%rbp), %edx
addl $0x3, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x55d8
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x5601
movl -0x20(%rbp), %eax
movl -0x18(%rbp), %ecx
shll %cl, %eax
movq -0x10(%rbp), %rcx
movl -0x1c(%rbp), %edx
addl $0x4, %edx
movl %edx, %edx
movzbl (%rcx,%rdx), %edx
movl $0x8, %ecx
subl -0x18(%rbp), %ecx
sarl %cl, %edx
movl %edx, %ecx
orl %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC(unsigned char*, int)
UDWORD CalcCRC(PUBYTE buf, int len)
{
	UDWORD crc=~0;

	while (len--)
		crc=crctab[(crc^*buf++) & 0xff] ^ (crc >> 8);

	return crc^~0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
je 0x58e9
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x8(%rbp)
movzbl (%rcx), %ecx
xorl %ecx, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x22457(%rip), %rax     # 0x27d30
movl (%rax,%rcx,4), %eax
movl -0x10(%rbp), %ecx
shrl $0x8, %ecx
xorl %ecx, %eax
movl %eax, -0x10(%rbp)
jmp 0x58a2
movl -0x10(%rbp), %eax
xorl $-0x1, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC32(unsigned char*, int, unsigned int)
UDWORD CalcCRC32(PUBYTE buf, int len, UDWORD seed)
{
	UDWORD crc=~seed;

	while (len--)
		crc=crctab[(crc^*buf++) & 0xff] ^ (crc >> 8);

	return crc^~0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl -0x10(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
je 0x595e
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x8(%rbp)
movzbl (%rcx), %ecx
xorl %ecx, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x223e2(%rip), %rax     # 0x27d30
movl (%rax,%rcx,4), %eax
movl -0x14(%rbp), %ecx
shrl $0x8, %ecx
xorl %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x5917
movl -0x14(%rbp), %eax
xorl $-0x1, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: OpenFodder[P]SOS_Unpacker/capsimg/Core/CRC.cpp
// Function: CalcCRC_CCITT(unsigned char*, int)
UWORD CalcCRC_CCITT(PUBYTE buf, int len)
{
	UWORD crc=~0;

	while (len--)
		crc=crctab_ccitt[*buf++^(crc>>8)] ^ (crc << 8);

	return crc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movw $0xffff, -0xe(%rbp)     # imm = 0xFFFF
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
je 0x59c9
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x8(%rbp)
movzbl (%rax), %eax
movzwl -0xe(%rbp), %ecx
sarl $0x8, %ecx
xorl %ecx, %eax
movslq %eax, %rcx
leaq 0x2277a(%rip), %rax     # 0x28130
movzwl (%rax,%rcx,2), %eax
movzwl -0xe(%rbp), %ecx
shll $0x8, %ecx
xorl %ecx, %eax
movw %ax, -0xe(%rbp)
jmp 0x5981
movw -0xe(%rbp), %ax
popq %rbp
retq
nop