// File: /workspace/github_cpp_makefile_star2_O2/ncbi[P]amr/common.cpp
// Function: Common_sp::unpercent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
string unpercent (const string &s)
{
  for (const char c : s)
  	if (between (c, '\0', ' ') /*! printable (c)*/)
  		throw runtime_error (FUNC "Non-printable character: " + to_string (uint (c)));

  string r;
  constexpr size_t hex_pos_max = 2;
  size_t hex_pos = no_index;
  uchar hex = 0;
  for (const char c : s)
    if (hex_pos == no_index)
    {
      if (c == '%')
        hex_pos = 0;
      else
        r += c;
    }
    else
    {
      ASSERT (hex_pos < hex_pos_max);
      if (! isHex (c))
        throw runtime_error (FUNC "Bad hexadecimal character: " + to_string (c));
      hex = uchar (hex + hex2uchar (c));
      if (! hex_pos)
      {
        ASSERT (hex < 16);
        hex = uchar (hex * 16);
      }
      hex_pos++;
      if (hex_pos == hex_pos_max)
      {
        r += char (hex);
        hex_pos = no_index;
        hex = 0;
      }
    }
      
  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x8(%rsp)
movq (%rsi), %r12
movq 0x8(%rsi), %rcx
xorl %eax, %eax
cmpq %rax, %rcx
je 0x24a9c
movzbl (%r12,%rax), %ebp
incq %rax
cmpl $0x1f, %ebp
ja 0x249ff
pushq $0x10
popq %rdi
callq 0xb300
movq %rax, %rbx
leaq 0x3719b(%rip), %rsi     # 0x5bbc2
leaq 0x30(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x1b7b6
leaq 0x371ae(%rip), %rdx     # 0x5bbee
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1b92d
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
callq 0x1d918
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x1ca3c
movb $0x1, %bpl
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0xb940
xorl %ebp, %ebp
movq 0x5f560(%rip), %rsi     # 0x83fe8
movq 0x5f4d1(%rip), %rdx     # 0x83f60
movq %rbx, %rdi
callq 0xb9d0
jmp 0x24be9
movq %rcx, 0x90(%rsp)
movq 0x8(%rsp), %rcx
leaq 0x10(%rcx), %rax
movq %rax, (%rcx)
andq $0x0, 0x8(%rcx)
movb $0x0, 0x10(%rcx)
pushq $-0x1
popq %r15
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpq %rbx, 0x90(%rsp)
je 0x24b51
movsbl (%r12,%rbx), %ebp
cmpq $-0x1, %r15
je 0x24b16
callq 0xb060
movq %rax, %r14
andl $0x0, (%rax)
movl %ebp, %edi
callq 0x3c424
testb %al, %al
je 0x24b68
movl %ebp, %edi
callq 0x3c456
addb %r13b, %al
testq %r15, %r15
je 0x24b21
movsbl %al, %esi
movq 0x8(%rsp), %rdi
callq 0xb4e0
xorl %r13d, %r13d
pushq $-0x1
popq %r15
jmp 0x24b49
cmpb $0x25, %bpl
jne 0x24b39
xorl %r15d, %r15d
jmp 0x24b49
andl $0x0, (%r14)
cmpb $0x10, %al
jae 0x24be9
shlb $0x4, %al
pushq $0x1
popq %r15
movl %eax, %r13d
jmp 0x24b49
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0xb4e0
pushq $-0x1
popq %r15
incq %rbx
jmp 0x24ac2
movq 0x8(%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0xb300
movq %rax, %r15
leaq 0x37048(%rip), %rsi     # 0x5bbc2
leaq 0x30(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x1b7b6
leaq 0x37077(%rip), %rdx     # 0x5bc0a
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1b92d
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
callq 0x1caa3
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x1ca3c
movb $0x1, %bl
leaq 0x70(%rsp), %rsi
movq %r15, %rdi
callq 0xb940
xorl %ebx, %ebx
movq 0x5f40e(%rip), %rsi     # 0x83fe8
movq 0x5f37f(%rip), %rdx     # 0x83f60
movq %r15, %rdi
callq 0xb9d0
callq 0xb6c0
testl %eax, %eax
jne 0x24cbd
leaq 0x36d44(%rip), %rsi     # 0x5b941
leaq 0x98(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x1b7b6
leaq 0xf8(%rsp), %rdi
movl $0x485, %esi            # imm = 0x485
callq 0x1caa3
leaq 0x10(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x1ca3c
leaq 0x34fa1(%rip), %rdx     # 0x59be3
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1b92d
leaq 0x36f6a(%rip), %rsi     # 0x5bbc2
leaq 0xb8(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0x1b7b6
leaq 0x36ccd(%rip), %rdx     # 0x5b93e
leaq 0xd8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x1b92d
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x1ca3c
leaq 0x36f84(%rip), %rdx     # 0x5bc28
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1b92d
leaq 0x70(%rsp), %rdi
callq 0x224fc
pushq $0x1
popq %rdi
callq 0xb6d0
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0xbb68
jmp 0x24cd7
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0xbb68
jmp 0x24ce6
movq %rax, %r14
leaq 0xd8(%rsp), %rdi
callq 0xbb68
jmp 0x24cf8
movq %rax, %r14
leaq 0xb8(%rsp), %rdi
callq 0xbb68
jmp 0x24d0a
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0xbb68
jmp 0x24d19
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0xbb68
jmp 0x24d28
movq %rax, %r14
leaq 0xf8(%rsp), %rdi
callq 0xbb68
jmp 0x24d3a
movq %rax, %r14
leaq 0x98(%rsp), %rdi
callq 0xbb68
jmp 0x24dfe
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0xbb68
jmp 0x24d60
movq %rax, %r14
movb $0x1, %bl
leaq 0x10(%rsp), %rdi
callq 0xbb68
jmp 0x24d97
jmp 0x24dfb
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0xbb68
jmp 0x24d86
movq %rax, %r14
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0xbb68
jmp 0x24da9
movq %rax, %r14
movb $0x1, %bl
leaq 0x50(%rsp), %rdi
callq 0xbb68
jmp 0x24dba
movq %rax, %r14
movb $0x1, %bpl
leaq 0x50(%rsp), %rdi
callq 0xbb68
jmp 0x24dd0
movq %rax, %r14
movb $0x1, %bl
leaq 0x30(%rsp), %rdi
callq 0xbb68
testb %bl, %bl
jne 0x24de4
jmp 0x24dfe
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0xbb68
testb %bpl, %bpl
jne 0x24df1
jmp 0x24e08
movq %rax, %r14
movq %r15, %rdi
callq 0xb470
jmp 0x24dfe
movq %rax, %r14
movq %rbx, %rdi
callq 0xb470
jmp 0x24e08
movq %rax, %r14
movq 0x8(%rsp), %rdi
callq 0xbb68
movq %r14, %rdi
callq 0xba30