// File: /workspace/github_c_makefile_star2_O0/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: msgpack_compare_non_recursive
static msgpack_compare_t
msgpack_compare_non_recursive(as_unpacker *pk1, as_unpacker *pk2,
		msgpack_parse_memblock **block, msgpack_parse_state *state)
{
	while (state) {
		while (state->index >= state->len) {
			if (! msgpack_compare_unwind(pk1, pk2, state)) {
				return MSGPACK_COMPARE_ERROR;
			}

			if (! msgpack_parse_memblock_has_prev(*block)) {
				return state->default_compare_type;
			}

			uint32_t len1 = state->len1;
			uint32_t len2 = state->len2;

			state = msgpack_parse_memblock_prev(block);

			MSGPACK_COMPARE_RET_LESS_OR_GREATER(len1, len2);
		}

		if (state->type == AS_LIST) {
			state->index++;
		}
		else if (state->type == AS_MAP) {
			if (state->map_pair == 0) {
				state->map_pair++;
			}
			else {
				state->map_pair = 0;
				state->index++;
			}
		}
		else {
			return MSGPACK_COMPARE_ERROR;
		}

		as_val_t type;
		msgpack_compare_t ret = msgpack_peek_compare_type(pk1, pk2, &type);

		if (ret == MSGPACK_COMPARE_ERROR || ret == MSGPACK_COMPARE_END) {
			return MSGPACK_COMPARE_ERROR;
		}

		if (ret != MSGPACK_COMPARE_EQUAL) {
			if (as_unpack_size(pk1) < 0) {
				return MSGPACK_COMPARE_ERROR;
			}
			if (as_unpack_size(pk2) < 0) {
				return MSGPACK_COMPARE_ERROR;
			}
			return ret;
		}

		if (type == AS_LIST ) {
			state = msgpack_parse_memblock_next(block);

			if (! msgpack_parse_state_list_cmp_init(state, pk1, pk2)) {
				return MSGPACK_COMPARE_ERROR;
			}

			continue;
		}

		if (type == AS_MAP) {
			state = msgpack_parse_memblock_next(block);

			if (! msgpack_parse_state_map_cmp_init(state, pk1, pk2)) {
				return MSGPACK_COMPARE_ERROR;
			}

			MSGPACK_COMPARE_RET_LESS_OR_GREATER(state->len1, state->len2);
			continue;
		}

		if (type == AS_CMP_WILDCARD) {
			if (! msgpack_skip(pk1, 1) || ! msgpack_skip(pk2, 1)) {
				return MSGPACK_COMPARE_ERROR;
			}

			if (! msgpack_compare_unwind(pk1, pk2, state)) {
				return MSGPACK_COMPARE_ERROR;
			}

			if (! msgpack_parse_memblock_has_prev(*block)) {
				return MSGPACK_COMPARE_EQUAL;
			}

			state = msgpack_parse_memblock_prev(block);
			continue;
		}

		ret = msgpack_compare_type(pk1, pk2, type, 0);

		if (ret != MSGPACK_COMPARE_EQUAL) {
			return ret;
		}
	}

	return MSGPACK_COMPARE_EQUAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x12fcd
jmp 0x12cf5
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jb 0x12d96
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x13120
testb $0x1, %al
jne 0x12d2a
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x11f30
testb $0x1, %al
jne 0x12d49
movq -0x28(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x12fd4
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x11f70
movq %rax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0x12d7d
movl $0x0, -0x4(%rbp)
jmp 0x12fd4
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jbe 0x12d91
movl $0x2, -0x4(%rbp)
jmp 0x12fd4
jmp 0x12cf5
movq -0x28(%rbp), %rax
movzbl 0x11(%rax), %eax
cmpl $0x5, %eax
jne 0x12db2
movq -0x28(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0x12e00
movq -0x28(%rbp), %rax
movzbl 0x11(%rax), %eax
cmpl $0x6, %eax
jne 0x12df2
movq -0x28(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x0, %eax
jne 0x12ddb
movq -0x28(%rbp), %rax
movb 0x10(%rax), %cl
addb $0x1, %cl
movb %cl, 0x10(%rax)
jmp 0x12df0
movq -0x28(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0x12dfe
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
jmp 0x12e00
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x31(%rbp), %rdx
callq 0x120e0
movl %eax, -0x38(%rbp)
cmpl $-0x2, -0x38(%rbp)
je 0x12e20
cmpl $-0x1, -0x38(%rbp)
jne 0x12e2c
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
cmpl $0x1, -0x38(%rbp)
je 0x12e73
movq -0x10(%rbp), %rdi
callq 0x89e0
cmpq $0x0, %rax
jge 0x12e4d
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
movq -0x18(%rbp), %rdi
callq 0x89e0
cmpq $0x0, %rax
jge 0x12e68
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12fd4
movzbl -0x31(%rbp), %eax
cmpl $0x5, %eax
jne 0x12eaf
movq -0x20(%rbp), %rdi
callq 0x11ce0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x12c00
testb $0x1, %al
jne 0x12eaa
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
jmp 0x12ce8
movzbl -0x31(%rbp), %eax
cmpl $0x6, %eax
jne 0x12f21
movq -0x20(%rbp), %rdi
callq 0x11ce0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x13210
testb $0x1, %al
jne 0x12ee6
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
movq -0x28(%rbp), %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x12f01
movl $0x0, -0x4(%rbp)
jmp 0x12fd4
movq -0x28(%rbp), %rax
movl (%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x12f1c
movl $0x2, -0x4(%rbp)
jmp 0x12fd4
jmp 0x12ce8
movzbl -0x31(%rbp), %eax
cmpl $0xd, %eax
jne 0x12fa2
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x13080
testb $0x1, %al
jne 0x12f3e
jmp 0x12f50
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x13080
testb $0x1, %al
jne 0x12f59
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x13120
testb $0x1, %al
jne 0x12f77
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x12fd4
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x11f30
testb $0x1, %al
jne 0x12f90
movl $0x1, -0x4(%rbp)
jmp 0x12fd4
movq -0x20(%rbp), %rdi
callq 0x11f70
movq %rax, -0x28(%rbp)
jmp 0x12ce8
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movzbl -0x31(%rbp), %edx
callq 0x12200
movl %eax, -0x38(%rbp)
cmpl $0x1, -0x38(%rbp)
je 0x12fc8
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12fd4
jmp 0x12ce8
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)