// File: /workspace/github_c_makefile_star2_O3/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 0x4984(%rip), %r13      # 0x7100
callq 0x1080
movq %rax, %r14
movq %rsp, %r12
addq $0x14, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
leaq 0x21fe(%rip), %rdx      # 0x499a
movq %r13, %rdi
movl %ebx, %esi
movl $0x14, %ecx
callq 0x3480
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x2a2e
movl %ebx, %eax
addq %rax, %r13
xorl %ecx, %ecx
subl (%r13), %ecx
leaq 0x21d3(%rip), %rdi      # 0x499d
movq %r15, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%r13), %edx
testl %edx, %edx
je 0x2807
testb $0x1, 0x14(%r13)
jne 0x281a
leaq 0x18(%r13), %rdi
movl %edx, %esi
callq 0x1fae
leaq 0x21ef(%rip), %rdi      # 0x49e7
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x282f
leaq 0x21b0(%rip), %rdi      # 0x49be
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
jmp 0x282f
leaq 0x18(%r13), %rcx
leaq 0x21b0(%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 0x2858
leaq 0x267d(%rip), %rax      # 0x4ecc
movslq (%rax,%rdx,4), %r9
addq %rax, %r9
jmp 0x285f
leaq 0x2375(%rip), %r9       # 0x4bd4
leaq 0xc(%r13), %rbx
leaq 0x218e(%rip), %rdi      # 0x49f8
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
leaq 0x21b5(%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 0x28ca
movl (%rbx), %esi
leaq 0x487c(%rip), %rdi      # 0x7118
callq 0x330d
leaq 0x4878(%rip), %r14      # 0x7120
cmpq %r14, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
movq %rbx, %r15
jne 0x28e5
movl (%r15), %ecx
leaq 0x21b0(%rip), %rdi      # 0x4a75
jmp 0x29fe
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl $0x5, %ecx
jb 0x29ae
leaq 0x2157(%rip), %rdi      # 0x4a37
jmp 0x29fe
movl 0x8(%r13), %esi
movl 0x4819(%rip), %edx      # 0x7108
incl 0x24(%rax)
movl 0x28(%rax), %ecx
cmpl $0x3fd9, %esi           # imm = 0x3FD9
jb 0x29ba
cmpl $0x14, %edx
jbe 0x29ba
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x28(%rax)
movl (%r15), %r13d
movq 0x47e3(%rip), %rbx      # 0x7100
leaq 0x2334(%rip), %rdx      # 0x4c58
movq %rbx, %rdi
movl %r13d, %esi
movl $0x8, %ecx
callq 0x3480
testl %eax, %eax
movl -0x2c(%rbp), %esi
jne 0x2abb
xorl %ecx, %ecx
subl (%rbx,%r13), %ecx
leaq 0x230f(%rip), %rdi      # 0x4c5b
movq %r12, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%rbx,%r13), %edx
leaq 0x2316(%rip), %rdi      # 0x4c7c
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
cmpw $0x0, 0x6(%rbx,%r13)
je 0x2a2c
movl 0x8(%rbx,%r13), %esi
leaq 0x478f(%rip), %rdi      # 0x7118
callq 0x330d
cmpq %r14, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x2a3f
leaq 0x22e4(%rip), %rdi      # 0x4c8d
jmp 0x2aa2
movl 0x10(%r13), %edx
movq %r12, %rdi
movq %rbx, %rsi
jmp 0x2a27
movq %r15, %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 0x4724(%rip), %r13      # 0x7100
leaq 0x2270(%rip), %rdx      # 0x4c53
movq %r13, %rdi
movl %r15d, %esi
movl %r14d, %ecx
callq 0x340a
testl %eax, %eax
je 0x2a16
movl (%rbx), %ecx
leaq 0x20ac(%rip), %rdi      # 0x4aaa
leaq 0x1f95(%rip), %rdx      # 0x499a
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x2a2e
leaq (%r15,%r13), %rsi
addq $0x4, %rsi
movq %r12, %rdi
movl -0x38(%rbp), %edx
movl %r14d, %ecx
callq 0x2bb6
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 0x18af(%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, -0x38(%rbp)
movzwl 0x6(%rbx,%r13), %ebx
movq %rax, %rsi
movq 0x4687(%rip), %r12      # 0x7100
leal (,%rbx,4), %ecx
leaq 0x227b(%rip), %rdx      # 0x4d02
movq %r12, %rdi
movq %rax, -0x50(%rbp)
callq 0x340a
leaq 0x222d(%rip), %rdi      # 0x4cc7
testl %eax, %eax
je 0x2ad1
movq -0x38(%rbp), %rbx
movl 0x8(%rbx,%r13), %ecx
leaq 0x21aa(%rip), %rdx      # 0x4c58
movl %r13d, %esi
xorl %eax, %eax
callq 0x1339
movl -0x2c(%rbp), %esi
movl (%r15), %ecx
leaq 0x201e(%rip), %rdi      # 0x4ae3
leaq 0x1ece(%rip), %rdx      # 0x499a
jmp 0x2a08
movq -0x50(%rbp), %rdx
addq %rdx, %r12
xorl %ecx, %ecx
subl (%r12), %ecx
leaq 0x2222(%rip), %rdi      # 0x4d07
leaq -0x60(%rbp), %rsi
xorl %eax, %eax
callq 0x10a0
testq %rbx, %rbx
je 0x2a2c
movq %r15, -0x48(%rbp)
negq %rbx
movb $0x1, %al
movl %eax, -0x3c(%rbp)
xorl %r15d, %r15d
incq %r15
movl (%r12,%r15,4), %ecx
leal -0x1(%r15), %edx
leaq 0x2210(%rip), %rdi      # 0x4d2a
leaq -0x60(%rbp), %rsi
xorl %eax, %eax
callq 0x10a0
movl (%r12,%r15,4), %esi
leaq 0x45e8(%rip), %rdi      # 0x7118
callq 0x330d
cmpq %r14, %rax
je 0x2b58
testq %rax, %rax
je 0x2b58
incl 0x24(%rax)
orb $0x4, 0x29(%rax)
leaq (%rbx,%r15), %rax
incq %rax
incq %r15
cmpq $0x1, %rax
jne 0x2b0b
jmp 0x2b98
movl (%r12,%r15,4), %ecx
movl $0x0, -0x3c(%rbp)
leaq 0x21d5(%rip), %rdi      # 0x4d3f
movq -0x50(%rbp), %rsi
leaq 0x218d(%rip), %rdx      # 0x4d02
xorl %eax, %eax
callq 0x1339
movq %rbx, %rax
addq %r15, %rax
jne 0x2b08
movq -0x48(%rbp), %r15
movq -0x38(%rbp), %rbx
leaq 0x2134(%rip), %rdi      # 0x4cc7
jmp 0x2aa2
testb $0x1, -0x3c(%rbp)
movq -0x48(%rbp), %r15
movq -0x38(%rbp), %rbx
leaq 0x211c(%rip), %rdi      # 0x4cc7
jne 0x2a2c
jmp 0x2aa2