LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/mkubecek[P]nperf/common.c
// Function: ctrl_recv_msg
int ctrl_recv_msg(int sd, void *buff, unsigned int length)
{
	const struct __common_ctrl_header *hdr = buff;
	unsigned int rest = length;
	unsigned char *bp = buff;
	ssize_t chunk;

	while (rest > length - sizeof(*hdr)) {
		chunk = recv(sd, bp, rest, 0);
		if (chunk < 0) {
			if (errno == EINTR)
				continue;
			return -errno;
		}
		if (!chunk)
			return -EINVAL;

		bp += chunk;
		rest -= chunk;
	}

	if (ntohl(hdr->length) != length || ntohl(hdr->version) != CTRL_VERSION)
		return -EINVAL;

	while (rest > 0) {
		chunk = recv(sd, bp, rest, MSG_WAITALL);
		if (chunk < 0)
			return -errno;

		bp += chunk;
		rest -= chunk;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movl %edi, %ebx
movl %edx, %r13d
leaq -0x8(%r13), %rax
movl %edx, %r15d
movq %rsi, %r14
cmpq %r13, %rax
jae 0x2295
movq %rsi, %r14
movl %ebp, %r15d
movq %rsi, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movl %ebx, %edi
movq %r14, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x1030
testq %rax, %rax
jns 0x227b
callq 0x1040
movl (%rax), %r12d
cmpl $0x4, %r12d
je 0x2257
jmp 0x22d5
movq 0x10(%rsp), %rsi
je 0x22f7
addq %rax, %r14
subl %eax, %r15d
movq %r15, %r13
movq 0x8(%rsp), %rax
cmpq %r15, %rax
jb 0x2257
movl (%rsi), %eax
bswapl %eax
movl $0xffffffea, %r12d      # imm = 0xFFFFFFEA
cmpl %ebp, %eax
jne 0x22d8
cmpl $0x1000000, 0x4(%rsi)   # imm = 0x1000000
jne 0x22d8
xorl %r12d, %r12d
testl %r15d, %r15d
je 0x22d8
movl %r15d, %edx
movl %ebx, %edi
movq %r14, %rsi
movl $0x100, %ecx            # imm = 0x100
callq 0x1030
testq %rax, %rax
js 0x22ea
addq %rax, %r14
subl %eax, %r15d
jne 0x22b4
jmp 0x22d8
negl %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1040
xorl %r12d, %r12d
subl (%rax), %r12d
jmp 0x22d8
movl $0xffffffea, %r12d      # imm = 0xFFFFFFEA
jmp 0x22d8
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/encoding.c
// Function: decode_table
static void decode_table(VTermEncoding *enc, void *data,
                         uint32_t cp[], int *cpi, int cplen,
                         const char bytes[], size_t *pos, size_t bytelen)
{
  struct StaticTableEncoding *table = (struct StaticTableEncoding *)enc;
  int is_gr = bytes[*pos] & 0x80;

  for(; *pos < bytelen && *cpi < cplen; (*pos)++) {
    unsigned char c = bytes[*pos] ^ is_gr;

    if(c < 0x20 || c == 0x7f || c >= 0x80)
      return;

    if(table->chars[c])
      cp[(*cpi)++] = table->chars[c];
    else
      cp[(*cpi)++] = c;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movq 0x30(%rsp), %rax
movq 0x28(%rsp), %rsi
movq (%rsi), %r10
cmpq %rax, %r10
jae 0x269a
movb (%r9,%r10), %r11b
andb $-0x80, %r11b
negq %rax
incq %r10
movslq (%rcx), %rbx
cmpl %r8d, %ebx
jge 0x269a
movb -0x1(%r9,%r10), %r14b
xorb %r11b, %r14b
leal -0x20(%r14), %ebp
cmpb $0x5e, %bpl
ja 0x269a
movzbl %r14b, %r14d
movl 0x10(%rdi,%r14,4), %ebp
leal 0x1(%rbx), %r15d
testl %ebp, %ebp
movl %r15d, (%rcx)
cmovel %r14d, %ebp
movl %ebp, (%rdx,%rbx,4)
movq %r10, (%rsi)
leaq (%rax,%r10), %rbx
incq %rbx
incq %r10
cmpq $0x1, %rbx
jne 0x2654
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/encoding.c
// Function: decode_usascii
static void decode_usascii(VTermEncoding *enc, void *data,
                           uint32_t cp[], int *cpi, int cplen,
                           const char bytes[], size_t *pos, size_t bytelen)
{
  int is_gr = bytes[*pos] & 0x80;

  for(; *pos < bytelen && *cpi < cplen; (*pos)++) {
    unsigned char c = bytes[*pos] ^ is_gr;

    if(c < 0x20 || c == 0x7f || c >= 0x80)
      return;

    cp[(*cpi)++] = c;
  }
}

// Assembly:
pushq %rbp
pushq %rbx
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %rsi
movq (%rsi), %rdi
cmpq %rax, %rdi
jae 0x26fc
movb (%r9,%rdi), %r10b
andb $-0x80, %r10b
negq %rax
incq %rdi
movslq (%rcx), %r11
cmpl %r8d, %r11d
jge 0x26fc
movb -0x1(%r9,%rdi), %bl
xorb %r10b, %bl
leal -0x20(%rbx), %ebp
cmpb $0x5e, %bpl
ja 0x26fc
movzbl %bl, %ebx
leal 0x1(%r11), %ebp
movl %ebp, (%rcx)
movl %ebx, (%rdx,%r11,4)
movq %rdi, (%rsi)
leaq (%rax,%rdi), %r11
incq %r11
incq %rdi
cmpq $0x1, %r11
jne 0x26c3
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/keyboard.c
// Function: vterm_keyboard_unichar
void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod)
{
  /* The shift modifier is never important for Unicode characters
   * apart from Space
   */
  if(c != ' ')
    mod &= ~VTERM_MOD_SHIFT;

  if(mod == 0) {
    // Normal text - ignore just shift
    char str[6];
    int seqlen = fill_utf8(c, str);
    vterm_push_output_bytes(vt, str, seqlen);
    return;
  }

  int needs_CSIu;
  switch(c) {
    /* Special Ctrl- letters that can't be represented elsewise */
    case 'i': case 'j': case 'm': case '[':
      needs_CSIu = 1;
      break;
    /* Ctrl-\ ] ^ _ don't need CSUu */
    case '\\': case ']': case '^': case '_':
      needs_CSIu = 0;
      break;
    /* Shift-space needs CSIu */
    case ' ':
      needs_CSIu = !!(mod & VTERM_MOD_SHIFT);
      break;
    /* All other characters needs CSIu except for letters a-z */
    default:
      needs_CSIu = (c < 'a' || c > 'z');
  }

  /* ALT we can just prefix with ESC; anything else requires CSI u */
  if(needs_CSIu && (mod & ~VTERM_MOD_ALT)) {
    vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", c, mod+1);
    return;
  }

  if(mod & VTERM_MOD_CTRL)
    c &= 0x1f;

  vterm_push_output_sprintf(vt, "%s%c", mod & VTERM_MOD_ALT ? ESC_S : "", c);
}

// Assembly:
movl %esi, %eax
movl %edx, %r8d
andl $-0x2, %r8d
cmpl $0x20, %esi
cmovel %edx, %r8d
testl %r8d, %r8d
je 0x2752
leal -0x5b(%rax), %edx
cmpl $0x12, %edx
ja 0x273e
movl $0x1e, %ecx
btl %edx, %ecx
jb 0x27d0
movl $0x1, %ecx
movl $0x4c001, %esi          # imm = 0x4C001
btl %edx, %esi
jb 0x27d2
cmpl $0x20, %eax
jne 0x285d
movl %r8d, %ecx
andl $0x1, %ecx
jmp 0x27d2
movl %eax, %ecx
movl $0x1, %esi
cmpl $0x80, %eax
jb 0x2791
movl $0x2, %esi
cmpl $0x800, %eax            # imm = 0x800
jb 0x2791
movl $0x3, %esi
cmpl $0x10000, %eax          # imm = 0x10000
jb 0x2791
movl $0x4, %esi
cmpl $0x200000, %eax         # imm = 0x200000
jb 0x2791
cmpl $0x4000000, %eax        # imm = 0x4000000
movl $0x6, %esi
sbbl $0x0, %esi
pushq %rax
movl %esi, %edx
cmpl $0x2, %esi
jb 0x27b9
leaq 0x1(%rdx), %rax
movl %ecx, %r8d
andb $0x3f, %r8b
orb $-0x80, %r8b
movb %r8b, (%rsp,%rax)
shrq $0x6, %rcx
decq %rax
cmpq $0x2, %rax
jg 0x279d
decl %esi
leaq 0x885e(%rip), %rax      # 0xb020
movslq (%rax,%rsi,4), %rsi
addq %rax, %rsi
jmpq *%rsi
andb $0x7f, %cl
jmp 0x284d
xorl %ecx, %ecx
testl $0xfffffffd, %r8d       # imm = 0xFFFFFFFD
je 0x27f7
testl %ecx, %ecx
je 0x27f7
incl %r8d
leaq 0x8aaf(%rip), %rdx      # 0xb298
movl $0x9b, %esi
movl %eax, %ecx
xorl %eax, %eax
jmp 0xa5f7
movl %eax, %ecx
andl $0x1f, %ecx
testb $0x4, %r8b
cmovel %eax, %ecx
testb $0x2, %r8b
leaq 0x8aa0(%rip), %rax      # 0xb2ae
leaq 0x8a8f(%rip), %rdx      # 0xb2a4
cmoveq %rax, %rdx
leaq 0x8a7f(%rip), %rsi      # 0xb29f
xorl %eax, %eax
jmp 0xa573
andb $0x3, %cl
orb $-0x8, %cl
jmp 0x284d
andb $0xf, %cl
orb $-0x20, %cl
jmp 0x284d
andb $0x7, %cl
orb $-0x10, %cl
jmp 0x284d
andb $0x1f, %cl
orb $-0x40, %cl
jmp 0x284d
andb $0x1, %cl
orb $-0x4, %cl
movb %cl, 0x2(%rsp)
leaq 0x2(%rsp), %rsi
callq 0xa493
popq %rax
retq
leal -0x7b(%rax), %edx
xorl %ecx, %ecx
cmpl $-0x1a, %edx
setb %cl
jmp 0x27d2
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/mouse.c
// Function: vterm_mouse_move
void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod)
{
  VTermState *state = vt->state;

  if(col == state->mouse_col && row == state->mouse_row)
    return;

  state->mouse_col = col;
  state->mouse_row = row;

  if((state->mouse_flags & MOUSE_WANT_DRAG && state->mouse_buttons) ||
     (state->mouse_flags & MOUSE_WANT_MOVE)) {
    int button = state->mouse_buttons & 0x01 ? 1 :
                 state->mouse_buttons & 0x02 ? 2 :
                 state->mouse_buttons & 0x04 ? 3 : 4;
    output_mouse(state, button-1 + 0x20, 1, mod, col, row);
  }
}

// Assembly:
movl %edx, %r8d
movl %esi, %r9d
movq 0x128(%rdi), %rdi
cmpl %edx, 0x78(%rdi)
jne 0x2a8c
cmpl %r9d, 0x7c(%rdi)
je 0x2aa2
movl %r8d, 0x78(%rdi)
movl %r9d, 0x7c(%rdi)
movl 0x84(%rdi), %eax
testb $0x2, %al
jne 0x2aa3
testb $0x4, %al
jne 0x2aae
retq
andl $0x4, %eax
orl 0x80(%rdi), %eax
je 0x2aa2
movl 0x80(%rdi), %eax
movl $0x20, %esi
testb $0x1, %al
jne 0x2ad1
movl $0x21, %esi
testb $0x2, %al
jne 0x2ad1
andl $0x4, %eax
xorl %esi, %esi
cmpl $0x1, %eax
adcl $0x22, %esi
movl $0x1, %edx
jmp 0x2ad8
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %esi, %eax
movl 0x88(%rdi), %esi
cmpq $0x3, %rsi
ja 0x2c35
movl %r9d, %ebp
movl %r8d, %ebx
movq %rdi, %r14
shll $0x2, %ecx
leaq 0x87bb(%rip), %rdi      # 0xb2c4
movslq (%rdi,%rsi,4), %rsi
addq %rdi, %rsi
jmpq *%rsi
movl $0xde, %r9d
cmpl %r9d, %ebx
cmovgel %r9d, %ebx
cmpl %r9d, %ebp
cmovll %ebp, %r9d
testl %edx, %edx
movl $0x3, %edx
cmovel %edx, %eax
movq (%r14), %rdi
orl %ecx, %eax
addl $0x20, %eax
addl $0x21, %ebx
addl $0x21, %r9d
leaq 0x87a6(%rip), %rdx      # 0xb2ec
movl $0x9b, %esi
movl %eax, %ecx
movl %ebx, %r8d
jmp 0x2bb0
movq (%r14), %rdi
orl %eax, %ecx
incl %ebx
incl %ebp
xorl %eax, %eax
testl %edx, %edx
sete %al
shll $0x5, %eax
orl $0x4d, %eax
movl %eax, (%rsp)
leaq 0x8786(%rip), %rdx      # 0xb2f8
movl $0x9b, %esi
movl %ebx, %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0xa5f7
jmp 0x2c35
testl %edx, %edx
movl $0x3, %edx
cmovel %edx, %eax
movq (%r14), %rdi
orl %ecx, %eax
incl %ebx
incl %ebp
leaq 0x8761(%rip), %rdx      # 0xb304
movl $0x9b, %esi
movl %eax, %ecx
movl %ebx, %r8d
movl %ebp, %r9d
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa5f7
testl %edx, %edx
movl $0x3, %edx
cmovel %edx, %eax
orl %ecx, %eax
addl $0x20, %eax
movslq %eax, %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
callq 0x2cac
movl %eax, %r12d
movl %eax, %eax
addl $0x21, %ebx
movslq %ebx, %rdi
leaq (%rsp,%rax), %rsi
addq $0x10, %rsi
callq 0x2cac
movl %eax, %ebx
addl %r12d, %ebx
addl $0x21, %ebp
movslq %ebp, %rdi
leaq (%rsp,%rbx), %rsi
addq $0x10, %rsi
callq 0x2cac
movl %eax, %eax
addq %rbx, %rax
movb $0x0, 0x10(%rsp,%rax)
movq (%r14), %rdi
leaq 0x86ce(%rip), %rdx      # 0xb2f4
movl $0x9b, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0xa5f7
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/mouse.c
// Function: vterm_mouse_button
void vterm_mouse_button(VTerm *vt, int button, bool pressed, VTermModifier mod)
{
  VTermState *state = vt->state;

  int old_buttons = state->mouse_buttons;

  if(button > 0 && button <= 3) {
    if(pressed)
      state->mouse_buttons |= (1 << (button-1));
    else
      state->mouse_buttons &= ~(1 << (button-1));
  }

  /* Most of the time we don't get button releases from 4/5 */
  if(state->mouse_buttons == old_buttons && button < 4)
    return;

  if(!state->mouse_flags)
    return;

  if(button < 4) {
    output_mouse(state, button-1, pressed, mod, state->mouse_col, state->mouse_row);
  }
  else if(button < 8) {
    output_mouse(state, button-4 + 0x40, pressed, mod, state->mouse_col, state->mouse_row);
  }
}

// Assembly:
movq 0x128(%rdi), %rdi
movl 0x80(%rdi), %r8d
leal -0x1(%rsi), %eax
cmpl $0x2, %eax
ja 0x2c73
movl %r8d, %r9d
btsl %eax, %r9d
movl %r8d, %r10d
btrl %eax, %r10d
testb %dl, %dl
cmovnel %r9d, %r10d
movl %r10d, 0x80(%rdi)
cmpl $0x3, %esi
jg 0x2c81
cmpl %r8d, 0x80(%rdi)
je 0x2cab
cmpl $0x0, 0x84(%rdi)
je 0x2cab
cmpl $0x4, %esi
jl 0x2c99
cmpl $0x7, %esi
jg 0x2cab
addl $0x3c, %esi
movl %esi, %eax
movzbl %dl, %edx
movl 0x78(%rdi), %r8d
movl 0x7c(%rdi), %r9d
movl %eax, %esi
jmp 0x2ad8
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/utf8.h
// Function: fill_utf8
static int fill_utf8(long codepoint, char *str)
{
  int nbytes = utf8_seqlen(codepoint);

  // This is easier done backwards
  int b = nbytes;
  while(b > 1) {
    b--;
    str[b] = 0x80 | (codepoint & 0x3f);
    codepoint >>= 6;
  }

  switch(nbytes) {
    case 1: str[0] =        (codepoint & 0x7f); break;
    case 2: str[0] = 0xc0 | (codepoint & 0x1f); break;
    case 3: str[0] = 0xe0 | (codepoint & 0x0f); break;
    case 4: str[0] = 0xf0 | (codepoint & 0x07); break;
    case 5: str[0] = 0xf8 | (codepoint & 0x03); break;
    case 6: str[0] = 0xfc | (codepoint & 0x01); break;
  }

  return nbytes;
}

// Assembly:
movl $0x1, %eax
cmpq $0x80, %rdi
jl 0x2cf3
movl $0x2, %eax
cmpq $0x800, %rdi            # imm = 0x800
jl 0x2cf3
movl $0x3, %eax
cmpq $0x10000, %rdi          # imm = 0x10000
jl 0x2cf3
movl $0x4, %eax
cmpq $0x200000, %rdi         # imm = 0x200000
jl 0x2cf3
xorl %eax, %eax
cmpq $0x4000000, %rdi        # imm = 0x4000000
setge %al
addl $0x5, %eax
cmpl $0x2, %eax
jb 0x2d16
movl %eax, %ecx
incq %rcx
movl %edi, %edx
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, -0x2(%rsi,%rcx)
sarq $0x6, %rdi
decq %rcx
cmpq $0x2, %rcx
jg 0x2cfd
leal -0x1(%rax), %ecx
leaq 0x85b4(%rip), %rdx      # 0xb2d4
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
andb $0x7f, %dil
jmp 0x2d5f
andb $0x3, %dil
orb $-0x8, %dil
jmp 0x2d5f
andb $0xf, %dil
orb $-0x20, %dil
jmp 0x2d5f
andb $0x7, %dil
orb $-0x10, %dil
jmp 0x2d5f
andb $0x1f, %dil
orb $-0x40, %dil
jmp 0x2d5f
andb $0x1, %dil
orb $-0x4, %dil
movb %dil, (%rsi)
retq
nop
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/parser.c
// Function: string_fragment
static void string_fragment(VTerm *vt, const char *str, size_t len, bool final)
{
  VTermStringFragment frag = {
    .str     = str,
    .len     = len,
    .initial = vt->parser.string_initial,
    .final   = final,
  };

  switch(vt->parser.state) {
    case OSC:
      if(vt->parser.callbacks && vt->parser.callbacks->osc)
        (*vt->parser.callbacks->osc)(vt->parser.v.osc.command, frag, vt->parser.cbdata);
      break;

    case DCS:
      if(vt->parser.callbacks && vt->parser.callbacks->dcs)
        (*vt->parser.callbacks->dcs)(vt->parser.v.dcs.command, vt->parser.v.dcs.commandlen, frag, vt->parser.cbdata);
      break;

    case APC:
      if(vt->parser.callbacks && vt->parser.callbacks->apc)
        (*vt->parser.callbacks->apc)(frag, vt->parser.cbdata);
      break;

    case PM:
      if(vt->parser.callbacks && vt->parser.callbacks->pm)
        (*vt->parser.callbacks->pm)(frag, vt->parser.cbdata);
      break;

    case SOS:
      if(vt->parser.callbacks && vt->parser.callbacks->sos)
        (*vt->parser.callbacks->sos)(frag, vt->parser.cbdata);
      break;

    case NORMAL:
    case CSI_LEADER:
    case CSI_ARGS:
    case CSI_INTERMED:
    case OSC_COMMAND:
    case DCS_COMMAND:
      break;
  }

  vt->parser.string_initial = false;
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
movl 0x20(%rdi), %esi
addl $-0x6, %esi
cmpl $0x4, %esi
ja 0x342a
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movzbl 0xe8(%rbx), %edi
shlq $0x1e, %rdi
orq %rdx, %rdi
shll $0x1f, %ecx
orq %rdi, %rcx
leaq 0x7fe5(%rip), %rdx      # 0xb35c
movslq (%rdx,%rsi,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
movq 0xd8(%rbx), %rdx
testq %rdx, %rdx
je 0x342a
movq 0x20(%rdx), %r9
testq %r9, %r9
je 0x342a
movl 0x40(%rbx), %edi
movq 0xe0(%rbx), %r8
movq %rax, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq *%r9
jmp 0x342a
movq 0xd8(%rbx), %rdx
testq %rdx, %rdx
je 0x342a
movq 0x40(%rdx), %r8
jmp 0x33e9
movq 0xd8(%rbx), %rdx
testq %rdx, %rdx
je 0x342a
movq 0x30(%rdx), %r8
jmp 0x33e9
movq 0xd8(%rbx), %rdx
testq %rdx, %rdx
je 0x342a
movq 0x38(%rdx), %r8
testq %r8, %r8
je 0x342a
movq 0xe0(%rbx), %rdx
movq %rax, %rdi
movq %rcx, %rsi
callq *%r8
jmp 0x342a
movq 0xd8(%rbx), %rdx
testq %rdx, %rdx
je 0x342a
movq 0x28(%rdx), %r9
testq %r9, %r9
je 0x342a
leaq 0x44(%rbx), %rdi
movslq 0x40(%rbx), %rsi
movq 0xe0(%rbx), %r8
movq %rax, %rdx
callq *%r9
movb $0x0, 0xe8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/parser.c
// Function: do_escape
static void do_escape(VTerm *vt, char command)
{
  char seq[INTERMED_MAX+1];

  size_t len = vt->parser.intermedlen;
  strncpy(seq, vt->parser.intermed, len);
  seq[len++] = command;
  seq[len]   = 0;

  if(vt->parser.callbacks && vt->parser.callbacks->escape)
    if((*vt->parser.callbacks->escape)(seq, len, vt->parser.cbdata))
      return;

  DEBUG_LOG("libvterm: Unhandled escape ESC 0x%02x\n", command);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %r14
movslq 0x28(%rdi), %rbx
leaq 0x2c(%rdi), %rsi
movq %rsp, %rdi
movq %rbx, %rdx
callq 0x2070
movb %bpl, (%rsp,%rbx)
movb $0x0, 0x1(%rsp,%rbx)
movq 0xd8(%r14), %rax
testq %rax, %rax
je 0x3483
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x3483
incq %rbx
movq 0xe0(%r14), %rdx
movq %rsp, %rdi
movq %rbx, %rsi
callq *%rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/pen.c
// Function: vterm_state_newpen
INTERNAL void vterm_state_newpen(VTermState *state)
{
  // 90% grey so that pure white is brighter
  vterm_color_rgb(&state->default_fg, 240, 240, 240);
  vterm_color_rgb(&state->default_bg, 0, 0, 0);
  vterm_state_set_default_colors(state, &state->default_fg, &state->default_bg);

  for(int col = 0; col < 16; col++)
    lookup_default_colour_ansi(col, &state->colors[col]);
}

// Assembly:
movl $0xf0f0f002, %eax       # imm = 0xF0F0F002
movq %rax, 0x140(%rdi)
movb $0x4, 0x144(%rdi)
leaq 0x809c(%rip), %rax      # 0xb562
xorl %ecx, %ecx
movzwl -0x2(%rax), %edx
movb (%rax), %sil
movb $0x0, 0x148(%rdi,%rcx,4)
movw %dx, 0x149(%rdi,%rcx,4)
movb %sil, 0x14b(%rdi,%rcx,4)
incq %rcx
addq $0x3, %rax
cmpq $0x10, %rcx
jne 0x34c8
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/pen.c
// Function: vterm_state_set_default_colors
void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg)
{
  if(default_fg) {
    state->default_fg = *default_fg;
    state->default_fg.type = (state->default_fg.type & ~VTERM_COLOR_DEFAULT_MASK)
                           | VTERM_COLOR_DEFAULT_FG;
  }

  if(default_bg) {
    state->default_bg = *default_bg;
    state->default_bg.type = (state->default_bg.type & ~VTERM_COLOR_DEFAULT_MASK)
                           | VTERM_COLOR_DEFAULT_BG;
  }
}

// Assembly:
testq %rsi, %rsi
je 0x350c
movl (%rsi), %eax
movl %eax, 0x140(%rdi)
andb $-0x7, %al
orb $0x2, %al
movb %al, 0x140(%rdi)
testq %rdx, %rdx
je 0x3523
movl (%rdx), %eax
movl %eax, 0x144(%rdi)
andb $-0x7, %al
orb $0x4, %al
movb %al, 0x144(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/pen.c
// Function: vterm_color_is_equal
int vterm_color_is_equal(const VTermColor *a, const VTermColor *b)
{
  /* First make sure that the two colours are of the same type (RGB/Indexed) */
  if (a->type != b->type) {
    return false;
  }

  /* Depending on the type inspect the corresponding members */
  if (VTERM_COLOR_IS_INDEXED(a)) {
    return a->indexed.idx == b->indexed.idx;
  }
  else if (VTERM_COLOR_IS_RGB(a)) {
    return    (a->rgb.red   == b->rgb.red)
           && (a->rgb.green == b->rgb.green)
           && (a->rgb.blue  == b->rgb.blue);
  }

  return 0;
}

// Assembly:
movb (%rdi), %al
cmpb (%rsi), %al
jne 0x39fc
movb 0x1(%rsi), %cl
cmpb %cl, 0x1(%rdi)
sete %cl
movl %ecx, %edx
notb %dl
orb %al, %dl
testb $0x1, %dl
je 0x39e9
andb %cl, %al
jmp 0x39fe
movb 0x2(%rdi), %al
cmpb 0x2(%rsi), %al
jne 0x39fc
movb 0x3(%rdi), %al
cmpb 0x3(%rsi), %al
sete %al
jmp 0x39fe
xorl %eax, %eax
movzbl %al, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/pen.c
// Function: lookup_colour_palette
static bool lookup_colour_palette(const VTermState *state, long index, VTermColor *col)
{
  if(index >= 0 && index < 16) {
    // Normal 8 colours or high intensity - parse as palette 0
    return lookup_colour_ansi(state, index, col);
  }
  else if(index >= 16 && index < 232) {
    // 216-colour cube
    index -= 16;

    vterm_color_rgb(col, ramp6[index/6/6 % 6],
                         ramp6[index/6   % 6],
                         ramp6[index     % 6]);

    return true;
  }
  else if(index >= 232 && index < 256) {
    // 24 greyscales
    index -= 232;

    vterm_color_rgb(col, ramp24[index], ramp24[index], ramp24[index]);

    return true;
  }

  return false;
}

// Assembly:
movq %rdx, %rcx
cmpq $0xf, %rsi
ja 0x3a2b
movl 0x148(%rdi,%rsi,4), %eax
movl %eax, (%rcx)
retq
leaq -0x10(%rsi), %rdi
cmpq $0xd7, %rdi
ja 0x3ab7
movabsq $-0x1c71c71c71c71c71, %rdx # imm = 0xE38E38E38E38E38F
movq %rdi, %rax
mulq %rdx
movq %rdx, %rsi
shrq $0x5, %rsi
movabsq $0x2aaaaaaaaaaaaaab, %r10 # imm = 0x2AAAAAAAAAAAAAAB
movq %rsi, %rax
mulq %r10
addl %edx, %edx
leal (%rdx,%rdx,2), %eax
subl %eax, %esi
leaq 0x7b23(%rip), %r9       # 0xb590
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rdi, %rax
mulq %rdx
movq %rdx, %r8
movb (%r9,%rsi,4), %sil
shrq $0x2, %r8
movq %r8, %rax
mulq %r10
addl %edx, %edx
leal (%rdx,%rdx,2), %eax
movl %r8d, %edx
subl %eax, %edx
movb (%r9,%rdx,4), %al
addl %r8d, %r8d
leal (%r8,%r8,2), %edx
subl %edx, %edi
movb (%r9,%rdi,4), %dl
movb $0x0, (%rcx)
movb %sil, 0x1(%rcx)
movb %al, 0x2(%rcx)
movb %dl, 0x3(%rcx)
retq
leaq -0xe8(%rsi), %rax
cmpq $0x17, %rax
ja 0x3ade
leaq 0x7ae5(%rip), %rax      # 0xb5b0
movb -0x3a0(%rax,%rsi,4), %al
movb $0x0, (%rcx)
movb %al, 0x1(%rcx)
movb %al, 0x2(%rcx)
movb %al, 0x3(%rcx)
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/pen.c
// Function: lookup_colour
static int lookup_colour(const VTermState *state, int palette, const long args[], int argcount, VTermColor *col)
{
  switch(palette) {
  case 2: // RGB mode - 3 args contain colour values directly
    if(argcount < 3)
      return argcount;

    vterm_color_rgb(col, CSI_ARG(args[0]), CSI_ARG(args[1]), CSI_ARG(args[2]));

    return 3;

  case 5: // XTerm 256-colour mode
    if (!argcount || CSI_ARG_IS_MISSING(args[0])) {
      return argcount ? 1 : 0;
    }

    vterm_color_indexed(col, args[0]);

    return argcount ? 1 : 0;

  default:
    DEBUG_LOG("Unrecognised colour palette %d\n", palette);
    return 0;
  }
}

// Assembly:
cmpl $0x5, %edi
je 0x41c1
xorl %eax, %eax
cmpl $0x2, %edi
jne 0x41e7
movl %edx, %eax
cmpl $0x3, %edx
jl 0x41e7
movb (%rsi), %al
movb 0x8(%rsi), %dl
movb 0x10(%rsi), %sil
movb $0x0, (%rcx)
movb %al, 0x1(%rcx)
movb %dl, 0x2(%rcx)
movb %sil, 0x3(%rcx)
movl $0x3, %eax
retq
testl %edx, %edx
je 0x41d4
movq (%rsi), %rax
movl %eax, %esi
notl %esi
testl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jne 0x41dc
xorl %eax, %eax
testl %edx, %edx
setne %al
retq
movb $0x1, (%rcx)
movb %al, 0x1(%rcx)
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/pen.c
// Function: vterm_state_getpen
INTERNAL int vterm_state_getpen(VTermState *state, long args[], int argcount)
{
  int argi = 0;

  if(state->pen.bold)
    args[argi++] = 1;

  if(state->pen.italic)
    args[argi++] = 3;

  if(state->pen.underline == VTERM_UNDERLINE_SINGLE)
    args[argi++] = 4;
  if(state->pen.underline == VTERM_UNDERLINE_CURLY)
    args[argi++] = 4 | CSI_ARG_FLAG_MORE, args[argi++] = 3;

  if(state->pen.blink)
    args[argi++] = 5;

  if(state->pen.reverse)
    args[argi++] = 7;

  if(state->pen.conceal)
    args[argi++] = 8;

  if(state->pen.strike)
    args[argi++] = 9;

  if(state->pen.font)
    args[argi++] = 10 + state->pen.font;

  if(state->pen.underline == VTERM_UNDERLINE_DOUBLE)
    args[argi++] = 21;

  argi = vterm_state_getpen_color(&state->pen.fg, argi, args, true);

  argi = vterm_state_getpen_color(&state->pen.bg, argi, args, false);

  if(state->pen.small) {
    if(state->pen.baseline == VTERM_BASELINE_RAISE)
      args[argi++] = 73;
    else if(state->pen.baseline == VTERM_BASELINE_LOWER)
      args[argi++] = 74;
  }

  return argi;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %esi, %esi
testb $0x1, 0x13c(%rdi)
je 0x4209
movq $0x1, (%rbx)
movl $0x1, %esi
testb $0x8, 0x13c(%r14)
je 0x421f
movl %esi, %eax
incl %esi
movq $0x3, (%rbx,%rax,8)
movzwl 0x13c(%r14), %eax
andl $0x6, %eax
cmpw $0x2, %ax
jne 0x423c
movl %esi, %eax
incl %esi
movq $0x4, (%rbx,%rax,8)
movl 0x13c(%r14), %eax
notl %eax
testb $0x6, %al
jne 0x4260
movl %esi, %eax
movl $0x80000004, %ecx       # imm = 0x80000004
movq %rcx, (%rbx,%rax,8)
addl $0x2, %esi
movq $0x3, 0x8(%rbx,%rax,8)
testb $0x10, 0x13c(%r14)
je 0x4276
movl %esi, %eax
incl %esi
movq $0x5, (%rbx,%rax,8)
testb $0x20, 0x13c(%r14)
je 0x428c
movl %esi, %eax
incl %esi
movq $0x7, (%rbx,%rax,8)
testb $0x40, 0x13c(%r14)
je 0x42a2
movl %esi, %eax
incl %esi
movq $0x8, (%rbx,%rax,8)
testb $-0x80, 0x13c(%r14)
je 0x42b8
movl %esi, %eax
incl %esi
movq $0x9, (%rbx,%rax,8)
movzbl 0x13d(%r14), %eax
andq $0xf, %rax
je 0x42d2
addq $0xa, %rax
movl %esi, %ecx
incl %esi
movq %rax, (%rbx,%rcx,8)
leaq 0x134(%r14), %rdi
movzwl 0x13c(%r14), %eax
andl $0x6, %eax
cmpw $0x4, %ax
jne 0x42f6
movl %esi, %eax
incl %esi
movq $0x15, (%rbx,%rax,8)
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x4351
leaq 0x138(%r14), %rdi
movl %eax, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x4351
movzwl 0x13c(%r14), %ecx
btl $0xc, %ecx
jae 0x4349
shrl $0xd, %ecx
andl $0x3, %ecx
cmpl $0x1, %ecx
je 0x433b
cmpl $0x2, %ecx
jne 0x4349
movl $0x4a, %ecx
jmp 0x4340
movl $0x49, %ecx
movslq %eax, %rdx
incl %eax
movq %rcx, (%rbx,%rdx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/pen.c
// Function: vterm_state_getpen_color
static int vterm_state_getpen_color(const VTermColor *col, int argi, long args[], int fg)
{
    /* Do nothing if the given color is the default color */
    if (( fg && VTERM_COLOR_IS_DEFAULT_FG(col)) ||
        (!fg && VTERM_COLOR_IS_DEFAULT_BG(col))) {
        return argi;
    }

    /* Decide whether to send an indexed color or an RGB color */
    if (VTERM_COLOR_IS_INDEXED(col)) {
        const uint8_t idx = col->indexed.idx;
        if (idx < 8) {
            args[argi++] = (idx + (fg ? 30 : 40));
        }
        else if (idx < 16) {
            args[argi++] = (idx - 8 + (fg ? 90 : 100));
        }
        else {
            args[argi++] = CSI_ARG_FLAG_MORE | (fg ? 38 : 48);
            args[argi++] = CSI_ARG_FLAG_MORE | 5;
            args[argi++] = idx;
        }
    }
    else if (VTERM_COLOR_IS_RGB(col)) {
        args[argi++] = CSI_ARG_FLAG_MORE | (fg ? 38 : 48);
        args[argi++] = CSI_ARG_FLAG_MORE | 2;
        args[argi++] = CSI_ARG_FLAG_MORE | col->rgb.red;
        args[argi++] = CSI_ARG_FLAG_MORE | col->rgb.green;
        args[argi++] = col->rgb.blue;
    }
    return argi;
}

// Assembly:
movl %esi, %eax
movb (%rdi), %sil
testl %ecx, %ecx
je 0x4361
testb $0x2, %sil
je 0x4367
retq
testb $0x4, %sil
jne 0x4360
testb $0x1, (%rdi)
jne 0x43bf
testl %ecx, %ecx
movl $0x30, %ecx
movl $0x26, %esi
cmoveq %rcx, %rsi
btsq $0x1f, %rsi
movslq %eax, %rcx
movq %rsi, (%rdx,%rcx,8)
movl $0x80000000, %esi       # imm = 0x80000000
orq $0x2, %rsi
movq %rsi, 0x8(%rdx,%rcx,8)
movzbl 0x1(%rdi), %esi
btsq $0x1f, %rsi
movq %rsi, 0x10(%rdx,%rcx,8)
movzbl 0x2(%rdi), %esi
btsq $0x1f, %rsi
movq %rsi, 0x18(%rdx,%rcx,8)
movzbl 0x3(%rdi), %esi
addl $0x5, %eax
movq %rsi, 0x20(%rdx,%rcx,8)
retq
movzbl 0x1(%rdi), %esi
cmpl $0x7, %esi
ja 0x43d0
leal 0x1e(%rsi), %edi
addl $0x28, %esi
jmp 0x43dc
cmpb $0xf, %sil
ja 0x43eb
leal 0x52(%rsi), %edi
addl $0x5c, %esi
testl %ecx, %ecx
cmovnel %edi, %esi
movslq %eax, %rcx
incl %eax
movq %rsi, (%rdx,%rcx,8)
retq
testl %ecx, %ecx
movl $0x30, %ecx
movl $0x26, %edi
cmoveq %rcx, %rdi
btsq $0x1f, %rdi
movslq %eax, %rcx
movq %rdi, (%rdx,%rcx,8)
movl $0x80000000, %eax       # imm = 0x80000000
orq $0x5, %rax
movq %rax, 0x8(%rdx,%rcx,8)
leal 0x3(%rcx), %eax
movq %rsi, 0x10(%rdx,%rcx,8)
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: vterm_screen_free
INTERNAL void vterm_screen_free(VTermScreen *screen)
{
  vterm_allocator_free(screen->vt, screen->buffers[BUFIDX_PRIMARY]);
  if(screen->buffers[BUFIDX_ALTSCREEN])
    vterm_allocator_free(screen->vt, screen->buffers[BUFIDX_ALTSCREEN]);

  vterm_allocator_free(screen->vt, screen->sb_buffer);

  vterm_allocator_free(screen->vt, screen);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x60(%rbx), %rsi
callq 0xa40a
movq 0x68(%rbx), %rsi
testq %rsi, %rsi
je 0x44e5
movq (%rbx), %rdi
callq 0xa40a
movq (%rbx), %rdi
movq 0x78(%rbx), %rsi
callq 0xa40a
movq (%rbx), %rdi
movq %rbx, %rsi
popq %rbx
jmp 0xa40a
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: vterm_screen_reset
void vterm_screen_reset(VTermScreen *screen, int hard)
{
  screen->damaged.start_row = -1;
  screen->pending_scrollrect.start_row = -1;
  vterm_state_reset(screen->state, hard);
  vterm_screen_flush_damage(screen);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x28(%rdi)
movl %eax, 0x38(%rdi)
movq 0x8(%rdi), %rdi
callq 0x2110
movq %rbx, %rdi
popq %rbx
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: vterm_screen_flush_damage
void vterm_screen_flush_damage(VTermScreen *screen)
{
  if(screen->pending_scrollrect.start_row != -1) {
    vterm_scroll_rect(screen->pending_scrollrect, screen->pending_scroll_downward, screen->pending_scroll_rightward,
        moverect_user, erase_user, screen);

    screen->pending_scrollrect.start_row = -1;
  }

  if(screen->damaged.start_row != -1) {
    if(screen->callbacks && screen->callbacks->damage)
      (*screen->callbacks->damage)(screen->damaged, screen->cbdata);

    screen->damaged.start_row = -1;
  }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $-0x1, 0x38(%rdi)
je 0x4558
movl 0x48(%rbx), %edx
movl 0x4c(%rbx), %ecx
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
movq %rbx, (%rsp)
leaq 0x6b5(%rip), %r8        # 0x4bfa
leaq 0x71c(%rip), %r9        # 0x4c68
callq 0x2170
movl $0xffffffff, 0x38(%rbx) # imm = 0xFFFFFFFF
cmpl $-0x1, 0x28(%rbx)
je 0x4584
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x457d
movq (%rax), %rax
testq %rax, %rax
je 0x457d
movq 0x18(%rbx), %rdx
movq 0x28(%rbx), %rdi
movq 0x30(%rbx), %rsi
callq *%rax
movl $0xffffffff, 0x28(%rbx) # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: vterm_screen_is_eol
int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos)
{
  /* This cell is EOL if this and every cell to the right is black */
  for(; pos.col < screen->cols; pos.col++) {
    ScreenCell *cell = getcell(screen, pos.row, pos.col);
    if(cell->chars[0] != 0)
      return 0;
  }

  return 1;
}

// Assembly:
movq %rsi, %rcx
shrq $0x20, %rcx
movl 0x54(%rdi), %edx
movl $0x1, %eax
cmpl %ecx, %edx
jle 0x49ea
imull %edx, %esi
leaq (%rcx,%rcx,8), %r8
leaq (%rsi,%rsi,8), %rsi
shlq $0x2, %rsi
leaq (%rsi,%r8,4), %rsi
addq 0x70(%rdi), %rsi
cmpl $0x0, (%rsi)
jne 0x49eb
addq $0x24, %rsi
incl %ecx
cmpl %ecx, %edx
jg 0x49db
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: vterm_obtain_screen
VTermScreen *vterm_obtain_screen(VTerm *vt)
{
  if(vt->screen)
    return vt->screen;

  VTermScreen *screen = screen_new(vt);
  vt->screen = screen;

  return screen;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq 0x130(%rdi), %r14
testq %r14, %r14
jne 0x4ad6
movq %rdi, %rbx
callq 0x2150
testq %rax, %rax
je 0x4acc
movq %rax, %r15
movl $0x90, %esi
movq %rbx, %rdi
callq 0xa39f
movq %rax, %r14
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x20b0
movq %rbx, (%r14)
movq %r15, 0x8(%r14)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x24(%r14)
movl $0xffffffff, 0x38(%r14) # imm = 0xFFFFFFFF
movl (%r12), %esi
movl %esi, 0x50(%r14)
movl (%r13), %edx
movl %edx, 0x54(%r14)
andb $-0x4, 0x58(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movb $0x0, 0x20(%r14)
movq %r14, %rdi
callq 0x4b50
movq %rax, 0x60(%r14)
movq %rax, 0x70(%r14)
movq (%r14), %rdi
movslq (%r13), %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
callq 0xa39f
movq %rax, 0x78(%r14)
movq 0x8(%r14), %rdi
leaq 0xb67f(%rip), %rsi      # 0x10138
movq %r14, %rdx
callq 0x21d0
movq 0x8(%r14), %rdi
callq 0x21a0
jmp 0x4acf
xorl %r14d, %r14d
movq %r14, 0x130(%rbx)
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: alloc_buffer
static ScreenCell *alloc_buffer(VTermScreen *screen, int rows, int cols)
{
  ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * rows * cols);

  for(int row = 0; row < rows; row++) {
    for(int col = 0; col < cols; col++) {
      clearcell(screen, &new_buffer[row * cols + col]);
    }
  }

  return new_buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movq (%rdi), %rdi
movslq %esi, %r15
movslq %edx, %rax
imulq %r15, %rax
shlq $0x2, %rax
leaq (%rax,%rax,8), %rsi
callq 0xa39f
testl %r15d, %r15d
jle 0x4bca
subq $-0x80, %r14
movl %ebx, %esi
movl %ebp, %ecx
movq %rax, %rdx
addq $0x18, %rdx
shlq $0x2, %rsi
leaq (%rsi,%rsi,8), %rsi
xorl %edi, %edi
testl %ebx, %ebx
jle 0x4bbf
xorl %r8d, %r8d
movl $0x0, -0x18(%rdx,%r8)
movq (%r14), %r9
movq %r9, (%rdx,%r8)
movl 0x8(%r14), %r9d
movl %r9d, 0x8(%rdx,%r8)
addq $0x24, %r8
cmpq %r8, %rsi
jne 0x4b9d
incq %rdi
addq %rsi, %rdx
cmpq %rcx, %rdi
jne 0x4b96
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: moverect_user
static int moverect_user(VTermRect dest, VTermRect src, void *user)
{
  VTermScreen *screen = user;

  if(screen->callbacks && screen->callbacks->moverect) {
    if(screen->damage_merge != VTERM_DAMAGE_SCROLL)
      // Avoid an infinite loop
      vterm_screen_flush_damage(screen);

    if((*screen->callbacks->moverect)(dest, src, screen->cbdata))
      return 1;
  }

  damagerect(screen, dest);

  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%r8), %rax
testq %rax, %rax
je 0x4c4b
cmpq $0x0, 0x8(%rax)
je 0x4c4b
movq %rcx, %r12
movq %rdx, %r13
cmpl $0x3, 0x24(%rbx)
je 0x4c30
movq %rbx, %rdi
callq 0x2040
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %r8
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq *0x8(%rax)
testl %eax, %eax
jne 0x4c59
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5984
movl $0x1, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: vterm_screen_get_attrs_extent
int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs)
{
  ScreenCell *target = getcell(screen, pos.row, pos.col);

  // TODO: bounds check
  extent->start_row = pos.row;
  extent->end_row   = pos.row + 1;

  if(extent->start_col < 0)
    extent->start_col = 0;
  if(extent->end_col < 0)
    extent->end_col = screen->cols;

  int col;

  for(col = pos.col - 1; col >= extent->start_col; col--)
    if(attrs_differ(attrs, target, getcell(screen, pos.row, col)))
      break;
  extent->start_col = col + 1;

  for(col = pos.col + 1; col < extent->end_col; col++)
    if(attrs_differ(attrs, target, getcell(screen, pos.row, col)))
      break;
  extent->end_col = col - 1;

  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0xc(%rsp)
movq %rdx, %r15
movq %rsi, %r14
movq %rdx, %rbp
shrq $0x20, %rbp
testl %r15d, %r15d
js 0x4cf2
xorl %r13d, %r13d
testq %r15, %r15
js 0x4cf5
cmpl %r15d, 0x50(%rdi)
jle 0x4cf5
movl 0x54(%rdi), %eax
cmpl %ebp, %eax
jle 0x4cf2
imull %r15d, %eax
leaq (%rax,%rax,8), %rax
shlq $0x2, %rax
addq 0x70(%rdi), %rax
leaq (,%rbp,8), %rcx
addq %rbp, %rcx
leaq (%rax,%rcx,4), %r13
jmp 0x4cf5
xorl %r13d, %r13d
movl %r15d, (%r14)
leal 0x1(%r15), %eax
movl %eax, 0x4(%r14)
cmpl $0x0, 0x8(%r14)
jns 0x4d0f
movl $0x0, 0x8(%r14)
cmpl $0x0, 0xc(%r14)
jns 0x4d1d
movl 0x54(%rdi), %eax
movl %eax, 0xc(%r14)
movq %rdi, 0x10(%rsp)
movl %ebp, %ebx
movl %ebx, %r12d
cmpl 0x8(%r14), %ebx
jle 0x4d89
leal -0x1(%r12), %ebx
testl %r15d, %r15d
js 0x4d59
testl %r12d, %r12d
jle 0x4d59
movl $0x0, %edx
movq 0x10(%rsp), %rax
cmpl %r15d, 0x50(%rax)
jle 0x4d5b
movq 0x10(%rsp), %rcx
movl 0x54(%rcx), %eax
cmpl %r12d, %eax
jge 0x4d6d
xorl %edx, %edx
movl 0xc(%rsp), %edi
movq %r13, %rsi
callq 0x4e03
testl %eax, %eax
je 0x4d24
jmp 0x4d89
imull %r15d, %eax
leaq (%rax,%rax,8), %rax
shlq $0x2, %rax
addq 0x70(%rcx), %rax
movl %ebx, %ecx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %rdx
jmp 0x4d5b
movl %r12d, 0x8(%r14)
movq 0x10(%rsp), %rbx
movl %ebp, %r12d
leal 0x1(%r12), %ebp
cmpl 0xc(%r14), %ebp
jge 0x4deb
testl %r15d, %r15d
js 0x4dd9
cmpl $-0x1, %r12d
jl 0x4dd9
movl $0x0, %edx
cmpl %r15d, 0x50(%rbx)
jle 0x4ddb
movl 0x54(%rbx), %eax
cmpl %ebp, %eax
jle 0x4dd9
imull %r15d, %eax
leaq (%rax,%rax,8), %rax
shlq $0x2, %rax
addq 0x70(%rbx), %rax
movl %ebp, %ecx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %rdx
jmp 0x4ddb
xorl %edx, %edx
movl 0xc(%rsp), %edi
movq %r13, %rsi
callq 0x4e03
testl %eax, %eax
je 0x4d92
movl %r12d, 0xc(%r14)
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: attrs_differ
static int attrs_differ(VTermAttrMask attrs, ScreenCell *a, ScreenCell *b)
{
  if((attrs & VTERM_ATTR_BOLD_MASK)       && (a->pen.bold != b->pen.bold))
    return 1;
  if((attrs & VTERM_ATTR_UNDERLINE_MASK)  && (a->pen.underline != b->pen.underline))
    return 1;
  if((attrs & VTERM_ATTR_ITALIC_MASK)     && (a->pen.italic != b->pen.italic))
    return 1;
  if((attrs & VTERM_ATTR_BLINK_MASK)      && (a->pen.blink != b->pen.blink))
    return 1;
  if((attrs & VTERM_ATTR_REVERSE_MASK)    && (a->pen.reverse != b->pen.reverse))
    return 1;
  if((attrs & VTERM_ATTR_CONCEAL_MASK)    && (a->pen.conceal != b->pen.conceal))
    return 1;
  if((attrs & VTERM_ATTR_STRIKE_MASK)     && (a->pen.strike != b->pen.strike))
    return 1;
  if((attrs & VTERM_ATTR_FONT_MASK)       && (a->pen.font != b->pen.font))
    return 1;
  if((attrs & VTERM_ATTR_FOREGROUND_MASK) && !vterm_color_is_equal(&a->pen.fg, &b->pen.fg))
    return 1;
  if((attrs & VTERM_ATTR_BACKGROUND_MASK) && !vterm_color_is_equal(&a->pen.bg, &b->pen.bg))
    return 1;
  if((attrs & VTERM_ATTR_SMALL_MASK)    && (a->pen.small != b->pen.small))
    return 1;
  if((attrs & VTERM_ATTR_BASELINE_MASK)    && (a->pen.baseline != b->pen.baseline))
    return 1;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
testb $0x1, %bpl
je 0x4e2a
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testb $0x1, %cl
jne 0x4f4b
testb $0x2, %bpl
je 0x4e45
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testb $0x6, %cl
jne 0x4f4b
testb $0x4, %bpl
je 0x4e60
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testb $0x8, %cl
jne 0x4f4b
testb $0x8, %bpl
je 0x4e7b
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testb $0x10, %cl
jne 0x4f4b
testb $0x10, %bpl
je 0x4e96
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testb $0x20, %cl
jne 0x4f4b
btl $0x9, %ebp
jae 0x4eb1
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testb $0x40, %cl
jne 0x4f4b
testb $0x20, %bpl
je 0x4ec9
movb 0x20(%r14), %cl
movl $0x1, %eax
xorb 0x20(%rbx), %cl
js 0x4f4b
testb $0x40, %bpl
je 0x4ee3
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testl $0xf00, %ecx            # imm = 0xF00
jne 0x4f4b
testb %bpl, %bpl
jns 0x4ef9
leaq 0x18(%rbx), %rdi
leaq 0x18(%r14), %rsi
callq 0x20c0
testl %eax, %eax
je 0x4f46
btl $0x8, %ebp
jae 0x4f10
leaq 0x1c(%rbx), %rdi
leaq 0x1c(%r14), %rsi
callq 0x20c0
testl %eax, %eax
je 0x4f46
btl $0xa, %ebp
jae 0x4f28
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
btl $0xc, %ecx
jb 0x4f4b
btl $0xb, %ebp
jae 0x4f42
movl 0x20(%r14), %ecx
xorl 0x20(%rbx), %ecx
movl $0x1, %eax
testl $0x6000, %ecx           # imm = 0x6000
jne 0x4f4b
xorl %eax, %eax
jmp 0x4f4b
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: vterm_screen_set_default_colors
void vterm_screen_set_default_colors(VTermScreen *screen, const VTermColor *default_fg, const VTermColor *default_bg)
{
  vterm_state_set_default_colors(screen->state, default_fg, default_bg);

  if(default_fg && VTERM_COLOR_IS_DEFAULT_FG(&screen->pen.fg)) {
    screen->pen.fg = *default_fg;
    screen->pen.fg.type = (screen->pen.fg.type & ~VTERM_COLOR_DEFAULT_MASK)
                        | VTERM_COLOR_DEFAULT_FG;
  }

  if(default_bg && VTERM_COLOR_IS_DEFAULT_BG(&screen->pen.bg)) {
    screen->pen.bg = *default_bg;
    screen->pen.bg.type = (screen->pen.bg.type & ~VTERM_COLOR_DEFAULT_MASK)
                        | VTERM_COLOR_DEFAULT_BG;
  }

  reset_default_colours(screen, screen->buffers[0]);
  if(screen->buffers[1])
    reset_default_colours(screen, screen->buffers[1]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x21e0
testq %r15, %r15
je 0x4f91
testb $0x2, 0x80(%rbx)
je 0x4f91
movl (%r15), %eax
movl %eax, 0x80(%rbx)
andb $-0x7, %al
orb $0x2, %al
movb %al, 0x80(%rbx)
testq %r14, %r14
je 0x4fb2
testb $0x4, 0x84(%rbx)
je 0x4fb2
movl (%r14), %eax
movl %eax, 0x84(%rbx)
andb $-0x7, %al
orb $0x4, %al
movb %al, 0x84(%rbx)
movq 0x60(%rbx), %rsi
movq %rbx, %rdi
callq 0x4fd7
movq 0x68(%rbx), %rsi
testq %rsi, %rsi
je 0x4fd1
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4fd7
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: reset_default_colours
static void reset_default_colours(VTermScreen *screen, ScreenCell *buffer)
{
  for(int row = 0; row <= screen->rows - 1; row++)
    for(int col = 0; col <= screen->cols - 1; col++) {
      ScreenCell *cell = &buffer[row * screen->cols + col];
      if(VTERM_COLOR_IS_DEFAULT_FG(&cell->pen.fg))
        cell->pen.fg = screen->pen.fg;
      if(VTERM_COLOR_IS_DEFAULT_BG(&cell->pen.bg))
        cell->pen.bg = screen->pen.bg;
    }
}

// Assembly:
cmpl $0x0, 0x50(%rdi)
jle 0x502e
xorl %eax, %eax
movl 0x54(%rdi), %edx
testl %edx, %edx
jle 0x5027
xorl %ecx, %ecx
imull %eax, %edx
movslq %edx, %rdx
addq %rcx, %rdx
leaq (%rdx,%rdx,8), %rdx
leaq (%rsi,%rdx,4), %rdx
addq $0x18, %rdx
testb $0x2, (%rdx)
je 0x500c
movl 0x80(%rdi), %r8d
movl %r8d, (%rdx)
testb $0x4, 0x4(%rdx)
je 0x501d
movl 0x84(%rdi), %r8d
movl %r8d, 0x4(%rdx)
movl 0x54(%rdi), %edx
incq %rcx
cmpl %edx, %ecx
jl 0x4fe8
incl %eax
cmpl 0x50(%rdi), %eax
jl 0x4fdf
retq
// File: /workspace/github_c_makefile_star2_O1/neovim[P]libvterm/src/screen.c
// Function: putglyph
static int putglyph(VTermGlyphInfo *info, VTermPos pos, void *user)
{
  VTermScreen *screen = user;
  ScreenCell *cell = getcell(screen, pos.row, pos.col);

  if(!cell)
    return 0;

  int i;
  for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && info->chars[i]; i++) {
    cell->chars[i] = info->chars[i];
    cell->pen = screen->pen;
  }
  if(i < VTERM_MAX_CHARS_PER_CELL)
    cell->chars[i] = 0;

  for(int col = 1; col < info->width; col++)
    getcell(screen, pos.row, pos.col + col)->chars[0] = (uint32_t)-1;

  VTermRect rect = {
    .start_row = pos.row,
    .end_row   = pos.row+1,
    .start_col = pos.col,
    .end_col   = pos.col+info->width,
  };

  cell->pen.protected_cell = info->protected_cell;
  cell->pen.dwl            = info->dwl;
  cell->pen.dhl            = info->dhl;

  damagerect(screen, rect);

  return 1;
}

// Assembly:
movq %rsi, %r9
shrq $0x20, %r9
xorl %eax, %eax
testl %esi, %esi
js 0x5121
xorl %r8d, %r8d
testq %rsi, %rsi
js 0x5124
cmpl %esi, 0x50(%rdx)
jle 0x5124
movl 0x54(%rdx), %ecx
cmpl %r9d, %ecx
jle 0x5121
imull %esi, %ecx
leaq (%rcx,%rcx,8), %rcx
shlq $0x2, %rcx
addq 0x70(%rdx), %rcx
leaq (%r9,%r9,8), %r8
leaq (%rcx,%r8,4), %r8
jmp 0x5124
xorl %r8d, %r8d
testq %r8, %r8
je 0x5232
pushq %rax
leaq 0x18(%r8), %rax
leaq 0x80(%rdx), %r10
xorl %ecx, %ecx
movq (%rdi), %r11
movl (%r11,%rcx,4), %r11d
testl %r11d, %r11d
je 0x5164
movl %r11d, (%r8,%rcx,4)
movl 0x8(%r10), %r11d
movl %r11d, 0x8(%rax)
movq (%r10), %r11
movq %r11, (%rax)
incq %rcx
cmpq $0x6, %rcx
jne 0x513b
jmp 0x516c
movl $0x0, (%r8,%rcx,4)
movl 0x8(%rdi), %eax
cmpl $0x2, %eax
jl 0x51b2
movq 0x70(%rdx), %rax
movq %rsi, %rcx
sarq $0x20, %rcx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %rcx
addq $0x24, %rcx
movl $0x1, %r10d
movl 0x54(%rdx), %eax
imull %esi, %eax
leaq (%rax,%rax,8), %rax
movl $0xffffffff, (%rcx,%rax,4) # imm = 0xFFFFFFFF
incq %r10
movslq 0x8(%rdi), %rax
addq $0x24, %rcx
cmpq %rax, %r10
jl 0x5191
movl %esi, %ecx
shlq $0x20, %rsi
orq %rcx, %rsi
movabsq $0x100000000, %rcx      # imm = 0x100000000
addq %rsi, %rcx
addl %r9d, %eax
shlq $0x20, %rax
orq %r9, %rax
movzbl 0xc(%rdi), %esi
andl $0x1, %esi
shll $0xf, %esi
movl $0xffff7fff, %r9d       # imm = 0xFFFF7FFF
andl 0x20(%r8), %r9d
orl %esi, %r9d
movl %r9d, 0x20(%r8)
movl 0xc(%rdi), %esi
andl $0x2, %esi
shll $0xf, %esi
andl $0xfffeffff, %r9d       # imm = 0xFFFEFFFF
orl %esi, %r9d
movl %r9d, 0x20(%r8)
movl 0xc(%rdi), %esi
andl $0xc, %esi
shll $0xf, %esi
andl $0xfff9ffff, %r9d       # imm = 0xFFF9FFFF
orl %esi, %r9d
movl %r9d, 0x20(%r8)
movq %rdx, %rdi
movq %rcx, %rsi
movq %rax, %rdx
callq 0x5984
movl $0x1, %eax
addq $0x8, %rsp
retq