// File: /workspace/github_c_makefile_star2_O2/BatchLabs[P]msgpack-dump/src/cmp.c
// Function: read_obj_data
static bool read_obj_data(cmp_ctx_t *ctx, uint8_t type_marker,
                                          cmp_object_t *obj) {
  switch (obj->type) {
    case CMP_TYPE_POSITIVE_FIXNUM:
      obj->as.u8 = type_marker;
      return true;
    case CMP_TYPE_NEGATIVE_FIXNUM:
      obj->as.s8 = type_marker;
      return true;
    case CMP_TYPE_NIL:
      obj->as.u8 = 0;
      return true;
    case CMP_TYPE_BOOLEAN:
      switch (type_marker) {
        case TRUE_MARKER:
          obj->as.boolean = true;
          return true;
        case FALSE_MARKER:
          obj->as.boolean = false;
          return true;
        default:
          break;
      }
      ctx->error = INTERNAL_ERROR;
      return false;
    case CMP_TYPE_UINT8:
      if (!ctx->read(ctx, &obj->as.u8, sizeof(uint8_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      return true;
    case CMP_TYPE_UINT16:
      if (!ctx->read(ctx, &obj->as.u16, sizeof(uint16_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.u16 = be16(obj->as.u16);
      return true;
    case CMP_TYPE_UINT32:
      if (!ctx->read(ctx, &obj->as.u32, sizeof(uint32_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.u32 = be32(obj->as.u32);
      return true;
    case CMP_TYPE_UINT64:
      if (!ctx->read(ctx, &obj->as.u64, sizeof(uint64_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.u64 = be64(obj->as.u64);
      return true;
    case CMP_TYPE_SINT8:
      if (!ctx->read(ctx, &obj->as.s8, sizeof(int8_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      return true;
    case CMP_TYPE_SINT16:
      if (!ctx->read(ctx, &obj->as.s16, sizeof(int16_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.s16 = be16(obj->as.s16);
      return true;
    case CMP_TYPE_SINT32:
      if (!ctx->read(ctx, &obj->as.s32, sizeof(int32_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.s32 = be32(obj->as.s32);
      return true;
    case CMP_TYPE_SINT64:
      if (!ctx->read(ctx, &obj->as.s64, sizeof(int64_t))) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.s64 = be64(obj->as.s64);
      return true;
    case CMP_TYPE_FLOAT:
    {
      char bytes[4];

      if (!ctx->read(ctx, bytes, 4)) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.flt = decode_befloat(bytes);
      return true;
    }
    case CMP_TYPE_DOUBLE:
    {
      char bytes[8];

      if (!ctx->read(ctx, bytes, 8)) {
        ctx->error = DATA_READING_ERROR;
        return false;
      }
      obj->as.dbl = decode_bedouble(bytes);
      return true;
    }
    case CMP_TYPE_BIN8:
    case CMP_TYPE_BIN16:
    case CMP_TYPE_BIN32:
      return read_type_size(ctx, type_marker, obj->type, &obj->as.bin_size);
    case CMP_TYPE_FIXSTR:
    case CMP_TYPE_STR8:
    case CMP_TYPE_STR16:
    case CMP_TYPE_STR32:
      return read_type_size(ctx, type_marker, obj->type, &obj->as.str_size);
    case CMP_TYPE_FIXARRAY:
    case CMP_TYPE_ARRAY16:
    case CMP_TYPE_ARRAY32:
      return read_type_size(ctx, type_marker, obj->type, &obj->as.array_size);
    case CMP_TYPE_FIXMAP:
    case CMP_TYPE_MAP16:
    case CMP_TYPE_MAP32:
      return read_type_size(ctx, type_marker, obj->type, &obj->as.map_size);
    case CMP_TYPE_FIXEXT1:
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      obj->as.ext.size = 1;
      return true;
    case CMP_TYPE_FIXEXT2:
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      obj->as.ext.size = 2;
      return true;
    case CMP_TYPE_FIXEXT4:
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      obj->as.ext.size = 4;
      return true;
    case CMP_TYPE_FIXEXT8:
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      obj->as.ext.size = 8;
      return true;
    case CMP_TYPE_FIXEXT16:
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      obj->as.ext.size = 16;
      return true;
    case CMP_TYPE_EXT8:
      if (!read_type_size(ctx, type_marker, obj->type, &obj->as.ext.size)) {
        return false;
      }
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      return true;
    case CMP_TYPE_EXT16:
      if (!read_type_size(ctx, type_marker, obj->type, &obj->as.ext.size)) {
        return false;
      }
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      obj->as.ext.type = obj->as.ext.type;
      return true;
    case CMP_TYPE_EXT32:
      if (!read_type_size(ctx, type_marker, obj->type, &obj->as.ext.size)) {
        return false;
      }
      if (!ctx->read(ctx, &obj->as.ext.type, sizeof(int8_t))) {
        ctx->error = EXT_TYPE_READING_ERROR;
        return false;
      }
      obj->as.ext.type = obj->as.ext.type;
      return true;
    default:
      break;
  }

  ctx->error = INVALID_TYPE_ERROR;
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movzbl (%rdx), %eax
cmpq $0x22, %rax
ja 0x38a9
movq %rdx, %r14
leaq 0x1c0d(%rip), %rcx      # 0x52ac
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
addq $0x8, %r14
movzbl %sil, %esi
movzbl %al, %edx
movq %rbx, %rdi
movq %r14, %rcx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x398b
movb %sil, 0x8(%r14)
jmp 0x38a0
addq $0x8, %r14
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%rbx)
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x38b3
jmp 0x374e
addq $0x8, %r14
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%rbx)
testb %al, %al
je 0x374e
rolw $0x8, (%r14)
jmp 0x38a0
addq $0x8, %r14
pushq $0x4
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%rbx)
testb %al, %al
je 0x374e
movl (%r14), %eax
bswapl %eax
movl %eax, (%r14)
jmp 0x38a0
addq $0x8, %r14
pushq $0x8
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%rbx)
testb %al, %al
je 0x374e
movq (%r14), %rax
bswapq %rax
movq %rax, (%r14)
jmp 0x38a0
movb $0x9, (%rbx)
jmp 0x38b1
leaq -0x14(%rbp), %rsi
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq *0x10(%rbx)
testb %al, %al
je 0x37ae
movl -0x14(%rbp), %ecx
bswapl %ecx
movl %ecx, 0x8(%r14)
jmp 0x38b3
leaq 0xc(%r14), %rcx
movzbl %sil, %esi
pushq $0xb
jmp 0x37c0
leaq 0xc(%r14), %rcx
movzbl %sil, %esi
pushq $0x9
jmp 0x37c0
leaq -0x1c(%rbp), %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq *0x10(%rbx)
testb %al, %al
je 0x37ae
movq -0x1c(%rbp), %rcx
bswapq %rcx
movq %rcx, 0x8(%r14)
jmp 0x38b3
movb $0x9, (%rbx)
jmp 0x38b3
leaq 0xc(%r14), %rcx
movzbl %sil, %esi
pushq $0xa
popq %rdx
movq %rbx, %rdi
callq 0x398b
testb %al, %al
je 0x38b1
addq $0x8, %r14
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x10(%rbx)
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x38b3
jmp 0x38a4
cmpb $-0x3e, %sil
je 0x3811
movzbl %sil, %eax
cmpl $0xc3, %eax
jne 0x38ae
movb $0x1, 0x8(%r14)
jmp 0x38a0
movb $0x0, 0x8(%r14)
jmp 0x38a0
leaq 0x8(%r14), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq *0x10(%rbx)
testb %al, %al
je 0x38a4
movl $0x8, 0xc(%r14)
jmp 0x38a0
leaq 0x8(%r14), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq *0x10(%rbx)
testb %al, %al
je 0x38a4
movl $0x4, 0xc(%r14)
jmp 0x38a0
leaq 0x8(%r14), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq *0x10(%rbx)
testb %al, %al
je 0x38a4
movl $0x10, 0xc(%r14)
jmp 0x38a0
leaq 0x8(%r14), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq *0x10(%rbx)
testb %al, %al
je 0x38a4
movl $0x1, 0xc(%r14)
jmp 0x38a0
leaq 0x8(%r14), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq *0x10(%rbx)
testb %al, %al
je 0x38a4
movl $0x2, 0xc(%r14)
movb $0x1, %al
jmp 0x38b3
movb $0xb, (%rbx)
jmp 0x38b1
movb $0xd, (%rbx)
jmp 0x38b1
movb $0x11, (%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq