// File: /workspace/github_c_makefile_star2_O0/neovim[P]libvterm/src/mouse.c
// Function: output_mouse
static void output_mouse(VTermState *state, int code, int pressed, int modifiers, int col, int row)
{
  modifiers <<= 2;

  switch(state->mouse_protocol) {
  case MOUSE_X10:
    if(col + 0x21 > 0xff)
      col = 0xff - 0x21;
    if(row + 0x21 > 0xff)
      row = 0xff - 0x21;

    if(!pressed)
      code = 3;

    vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "M%c%c%c",
        (code | modifiers) + 0x20, col + 0x21, row + 0x21);
    break;

  case MOUSE_UTF8:
    {
      char utf8[18]; size_t len = 0;

      if(!pressed)
        code = 3;

      len += fill_utf8((code | modifiers) + 0x20, utf8 + len);
      len += fill_utf8(col + 0x21, utf8 + len);
      len += fill_utf8(row + 0x21, utf8 + len);
      utf8[len] = 0;

      vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "M%s", utf8);
    }
    break;

  case MOUSE_SGR:
    vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "<%d;%d;%d%c",
        code | modifiers, col + 1, row + 1, pressed ? 'M' : 'm');
    break;

  case MOUSE_RXVT:
    if(!pressed)
      code = 3;

    vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%d;%d;%dM",
        code | modifiers, col + 1, row + 1);
    break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl -0x14(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x88(%rax), %eax
movq %rax, -0x40(%rbp)
subq $0x3, %rax
ja 0x3408
movq -0x40(%rbp), %rax
leaq 0xff4b(%rip), %rcx      # 0x131b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x18(%rbp), %eax
addl $0x21, %eax
cmpl $0xff, %eax
jle 0x3286
movl $0xde, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x21, %eax
cmpl $0xff, %eax
jle 0x329a
movl $0xde, -0x1c(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x32a7
movl $0x3, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %ecx
orl -0x14(%rbp), %ecx
addl $0x20, %ecx
movl -0x18(%rbp), %r8d
addl $0x21, %r8d
movl -0x1c(%rbp), %r9d
addl $0x21, %r9d
movl $0x9b, %esi
leaq 0xff09(%rip), %rdx      # 0x131dc
movb $0x0, %al
callq 0x11e00
jmp 0x3408
movq $0x0, -0x38(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x32f4
movl $0x3, -0xc(%rbp)
movl -0xc(%rbp), %eax
orl -0x14(%rbp), %eax
addl $0x20, %eax
movslq %eax, %rdi
leaq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
callq 0x3530
cltq
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x18(%rbp), %eax
addl $0x21, %eax
movslq %eax, %rdi
leaq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
callq 0x3530
cltq
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
addl $0x21, %eax
movslq %eax, %rdi
leaq -0x30(%rbp), %rsi
addq -0x38(%rbp), %rsi
callq 0x3530
cltq
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movb $0x0, -0x30(%rbp,%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq -0x30(%rbp), %rcx
movl $0x9b, %esi
leaq 0xfe6d(%rip), %rdx      # 0x131e4
movb $0x0, %al
callq 0x11e00
jmp 0x3408
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %ecx
orl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
addl $0x1, %r8d
movl -0x1c(%rbp), %r9d
addl $0x1, %r9d
movl -0x10(%rbp), %esi
movl $0x6d, %eax
movl $0x4d, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
movl $0x9b, %esi
leaq 0xfe29(%rip), %rdx      # 0x131e8
movl %eax, (%rsp)
movb $0x0, %al
callq 0x11e00
jmp 0x3408
cmpl $0x0, -0x10(%rbp)
jne 0x33d8
movl $0x3, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %ecx
orl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
addl $0x1, %r8d
movl -0x1c(%rbp), %r9d
addl $0x1, %r9d
movl $0x9b, %esi
leaq 0xfdf3(%rip), %rdx      # 0x131f4
movb $0x0, %al
callq 0x11e00
addq $0x50, %rsp
popq %rbp
retq
nop