// File: /workspace/github_cpp_makefile_star2_O2/SYZYGYfpga[P]brain-tools/include/json.hpp
// Function: nlohmann::detail::serializer<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>>::throw_if_invalid_utf8(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static void throw_if_invalid_utf8(const std::string& str)
    {
        // start with state 0 (= accept)
        uint8_t state = 0;

        for (size_t i = 0; i < str.size(); ++i)
        {
            const auto byte = static_cast<uint8_t>(str[i]);
            decode(state, byte);
            if (state == 1)
            {
                // state 1 means reject
                std::stringstream ss;
                ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << static_cast<int>(byte);
                JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + ss.str()));
            }
        }

        if (state != 0)
        {
            // we finish reading, but do not accept: string was incomplete
            std::stringstream ss;
            ss << std::setw(2) << std::uppercase << std::setfill('0') << std::hex << static_cast<int>(static_cast<uint8_t>(str.back()));
            JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + ss.str()));
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
xorl %esi, %esi
leaq 0x385c(%rip), %rdx      # 0x9454
xorl %r14d, %r14d
cmpq %r14, %rcx
je 0x5c27
movzbl (%rax,%r14), %r15d
movzbl (%r15,%rdx), %edi
movzbl %sil, %esi
shll $0x4, %esi
addq %rdi, %rsi
movb 0x100(%rsi,%rdx), %sil
cmpb $0x1, %sil
je 0x5c3e
incq %r14
jmp 0x5bfb
testb %sil, %sil
jne 0x5d3b
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa0(%rsp), %rdi
callq 0x3180
leaq 0xb0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rcx
movq $0x2, 0xc0(%rsp,%rcx)
movq -0x18(%rax), %rax
orl $0x4000, 0xc8(%rsp,%rax) # imm = 0x4000
pushq $0x30
popq %rsi
callq 0x3340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movl %r15d, %esi
callq 0x33a0
pushq $0x20
popq %rdi
callq 0x3120
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x6291
leaq 0x27f5(%rip), %rsi      # 0x84b1
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x626d
leaq 0x281b(%rip), %rdx      # 0x84f0
movq %rsp, %rdi
leaq 0x80(%rsp), %rsi
callq 0x624e
leaq 0xb8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x3350
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
leaq 0x40(%rsp), %rdx
callq 0x61e7
movb $0x1, %bpl
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movl $0x13c, %esi            # imm = 0x13C
callq 0x6132
xorl %ebp, %ebp
leaq 0x8021(%rip), %rsi      # 0xdd48
leaq 0xeb4(%rip), %rdx       # 0x6be2
movq %rbx, %rdi
callq 0x3390
jmp 0x5dff
leaq 0xa0(%rsp), %rdi
callq 0x3180
leaq 0xb0(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rcx
movq $0x2, 0xc0(%rsp,%rcx)
movq -0x18(%rax), %rax
orl $0x4000, 0xc8(%rsp,%rax) # imm = 0x4000
pushq $0x30
popq %rsi
callq 0x3340
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
movzbl -0x1(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x33a0
pushq $0x20
popq %rdi
callq 0x3120
movq %rax, %rbx
leaq 0xb8(%rsp), %rsi
movq %rsp, %rdi
callq 0x3350
leaq 0x2709(%rip), %rsi      # 0x84ce
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x626d
movb $0x1, %bpl
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
movl $0x13c, %esi            # imm = 0x13C
callq 0x6132
xorl %ebp, %ebp
leaq 0x7f58(%rip), %rsi      # 0xdd48
leaq 0xdeb(%rip), %rdx       # 0x6be2
movq %rbx, %rdi
callq 0x3390
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x3110
jmp 0x5e14
movq %rax, %r14
movb $0x1, %bpl
movq %rsp, %rdi
jmp 0x5e6e
jmp 0x5e7a
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x3110
jmp 0x5e30
movq %rax, %r14
movb $0x1, %bpl
leaq 0x40(%rsp), %rdi
callq 0x3110
jmp 0x5e42
movq %rax, %r14
movb $0x1, %bpl
movq %rsp, %rdi
callq 0x3110
jmp 0x5e54
jmp 0x5e87
movq %rax, %r14
movb $0x1, %bpl
leaq 0x80(%rsp), %rdi
callq 0x3110
jmp 0x5e69
movq %rax, %r14
movb $0x1, %bpl
leaq 0x60(%rsp), %rdi
callq 0x3110
testb %bpl, %bpl
jne 0x5e7d
jmp 0x5e8a
movq %rax, %r14
movq %rbx, %rdi
callq 0x3190
jmp 0x5e8a
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
callq 0x31b0
movq %r14, %rdi
callq 0x33b0
nop