// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq 0x8(%rsi), %r13
testq %r13, %r13
je 0x394b6
movq (%rsi), %r15
xorl %eax, %eax
movzbl (%r15,%rax), %ebp
cmpl $0x1f, %ebp
jbe 0x394e3
incq %rax
cmpq %rax, %r13
jne 0x3938e
leaq 0x10(%r12), %rax
movq %rax, 0x68(%rsp)
movq %rax, (%r12)
movq $0x0, 0x8(%r12)
movb $0x0, 0x10(%r12)
testq %r13, %r13
je 0x394ce
movq $-0x1, %r14
xorl %ebx, %ebx
movl $0x0, 0x4(%rsp)
movq %r12, 0x70(%rsp)
movsbl (%r15,%rbx), %ebp
cmpq $-0x1, %r14
je 0x39414
callq 0xa070
movl $0x0, (%rax)
movl $0xb, %edx
leaq 0x55a94(%rip), %rdi     # 0x8ee96
movl %ebp, %esi
callq 0xa610
testq %rax, %rax
je 0x39422
addb $-0x30, %bpl
jmp 0x39456
cmpb $0x25, %bpl
jne 0x39497
xorl %r14d, %r14d
jmp 0x394a8
movl %ebp, %edi
callq 0xaa60
movl %eax, %r12d
movsbl %r12b, %esi
movl $0x7, %edx
leaq 0x55a80(%rip), %rdi     # 0x8eebc
callq 0xa610
testq %rax, %rax
je 0x3954c
addb $-0x37, %r12b
movl %r12d, %ebp
movq 0x70(%rsp), %r12
addb 0x4(%rsp), %bpl
testq %r14, %r14
je 0x3947d
movsbl %bpl, %esi
movq %r12, %rdi
callq 0xa4d0
movq $-0x1, %r14
movl $0x0, 0x4(%rsp)
jmp 0x394a8
cmpb $0x10, %bpl
jae 0x395b5
shlb $0x4, %bpl
movl $0x1, %r14d
movl %ebp, 0x4(%rsp)
jmp 0x394a8
movq $-0x1, %r14
movq %r12, %rdi
movl %ebp, %esi
callq 0xa4d0
incq %rbx
cmpq %rbx, %r13
jne 0x393e0
jmp 0x394ce
leaq 0x10(%r12), %rax
movq %rax, (%r12)
movq $0x0, 0x8(%r12)
movb $0x0, 0x10(%r12)
movq %r12, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0xa2c0
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x536b7(%rip), %rsi     # 0x8cbb7
leaq 0x536db(%rip), %rdx     # 0x8cbe2
leaq 0x8(%rsp), %rdi
callq 0x2fa1a
leaq 0x536cb(%rip), %rsi     # 0x8cbe3
leaq 0x8(%rsp), %rdi
callq 0xaac0
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x39650
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x3965d
movl $0x10, %edi
callq 0xa2c0
movq %rax, %r15
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x5364d(%rip), %rsi     # 0x8cbb7
leaq 0x53671(%rip), %rdx     # 0x8cbe2
leaq 0x8(%rsp), %rdi
callq 0x2fa1a
leaq 0x5367d(%rip), %rsi     # 0x8cbff
leaq 0x8(%rsp), %rdi
callq 0xaac0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x396c9
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x396d6
callq 0xa6b0
testl %eax, %eax
jne 0x396bf
leaq 0xe8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x53361(%rip), %rsi     # 0x8c936
leaq 0x5336d(%rip), %rdx     # 0x8c949
leaq 0xd8(%rsp), %rdi
callq 0x2fa1a
leaq 0xf8(%rsp), %rdi
movl $0x485, %esi            # imm = 0x485
callq 0x2d1fa
leaq 0x78(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x2d152
leaq 0x515c9(%rip), %rsi     # 0x8abe5
leaq 0x78(%rsp), %rdi
callq 0xaac0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x39735
movups (%rcx), %xmm0
movups %xmm0, (%r12)
jmp 0x39742
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x78(%rsp), %rdi
movl %ebp, %esi
callq 0x646b3
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x2d152
movb $0x1, %bpl
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xa930
xorl %ebp, %ebp
movq 0x7693a(%rip), %rsi     # 0xaffe8
movq 0x768ab(%rip), %rdx     # 0xaff60
movq %rbx, %rdi
callq 0xa9b0
jmp 0x39735
movl $0x1, %edi
callq 0xa6c0
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x78(%rsp), %rdi
movl %ebp, %esi
callq 0x2d1fa
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x2d152
movb $0x1, %bl
leaq 0x48(%rsp), %rsi
movq %r15, %rdi
callq 0xa930
xorl %ebx, %ebx
movq 0x768c2(%rip), %rsi     # 0xaffe8
movq 0x76833(%rip), %rdx     # 0xaff60
movq %r15, %rdi
callq 0xa9b0
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xc8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x5344a(%rip), %rsi     # 0x8cbb7
leaq 0x5346e(%rip), %rdx     # 0x8cbe2
leaq 0xb8(%rsp), %rdi
callq 0x2fa1a
leaq 0x531ab(%rip), %rsi     # 0x8c933
leaq 0xb8(%rsp), %rdi
callq 0xaac0
leaq 0xa8(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x397b8
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
jmp 0x397cb
movq %rdx, 0x98(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa8(%rsp)
movq 0x8(%rax), %rsi
leaq 0x98(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2d152
leaq 0x5341d(%rip), %rsi     # 0x8cc1d
leaq 0x28(%rsp), %rdi
callq 0xaac0
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3982c
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x39839
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0x34fa2
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x39879
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39879
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39899
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39899
movq %rax, %r14
movq 0x98(%rsp), %rdi
cmpq %rbx, %rdi
je 0x398bb
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x398bb
movq %rax, %r14
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x398dd
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x398dd
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x398f9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x398f9
movq %rax, %r14
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3991f
movq 0x88(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3991f
movq %rax, %r14
leaq 0x108(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3998d
movq 0x108(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3998d
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39967
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39967
movq %rax, %r14
movb $0x1, %bl
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x399b8
movq 0x88(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x399b8
movq %rax, %r14
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x39ac0
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39ac0
movq %rax, %r14
movb $0x1, %bl
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x399cf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x399e6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
testb %bl, %bl
jne 0x39a5c
jmp 0x39ac0
jmp 0x39abd
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x39a5c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39a5c
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39a36
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39a36
movq %rax, %r14
movb $0x1, %bpl
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39a6c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39a6c
movq %rax, %r14
movq %r15, %rdi
callq 0xa440
jmp 0x39ac0
movq %rax, %r14
movb $0x1, %bpl
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x39a83
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x39a9a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
testb %bpl, %bpl
jne 0x39ae4
jmp 0x39aec
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x39ae4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39ae4
movq %rax, %r14
movq 0x70(%rsp), %rax
movq (%rax), %rdi
cmpq 0x68(%rsp), %rdi
je 0x39aec
movq 0x68(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0xa5a0
jmp 0x39aec
movq %rax, %r14
movq %rbx, %rdi
callq 0xa440
movq %r14, %rdi
callq 0xaa10