// File: /workspace/github_c_makefile_star2_O0/BatchLabs[P]msgpack-dump/src/cmp.c
// Function: cmp_skip_object_limit
bool cmp_skip_object_limit(cmp_ctx_t *ctx, cmp_object_t *obj, uint32_t limit) {
  size_t element_count = 1;
  uint32_t depth = 0;

  while (element_count) {
    uint8_t type_marker = 0;
    uint8_t cmp_type;
    uint32_t size = 0;

    if (!read_type_marker(ctx, &type_marker)) {
      return false;
    }

    if (!type_marker_to_cmp_type(type_marker, &cmp_type)) {
      ctx->error = INVALID_TYPE_ERROR;
      return false;
    }

    switch (cmp_type) {
      case CMP_TYPE_FIXARRAY:
      case CMP_TYPE_ARRAY16:
      case CMP_TYPE_ARRAY32:
      case CMP_TYPE_FIXMAP:
      case CMP_TYPE_MAP16:
      case CMP_TYPE_MAP32:
        depth++;

        if (depth > limit) {
          obj->type = cmp_type;

          if (!read_obj_data(ctx, type_marker, obj)) {
            return false;
          }

          ctx->error = SKIP_DEPTH_LIMIT_EXCEEDED_ERROR;

          return false;
        }

        break;
      default:
        if (!read_type_size(ctx, type_marker, cmp_type, &size)) {
          return false;
        }

        if (size) {
          switch (cmp_type) {
            case CMP_TYPE_FIXEXT1:
            case CMP_TYPE_FIXEXT2:
            case CMP_TYPE_FIXEXT4:
            case CMP_TYPE_FIXEXT8:
            case CMP_TYPE_FIXEXT16:
            case CMP_TYPE_EXT8:
            case CMP_TYPE_EXT16:
            case CMP_TYPE_EXT32:
              size++;
            default:
              break;
          }

          skip_bytes(ctx, size);
        }
    }

    element_count--;

    switch (cmp_type) {
      case CMP_TYPE_FIXARRAY:
      case CMP_TYPE_ARRAY16:
      case CMP_TYPE_ARRAY32:
        if (!read_type_size(ctx, type_marker, cmp_type, &size)) {
          return false;
        }
        element_count += size;
        break;
      case CMP_TYPE_FIXMAP:
      case CMP_TYPE_MAP16:
      case CMP_TYPE_MAP32:
        if (!read_type_size(ctx, type_marker, cmp_type, &size)) {
          return false;
        }
        element_count += ((size_t)size) * 2;
        break;
      default:
        break;
    }
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq $0x1, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6e62
movb $0x0, -0x2d(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x2d(%rbp), %rsi
callq 0x57f0
testb $0x1, %al
jne 0x6cd2
movb $0x0, -0x1(%rbp)
jmp 0x6e66
leaq -0x2e(%rbp), %rsi
movzbl -0x2d(%rbp), %edi
callq 0x5830
testb $0x1, %al
jne 0x6cf3
movq -0x10(%rbp), %rax
movb $0xd, (%rax)
movb $0x0, -0x1(%rbp)
jmp 0x6e66
movzbl -0x2e(%rbp), %eax
movl %eax, -0x38(%rbp)
decl %eax
subl $0x2, %eax
jb 0x6d10
jmp 0x6d03
movl -0x38(%rbp), %eax
addl $-0x1e, %eax
subl $0x3, %eax
ja 0x6d5c
jmp 0x6d10
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jbe 0x6d5a
movb -0x2e(%rbp), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rdi
movb -0x2d(%rbp), %al
movq -0x18(%rbp), %rdx
movzbl %al, %esi
callq 0x5ad0
testb $0x1, %al
jne 0x6d4a
movb $0x0, -0x1(%rbp)
jmp 0x6e66
movq -0x10(%rbp), %rax
movb $0x10, (%rax)
movb $0x0, -0x1(%rbp)
jmp 0x6e66
jmp 0x6dbf
movq -0x10(%rbp), %rdi
movb -0x2d(%rbp), %al
leaq -0x34(%rbp), %rcx
movzbl %al, %esi
movzbl -0x2e(%rbp), %edx
callq 0x62f0
testb $0x1, %al
jne 0x6d80
movb $0x0, -0x1(%rbp)
jmp 0x6e66
cmpl $0x0, -0x34(%rbp)
je 0x6dbd
movzbl -0x2e(%rbp), %eax
movl %eax, -0x3c(%rbp)
addl $-0x9, %eax
subl $0x3, %eax
jb 0x6da4
jmp 0x6d97
movl -0x3c(%rbp), %eax
addl $-0x16, %eax
subl $0x4, %eax
ja 0x6dad
jmp 0x6da4
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x6daf
movq -0x10(%rbp), %rdi
movl -0x34(%rbp), %eax
movl %eax, %esi
callq 0x6860
jmp 0x6dbf
movq -0x28(%rbp), %rax
decq %rax
movq %rax, -0x28(%rbp)
movzbl -0x2e(%rbp), %eax
movl %eax, -0x40(%rbp)
subl $0x1, %eax
je 0x6e2a
jmp 0x6dd8
movl -0x40(%rbp), %eax
subl $0x2, %eax
je 0x6dfc
jmp 0x6de2
movl -0x40(%rbp), %eax
addl $-0x1e, %eax
subl $0x2, %eax
jb 0x6dfc
jmp 0x6def
movl -0x40(%rbp), %eax
addl $-0x20, %eax
subl $0x2, %eax
jb 0x6e2a
jmp 0x6e5b
movq -0x10(%rbp), %rdi
movb -0x2d(%rbp), %al
leaq -0x34(%rbp), %rcx
movzbl %al, %esi
movzbl -0x2e(%rbp), %edx
callq 0x62f0
testb $0x1, %al
jne 0x6e1d
movb $0x0, -0x1(%rbp)
jmp 0x6e66
movl -0x34(%rbp), %eax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x6e5d
movq -0x10(%rbp), %rdi
movb -0x2d(%rbp), %al
leaq -0x34(%rbp), %rcx
movzbl %al, %esi
movzbl -0x2e(%rbp), %edx
callq 0x62f0
testb $0x1, %al
jne 0x6e4b
movb $0x0, -0x1(%rbp)
jmp 0x6e66
movl -0x34(%rbp), %eax
shlq %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x6e5d
jmp 0x6e5d
jmp 0x6ca2
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)