// File: 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:
subq $0x418, %rsp            # imm = 0x418
movq %rdi, 0x50(%rsp)
movq %rdi, %rax
movq %rax, 0x58(%rsp)
movq %rdi, 0x410(%rsp)
movq %rsi, 0x408(%rsp)
movq 0x408(%rsp), %rax
movq %rax, 0x400(%rsp)
movq 0x400(%rsp), %rdi
callq 0xc6d0
movq %rax, 0x3f8(%rsp)
movq 0x400(%rsp), %rdi
callq 0xcd90
movq %rax, 0x3f0(%rsp)
leaq 0x3f8(%rsp), %rdi
leaq 0x3f0(%rsp), %rsi
callq 0x736e0
testb $0x1, %al
jne 0x4324c
jmp 0x4342f
leaq 0x3f8(%rsp), %rdi
callq 0x73720
movb (%rax), %al
movb %al, 0x3ef(%rsp)
xorl %esi, %esi
movl $0x20, %edx
movsbl 0x3ef(%rsp), %edi
callq 0x73b80
testb $0x1, %al
jne 0x4327f
jmp 0x4341b
movb $0x1, 0x34f(%rsp)
movl $0x10, %edi
callq 0xc3b0
movq %rax, 0x40(%rsp)
leaq 0x387(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xcd00
movq 0x48(%rsp), %rdx
leaq 0x8a9e6(%rip), %rsi     # 0xcdc9a
leaq 0x388(%rsp), %rdi
callq 0x29fd0
jmp 0x432c3
leaq 0x8a9fc(%rip), %rdx     # 0xcdcc6
leaq 0x3a8(%rsp), %rdi
leaq 0x388(%rsp), %rsi
callq 0x2a2f0
jmp 0x432e1
movsbl 0x3ef(%rsp), %esi
leaq 0x350(%rsp), %rdi
callq 0x2ff40
jmp 0x432f8
leaq 0x3c8(%rsp), %rdi
leaq 0x3a8(%rsp), %rsi
leaq 0x350(%rsp), %rdx
callq 0x2dde0
jmp 0x43317
movq 0x40(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0xcbb0
jmp 0x4332b
movq 0x40(%rsp), %rdi
movb $0x0, 0x34f(%rsp)
movq 0xc2cb1(%rip), %rsi     # 0x105ff0
movq 0xc2c2a(%rip), %rdx     # 0x105f70
callq 0xcc80
jmp 0x43d0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x433f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x433e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x433d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x433cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0x3c8(%rsp), %rdi
callq 0xce98
leaq 0x350(%rsp), %rdi
callq 0xce98
leaq 0x3a8(%rsp), %rdi
callq 0xce98
leaq 0x388(%rsp), %rdi
callq 0xce98
leaq 0x387(%rsp), %rdi
callq 0xc7a0
testb $0x1, 0x34f(%rsp)
jne 0x4340c
jmp 0x43416
movq 0x40(%rsp), %rdi
callq 0xc580
jmp 0x43cfd
jmp 0x4341d
leaq 0x3f8(%rsp), %rdi
callq 0x737b0
jmp 0x4322e
movq 0x50(%rsp), %rdi
movb $0x0, 0x34e(%rsp)
callq 0xca10
movq $0x2, 0x340(%rsp)
movq $-0x1, 0x338(%rsp)
movb $0x0, 0x337(%rsp)
movq 0x408(%rsp), %rax
movq %rax, 0x328(%rsp)
movq 0x328(%rsp), %rdi
callq 0xc6d0
movq %rax, 0x320(%rsp)
movq 0x328(%rsp), %rdi
callq 0xcd90
movq %rax, 0x318(%rsp)
leaq 0x320(%rsp), %rdi
leaq 0x318(%rsp), %rsi
callq 0x736e0
testb $0x1, %al
jne 0x434b9
jmp 0x43cca
leaq 0x320(%rsp), %rdi
callq 0x73720
movb (%rax), %al
movb %al, 0x317(%rsp)
cmpq $-0x1, 0x338(%rsp)
jne 0x43529
movsbl 0x317(%rsp), %eax
cmpl $0x25, %eax
jne 0x434f5
movq $0x0, 0x338(%rsp)
jmp 0x43524
movq 0x50(%rsp), %rdi
movsbl 0x317(%rsp), %esi
callq 0xc4c0
jmp 0x43509
jmp 0x43524
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43cf3
jmp 0x43cb6
callq 0xc090
movl $0x0, (%rax)
cmpq $0x2, 0x338(%rsp)
jb 0x437ca
callq 0xc8c0
cmpl $0x0, %eax
jne 0x437c0
leaq 0x26f(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0xcd00
movq 0x38(%rsp), %rdx
leaq 0x8a4aa(%rip), %rsi     # 0xcda19
leaq 0x270(%rsp), %rdi
callq 0x29fd0
jmp 0x4357e
leaq 0x248(%rsp), %rdi
movl $0x47f, %esi            # imm = 0x47F
callq 0x2ded0
jmp 0x43592
leaq 0x290(%rsp), %rdi
leaq 0x270(%rsp), %rsi
leaq 0x248(%rsp), %rdx
callq 0x2dde0
jmp 0x435b1
leaq 0x885e9(%rip), %rdx     # 0xcbba1
leaq 0x2b0(%rsp), %rdi
leaq 0x290(%rsp), %rsi
callq 0x2a2f0
jmp 0x435cf
leaq 0x207(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0xcd00
movq 0x30(%rsp), %rdx
leaq 0x8a6ad(%rip), %rsi     # 0xcdc9a
leaq 0x208(%rsp), %rdi
callq 0x29fd0
jmp 0x435fc
leaq 0x8a413(%rip), %rdx     # 0xcda16
leaq 0x228(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x2a2f0
jmp 0x4361a
leaq 0x2d0(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
leaq 0x228(%rsp), %rdx
callq 0x2dde0
jmp 0x43639
leaq 0x8a6a2(%rip), %rdx     # 0xcdce2
leaq 0x2f0(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
callq 0x2a2f0
jmp 0x43657
leaq 0x2f0(%rsp), %rdi
callq 0x3e9b0
jmp 0x43666
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x437ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x437a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43794
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43787
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x4376d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43760
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43753
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43746
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0x2f0(%rsp), %rdi
callq 0xce98
leaq 0x2d0(%rsp), %rdi
callq 0xce98
leaq 0x228(%rsp), %rdi
callq 0xce98
leaq 0x208(%rsp), %rdi
callq 0xce98
leaq 0x207(%rsp), %rdi
callq 0xc7a0
leaq 0x2b0(%rsp), %rdi
callq 0xce98
leaq 0x290(%rsp), %rdi
callq 0xce98
leaq 0x248(%rsp), %rdi
callq 0xce98
leaq 0x270(%rsp), %rdi
callq 0xce98
leaq 0x26f(%rsp), %rdi
callq 0xc7a0
jmp 0x43cf3
movl $0x1, %edi
callq 0xc8d0
movsbl 0x317(%rsp), %edi
callq 0x73bd0
movb %al, 0x2f(%rsp)
jmp 0x437dd
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x43987
jmp 0x437eb
movb $0x1, 0x177(%rsp)
movl $0x10, %edi
callq 0xc3b0
movq %rax, 0x18(%rsp)
leaq 0x19f(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xcd00
movq 0x20(%rsp), %rdx
leaq 0x8a47a(%rip), %rsi     # 0xcdc9a
leaq 0x1a0(%rsp), %rdi
callq 0x29fd0
jmp 0x4382f
leaq 0x8a4c2(%rip), %rdx     # 0xcdcf8
leaq 0x1c0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x2a2f0
jmp 0x4384d
movsbl 0x317(%rsp), %esi
leaq 0x178(%rsp), %rdi
callq 0x2ded0
jmp 0x43864
leaq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
leaq 0x178(%rsp), %rdx
callq 0x2dde0
jmp 0x43883
movq 0x18(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0xcbb0
jmp 0x43897
movq 0x18(%rsp), %rdi
movb $0x0, 0x177(%rsp)
movq 0xc2745(%rip), %rsi     # 0x105ff0
movq 0xc26be(%rip), %rdx     # 0x105f70
callq 0xcc80
jmp 0x43d0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x4395f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43952
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43945
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43938
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0x1e0(%rsp), %rdi
callq 0xce98
leaq 0x178(%rsp), %rdi
callq 0xce98
leaq 0x1c0(%rsp), %rdi
callq 0xce98
leaq 0x1a0(%rsp), %rdi
callq 0xce98
leaq 0x19f(%rsp), %rdi
callq 0xc7a0
testb $0x1, 0x177(%rsp)
jne 0x43978
jmp 0x43982
movq 0x18(%rsp), %rdi
callq 0xc580
jmp 0x43cf3
movzbl 0x337(%rsp), %eax
movl %eax, 0x10(%rsp)
movsbl 0x317(%rsp), %edi
callq 0x73c20
movb %al, 0x17(%rsp)
jmp 0x439a6
movl 0x10(%rsp), %eax
movb 0x17(%rsp), %cl
movzbl %cl, %ecx
addl %ecx, %eax
movb %al, 0x337(%rsp)
cmpq $0x0, 0x338(%rsp)
jne 0x43c6d
callq 0xc090
movl $0x0, (%rax)
movzbl 0x337(%rsp), %eax
cmpl $0x10, %eax
jl 0x43c5b
callq 0xc8c0
cmpl $0x0, %eax
jne 0x43c51
leaq 0xcf(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xcd00
movq 0x8(%rsp), %rdx
leaq 0x8a008(%rip), %rsi     # 0xcda19
leaq 0xd0(%rsp), %rdi
callq 0x29fd0
jmp 0x43a20
leaq 0xa8(%rsp), %rdi
movl $0x485, %esi            # imm = 0x485
callq 0x2ded0
jmp 0x43a34
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x2dde0
jmp 0x43a53
leaq 0x88147(%rip), %rdx     # 0xcbba1
leaq 0x110(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x2a2f0
jmp 0x43a71
leaq 0x67(%rsp), %rdi
movq %rdi, (%rsp)
callq 0xcd00
movq (%rsp), %rdx
leaq 0x8a210(%rip), %rsi     # 0xcdc9a
leaq 0x68(%rsp), %rdi
callq 0x29fd0
jmp 0x43a96
leaq 0x89f79(%rip), %rdx     # 0xcda16
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x2a2f0
jmp 0x43ab1
leaq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x2dde0
jmp 0x43ad0
leaq 0x8a23f(%rip), %rdx     # 0xcdd16
leaq 0x150(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x2a2f0
jmp 0x43aee
leaq 0x150(%rsp), %rdi
callq 0x3e9b0
jmp 0x43afd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43c3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43c32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43c25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43c18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43c01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43bf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43bea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x43bdd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0x150(%rsp), %rdi
callq 0xce98
leaq 0x130(%rsp), %rdi
callq 0xce98
leaq 0x88(%rsp), %rdi
callq 0xce98
leaq 0x68(%rsp), %rdi
callq 0xce98
leaq 0x67(%rsp), %rdi
callq 0xc7a0
leaq 0x110(%rsp), %rdi
callq 0xce98
leaq 0xf0(%rsp), %rdi
callq 0xce98
leaq 0xa8(%rsp), %rdi
callq 0xce98
leaq 0xd0(%rsp), %rdi
callq 0xce98
leaq 0xcf(%rsp), %rdi
callq 0xc7a0
jmp 0x43cf3
movl $0x1, %edi
callq 0xc8d0
movzbl 0x337(%rsp), %eax
shll $0x4, %eax
movb %al, 0x337(%rsp)
movq 0x338(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x338(%rsp)
cmpq $0x2, 0x338(%rsp)
jne 0x43cb4
movq 0x50(%rsp), %rdi
movsbl 0x337(%rsp), %esi
callq 0xc4c0
jmp 0x43ca0
movq $-0x1, 0x338(%rsp)
movb $0x0, 0x337(%rsp)
jmp 0x43cb6
jmp 0x43cb8
leaq 0x320(%rsp), %rdi
callq 0x737b0
jmp 0x4349b
movb $0x1, 0x34e(%rsp)
testb $0x1, 0x34e(%rsp)
jne 0x43ce6
movq 0x50(%rsp), %rdi
callq 0xce98
movq 0x58(%rsp), %rax
addq $0x418, %rsp            # imm = 0x418
retq
movq 0x50(%rsp), %rdi
callq 0xce98
movq 0x378(%rsp), %rdi
callq 0xccf0
nopw (%rax,%rax)