// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq 0x494e(%rip), %r13      # 0x7100
callq 0x1080
movq %rax, %r14
movq %rsp, %r12
addq $0x14, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
leaq 0x21c8(%rip), %rdx      # 0x499a
movq %r13, %rdi
movl %ebx, %esi
movl $0x14, %ecx
callq 0x349b
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x2a64
movl %ebx, %eax
addq %rax, %r13
xorl %ecx, %ecx
subl (%r13), %ecx
leaq 0x219d(%rip), %rdi      # 0x499d
movq %r15, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%r13), %edx
testl %edx, %edx
je 0x283d
testb $0x1, 0x14(%r13)
jne 0x2850
leaq 0x18(%r13), %rdi
movl %edx, %esi
callq 0x1fa7
leaq 0x21b9(%rip), %rdi      # 0x49e7
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x2865
leaq 0x217a(%rip), %rdi      # 0x49be
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
jmp 0x2865
leaq 0x18(%r13), %rcx
leaq 0x217a(%rip), %rdi      # 0x49d5
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
addq $0x5, %r14
movl 0x10(%r13), %edx
movl 0x8(%r13), %r8d
movl 0xc(%r13), %ecx
cmpq $0xb, %rdx
movl %ebx, -0x2c(%rbp)
ja 0x288e
leaq 0x2647(%rip), %rax      # 0x4ecc
movslq (%rax,%rdx,4), %r9
addq %rax, %r9
jmp 0x2895
leaq 0x233f(%rip), %r9       # 0x4bd4
leaq 0xc(%r13), %rbx
leaq 0x2158(%rip), %rdi      # 0x49f8
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x217f(%rip), %rdx      # 0x4a30
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x10b0
movl 0x8(%r13), %ecx
testl %ecx, %ecx
js 0x2900
movl (%rbx), %esi
leaq 0x4846(%rip), %rdi      # 0x7118
callq 0x3329
leaq 0x4842(%rip), %r15      # 0x7120
cmpq %r15, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
movq %rbx, %r14
jne 0x291b
movl (%r14), %ecx
leaq 0x217a(%rip), %rdi      # 0x4a75
jmp 0x2a34
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl $0x5, %ecx
jb 0x29e4
leaq 0x2121(%rip), %rdi      # 0x4a37
jmp 0x2a34
movl 0x8(%r13), %esi
movl 0x47e3(%rip), %edx      # 0x7108
incl 0x24(%rax)
movl 0x28(%rax), %ecx
cmpl $0x3fd9, %esi           # imm = 0x3FD9
jb 0x29f0
cmpl $0x14, %edx
jbe 0x29f0
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x28(%rax)
movl (%r14), %r13d
movq 0x47ad(%rip), %rbx      # 0x7100
leaq 0x22fe(%rip), %rdx      # 0x4c58
movq %rbx, %rdi
movl %r13d, %esi
movl $0x8, %ecx
callq 0x349b
testl %eax, %eax
movl -0x2c(%rbp), %esi
jne 0x2af1
xorl %ecx, %ecx
subl (%rbx,%r13), %ecx
leaq 0x22d9(%rip), %rdi      # 0x4c5b
movq %r12, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%rbx,%r13), %edx
leaq 0x22e0(%rip), %rdi      # 0x4c7c
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
cmpw $0x0, 0x6(%rbx,%r13)
je 0x2a62
movl 0x8(%rbx,%r13), %esi
leaq 0x4759(%rip), %rdi      # 0x7118
callq 0x3329
cmpq %r15, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x2a75
leaq 0x22ae(%rip), %rdi      # 0x4c8d
jmp 0x2ad8
movl 0x10(%r13), %edx
movq %r12, %rdi
movq %rbx, %rsi
jmp 0x2a5d
movq %r14, %rbx
orl $0x80, %ecx
movl %ecx, 0x28(%rax)
movl 0x8(%r13), %r14d
movl 0xc(%r13), %r15d
movl 0x10(%r13), %eax
movl %eax, -0x38(%rbp)
movq 0x46ee(%rip), %r13      # 0x7100
leaq 0x223a(%rip), %rdx      # 0x4c53
movq %r13, %rdi
movl %r15d, %esi
movl %r14d, %ecx
callq 0x341e
testl %eax, %eax
je 0x2a4c
movl (%rbx), %ecx
leaq 0x2076(%rip), %rdi      # 0x4aaa
leaq 0x1f5f(%rip), %rdx      # 0x499a
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x2a64
leaq (%r15,%r13), %rsi
addq $0x4, %rsi
movq %r12, %rdi
movl -0x38(%rbp), %edx
movl %r14d, %ecx
callq 0x2bcc
xorl %ecx, %ecx
movl %ecx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl 0x24(%rax)
orb $0x2, 0x29(%rax)
leaq 0x1879(%rip), %rdx      # 0x42fc
leaq -0x60(%rbp), %rdi
movl $0x10, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0x10b0
movl 0x8(%rbx,%r13), %eax
movq %rbx, -0x40(%rbp)
movzwl 0x6(%rbx,%r13), %ebx
movq %rax, %rsi
movq 0x4651(%rip), %r12      # 0x7100
leal (,%rbx,4), %ecx
leaq 0x2245(%rip), %rdx      # 0x4d02
movq %r12, %rdi
movq %rax, -0x38(%rbp)
callq 0x341e
leaq 0x21f7(%rip), %rdi      # 0x4cc7
testl %eax, %eax
je 0x2b07
movq -0x40(%rbp), %rbx
movl 0x8(%rbx,%r13), %ecx
leaq 0x2174(%rip), %rdx      # 0x4c58
movl %r13d, %esi
xorl %eax, %eax
callq 0x1339
movl -0x2c(%rbp), %esi
movl (%r14), %ecx
leaq 0x1fe8(%rip), %rdi      # 0x4ae3
leaq 0x1e98(%rip), %rdx      # 0x499a
jmp 0x2a3e
movq -0x38(%rbp), %rdx
addq %rdx, %r12
xorl %ecx, %ecx
subl (%r12), %ecx
leaq 0x21ec(%rip), %rdi      # 0x4d07
leaq -0x60(%rbp), %rsi
xorl %eax, %eax
callq 0x10a0
testq %rbx, %rbx
je 0x2a62
movq %r14, -0x48(%rbp)
xorl %r14d, %r14d
movl $0x0, -0x30(%rbp)
movl 0x4(%r12,%r14,4), %ecx
leaq 0x21e1(%rip), %rdi      # 0x4d2a
leaq -0x60(%rbp), %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x10a0
movl 0x4(%r12,%r14,4), %esi
leaq 0x45b5(%rip), %rdi      # 0x7118
callq 0x3329
cmpq %r15, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x2b9f
movl 0x4(%r12,%r14,4), %ecx
leaq 0x21bb(%rip), %rdi      # 0x4d3f
movq -0x38(%rbp), %rsi
leaq 0x2173(%rip), %rdx      # 0x4d02
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
jmp 0x2ba6
incl 0x24(%rax)
orb $0x4, 0x29(%rax)
incq %r14
cmpq %r14, %rbx
jne 0x2b3d
cmpl $0x0, -0x30(%rbp)
movq -0x48(%rbp), %r14
movq -0x40(%rbp), %rbx
leaq 0x2106(%rip), %rdi      # 0x4cc7
jne 0x2ad8
jmp 0x2a62