// File: /workspace/github_cpp_makefile_star2_O3/akojo[P]quickfind/term.cpp
// Function: Term::Term(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
Term::Term(const string& ttyName)
{
    tty = fopen(ttyName.c_str(), "r+");
    if (!tty)
        throw invalid_argument("bad tty");
    setbuf(tty, nullptr);

    int fd = fileno(tty);
    if (tcgetattr(fd, &old_termios) < 0)
        throw runtime_error("failed to read terminal parameters");

    struct termios new_termios = old_termios;
    new_termios.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
    if (tcsetattr(fd, TCSAFLUSH, &new_termios) < 0) {
        throw runtime_error(string("failed to set terminal parameters: ") + strerror(errno));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
movq (%rsi), %rdi
leaq 0x1360(%rip), %rsi      # 0x5054
callq 0x21f0
movq %rax, (%rbx)
testq %rax, %rax
je 0x3d71
movq %rax, %rdi
xorl %esi, %esi
callq 0x2240
movq (%rbx), %rdi
callq 0x21a0
movl %eax, %ebp
addq $0x8, %rbx
movl %eax, %edi
movq %rbx, %rsi
callq 0x21c0
testl %eax, %eax
js 0x3d9d
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x2c(%rbx), %xmm3
leaq 0x40(%rsp), %rdx
movaps %xmm0, (%rdx)
movups %xmm3, 0x2c(%rdx)
movaps %xmm2, 0x20(%rdx)
movaps %xmm1, 0x10(%rdx)
andl $0xffff7ff4, 0xc(%rdx)  # imm = 0xFFFF7FF4
movl %ebp, %edi
movl $0x2, %esi
callq 0x2220
testl %eax, %eax
js 0x3dcf
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20d0
movq %rax, %rbx
leaq 0x12d2(%rip), %rsi      # 0x5057
movq %rax, %rdi
callq 0x2310
movq 0x323c(%rip), %rsi      # 0x6fd0
movq 0x3225(%rip), %rdx      # 0x6fc0
jmp 0x3dc7
movl $0x10, %edi
callq 0x20d0
movq %rax, %rbx
leaq 0x12ae(%rip), %rsi      # 0x505f
movq %rax, %rdi
callq 0x20a0
movq 0x3230(%rip), %rsi      # 0x6ff0
movq 0x31e9(%rip), %rdx      # 0x6fb0
movq %rbx, %rdi
callq 0x22c0
movl $0x10, %edi
callq 0x20d0
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1296(%rip), %rsi      # 0x5082
leaq 0x12b2(%rip), %rdx      # 0x50a5
movq %rsp, %rdi
callq 0x2dd0
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x2320
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3e35
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x3e42
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %rbx, %rdi
callq 0x2290
xorl %ebp, %ebp
movq 0x317e(%rip), %rsi      # 0x6ff0
movq 0x3137(%rip), %rdx      # 0x6fb0
movq %rbx, %rdi
callq 0x22c0
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x3e9b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2180
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x3eb1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
testb %bpl, %bpl
jne 0x3eda
jmp 0x3ee2
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x3eda
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2180
jmp 0x3eda
jmp 0x3ed7
jmp 0x3ed7
movq %rax, %r14
movq %rbx, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x22d0