// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movl %esi, %ebp
movl %edi, %r15d
movl 0x1f13f(%rip), %r12d    # 0x25a74
leaq 0x1f12c(%rip), %rbx     # 0x25a68
xorl %r14d, %r14d
movl $0x638, %edx            # imm = 0x638
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6230
movq $-0x1, 0x1f10f(%rip) # 0x25a68
movl $0xffffffff, 0x1f10d(%rip) # imm = 0xFFFFFFFF
movl %r12d, 0x1f10a(%rip)    # 0x25a74
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x1f102(%rip)    # 0x25a78
movdqu %xmm0, 0x1f10a(%rip)    # 0x25a88
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x1f109(%rip)     # 0x25a98
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x1f100(%rip)     # 0x25aa0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpl %ebp, %r15d
jne 0x69bc
movl %r15d, %edi
callq 0x60c0
xorl %edi, %edi
cmpl $0x1, %eax
sbbl %edi, %edi
orl %r15d, %edi
movl %edi, 0x1f0a6(%rip)     # 0x25a68
movl %r15d, 0x1f0a3(%rip)    # 0x25a6c
movl %ebp, 0x1f0a1(%rip)     # 0x25a70
testl %edi, %edi
js 0x6a78
leaq 0x1f26a(%rip), %rsi     # 0x25c48
callq 0x64c0
testl %eax, %eax
je 0x69fc
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1f294(%rip)     # 0x25c88
movl $0xfffffff1, %r14d      # imm = 0xFFFFFFF1
jmp 0x6a78
movups 0x1f271(%rip), %xmm0    # 0x25c74
movq %rsp, %r14
movups %xmm0, 0x2c(%r14)
movups 0x1f256(%rip), %xmm0    # 0x25c68
movaps %xmm0, 0x20(%r14)
movups 0x1f23a(%rip), %xmm0    # 0x25c58
movaps %xmm0, 0x10(%r14)
movdqu 0x1f21d(%rip), %xmm0    # 0x25c48
movdqa %xmm0, (%r14)
movl $0x1, 0x1f24a(%rip)     # 0x25c84
movq %r14, %rdi
callq 0x6450
movw $0x100, 0x16(%r14)      # imm = 0x100
movl 0x1f019(%rip), %edi     # 0x25a68
movl $0x2, %esi
movq %r14, %rdx
callq 0x64d0
testl %eax, %eax
je 0x6a75
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1f21b(%rip)     # 0x25c88
movl $0xfffffff0, %r14d      # imm = 0xFFFFFFF0
jmp 0x6a78
xorl %r14d, %r14d
testl %r14d, %r14d
jne 0x6f2b
leaq 0x173da(%rip), %rdi     # 0x1de62
callq 0x6030
testq %rax, %rax
je 0x6af0
movq %rax, %r14
leaq 0x173cb(%rip), %rdi     # 0x1de67
callq 0x6030
testq %rax, %rax
je 0x6ab5
movq %rax, %rdi
movq %r14, %rsi
callq 0x134cb
movl %eax, %ebp
jmp 0x6af5
leaq 0x173b4(%rip), %rdi     # 0x1de70
callq 0x6030
testq %rax, %rax
je 0x6d75
leaq 0x173a4(%rip), %rdx     # 0x1de75
xorl %ebp, %ebp
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rcx
xorl %eax, %eax
callq 0x61d0
cmpl $0xfff, %eax            # imm = 0xFFF
jbe 0x6d62
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %ebp, %ebp
je 0x6b61
leaq 0x17362(%rip), %rdi     # 0x1de62
callq 0x6030
testq %rax, %rax
je 0x6c2b
movq %rax, %r14
leaq 0x1740c(%rip), %r15     # 0x1df24
movq %rax, %rdi
movq %r15, %rsi
callq 0x6310
testl %eax, %eax
je 0x6c39
xorl %ecx, %ecx
leaq 0x1c9fc(%rip), %r12     # 0x23530
leaq 0x18(%rcx), %r13
cmpq $0x90, %r13
je 0x6c5e
movq 0x18(%rcx,%r12), %rsi
movq %r14, %rdi
callq 0x6310
movq %r13, %rcx
testl %eax, %eax
jne 0x6b34
addq %r13, %r12
jmp 0x6c40
movq 0x1ef48(%rip), %rax     # 0x25ab0
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpq $0x6, %rax
jb 0x6c31
movq 0x1ef29(%rip), %rdx     # 0x25aa8
cmpw $0x21e, (%rdx)          # imm = 0x21E
sete %cl
movzwl 0x2(%rdx), %esi
movzwl 0x4(%rdx), %edi
addl %esi, %edi
movswl 0x6(%rdx), %esi
incb %cl
shll %cl, %esi
movl %edi, %ecx
andl $0x1, %ecx
addl %edi, %ecx
leal (%rsi,%rcx), %edi
addl $0xc, %edi
addl %esi, %ecx
movswl 0x8(%rdx), %esi
leal (%rcx,%rsi,2), %r8d
addl $0xc, %r8d
movswq %di, %rcx
addq %rdx, %rcx
movswl %r8w, %esi
movswq %r8w, %rdi
addq %rdx, %rdi
xorl %r8d, %r8d
leaq 0x15be0(%rip), %r9      # 0x1c7b0
leaq 0x17d71(%rip), %r10     # 0x1e948
movswq (%r8,%r9), %r11
movswl (%rcx,%r11,2), %r11d
movq %r10, %r15
testl %r11d, %r11d
js 0x6c07
cmpw 0xa(%rdx), %r11w
jge 0x6c04
leal (%rsi,%r11), %ebp
movslq %ebp, %r15
cmpq %r15, %rax
jbe 0x6c04
movl %r11d, %r15d
addq %rdi, %r15
jmp 0x6c07
xorl %r15d, %r15d
testq %r15, %r15
setne %r11b
je 0x6cc4
movq %r15, 0x50(%rbx,%r8,4)
addq $0x2, %r8
cmpq $0x48, %r8
jne 0x6bd7
xorl %r14d, %r14d
jmp 0x6cc4
movl $0xfffffff9, %r14d      # imm = 0xFFFFFFF9
xorl %r11d, %r11d
jmp 0x6cc4
leaq 0x1c8f0(%rip), %r12     # 0x23530
movq 0x8(%r12), %rax
xorl %r14d, %r14d
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movq %rdx, 0x50(%rbx,%rcx,8)
incq %rcx
cmpq $0x24, %rcx
jne 0x6c4a
jmp 0x6cc1
movl $0x18, %r13d
movq %r14, %rdi
movq %r15, %rsi
callq 0x6610
testq %rax, %rax
jne 0x6ca5
movq -0x8(%r13,%r12), %rsi
cmpb $0x0, (%rsi)
je 0x6c8b
movq %r14, %rdi
callq 0x6610
testq %rax, %rax
jne 0x6ca5
movq (%r13,%r12), %r15
addq $0x18, %r13
cmpq $0xa8, %r13
jne 0x6c64
movl $0xffffffef, %r14d      # imm = 0xFFFFFFEF
jmp 0x6c31
movq -0x10(%r13,%r12), %rax
xorl %r14d, %r14d
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movq %rdx, 0x50(%rbx,%rcx,8)
incq %rcx
cmpq $0x24, %rcx
jne 0x6caf
movb $0x1, %r11b
testb %r11b, %r11b
je 0x6f2b
movw $0xffff, %bp            # imm = 0xFFFF
xorl %r15d, %r15d
movq 0x50(%rbx,%r15,8), %rdi
movzwl %bp, %esi
xorl %edx, %edx
callq 0x135b1
testl %eax, %eax
jne 0x6d2a
incq %r15
decl %ebp
cmpq $0x17, %r15
jne 0x6cd4
leaq 0x1737a(%rip), %rdi     # 0x1e073
leaq 0x1c8f0(%rip), %rbx     # 0x235f0
movzwl -0x8(%rbx), %esi
movzbl -0x6(%rbx), %edx
callq 0x135b1
testl %eax, %eax
je 0x6d19
movl %eax, %r14d
cmpl $-0x16, %eax
jne 0x6d2d
movq (%rbx), %rdi
addq $0x10, %rbx
testq %rdi, %rdi
jne 0x6d00
xorl %r14d, %r14d
jmp 0x6d2d
movl %eax, %r14d
testl %r14d, %r14d
jne 0x6f2b
leaq 0x1ed3b(%rip), %rdi     # 0x25a78
callq 0x6270
testl %eax, %eax
je 0x6eba
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1ef31(%rip)     # 0x25c88
movl $0xfffffff4, %r14d      # imm = 0xFFFFFFF4
jmp 0x6eff
movq %rsp, %rdi
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6af5
leaq 0x17106(%rip), %rdi     # 0x1de82
callq 0x6030
testq %rax, %rax
je 0x6dfd
leaq 0x182e4(%rip), %rdx     # 0x1f071
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rcx
xorl %eax, %eax
callq 0x61d0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x6af5
leaq 0x185a9(%rip), %r15     # 0x1f35f
movq %rsp, %rdi
movq %r15, %rsi
callq 0x6540
movq %rax, %r12
xorl %ebp, %ebp
testq %r12, %r12
je 0x6dfd
cmpb $0x0, (%r12)
je 0x6de1
movq %r12, %rdi
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6df2
xorl %edi, %edi
movq %r15, %rsi
callq 0x6540
movq %rax, %r12
movb $0x1, %al
jmp 0x6df4
xorl %eax, %eax
testb %al, %al
jne 0x6dc6
jmp 0x6af5
leaq 0x1708c(%rip), %rdi     # 0x1de90
movq %r14, %rsi
callq 0x134cb
xorl %ebp, %ebp
testl %eax, %eax
je 0x6af5
leaq 0x1708b(%rip), %rdi     # 0x1dea8
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6af5
leaq 0x1708e(%rip), %rdi     # 0x1dec2
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6af5
leaq 0x1704f(%rip), %rdi     # 0x1de9a
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6af5
leaq 0x17078(%rip), %rdi     # 0x1deda
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6af5
leaq 0x17075(%rip), %rdi     # 0x1deee
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6af5
leaq 0x17070(%rip), %rdi     # 0x1df00
movq %r14, %rsi
callq 0x134cb
testl %eax, %eax
je 0x6af5
leaq 0x17063(%rip), %rdi     # 0x1df0a
movq %r14, %rsi
callq 0x134cb
xorl %ebp, %ebp
negl %eax
sbbl %ebp, %ebp
jmp 0x6af5
movq %rsp, %rbx
xorl %r14d, %r14d
movl $0x98, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6230
leaq 0xc7c7(%rip), %rax      # 0x1369d
movq %rax, (%rbx)
movl $0x1c, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x60d0
testl %eax, %eax
je 0x6eff
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1ed8f(%rip)     # 0x25c88
movl $0xfffffff3, %r14d      # imm = 0xFFFFFFF3
testl %r14d, %r14d
jne 0x6f2b
callq 0x6f59
testl %eax, %eax
jne 0x6f28
callq 0x6fc8
testl %eax, %eax
jne 0x6f28
callq 0x703f
testl %eax, %eax
jne 0x6f28
callq 0x71a2
testl %eax, %eax
je 0x6f4a
movl %eax, %r14d
testl %r14d, %r14d
je 0x6f35
callq 0x72e5
movl %r14d, %eax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, 0x1ed38(%rip)     # 0x25c8c
xorl %r14d, %r14d
jmp 0x6f2b