// File: /workspace/github_c_makefile_star2_O0/neovim[P]libtermkey/driver-csi.c
// Function: peekkey_ss3
static TermKeyResult peekkey_ss3(TermKey *tk, TermKeyCsi *csi, size_t introlen, TermKeyKey *key, int force, size_t *nbytep)
{
  if(tk->buffcount < introlen + 1) {
    if(!force)
      return TERMKEY_RES_AGAIN;

    (*tk->method.emit_codepoint)(tk, 'O', key);
    key->modifiers |= TERMKEY_KEYMOD_ALT;
    *nbytep = tk->buffcount;
    return TERMKEY_RES_KEY;
  }

  unsigned char cmd = CHARAT(introlen);

  if(cmd < 0x40 || cmd >= 0x80)
    return TERMKEY_RES_NONE;

  key->type = csi_ss3s[cmd - 0x40].type;
  key->code.sym = csi_ss3s[cmd - 0x40].sym;
  key->modifiers = csi_ss3s[cmd - 0x40].modifier_set;

  if(key->code.sym == TERMKEY_SYM_UNKNOWN) {
    if(tk->flags & TERMKEY_FLAG_CONVERTKP && ss3_kpalts[cmd - 0x40]) {
      key->type = TERMKEY_TYPE_UNICODE;
      key->code.codepoint = ss3_kpalts[cmd - 0x40];
      key->modifiers = 0;

      key->utf8[0] = key->code.codepoint;
      key->utf8[1] = 0;
    }
    else {
      key->type = ss3s[cmd - 0x40].type;
      key->code.sym = ss3s[cmd - 0x40].sym;
      key->modifiers = ss3s[cmd - 0x40].modifier_set;
    }
  }

  if(key->code.sym == TERMKEY_SYM_UNKNOWN) {
#ifdef DEBUG
    fprintf(stderr, "CSI: Unknown SS3 %c (0x%02x)\n", (char)cmd, cmd);
#endif
    return TERMKEY_RES_NONE;
  }

  *nbytep = introlen + 1;

  return TERMKEY_RES_KEY;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x7e89
cmpl $0x0, -0x2c(%rbp)
jne 0x7e47
movl $0x3, -0x4(%rbp)
jmp 0x803b
movq -0x10(%rbp), %rax
movq 0x2a8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0x4f, %esi
callq *%rax
movq -0x28(%rbp), %rax
movl 0x10(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x803b
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq -0x20(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x40, %eax
jl 0x7eb7
movzbl -0x39(%rbp), %eax
cmpl $0x80, %eax
jl 0x7ec3
movl $0x0, -0x4(%rbp)
jmp 0x803b
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x5c0c(%rip), %rax      # 0xdae0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x5bec(%rip), %rax      # 0xdae0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x5bca(%rip), %rax      # 0xdae0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x28(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
jne 0x8012
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x7fac
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x638b(%rip), %rax      # 0xe2e0
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x7fac
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x6367(%rip), %rax      # 0xe2e0
movsbq (%rax,%rcx), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x14(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x15(%rax)
jmp 0x8010
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x5f23(%rip), %rax      # 0xdee0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x5f03(%rip), %rax      # 0xdee0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
movzbl -0x39(%rbp), %eax
subl $0x40, %eax
movslq %eax, %rcx
leaq 0x5ee1(%rip), %rax      # 0xdee0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x8012
movq -0x28(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
jne 0x8025
movl $0x0, -0x4(%rbp)
jmp 0x803b
movq -0x20(%rbp), %rcx
addq $0x1, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)