// File: /workspace/github_c_makefile_star2_O0/neovim[P]libvterm/src/state.c
// Function: request_status_string
static void request_status_string(VTermState *state, VTermStringFragment frag)
{
  VTerm *vt = state->vt;

  char *tmp = state->tmp.decrqss;

  if(frag.initial)
    tmp[0] = tmp[1] = tmp[2] = tmp[3] = 0;

  int i = 0;
  while(i < sizeof(state->tmp.decrqss)-1 && tmp[i])
    i++;
  while(i < sizeof(state->tmp.decrqss)-1 && frag.len--)
    tmp[i++] = (frag.str++)[0];
  tmp[i] = 0;

  if(!frag.final)
    return;

  switch(tmp[0] | tmp[1]<<8 | tmp[2]<<16) {
    case 'm': {
      // Query SGR
      long args[20];
      int argc = vterm_state_getpen(state, args, sizeof(args)/sizeof(args[0]));
      size_t cur = 0;

      cur += snprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur,
          vt->mode.ctrl8bit ? "\x90" "1$r" : ESC_S "P" "1$r"); // DCS 1$r ...
      if(cur >= vt->tmpbuffer_len)
        return;

      for(int argi = 0; argi < argc; argi++) {
        cur += snprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur,
            argi == argc - 1             ? "%ld" :
            CSI_ARG_HAS_MORE(args[argi]) ? "%ld:" :
                                           "%ld;",
            CSI_ARG(args[argi]));
        if(cur >= vt->tmpbuffer_len)
          return;
      }

      cur += snprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur,
          vt->mode.ctrl8bit ? "m" "\x9C" : "m" ESC_S "\\"); // ... m ST
      if(cur >= vt->tmpbuffer_len)
        return;

      vterm_push_output_bytes(vt, vt->tmpbuffer, cur);
      return;
    }

    case 'r':
      // Query DECSTBM
      vterm_push_output_sprintf_str(vt, C1_DCS, true,
          "1$r%d;%dr", state->scrollregion_top+1, SCROLLREGION_BOTTOM(state));
      return;

    case 's':
      // Query DECSLRM
      vterm_push_output_sprintf_str(vt, C1_DCS, true,
          "1$r%d;%ds", SCROLLREGION_LEFT(state)+1, SCROLLREGION_RIGHT(state));
      return;

    case ' '|('q'<<8): {
      // Query DECSCUSR
      int reply;
      switch(state->mode.cursor_shape) {
        case VTERM_PROP_CURSORSHAPE_BLOCK:     reply = 2; break;
        case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break;
        case VTERM_PROP_CURSORSHAPE_BAR_LEFT:  reply = 6; break;
      }
      if(state->mode.cursor_blink)
        reply--;
      vterm_push_output_sprintf_str(vt, C1_DCS, true,
          "1$r%d q", reply);
      return;
    }

    case '\"'|('q'<<8):
      // Query DECSCA
      vterm_push_output_sprintf_str(vt, C1_DCS, true,
          "1$r%d\"q", state->protected_cell ? 1 : 2);
      return;
  }

  vterm_push_output_sprintf_str(state->vt, C1_DCS, true, "0$r");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rsi, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
