// File: /workspace/github_c_makefile_star2_O2/rsa9000[P]regfanalysistools/regfwalk.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 + 5];
	struct cell *cell;
	int res;

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

	printf("%svk.{off,len} = 0x%08X, 0x%08X\n", pref, off, -rc->sz);

	if (!vk->name_sz)
		printf("%svk.name = (default)\n", pref);
	else if (vk->flags & REGF_VK_F_ASCII)
		printf("%svk.name = %.*s\n", pref, vk->name_sz, vk->name);
	else
		printf("%svk.name = %ls\n", pref,
		       regf_unicode2wchar(vk->name, vk->name_sz));
	printf("%svk.data{type,off,size} = 0x%08X, 0x%08X, 0x%08X - %s\n", pref,
	       vk->type, vk->off, vk->sz, regf_parse_vk_type(vk->type));

	snprintf(__pref, sizeof(__pref), "%sval.", pref);

	if (vk->sz & 0x80000000) {	/* Embedded data */
		if ((vk->sz & ~0x80000000) > 4) {
			VK_PR_WARN("value legnth 0x%08X too big for embeded data\n",
				   vk->sz & ~0x80000000);
			return -1;
		}
		res = regf_print_data(__pref, &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) {
		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(__pref, 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, %ebx
movq %rdi, %r13
movq 0x4c6f(%rip), %r12      # 0x7100
callq 0x1080
movq %rax, %r14
movq %rsp, %r15
addq $0x14, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
leaq 0x24e9(%rip), %rdx      # 0x499a
pushq $0x14
popq %rcx
movq %r12, %rdi
movl %ebx, %esi
callq 0x31cb
pushq $-0x1
popq %rcx
testl %eax, %eax
je 0x24cd
movl %ecx, %r13d
jmp 0x2866
movl %ebx, %eax
addq %rax, %r12
xorl %ecx, %ecx
subl (%r12), %ecx
leaq 0x24be(%rip), %rdi      # 0x499d
movq %r13, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%r12), %edx
testl %edx, %edx
je 0x251f
testb $0x1, 0x14(%r12)
jne 0x2532
leaq 0x18(%r12), %rdi
movl %edx, %esi
callq 0x1da7
leaq 0x24d7(%rip), %rdi      # 0x49e7
movq %r13, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x2548
leaq 0x2498(%rip), %rdi      # 0x49be
movq %r13, %rsi
xorl %eax, %eax
callq 0x10a0
jmp 0x2548
leaq 0x18(%r12), %rcx
leaq 0x2497(%rip), %rdi      # 0x49d5
movq %r13, %rsi
xorl %eax, %eax
callq 0x10a0
addq $0x5, %r14
movl 0x10(%r12), %edx
movl 0x8(%r12), %r8d
movl 0xc(%r12), %ecx
cmpq $0xb, %rdx
movl %ebx, -0x2c(%rbp)
ja 0x2574
leaq 0x2961(%rip), %rax      # 0x4ecc
movslq (%rax,%rdx,4), %r9
addq %rax, %r9
jmp 0x257b
leaq 0x2659(%rip), %r9       # 0x4bd4
leaq 0xc(%r12), %rbx
leaq 0x2471(%rip), %rdi      # 0x49f8
movq %r13, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x2498(%rip), %rdx      # 0x4a30
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rcx
xorl %eax, %eax
callq 0x10b0
movl 0x8(%r12), %ecx
testl %ecx, %ecx
js 0x26e7
movl (%rbx), %edi
callq 0x1859
testq %rax, %rax
movq %rbx, %r14
je 0x26fb
movl 0x8(%r12), %esi
movl 0x4b35(%rip), %edx      # 0x7108
incl 0x24(%rax)
movl 0x28(%rax), %ecx
cmpl $0x3fd9, %esi           # imm = 0x3FD9
jb 0x2707
cmpl $0x14, %edx
jbe 0x2707
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x28(%rax)
movl (%r14), %r12d
movq 0x4aff(%rip), %rbx      # 0x7100
leaq 0x2650(%rip), %rdx      # 0x4c58
pushq $0x8
popq %rcx
movq %rbx, %rdi
movl %r12d, %esi
callq 0x31cb
testl %eax, %eax
movl -0x2c(%rbp), %esi
jne 0x284a
xorl %r13d, %r13d
xorl %ecx, %ecx
subl (%rbx,%r12), %ecx
leaq 0x262a(%rip), %rdi      # 0x4c5b
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%rbx,%r12), %edx
leaq 0x2631(%rip), %rdi      # 0x4c7c
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
cmpw $0x0, 0x6(%rbx,%r12)
je 0x2866
movl 0x8(%rbx,%r12), %edi
callq 0x1859
testq %rax, %rax
je 0x2788
movq %r14, -0x48(%rbp)
incl 0x24(%rax)
orb $0x2, 0x29(%rax)
leaq 0x1c75(%rip), %rdx      # 0x42fc
leaq -0x60(%rbp), %rdi
pushq $0x10
popq %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x10b0
movl 0x8(%rbx,%r12), %eax
movq %rbx, -0x40(%rbp)
movzwl 0x6(%rbx,%r12), %ebx
movq %rax, %rsi
movq 0x4a4f(%rip), %r14      # 0x7100
leal (,%rbx,4), %ecx
leaq 0x2643(%rip), %rdx      # 0x4d02
movq %r14, %rdi
movq %rax, -0x38(%rbp)
callq 0x3152
leaq 0x25f5(%rip), %rdi      # 0x4cc7
testl %eax, %eax
je 0x2794
movq -0x48(%rbp), %r14
movq -0x40(%rbp), %rbx
jmp 0x2831
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl $0x5, %ecx
jb 0x275d
leaq 0x233e(%rip), %rdi      # 0x4a37
jmp 0x274e
movl (%r14), %ecx
leaq 0x2370(%rip), %rdi      # 0x4a75
jmp 0x274e
movq %r14, %rbx
orl $0x80, %ecx
movl %ecx, 0x28(%rax)
movl 0x8(%r12), %r14d
movl 0xc(%r12), %r13d
movl 0x10(%r12), %eax
movl %eax, -0x38(%rbp)
movq 0x49d4(%rip), %r12      # 0x7100
leaq 0x2520(%rip), %rdx      # 0x4c53
movq %r12, %rdi
movl %r13d, %esi
movl %r14d, %ecx
callq 0x3152
testl %eax, %eax
je 0x276a
movl (%rbx), %ecx
leaq 0x235c(%rip), %rdi      # 0x4aaa
leaq 0x2245(%rip), %rdx      # 0x499a
movl -0x2c(%rbp), %esi
jmp 0x285b
movl 0x10(%r12), %edx
movq %r15, %rdi
movq %rbx, %rsi
jmp 0x277b
leaq (%r12,%r13), %rsi
addq $0x4, %rsi
movq %r15, %rdi
movl -0x38(%rbp), %edx
movl %r14d, %ecx
callq 0x2878
xorl %r13d, %r13d
jmp 0x2866
leaq 0x24fe(%rip), %rdi      # 0x4c8d
jmp 0x2831
movq -0x38(%rbp), %rdx
addq %rdx, %r14
xorl %ecx, %ecx
subl (%r14), %ecx
leaq 0x2560(%rip), %rdi      # 0x4d07
leaq -0x60(%rbp), %rsi
xorl %eax, %eax
callq 0x10a0
xorl %r15d, %r15d
movl $0x0, -0x30(%rbp)
cmpq %r15, %rbx
je 0x281c
movl 0x4(%r14,%r15,4), %ecx
leaq 0x255d(%rip), %rdi      # 0x4d2a
leaq -0x60(%rbp), %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x10a0
movl 0x4(%r14,%r15,4), %edi
callq 0x1859
testq %rax, %rax
je 0x27f3
incl 0x24(%rax)
orb $0x4, 0x29(%rax)
jmp 0x2817
movl 0x4(%r14,%r15,4), %ecx
leaq 0x2540(%rip), %rdi      # 0x4d3f
movq -0x38(%rbp), %rsi
leaq 0x24f8(%rip), %rdx      # 0x4d02
xorl %eax, %eax
callq 0x2fdc
pushq $-0x1
popq %rax
movl %eax, -0x30(%rbp)
incq %r15
jmp 0x27bc
cmpl $0x0, -0x30(%rbp)
movq -0x48(%rbp), %r14
movq -0x40(%rbp), %rbx
leaq 0x2498(%rip), %rdi      # 0x4cc7
je 0x2866
movl 0x8(%rbx,%r12), %ecx
leaq 0x241b(%rip), %rdx      # 0x4c58
movl %r12d, %esi
xorl %eax, %eax
callq 0x2fdc
movl -0x2c(%rbp), %esi
movl (%r14), %ecx
leaq 0x228f(%rip), %rdi      # 0x4ae3
leaq 0x213f(%rip), %rdx      # 0x499a
xorl %eax, %eax
callq 0x2fdc
pushq $-0x1
popq %r13
movl %r13d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq