// File: /workspace/github_c_makefile_star2_O3/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, %ebp
movl %edi, %ebx
leaq 0x1f146(%rip), %rdi     # 0x25aa8
movl $0x5f8, %edx            # imm = 0x5F8
xorl %esi, %esi
callq 0x6230
movq $-0x1, 0x1f0ef(%rip) # 0x25a68
movl $0xffffffff, 0x1f0ed(%rip) # imm = 0xFFFFFFFF
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x1f0e9(%rip)    # 0x25a78
movdqu %xmm0, 0x1f0f1(%rip)    # 0x25a88
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x1f0f0(%rip)     # 0x25a98
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x1f0e7(%rip)     # 0x25aa0
cmpl %ebp, %ebx
jne 0x6a0b
movl %ebx, %edi
callq 0x60c0
testl %eax, %eax
je 0x6a0b
movl %ebx, 0x1f09a(%rip)     # 0x25a68
movl %ebx, 0x1f098(%rip)     # 0x25a6c
movl %ebx, 0x1f096(%rip)     # 0x25a70
testl %ebx, %ebx
js 0x6a21
leaq 0x1f263(%rip), %rsi     # 0x25c48
movl %ebx, %edi
callq 0x64c0
testl %eax, %eax
je 0x6d2b
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1f287(%rip)     # 0x25c88
movl $0xfffffff1, %ebx       # imm = 0xFFFFFFF1
jmp 0x6f17
movl $0xffffffff, 0x1f053(%rip) # imm = 0xFFFFFFFF
movl %ebx, 0x1f051(%rip)     # 0x25a6c
movl %ebp, 0x1f04f(%rip)     # 0x25a70
leaq 0x1743a(%rip), %rdi     # 0x1de62
callq 0x6030
testq %rax, %rax
je 0x6ba5
movq %rax, %rbx
leaq 0x17427(%rip), %rdi     # 0x1de67
callq 0x6030
testq %rax, %rax
je 0x6b28
movq %rax, %rdi
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
jne 0x6ba5
movq 0x1f048(%rip), %rax     # 0x25ab0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq $0x6, %rax
jb 0x6f17
movq 0x1f02a(%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 0x15cdd(%rip), %r9      # 0x1c7b0
leaq 0x17e6e(%rip), %r10     # 0x1e948
leaq 0x1ef87(%rip), %r11     # 0x25a68
movswq (%r8,%r9), %r14
movswl (%rsi,%r14,2), %r14d
movq %r10, %r15
testl %r14d, %r14d
js 0x6b14
cmpw 0xa(%rdx), %r14w
jge 0x6f17
leal (%rcx,%r14), %ebp
movslq %ebp, %r15
cmpq %r15, %rax
jbe 0x6f17
movl %r14d, %r15d
addq %rdi, %r15
movq %r15, 0x50(%r11,%r8,4)
addq $0x2, %r8
cmpq $0x48, %r8
jne 0x6ae1
jmp 0x6c98
leaq 0x17341(%rip), %rdi     # 0x1de70
callq 0x6030
testq %rax, %rax
je 0x6b6c
leaq 0x17335(%rip), %rdx     # 0x1de75
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rcx
xorl %eax, %eax
callq 0x61d0
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x6ba5
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x1730f(%rip), %rdi     # 0x1de82
callq 0x6030
testq %rax, %rax
je 0x6e34
leaq 0x184e0(%rip), %rdx     # 0x1f068
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rcx
xorl %eax, %eax
callq 0x61d0
cmpl $0xfff, %eax            # imm = 0xFFF
jbe 0x6df2
leaq 0x172b6(%rip), %rdi     # 0x1de62
callq 0x6030
testq %rax, %rax
je 0x6bfe
movq %rax, %rbx
leaq 0x17364(%rip), %r14     # 0x1df24
movq %rax, %rdi
movq %r14, %rsi
callq 0x6310
testl %eax, %eax
je 0x6c08
xorl %ecx, %ecx
leaq 0x1c958(%rip), %r15     # 0x23530
leaq 0x18(%rcx), %r12
cmpq $0x90, %r12
je 0x6c30
movq 0x18(%rcx,%r15), %rsi
movq %rbx, %rdi
callq 0x6310
movq %r12, %rcx
testl %eax, %eax
jne 0x6bd8
addq %r12, %r15
jmp 0x6c0f
movl $0xfffffff9, %ebx       # imm = 0xFFFFFFF9
jmp 0x6f17
leaq 0x1c921(%rip), %r15     # 0x23530
movq 0x8(%r15), %rax
xorl %ecx, %ecx
leaq 0x1ee4c(%rip), %rdx     # 0x25a68
movq (%rax,%rcx,8), %rsi
movq %rsi, 0x50(%rdx,%rcx,8)
incq %rcx
cmpq $0x24, %rcx
jne 0x6c1c
jmp 0x6c98
movl $0x18, %r12d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6610
testq %rax, %rax
jne 0x6c78
movq -0x8(%r12,%r15), %rsi
cmpb $0x0, (%rsi)
je 0x6c5d
movq %rbx, %rdi
callq 0x6610
testq %rax, %rax
jne 0x6c78
movq (%r12,%r15), %r14
addq $0x18, %r12
cmpq $0xa8, %r12
jne 0x6c36
movl $0xffffffef, %ebx       # imm = 0xFFFFFFEF
jmp 0x6f17
movq -0x10(%r12,%r15), %rax
xorl %ecx, %ecx
leaq 0x1ede2(%rip), %rdx     # 0x25a68
movq (%rax,%rcx,8), %rsi
movq %rsi, 0x50(%rdx,%rcx,8)
incq %rcx
cmpq $0x24, %rcx
jne 0x6c86
movw $0xffff, %bp            # imm = 0xFFFF
xorl %r14d, %r14d
leaq 0x1edc2(%rip), %r15     # 0x25a68
movq 0x50(%r15,%r14,8), %rdi
movzwl %bp, %esi
xorl %edx, %edx
callq 0x132e2
testl %eax, %eax
jne 0x6f15
incq %r14
decl %ebp
cmpq $0x17, %r14
jne 0x6ca6
leaq 0x173a4(%rip), %rdi     # 0x1e073
leaq 0x1c91a(%rip), %r14     # 0x235f0
movzwl -0x8(%r14), %esi
movzbl -0x6(%r14), %edx
callq 0x132e2
testl %eax, %eax
je 0x6cf4
movl %eax, %ebx
cmpl $-0x16, %eax
jne 0x6f17
movq (%r14), %rdi
addq $0x10, %r14
testq %rdi, %rdi
jne 0x6cd6
leaq 0x1ed71(%rip), %rdi     # 0x25a78
callq 0x6270
testl %eax, %eax
je 0x6da5
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1ef67(%rip)     # 0x25c88
movl $0xfffffff4, %ebx       # imm = 0xFFFFFFF4
jmp 0x6f17
movups 0x1ef42(%rip), %xmm0    # 0x25c74
movq %rsp, %rbx
movups %xmm0, 0x2c(%rbx)
movups 0x1ef28(%rip), %xmm0    # 0x25c68
movaps %xmm0, 0x20(%rbx)
movups 0x1ef0d(%rip), %xmm0    # 0x25c58
movaps %xmm0, 0x10(%rbx)
movdqu 0x1eef1(%rip), %xmm0    # 0x25c48
movdqa %xmm0, (%rbx)
movl $0x1, 0x1ef1f(%rip)     # 0x25c84
movq %rbx, %rdi
callq 0x6450
movw $0x100, 0x16(%rbx)      # imm = 0x100
movl 0x1ecef(%rip), %edi     # 0x25a68
movl $0x2, %esi
movq %rbx, %rdx
callq 0x64d0
testl %eax, %eax
je 0x6a21
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1eeed(%rip)     # 0x25c88
movl $0xfffffff0, %ebx       # imm = 0xFFFFFFF0
jmp 0x6f17
leaq 0x8(%rsp), %rbx
movl $0x90, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6230
leaq 0xc5ec(%rip), %rax      # 0x133ac
movq %rax, -0x8(%rbx)
movq %rsp, %rsi
movl $0x1c, %edi
xorl %edx, %edx
callq 0x60d0
testl %eax, %eax
je 0x6ef1
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1eea0(%rip)     # 0x25c88
movl $0xfffffff3, %ebx       # imm = 0xFFFFFFF3
jmp 0x6f17
leaq 0x1855e(%rip), %rsi     # 0x1f357
movq %rsp, %rdi
callq 0x6540
testq %rax, %rax
je 0x6e34
leaq 0x1854a(%rip), %r14     # 0x1f357
cmpb $0x0, (%rax)
je 0x6e25
movq %rax, %rdi
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
xorl %edi, %edi
movq %r14, %rsi
callq 0x6540
testq %rax, %rax
jne 0x6e0d
leaq 0x17055(%rip), %rdi     # 0x1de90
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x17056(%rip), %rdi     # 0x1dea8
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x17059(%rip), %rdi     # 0x1dec2
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x1701a(%rip), %rdi     # 0x1de9a
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x17043(%rip), %rdi     # 0x1deda
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x17040(%rip), %rdi     # 0x1deee
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x1703b(%rip), %rdi     # 0x1df00
movq %rbx, %rsi
callq 0x131ff
testl %eax, %eax
je 0x6a61
leaq 0x1702e(%rip), %rdi     # 0x1df0a
movq %rbx, %rsi
callq 0x131ff
movl %eax, %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
jmp 0x6a59
callq 0x6f3c
testl %eax, %eax
jne 0x6f15
callq 0x6fab
testl %eax, %eax
jne 0x6f15
callq 0x7022
testl %eax, %eax
jne 0x6f15
callq 0x717a
testl %eax, %eax
je 0x6f2e
movl %eax, %ebx
callq 0x725b
movl %ebx, %eax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0x1ed54(%rip)     # 0x25c8c
xorl %ebx, %ebx
jmp 0x6f1c