// File: /workspace/github_cpp_makefile_star2_O2/oknenavin[P]cxon/test/../src/cxon/lang/cbor/common/sink.hxx
// Function: bool cxon::cbor::imp::sink_reader_<cxon::CBOR<cxon::cbor::format_traits>, cxon::cbor::sink<void> const>::read<unsigned char const*, cxon::context<cxon::CBOR<cxon::cbor::format_traits>>, cxon::CBOR<cxon::cbor::format_traits>>(cxon::cbor::sink<void> const&, unsigned char const*&, unsigned char const*, cxon::context<cxon::CBOR<cxon::cbor::format_traits>>&)
static bool read(S& s, II& i, II e, Cx& cx) {
                    auto t = std::back_inserter(s);
                    auto const b = bio::peek(i, e);
                    unsigned const mjr = b & Y::mjr;
                    unsigned const mnr = b & Y::mnr;
                    switch (mjr) {
                        case Y::pint: case Y::nint: case Y::tag: case Y::svn: {
                            II const o = i;
                            switch (mnr) {
                                case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
                                case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F:
                                case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
                                    return  (bio::get(t, i, e));
                                case 0x18: case 0x19: case 0x1A: case 0x1B:
                                    return  (bio::get(t, i, e, 1 + (1 << (mnr - 0x18)))) ||
                                            (bio::rewind(i, o), cx/cbor::read_error::unexpected)
                                    ;
                                case 0x1C: case 0x1D: case 0x1E: case 0x1F:
                                    return  (bio::rewind(i, o), cx/cbor::read_error::unexpected);
                                default:                                            // LCOV_EXCL_LINE
                                    return  CXON_ASSERT(0, "unexpected"), false;    // LCOV_EXCL_LINE
                            }
                        }
                        case Y::bstr: case Y::tstr: {
                            II const o = i;
                            switch (mnr) {
                                case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
                                case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F:
                                case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
                                    return  (bio::get(t, i, e, 1 + mnr)) ||
                                            (bio::rewind(i, o), cx/cbor::read_error::unexpected)
                                    ;
                                case 0x18: case 0x19: case 0x1A: case 0x1B: {
                                    std::size_t n;
                                    return  (
                                                bio::get(t, i, e) &&
                                                bio::get(n, 1U << (mnr - 0x18), i, e) &&
                                                bio::poke(t, n, 1U << (mnr - 0x18)) &&
                                                bio::get(t, i, e, n)
                                            )   ||
                                            (   bio::rewind(i, o), cx/cbor::read_error::unexpected
                                            )
                                    ;
                                }
                                case 0x1F:
                                    do      (bio::get(t, i, e)); // should not fail
                                    while   (bio::peek(i, e) != Y::brk);
                                    return  (bio::get(t, i, e) || (bio::rewind(i, o), cx/cbor::read_error::unexpected));
                                case 0x1C: case 0x1D: case 0x1E:
                                    return  (bio::rewind(i, o), cx/cbor::read_error::unexpected);
                                default:                                            // LCOV_EXCL_LINE
                                    return  CXON_ASSERT(0, "unexpected"), false;    // LCOV_EXCL_LINE
                            }
                        }
                        case Y::arr: case Y::map: {
                            II const o = i;
                            switch (mnr) {
                                case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
                                case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F:
                                case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
                                    bio::get(t, i, e); // should not fail
                                    for (unsigned j = 0; j != mnr; ++j)
                                        if (!read_element(s, mjr, i, e, cx))
                                            return (bio::rewind(i, o), cx/cbor::read_error::unexpected);
                                    return  true;
                                case 0x18: case 0x19: case 0x1A: case 0x1B: {
                                    std::size_t n;
                                    if (!bio::get(t, i, e) || !bio::get(n, 1U << (mnr - 0x18), i, e) || !bio::poke(t, n, 1U << (mnr - 0x18)))
                                        return (bio::rewind(i, o), cx/cbor::read_error::unexpected);
                                    for (unsigned j = 0; j != n; ++j)
                                        if (!read_element(s, mjr, i, e, cx))
                                            return (bio::rewind(i, o), cx/cbor::read_error::unexpected);
                                    return  true;
                                }
                                case 0x1F:
                                    bio::get(t, i, e); // should not fail
                                    while (bio::peek(i, e) != Y::brk)
                                        if (!read_element(s, mjr, i, e, cx))
                                            return (bio::rewind(i, o), cx/cbor::read_error::unexpected);
                                    return  (bio::get(t, i, e) || (bio::rewind(i, o), cx/cbor::read_error::unexpected));
                                case 0x1C: case 0x1D: case 0x1E:
                                    return  (bio::rewind(i, o), cx/cbor::read_error::unexpected);
                                default:                                            // LCOV_EXCL_LINE
                                    return  CXON_ASSERT(0, "unexpected"), false;    // LCOV_EXCL_LINE
                            }
                        }
                        default:                                        // LCOV_EXCL_LINE
                            return CXON_ASSERT(0, "unexpected"), false; // LCOV_EXCL_LINE
                    }
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, (%rsp)
movq (%rsi), %r13
cmpq %rdx, %r13
je 0x99246
movzbl (%r13), %eax
movl %eax, %ebp
andl $-0x20, %ebp
movl %eax, %ecx
andl $0x1f, %ecx
shrl $0x5, %eax
movq %rdx, %r15
movq %rsi, %r14
movl $0xc3, %edx
btl %eax, %edx
jae 0x99171
movl $0xffffff, %eax         # imm = 0xFFFFFF
btl %ecx, %eax
jae 0x99215
incq %r13
movq %r13, (%r14)
movb $0x1, %al
jmp 0x99204
pushq $0xc
popq %rdx
btl %eax, %edx
jae 0x991ad
movl %ecx, %eax
leaq 0x3abae(%rip), %rdx     # 0xd3d30
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
incq %rcx
subq %r13, %r15
cmpq %rcx, %r15
movq %rcx, %rax
cmovbq %r15, %rax
addq %r13, %rax
movq %rax, (%r14)
movb $0x1, %al
cmpq %rcx, %r15
jae 0x99204
jmp 0x99243
movq %rdi, %r12
movl %ecx, %eax
leaq 0x3aaf7(%rip), %rdx     # 0xd3cb0
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x1(%r13), %rax
movq %rax, (%r14)
leal 0x1(%rcx), %ebx
movzbl %bpl, %ebp
decl %ebx
je 0x991fd
movq %r12, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %r15, %rcx
movq (%rsp), %r8
callq 0x993c0
testb %al, %al
jne 0x991d0
movq %r13, (%r14)
pushq $0x1
popq %rsi
movq (%rsp), %rdi
callq 0x1445e
movl %eax, %ecx
testl %ebx, %ebx
sete %al
orb %cl, %al
andb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xf000000, %eax        # imm = 0xF000000
btl %ecx, %eax
jae 0x99246
addl $-0x18, %ecx
pushq $0x1
popq %rdx
shll %cl, %edx
incl %edx
subq %r13, %r15
cmpq %rdx, %r15
movq %rdx, %rax
cmovbq %r15, %rax
addq %r13, %rax
movq %rax, (%r14)
movb $0x1, %al
cmpq %rdx, %r15
jae 0x99204
movq %r13, (%r14)
pushq $0x1
popq %rsi
movq (%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1445e
leaq 0x1(%r13), %rax
movq %rax, (%r14)
addl $-0x18, %ecx
pushq $0x1
popq %rbp
shll %cl, %ebp
leaq 0x8(%rsp), %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x14409
testb %al, %al
je 0x9934b
cmpl $0x8, %ebp
ja 0x9934b
movl $0x116, %eax            # imm = 0x116
btl %ebp, %eax
jae 0x9934b
movq 0x8(%rsp), %rcx
movq (%r14), %rax
subq %rax, %r15
cmpq %rcx, %r15
movq %rcx, %rdx
cmovbq %r15, %rdx
addq %rax, %rdx
movq %rdx, (%r14)
movb $0x1, %al
cmpq %rcx, %r15
jae 0x99204
jmp 0x9934b
leaq 0x1(%r13), %rax
movq %rax, (%r14)
addl $-0x18, %ecx
pushq $0x1
popq %rbx
shll %cl, %ebx
leaq 0x8(%rsp), %rdi
movl %ebx, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x14409
testb %al, %al
je 0x9934b
cmpl $0x8, %ebx
ja 0x9934b
movl $0x116, %eax            # imm = 0x116
btl %ebx, %eax
jae 0x9934b
xorl %ecx, %ecx
movzbl %bpl, %eax
movl %eax, 0x14(%rsp)
movl %ecx, %ebx
movq 0x8(%rsp), %rbp
cmpq %rbx, %rbp
je 0x99343
movq %r12, %rdi
movl 0x14(%rsp), %esi
movq %r14, %rdx
movq %r15, %rcx
movq (%rsp), %r8
callq 0x993c0
leal 0x1(%rbx), %ecx
testb %al, %al
jne 0x99309
movq %r13, (%r14)
pushq $0x1
popq %rsi
movq (%rsp), %rdi
callq 0x1445e
movl %eax, %ecx
cmpq %rbx, %rbp
jmp 0x991ff
movq %r13, (%r14)
pushq $0x1
popq %rsi
movq (%rsp), %rdi
callq 0x1445e
jmp 0x99204
movq %r13, %rax
cmpq %r15, %rax
je 0x9936d
incq %rax
movq %rax, (%r14)
cmpq %r15, %rax
je 0x99243
cmpb $-0x1, (%rax)
jne 0x99362
incq %rax
movq %rax, (%r14)
jmp 0x9916a
leaq 0x1(%r13), %rax
movq %rax, (%r14)
movzbl %bpl, %ebp
movq (%r14), %rax
cmpq %r15, %rax
je 0x99243
cmpb $-0x1, (%rax)
je 0x9937b
movq %r12, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %r15, %rcx
movq (%rsp), %r8
callq 0x993c0
testb %al, %al
jne 0x99391
jmp 0x99243
nop