// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_init_rwfd
int tb_init_rwfd(int rfd, int wfd) {
    int rv;

    tb_reset();
    global.ttyfd = rfd == wfd && isatty(rfd) ? rfd : -1;
    global.rfd = rfd;
    global.wfd = wfd;

    do {
        if_err_break(rv, init_term_attrs());
        if_err_break(rv, init_term_caps());
        if_err_break(rv, init_cap_trie());
        if_err_break(rv, init_resize_handler());
        if_err_break(rv, send_init_escape_codes());
        if_err_break(rv, send_clear());
        if_err_break(rv, update_term_size());
        if_err_break(rv, init_cellbuf());
        global.initialized = 1;
    } while (0);

    if (rv != TB_OK) {
        tb_deinit();
    }

    return rv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movl %esi, %ebx
movl %edi, %ebp
callq 0x6d39
cmpl %ebx, %ebp
jne 0x67ad
movl %ebp, %edi
callq 0x60c0
xorl %edi, %edi
cmpl $0x1, %eax
sbbl %edi, %edi
orl %ebp, %edi
jmp 0x67b0
pushq $-0x1
popq %rdi
movl %edi, 0x1f2b2(%rip)     # 0x25a68
movl %ebp, 0x1f2b0(%rip)     # 0x25a6c
movl %ebx, 0x1f2ae(%rip)     # 0x25a70
testl %edi, %edi
js 0x685d
leaq 0x1f477(%rip), %rsi     # 0x25c48
callq 0x64c0
testl %eax, %eax
je 0x67ee
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1f4a1(%rip)     # 0x25c88
pushq $-0xf
jmp 0x6b72
movups 0x1f47f(%rip), %xmm0    # 0x25c74
movq %rsp, %rbx
movups %xmm0, 0x2c(%rbx)
movups 0x1f465(%rip), %xmm0    # 0x25c68
movaps %xmm0, 0x20(%rbx)
movups 0x1f44a(%rip), %xmm0    # 0x25c58
movaps %xmm0, 0x10(%rbx)
movups 0x1f42f(%rip), %xmm0    # 0x25c48
movaps %xmm0, (%rbx)
movl $0x1, 0x1f45e(%rip)     # 0x25c84
movq %rbx, %rdi
callq 0x6450
movw $0x100, 0x16(%rbx)      # imm = 0x100
movl 0x1f22e(%rip), %edi     # 0x25a68
pushq $0x2
popq %rsi
movq %rbx, %rdx
callq 0x64d0
testl %eax, %eax
je 0x685d
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1f432(%rip)     # 0x25c88
pushq $-0x10
jmp 0x6b72
leaq 0x165fe(%rip), %rdi     # 0x1ce62
callq 0x6030
testq %rax, %rax
je 0x69e0
movq %rax, %rbx
leaq 0x165eb(%rip), %rdi     # 0x1ce67
callq 0x6030
testq %rax, %rax
je 0x6963
movq %rax, %rdi
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
jne 0x69e0
movq 0x1f20c(%rip), %rax     # 0x25ab0
pushq $-0x1
popq %rbx
cmpq $0x6, %rax
jb 0x6b73
movq 0x1f1f0(%rip), %rdx     # 0x25aa8
cmpw $0x21e, (%rdx)          # imm = 0x21E
sete %cl
movzwl 0x2(%rdx), %esi
movzwl 0x4(%rdx), %edi
addl %esi, %edi
movl %edi, %esi
movswl 0x6(%rdx), %r8d
incb %cl
shll %cl, %r8d
andl $0x1, %esi
addl %edi, %esi
leal (%r8,%rsi), %edi
addl $0xc, %edi
addl %r8d, %esi
movswl 0x8(%rdx), %ecx
leal (%rsi,%rcx,2), %r8d
addl $0xc, %r8d
movswl %r8w, %ecx
movswq %di, %rsi
addq %rdx, %rsi
movswq %r8w, %rdi
addq %rdx, %rdi
xorl %r8d, %r8d
leaq 0x14ea3(%rip), %r9      # 0x1b7b0
leaq 0x17034(%rip), %r10     # 0x1d948
leaq 0x1f14d(%rip), %r11     # 0x25a68
cmpq $0x48, %r8
je 0x6aaa
movswq (%r8,%r9), %r14
movswl (%rsi,%r14,2), %r14d
movq %r10, %r15
testl %r14d, %r14d
js 0x6958
cmpw 0xa(%rdx), %r14w
jge 0x6b73
leal (%rcx,%r14), %ebp
movslq %ebp, %r15
cmpq %r15, %rax
jbe 0x6b73
movl %r14d, %r15d
addq %rdi, %r15
movq %r15, 0x50(%r11,%r8,4)
addq $0x2, %r8
jmp 0x691b
leaq 0x16506(%rip), %rdi     # 0x1ce70
callq 0x6030
testq %rax, %rax
je 0x69a7
leaq 0x164fa(%rip), %rdx     # 0x1ce75
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rcx
xorl %eax, %eax
callq 0x61d0
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x69e0
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x164d4(%rip), %rdi     # 0x1ce82
callq 0x6030
testq %rax, %rax
je 0x6bbd
leaq 0x176a5(%rip), %rdx     # 0x1e068
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rcx
xorl %eax, %eax
callq 0x61d0
cmpl $0xfff, %eax            # imm = 0xFFF
jbe 0x6b8a
leaq 0x1647b(%rip), %rdi     # 0x1ce62
callq 0x6030
testq %rax, %rax
je 0x6a3f
movq %rax, %r14
xorl %ecx, %ecx
leaq 0x1cb33(%rip), %r15     # 0x23530
leaq 0x18(%rcx), %rbx
cmpq $0xa8, %rbx
je 0x6a46
movq (%rcx,%r15), %rsi
movq %r14, %rdi
callq 0x6310
movq %rbx, %rcx
testl %eax, %eax
jne 0x69fd
movq -0x10(%rbx,%r15), %rax
xorl %ecx, %ecx
leaq 0x1f03d(%rip), %rdx     # 0x25a68
cmpq $0x24, %rcx
je 0x6aaa
movq (%rax,%rcx,8), %rsi
movq %rsi, 0x50(%rdx,%rcx,8)
incq %rcx
jmp 0x6a2b
pushq $-0x7
jmp 0x6b72
pushq $0x10
popq %r12
pushq $-0x11
popq %rbx
cmpq $0xa0, %r12
je 0x6b73
movq -0x10(%r12,%r15), %rsi
movq %r14, %rdi
callq 0x6610
testq %rax, %rax
jne 0x6a88
movq (%r12,%r15), %rsi
cmpb $0x0, (%rsi)
je 0x6a82
movq %r14, %rdi
callq 0x6610
testq %rax, %rax
jne 0x6a88
addq $0x18, %r12
jmp 0x6a4d
movq -0x8(%r12,%r15), %rax
xorl %ecx, %ecx
leaq 0x1efd2(%rip), %rdx     # 0x25a68
cmpq $0x24, %rcx
je 0x6aaa
movq (%rax,%rcx,8), %rsi
movq %rsi, 0x50(%rdx,%rcx,8)
incq %rcx
jmp 0x6a96
movw $0xffff, %bp            # imm = 0xFFFF
xorl %r14d, %r14d
leaq 0x1efb0(%rip), %r15     # 0x25a68
cmpq $0x17, %r14
je 0x6adf
movq 0x50(%r15,%r14,8), %rdi
movzwl %bp, %ebp
movl %ebp, %esi
xorl %edx, %edx
callq 0x132c8
incq %r14
decl %ebp
testl %eax, %eax
je 0x6ab8
movl %eax, %ebx
jmp 0x6b73
leaq 0x1cb04(%rip), %r14     # 0x235ea
movq -0xa(%r14), %rdi
testq %rdi, %rdi
je 0x6b0e
movzwl -0x2(%r14), %esi
movzbl (%r14), %edx
callq 0x132c8
testl %eax, %eax
je 0x6b08
movl %eax, %ebx
cmpl $-0x16, %eax
jne 0x6b73
addq $0x10, %r14
jmp 0x6ae6
leaq 0x1ef63(%rip), %rdi     # 0x25a78
callq 0x6270
testl %eax, %eax
je 0x6b2f
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1f15d(%rip)     # 0x25c88
pushq $-0xc
jmp 0x6b72
leaq 0x8(%rsp), %rbx
movl $0x90, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6230
leaq 0xc85f(%rip), %rax      # 0x133a9
movq %rax, -0x8(%rbx)
pushq $0x1c
popq %rdi
movq %rsp, %rsi
xorl %edx, %edx
callq 0x60d0
testl %eax, %eax
je 0x6c7a
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1f118(%rip)     # 0x25c88
pushq $-0xd
popq %rbx
callq 0x6f35
movl %ebx, %eax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x177c6(%rip), %r14     # 0x1e357
movq %rsp, %rdi
movq %r14, %rsi
callq 0x6540
testq %rax, %rax
je 0x6bbd
cmpb $0x0, (%rax)
je 0x6bb9
movq %rax, %rdi
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
xorl %edi, %edi
jmp 0x6b94
leaq 0x162cc(%rip), %rdi     # 0x1ce90
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x162cd(%rip), %rdi     # 0x1cea8
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x162d0(%rip), %rdi     # 0x1cec2
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x16291(%rip), %rdi     # 0x1ce9a
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x162ba(%rip), %rdi     # 0x1ceda
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x162b7(%rip), %rdi     # 0x1ceee
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x162b2(%rip), %rdi     # 0x1cf00
movq %rbx, %rsi
callq 0x131e9
testl %eax, %eax
je 0x689d
leaq 0x162a5(%rip), %rdi     # 0x1cf0a
movq %rbx, %rsi
callq 0x131e9
movl %eax, %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
jmp 0x6895
movq 0x1eeef(%rip), %rdi     # 0x25b70
callq 0x78d9
testl %eax, %eax
jne 0x6ad8
movq 0x1ef33(%rip), %rdi     # 0x25bc8
callq 0x78d9
testl %eax, %eax
jne 0x6ad8
movq 0x1eedf(%rip), %rdi     # 0x25b88
callq 0x78d9
testl %eax, %eax
jne 0x6ad8
callq 0x6da0
testl %eax, %eax
jne 0x6ad8
callq 0x6dfd
testl %eax, %eax
jne 0x6ad8
movl 0x1edaa(%rip), %esi     # 0x25a80
movl 0x1eda8(%rip), %edx     # 0x25a84
leaq 0x1ef45(%rip), %rdi     # 0x25c28
callq 0x133df
testl %eax, %eax
jne 0x6ad8
movl 0x1ed8a(%rip), %esi     # 0x25a80
movl 0x1ed88(%rip), %edx     # 0x25a84
leaq 0x1ef35(%rip), %rdi     # 0x25c38
callq 0x133df
testl %eax, %eax
jne 0x6ad8
leaq 0x1ef11(%rip), %rdi     # 0x25c28
callq 0x70d8
leaq 0x1ef15(%rip), %rdi     # 0x25c38
callq 0x70d8
movl $0x1, 0x1ef5a(%rip)     # 0x25c8c
xorl %ebx, %ebx
jmp 0x6b78