// File: /workspace/github_c_makefile_star2_O0/neovim[P]libvterm/bin/vterm-dump.c
// Function: main
int main(int argc, char *argv[])
{
  int use_colour = isatty(1);

  int opt;
  while((opt = getopt(argc, argv, "c")) != -1) {
    switch(opt) {
      case 'c': use_colour = 1; break;
    }
  }

  const char *file = argv[optind++];

  int fd;
  if(!file || streq(file, "-"))
    fd = 0; // stdin
  else {
    fd = open(file, O_RDONLY);
    if(fd == -1) {
      fprintf(stderr, "Cannot open %s - %s\n", file, strerror(errno));
      exit(1);
    }
  }

  if(use_colour) {
    special_begin = "\x1b[7m{";
    special_end   = "}\x1b[m";
  }

  /* Size matters not for the parser */
  VTerm *vt = vterm_new(25, 80);
  vterm_set_utf8(vt, 1);
  vterm_parser_set_callbacks(vt, &parser_cbs, NULL);
  vterm_parser_set_emit_nul(vt, true);

  int len;
  char buffer[1024];
  while((len = read(fd, buffer, sizeof(buffer))) > 0) {
    vterm_input_write(vt, buffer, len);
  }

  printf("\n");

  close(fd);
  vterm_free(vt);

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, %edi
callq 0x2050
movl %eax, -0x14(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0xd90(%rip), %rdx       # 0x3004
callq 0x2110
movl %eax, -0x18(%rbp)
cmpl $-0x1, %eax
je 0x2294
movl -0x18(%rbp), %eax
subl $0x63, %eax
jne 0x2292
jmp 0x228b
movl $0x1, -0x14(%rbp)
jmp 0x2266
movq -0x10(%rbp), %rax
movq 0x2d39(%rip), %rcx      # 0x4fd8
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movq 0x2d2b(%rip), %rdx      # 0x4fd8
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x22d6
movq -0x20(%rbp), %rdi
leaq 0xd3a(%rip), %rsi       # 0x3006
callq 0x20c0
cmpl $0x0, %eax
jne 0x22df
movl $0x0, -0x24(%rbp)
jmp 0x2348
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x20f0
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
jne 0x2346
movq 0x2cfc(%rip), %rax      # 0x4ff8
movq (%rax), %rax
movq %rax, -0x450(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x448(%rbp)
callq 0x2040
movl (%rax), %edi
callq 0x2130
movq -0x450(%rbp), %rdi
movq -0x448(%rbp), %rdx
movq %rax, %rcx
leaq 0xcd3(%rip), %rsi       # 0x3008
movb $0x0, %al
callq 0x20d0
movl $0x1, %edi
callq 0x2120
jmp 0x2348
cmpl $0x0, -0x14(%rbp)
je 0x236a
leaq 0xcc8(%rip), %rax       # 0x301d
movq %rax, 0x2d54(%rip)      # 0x50b0
leaq 0xcc0(%rip), %rax       # 0x3023
movq %rax, 0x2d4e(%rip)      # 0x50b8
movl $0x19, %edi
movl $0x50, %esi
callq 0x2090
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x2030
movq -0x30(%rbp), %rdi
leaq 0x2d2a(%rip), %rsi      # 0x50c0
xorl %eax, %eax
movl %eax, %edx
callq 0x2070
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x20e0
movl -0x24(%rbp), %edi
leaq -0x440(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x20b0
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
jle 0x23df
movq -0x30(%rbp), %rdi
leaq -0x440(%rbp), %rsi
movslq -0x34(%rbp), %rdx
callq 0x2060
jmp 0x23ad
leaq 0xc35(%rip), %rdi       # 0x301b
movb $0x0, %al
callq 0x2080
movl -0x24(%rbp), %edi
callq 0x20a0
movq -0x30(%rbp), %rdi
callq 0x2100
xorl %eax, %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopl (%rax)