// File: /workspace/github_c_makefile_star2_O2/rsa9000[P]regfanalysistools/regftree.c
// Function: regf_parse_vk
static int regf_parse_vk(const char *pref, unsigned off)
{
#define VK_PR_WARN(__fmt, ...)	PR_WARN(off, "vk", __fmt, ##__VA_ARGS__)
	const struct regf_cell *rc = st.data + off;
	const struct regf_vk *vk = (void *)rc->data;
	size_t pref_len = strlen(pref);
	char __pref[pref_len + 3];
	struct cell *cell;
	int res, pos = strlen(pref);
	const wchar_t *__name;

	if (regf_cell_check_sign_len(st.data, off, "vk", sizeof(*vk)))
		return -1;

	if (!vk->name_sz) {
		pos += printf("(default)");
	} else if (vk->flags & REGF_VK_F_ASCII) {
		pos += printf("%.*s", vk->name_sz, vk->name);
	} else {
		__name = regf_unicode2wchar(vk->name, vk->name_sz);
		pos += wcslen(__name);
		printf("%ls", __name);
	}

	if (pos < 60)
		pos += printf("%*s", 60 - pos, " ");
	printf(" %-10s (0x%02X)", regf_parse_vk_type(vk->type),
	       vk->sz & ~0x80000000);

	if (vk->sz & 0x80000000) {	/* Embedded data */
		if ((vk->sz & ~0x80000000) > 4) {
			printf("\n");
			VK_PR_WARN("value legnth 0x%08X too big for embeded data\n",
				   vk->sz & ~0x80000000);
			return -1;
		}
		res = regf_print_data(" ", &vk->off, vk->type,
				      vk->sz & ~0x80000000);
		if (res) {
			VK_PR_WARN("could not parse embeded data\n");
			return -1;
		}
		return 0;
	}

	cell = cache_cell_find(vk->off);
	if (!cell) {
		printf("\n");
		VK_PR_WARN("could not find raw data cell 0x%08X\n", vk->off);
		return -1;
	}

	/**
	 * Data occupates only one cell if it small, also data blocks
	 * supported in 1.5
	 */
	if (vk->sz <= 16344 || st.version < VER_1_5) {
		cache_cell_updref(cell, CT_DATA);
		res = regf_parse_raw(" ", vk->off, vk->type, vk->sz);
		if (res) {
			VK_PR_WARN("could not parse raw data in cell 0x%08X\n",
				   vk->off);
			return -1;
		}
	} else {
		cache_cell_updref(cell, CT_DB);
		res = regf_parse_db(__pref, vk->off);
		if (res) {
			VK_PR_WARN("could not parse data block in cell 0x%08X\n",
				   vk->off);
			return -1;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %r14d
movq 0x3f2d(%rip), %r15      # 0x6110
callq 0x1090
movq %rax, %r13
movq %rsp, %r12
addq $0x12, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
leaq 0x1474(%rip), %rdx      # 0x3677
pushq $0x14
popq %rcx
movq %r15, %rdi
movl %r14d, %esi
callq 0x2e77
pushq $-0x1
popq %rbx
testl %eax, %eax
jne 0x24d1
movl %r14d, %eax
addq %rax, %r15
movzwl 0x6(%r15), %esi
testl %esi, %esi
je 0x2262
testb $0x1, 0x14(%r15)
jne 0x2272
leaq 0x18(%r15), %rdi
callq 0x1aa1
movq %rax, %rbx
movq %rax, %rdi
callq 0x10c0
addl %eax, %r13d
leaq 0x1439(%rip), %rdi      # 0x3689
movq %rbx, %rsi
pushq $-0x1
popq %rbx
xorl %eax, %eax
callq 0x10b0
movl %r13d, %eax
jmp 0x2287
leaq 0x1411(%rip), %rdi      # 0x367a
xorl %eax, %eax
callq 0x10b0
jmp 0x2284
leaq 0x18(%r15), %rdx
leaq 0x1407(%rip), %rdi      # 0x3684
xorl %eax, %eax
callq 0x10b0
addl %r13d, %eax
cmpl $0x3b, %eax
jg 0x22a6
pushq $0x3c
popq %rsi
subl %eax, %esi
leaq 0x13f5(%rip), %rdi      # 0x368d
leaq 0x12ab(%rip), %rdx      # 0x354a
xorl %eax, %eax
callq 0x10b0
movl 0x10(%r15), %eax
cmpq $0xb, %rax
ja 0x22c0
leaq 0x17e9(%rip), %rcx      # 0x3aa0
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
jmp 0x22c7
leaq 0x1577(%rip), %rsi      # 0x383e
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl 0x8(%r15), %edx
leaq 0x13ba(%rip), %rdi      # 0x3691
xorl %eax, %eax
callq 0x10b0
movl 0x8(%r15), %edx
testl %edx, %edx
js 0x23e4
movl 0xc(%r15), %edi
callq 0x1879
testq %rax, %rax
je 0x240c
movl 0x8(%r15), %esi
movl 0x3e12(%rip), %edx      # 0x6118
incl 0x24(%rax)
movl 0x28(%rax), %ecx
cmpl $0x3fd9, %esi           # imm = 0x3FD9
jb 0x2424
cmpl $0x14, %edx
jbe 0x2424
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x28(%rax)
movl 0xc(%r15), %esi
movq 0x3ddb(%rip), %r13      # 0x6110
leaq 0x1555(%rip), %rdx      # 0x3891
pushq $0x8
popq %rcx
movq %r13, %rdi
movq %rsi, -0x30(%rbp)
callq 0x2e77
testl %eax, %eax
jne 0x24b5
movq -0x30(%rbp), %rax
cmpw $0x0, 0x6(%r13,%rax)
je 0x2489
movl 0x8(%r13,%rax), %edi
callq 0x1879
testq %rax, %rax
je 0x248d
incl 0x24(%rax)
orb $0x2, 0x29(%rax)
leaq 0x120a(%rip), %rdx      # 0x358f
leaq -0x60(%rbp), %rdi
pushq $0x10
popq %rsi
movq %r12, %rcx
xorl %eax, %eax
callq 0x10d0
movq -0x30(%rbp), %rax
movl 0x8(%r13,%rax), %r12d
movq %r13, -0x38(%rbp)
movzwl 0x6(%r13,%rax), %ebx
movq 0x3d60(%rip), %r13      # 0x6110
leal (,%rbx,4), %ecx
leaq 0x154b(%rip), %rdx      # 0x3909
movq %r13, %rdi
movl %r12d, %esi
callq 0x2dfe
leaq 0x14fe(%rip), %rdi      # 0x38ce
testl %eax, %eax
je 0x24e2
pushq $-0x1
popq %rbx
movq -0x38(%rbp), %rax
jmp 0x249f
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmpl $0x5, %edx
jb 0x2469
pushq $0xa
popq %rdi
callq 0x1030
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl 0x8(%r15), %ecx
leaq 0x129a(%rip), %rdi      # 0x36a1
jmp 0x24c0
pushq $0xa
popq %rdi
callq 0x1030
movl 0xc(%r15), %ecx
leaq 0x12c0(%rip), %rdi      # 0x36df
jmp 0x24c0
orl $0x80, %ecx
movl %ecx, 0x28(%rax)
movl 0x8(%r15), %ecx
movl 0xc(%r15), %r13d
movl 0x10(%r15), %eax
movl %eax, -0x30(%rbp)
movq 0x3ccd(%rip), %r12      # 0x6110
leaq 0x1442(%rip), %rdx      # 0x388c
movq %r12, %rdi
movl %r13d, %esi
movl %ecx, -0x38(%rbp)
callq 0x2dfe
testl %eax, %eax
je 0x2476
movl 0xc(%r15), %ecx
leaq 0x12ad(%rip), %rdi      # 0x3714
jmp 0x24c0
movl 0x10(%r15), %esi
addq $0xc, %r15
movq %r15, %rdi
jmp 0x2484
leaq (%r12,%r13), %rdi
addq $0x4, %rdi
movl -0x30(%rbp), %esi
movl -0x38(%rbp), %edx
callq 0x255c
xorl %ebx, %ebx
jmp 0x24d1
pushq $0xa
popq %rdi
callq 0x1030
leaq 0x13f8(%rip), %rdi      # 0x3894
movq %r13, %rax
movq -0x30(%rbp), %rsi
movl 0x8(%rax,%rsi), %ecx
leaq 0x13e3(%rip), %rdx      # 0x3891
xorl %eax, %eax
callq 0x2c88
movl 0xc(%r15), %ecx
leaq 0x128d(%rip), %rdi      # 0x374d
leaq 0x11b0(%rip), %rdx      # 0x3677
movl %r14d, %esi
xorl %eax, %eax
callq 0x2c88
movl %ebx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, -0x48(%rbp)
addq %r13, %r12
addq $0x4, %r12
xorl %r13d, %r13d
movl $0x0, -0x3c(%rbp)
movq -0x38(%rbp), %rax
cmpq %r13, %rbx
je 0x253f
movl (%r12,%r13,4), %edi
callq 0x1879
testq %rax, %rax
je 0x2517
incl 0x24(%rax)
orb $0x4, 0x29(%rax)
jmp 0x253a
movl (%r12,%r13,4), %ecx
leaq 0x13ec(%rip), %rdi      # 0x390e
movq -0x48(%rbp), %rsi
leaq 0x13dc(%rip), %rdx      # 0x3909
xorl %eax, %eax
callq 0x2c88
pushq $-0x1
popq %rax
movl %eax, -0x3c(%rbp)
incq %r13
jmp 0x24f7
cmpl $0x0, -0x3c(%rbp)
pushq $-0x1
popq %rbx
movq -0x30(%rbp), %rsi
leaq 0x137d(%rip), %rdi      # 0x38ce
jne 0x24a3
jmp 0x2489