// File: /workspace/github_c_makefile_star2_O0/mikeakohn[P]print_pe/build/../src/demangle.c
// Function: demangle_params
static int demangle_params(
  const char *name,
  char *params,
  char *return_type,
  int offset,
  int length)
{
  int count = 0;

  if (offset < length) { params[offset++] = '('; }

  if (name[0] == 'Y' && name[1] == 'A')
  {
    name += 2;

    while (offset < length)
    {
      if (*name == 0 || *name == '@') { break; }

      const char *type = NULL;
      uint8_t underline = 0;

      if (*name == '_')
      {
        underline = 1;
        name++;
      }

      // FIXME: Not sure why some functions end with @Z and some just
      // have a Z.
      uint8_t last = 0;
      if (name[1] == '@') { last = 1; }
      if (name[1] == 'Z' && name[2] == 0) { last = 1; }

      if (offset < length && count != 0 && last == 0)
      {
        params[offset++] = ',';
      }

      if (underline == 0)
      {
        switch (*name)
        {
          case 'C': type = "int8_t";        break;
          case 'D': type = "char";          break;
          case 'E': type = "uint8_t";       break;
          case 'F': type = "int16_t";       break;
          case 'G': type = "uint16_t";      break;
          case 'H': type = "int";           break;
          case 'I': type = "uint32_t";      break;
          case 'J': type = "long";          break;
          case 'K': type = "unsigned long"; break;
          case 'M': type = "float";         break;
          case 'N': type = "double";        break;
          case 'O': type = "long double";   break;
          case 'P': type = "???";           break;
          case 'Q': type = "???";           break;
          case 'V': type = "???";           break;
          case 'X': type = "void";          break;
          case 'Z': type = "...";           break;
          default: type = "???";            break;
        }
      }
        else
      {
        switch (*name)
        {
          case '$': type = "__w64";             break;
          case 'D': type = "__int8";            break;
          case 'E': type = "uint8_t";           break;
          case 'F': type = "__int16";           break;
          case 'G': type = "uint16_t";          break;
          case 'H': type = "__int32";           break;
          case 'I': type = "uint32_t";          break;
          case 'J': type = "__int64";           break;
          case 'K': type = "uint64_t";          break;
          case 'L': type = "__int128";          break;
          case 'M': type = "unsigned __int128"; break;
          case 'N': type = "bool";              break;
          case 'O': type = "???";               break;
          case 'P': type = "???";               break;
          case 'Q': type = "???";               break;
          case 'S': type = "char_16_t";         break;
          case 'U': type = "char32_t";          break;
          case 'W': type = "wchar_t";           break;
          case 'X':
          case 'Z': type = "...";           break;
          default: type = "???";            break;
        }
      }

      if (type != NULL)
      {
        if (last == 0)
        {
          offset = demangle_insert_name(type, params, offset, length);
        }
          else
        {
          demangle_insert_name(type, return_type, 0, length);
        }
      }

      if (last == 1) { break; }

      name++;
      count++;
    }
  }
    else
  {
    if (offset < length) { params[offset++] = '?'; }
  }

  if (offset < length) { params[offset++] = ')'; }
  if (offset < length) { params[offset] = 0; }

  return offset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2880
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
movb $0x28, (%rax,%rcx)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x59, %eax
jne 0x2c4f
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x41, %eax
jne 0x2c4f
movq -0x8(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x8(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2c4d
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x28d1
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x40, %eax
jne 0x28d6
jmp 0x2c4d
movq $0x0, -0x30(%rbp)
movb $0x0, -0x31(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
jne 0x28fe
movb $0x1, -0x31(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movb $0x0, -0x32(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x40, %eax
jne 0x2913
movb $0x1, -0x32(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x5a, %eax
jne 0x2931
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x2931
movb $0x1, -0x32(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x295e
cmpl $0x0, -0x24(%rbp)
je 0x295e
movzbl -0x32(%rbp), %eax
cmpl $0x0, %eax
jne 0x295e
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
movb $0x2c, (%rax,%rcx)
movzbl -0x31(%rbp), %eax
cmpl $0x0, %eax
jne 0x2a9d
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
addl $-0x43, %eax
movl %eax, %ecx
movq %rcx, -0x40(%rbp)
subl $0x17, %eax
ja 0x2a8d
movq -0x40(%rbp), %rax
leaq 0x3d85(%rip), %rcx      # 0x6714
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3e02(%rip), %rax      # 0x67a1
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3dec(%rip), %rax      # 0x679b
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3de1(%rip), %rax      # 0x67a0
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3dda(%rip), %rax      # 0x67a9
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3dc9(%rip), %rax      # 0x67a8
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3dc2(%rip), %rax      # 0x67b1
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3db6(%rip), %rax      # 0x67b5
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3db8(%rip), %rax      # 0x67c7
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d9f(%rip), %rax      # 0x67be
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3da0(%rip), %rax      # 0x67cc
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d9e(%rip), %rax      # 0x67d7
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d8c(%rip), %rax      # 0x67d2
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d8b(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d7e(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d71(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d68(%rip), %rax      # 0x67e2
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d60(%rip), %rax      # 0x67e7
movq %rax, -0x30(%rbp)
jmp 0x2a98
leaq 0x3d4a(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2bec
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
addl $-0x24, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x36, %eax
ja 0x2bdf
movq -0x48(%rbp), %rax
leaq 0x3b77(%rip), %rcx      # 0x6638
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3d1a(%rip), %rax      # 0x67eb
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3d10(%rip), %rax      # 0x67f1
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3caf(%rip), %rax      # 0x67a0
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3cf7(%rip), %rax      # 0x67f8
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c97(%rip), %rax      # 0x67a8
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3cdf(%rip), %rax      # 0x6800
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c84(%rip), %rax      # 0x67b5
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3cc7(%rip), %rax      # 0x6808
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3cbf(%rip), %rax      # 0x6810
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3cc1(%rip), %rax      # 0x6822
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3ca8(%rip), %rax      # 0x6819
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3cad(%rip), %rax      # 0x682b
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c53(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c46(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c39(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c7e(%rip), %rax      # 0x6830
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c7b(%rip), %rax      # 0x683a
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c77(%rip), %rax      # 0x6843
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3c0e(%rip), %rax      # 0x67e7
movq %rax, -0x30(%rbp)
jmp 0x2bea
leaq 0x3bf8(%rip), %rax      # 0x67de
movq %rax, -0x30(%rbp)
jmp 0x2bec
cmpq $0x0, -0x30(%rbp)
je 0x2c28
movzbl -0x32(%rbp), %eax
cmpl $0x0, %eax
jne 0x2c14
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
callq 0x2710
movl %eax, -0x1c(%rbp)
jmp 0x2c26
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %ecx
xorl %edx, %edx
callq 0x2710
jmp 0x2c28
movzbl -0x32(%rbp), %eax
cmpl $0x1, %eax
jne 0x2c33
jmp 0x2c4d
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x28ad
jmp 0x2c6f
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2c6d
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
movb $0x3f, (%rax,%rcx)
jmp 0x2c6f
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2c8d
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
movb $0x29, (%rax,%rcx)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x2ca1
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x1c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)