// File: tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::Reader::decodeUnicodeEscapeSequence(Json::Reader::Token&, char const*&, char const*, unsigned int&)
bool Reader::decodeUnicodeEscapeSequence(Token& token,
                                         Location& current,
                                         Location end,
                                         unsigned int& ret_unicode) {
  if (end - current < 4)
    return addError(
        "Bad unicode escape sequence in string: four digits expected.",
        token,
        current);
  int unicode = 0;
  for (int index = 0; index < 4; ++index) {
    Char c = *current++;
    unicode *= 16;
    if (c >= '0' && c <= '9')
      unicode += c - '0';
    else if (c >= 'a' && c <= 'f')
      unicode += c - 'a' + 10;
    else if (c >= 'A' && c <= 'F')
      unicode += c - 'A' + 10;
    else
      return addError(
          "Bad unicode escape sequence in string: hexadecimal digit expected.",
          token,
          current);
  }
  ret_unicode = static_cast<unsigned int>(unicode);
  return true;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xb8(%rsp)
movq %rsi, 0xb0(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rcx, 0xa0(%rsp)
movq %r8, 0x98(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xa0(%rsp), %rax
movq 0xa8(%rsp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
cmpq $0x4, %rax
jge 0xe3fc8
leaq 0x77(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x12c30
movq 0x20(%rsp), %rdx
leaq 0x86543(%rip), %rsi     # 0x16a47a
leaq 0x78(%rsp), %rdi
callq 0x22830
jmp 0xe3f43
movq 0x28(%rsp), %rdi
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
leaq 0x78(%rsp), %rsi
callq 0xe0aa0
movb %al, 0x1f(%rsp)
jmp 0xe3f6b
movb 0x1f(%rsp), %al
andb $0x1, %al
movb %al, 0xc7(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x12430
leaq 0x77(%rsp), %rdi
callq 0x12760
jmp 0xe415c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
jmp 0xe3fb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x12430
leaq 0x77(%rsp), %rdi
callq 0x12760
jmp 0xe416d
movl $0x0, 0x60(%rsp)
movl $0x0, 0x5c(%rsp)
cmpl $0x4, 0x5c(%rsp)
jge 0xe4146
movq 0xa8(%rsp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, (%rcx)
movb (%rax), %al
movb %al, 0x5b(%rsp)
movl 0x60(%rsp), %eax
shll $0x4, %eax
movl %eax, 0x60(%rsp)
movsbl 0x5b(%rsp), %eax
cmpl $0x30, %eax
jl 0xe4032
movsbl 0x5b(%rsp), %eax
cmpl $0x39, %eax
jg 0xe4032
movsbl 0x5b(%rsp), %eax
subl $0x30, %eax
addl 0x60(%rsp), %eax
movl %eax, 0x60(%rsp)
jmp 0xe4134
movsbl 0x5b(%rsp), %eax
cmpl $0x61, %eax
jl 0xe405e
movsbl 0x5b(%rsp), %eax
cmpl $0x66, %eax
jg 0xe405e
movsbl 0x5b(%rsp), %eax
subl $0x61, %eax
addl $0xa, %eax
addl 0x60(%rsp), %eax
movl %eax, 0x60(%rsp)
jmp 0xe4132
movsbl 0x5b(%rsp), %eax
cmpl $0x41, %eax
jl 0xe408a
movsbl 0x5b(%rsp), %eax
cmpl $0x46, %eax
jg 0xe408a
movsbl 0x5b(%rsp), %eax
subl $0x41, %eax
addl $0xa, %eax
addl 0x60(%rsp), %eax
movl %eax, 0x60(%rsp)
jmp 0xe4130
leaq 0x37(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x12c30
movq 0x10(%rsp), %rdx
leaq 0x86412(%rip), %rsi     # 0x16a4b7
leaq 0x38(%rsp), %rdi
callq 0x22830
jmp 0xe40b1
movq 0x28(%rsp), %rdi
movq 0xb0(%rsp), %rdx
movq 0xa8(%rsp), %rax
movq (%rax), %rcx
leaq 0x38(%rsp), %rsi
callq 0xe0aa0
movb %al, 0xf(%rsp)
jmp 0xe40d9
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0xc7(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x12430
leaq 0x37(%rsp), %rdi
callq 0x12760
jmp 0xe415c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
jmp 0xe4124
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x12430
leaq 0x37(%rsp), %rdi
callq 0x12760
jmp 0xe416d
jmp 0xe4132
jmp 0xe4134
jmp 0xe4136
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0xe3fd8
movl 0x60(%rsp), %ecx
movq 0x98(%rsp), %rax
movl %ecx, (%rax)
movb $0x1, 0xc7(%rsp)
movb 0xc7(%rsp), %al
andb $0x1, %al
addq $0xc8, %rsp
retq
movq 0x68(%rsp), %rdi
callq 0x12c20
nopw (%rax,%rax)