addq $0x1a8, %rax            # imm = 0x1A8
movq %rax, -0x28(%rbp)
movl -0x8(%rbp), %eax
shrl $0x1e, %eax
andl $0x1, %eax
testl $0x1, %eax
je 0x10eff
movq -0x28(%rbp), %rax
movb $0x0, 0x3(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x2(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x1(%rax)
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movl $0x0, -0x2c(%rbp)
movslq -0x2c(%rbp), %rcx
xorl %eax, %eax
cmpq $0x3, %rcx
movb %al, -0xe9(%rbp)
jae 0x10f30
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0xe9(%rbp)
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x10f3c
jmp 0x10f47
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x10f06
jmp 0x10f49
movslq -0x2c(%rbp), %rcx
xorl %eax, %eax
cmpq $0x3, %rcx
movb %al, -0xea(%rbp)
jae 0x10f8f
movl -0x8(%rbp), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq %rax, %rcx
addq $-0x1, %rcx
movl %ecx, %edx
movl -0x8(%rbp), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, -0x8(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0xea(%rbp)
movb -0xea(%rbp), %al
testb $0x1, %al
jne 0x10f9b
jmp 0x10fc3
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %dl
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x2c(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x10f49
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x8(%rbp), %eax
shrl $0x1f, %eax
testl $0x1, %eax
jne 0x10fe1
jmp 0x114da
movq -0x28(%rbp), %rcx
movsbl (%rcx), %eax
movsbl 0x1(%rcx), %edx
shll $0x8, %edx
orl %edx, %eax
movsbl 0x2(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, -0xf0(%rbp)
subl $0x6d, %eax
je 0x11052
jmp 0x11007
movl -0xf0(%rbp), %eax
subl $0x72, %eax
je 0x1129e
jmp 0x11018
movl -0xf0(%rbp), %eax
subl $0x73, %eax
je 0x11311
jmp 0x11029
movl -0xf0(%rbp), %eax
subl $0x7120, %eax           # imm = 0x7120
je 0x113d2
jmp 0x1103c
movl -0xf0(%rbp), %eax
subl $0x7122, %eax           # imm = 0x7122
je 0x1147c
jmp 0x114bb
movq -0x18(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
movl $0x14, %edx
callq 0x5a90
movl %eax, -0xd4(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0x20(%rbp), %rax
movq 0x118(%rax), %rdi
addq -0xe0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x120(%rax), %rsi
subq -0xe0(%rbp), %rsi
movq -0x20(%rbp), %rax
movb 0x18(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %ecx
leaq 0x2858(%rip), %rdx      # 0x13909
leaq 0x284c(%rip), %rax      # 0x13904
cmpl $0x0, %ecx
cmovneq %rax, %rdx
movb $0x0, %al
callq 0x20f0
cltq
addq -0xe0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x120(%rcx), %rax
jb 0x110ef
jmp 0x114da
movl $0x0, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
cmpl -0xd4(%rbp), %eax
jge 0x11207
movq -0x20(%rbp), %rax
movq 0x118(%rax), %rax
addq -0xe0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x20(%rbp), %rax
movq 0x120(%rax), %rax
subq -0xe0(%rbp), %rax
movq %rax, -0xf8(%rbp)
movl -0xe4(%rbp), %eax
movl -0xd4(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x11160
leaq 0x27b8(%rip), %rax      # 0x1390f
movq %rax, -0x108(%rbp)
jmp 0x11196
movslq -0xe4(%rbp), %rax
movabsq $0x80000000, %rdx       # imm = 0x80000000
andq -0xd0(%rbp,%rax,8), %rdx
leaq 0x2798(%rip), %rax      # 0x13918
leaq 0x278c(%rip), %rcx      # 0x13913
cmpq $0x0, %rdx
cmovneq %rcx, %rax
movq %rax, -0x108(%rbp)
movq -0xf8(%rbp), %rsi
movq -0x100(%rbp), %rdi
movq -0x108(%rbp), %rdx
movslq -0xe4(%rbp), %rax
movq -0xd0(%rbp,%rax,8), %rcx
andq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
movb $0x0, %al
callq 0x20f0
cltq
addq -0xe0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x120(%rcx), %rax
jb 0x111f1
jmp 0x114da
jmp 0x111f3
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0x110f9
movq -0x20(%rbp), %rax
movq 0x118(%rax), %rdi
addq -0xe0(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x120(%rax), %rsi
subq -0xe0(%rbp), %rsi
movq -0x20(%rbp), %rax
movb 0x18(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %ecx
leaq 0x26e0(%rip), %rdx      # 0x13920
leaq 0x26d6(%rip), %rax      # 0x1391d
cmpl $0x0, %ecx
cmovneq %rax, %rdx
movb $0x0, %al
callq 0x20f0
cltq
addq -0xe0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x120(%rcx), %rax
jb 0x1127e
jmp 0x114da
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x118(%rax), %rsi
movq -0xe0(%rbp), %rdx
callq 0x11c50
jmp 0x114da
movq -0x20(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x18(%rbp), %rax
movl 0x44(%rax), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x48(%rax)
jle 0x112d2
movq -0x18(%rbp), %rax
movl 0x48(%rax), %eax
movl %eax, -0x11c(%rbp)
jmp 0x112df
movq -0x18(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x11c(%rbp)
movl -0x10c(%rbp), %r8d
movq -0x118(%rbp), %rdi
movl -0x11c(%rbp), %r9d
movl $0x90, %esi
movl $0x1, %edx
leaq 0x261f(%rip), %rcx      # 0x13924
movb $0x0, %al
callq 0x11f90
jmp 0x114da
movq -0x20(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x18(%rbp), %rax
movw 0xac(%rax), %ax
shrw $0xc, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x11346
movq -0x18(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x12c(%rbp)
jmp 0x11350
xorl %eax, %eax
movl %eax, -0x12c(%rbp)
jmp 0x11350
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x130(%rbp)
movq -0x18(%rbp), %rax
movw 0xac(%rax), %ax
shrw $0xc, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x11393
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x50(%rax)
jle 0x11393
movq -0x18(%rbp), %rax
movl 0x50(%rax), %eax
movl %eax, -0x134(%rbp)
jmp 0x113a0
movq -0x18(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x134(%rbp)
movl -0x130(%rbp), %r8d
movq -0x128(%rbp), %rdi
movl -0x134(%rbp), %r9d
movl $0x90, %esi
movl $0x1, %edx
leaq 0x2568(%rip), %rcx      # 0x1392e
movb $0x0, %al
callq 0x11f90
jmp 0x114da
movq -0x18(%rbp), %rax
movzwl 0xac(%rax), %eax
shrl $0x7, %eax
andl $0x3, %eax
movl %eax, -0x138(%rbp)
subw $0x1, %ax
je 0x1140b
jmp 0x113f1
movl -0x138(%rbp), %eax
subl $0x2, %eax
je 0x11417
jmp 0x113fe
movl -0x138(%rbp), %eax
subl $0x3, %eax
je 0x11423
jmp 0x1142d
movl $0x2, -0xe8(%rbp)
jmp 0x1142d
movl $0x4, -0xe8(%rbp)
jmp 0x1142d
movl $0x6, -0xe8(%rbp)
movq -0x18(%rbp), %rax
movw 0xac(%rax), %ax
shrw $0x6, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x11457
movl -0xe8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xe8(%rbp)
movq -0x20(%rbp), %rdi
movl -0xe8(%rbp), %r8d
movl $0x90, %esi
movl $0x1, %edx
leaq 0x24c5(%rip), %rcx      # 0x13938
movb $0x0, %al
callq 0x11f90
jmp 0x114da
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movb 0x18c(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
movl $0x2, %r8d
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %r8d
movl $0x90, %esi
movl $0x1, %edx
leaq 0x248e(%rip), %rcx      # 0x13940
movb $0x0, %al
callq 0x11f90
jmp 0x114da
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movl $0x90, %esi
movl $0x1, %edx
leaq 0x2475(%rip), %rcx      # 0x13948
movb $0x0, %al
callq 0x11f90
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)