// File: /workspace/github_c_makefile_star2_O2/rsa9000[P]regfanalysistools/regftree.c
// Function: regf_parse_nk
static int regf_parse_nk(const char *pref, unsigned off)
{
#define NK_PR_WARN(__fmt, ...)	PR_WARN(off, "nk", __fmt, ##__VA_ARGS__)
	const struct regf_cell *rc = st.data + off;
	const struct regf_nk *nk = (void *)rc->data;
	struct cell *cell;
	int res, ret = 0;

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

	if (nk->flags & REGF_NK_F_ASCII)
		printf("[%.*s]\n", nk->name_sz, nk->name);
	else
		printf("[%ls]\n", regf_unicode2wchar(nk->name, nk->name_sz));

	if (!(nk->flags & REGF_NK_F_ENTRY)) {
		cell = cache_cell_find(nk->parent_off);
		if (!cell) {
			NK_PR_WARN("could not find parent cell 0x%08X\n",
				   nk->parent_off);
			ret = -1;
		} else {
			cache_cell_updref(cell, CT_NK);
		}
	}

	if (nk->cname_off != ~0U) {
		cell = cache_cell_find(nk->cname_off);
		if (!cell) {
			NK_PR_WARN("could not find class name cell 0x%08X\n",
				   nk->cname_off);
			ret = -1;
		} else {
			cache_cell_updref(cell, CT_CNAME);
		}
	}

	cell = cache_cell_find(nk->sec_off);
	if (!cell) {
		NK_PR_WARN("could not find security descriptor cell 0x%08X\n",
			   nk->sec_off);
		ret = -1;
	} else {
		cache_cell_updref(cell, CT_SK);
		res = regf_parse_sk(pref, nk->sec_off);
		if (res) {
			NK_PR_WARN("could not parse security key cell at 0x%08X\n",
				   nk->sec_off);
			ret = -1;
		}
	}

	if (nk->skey_num) {
		cell = cache_cell_find(nk->skey_off);
		if (!cell) {
			NK_PR_WARN("could not find subkeys list cell 0x%08X\n",
				   nk->skey_off);
			ret = -1;
		} else {
			cache_cell_updref(cell, CT_LST);
			res = regf_parse_lst(pref, nk->skey_off, nk->val_num ? 1 : 0);
			if (res) {
				NK_PR_WARN("could not parse subkeys list at 0x%08X\n",
					   nk->skey_off);
				ret = -1;
			}
		}
	}

	if (nk->val_num) {
		cell = cache_cell_find(nk->val_off);
		if (!cell) {
			NK_PR_WARN("could not find values list cell 0x%08X\n",
				   nk->val_off);
			ret = -1;
		} else {
			cache_cell_updref(cell, CT_VLST);
			res = regf_parse_vlst(pref, nk->val_off, nk->val_num);
			if (res) {
				NK_PR_WARN("could not parse values list cell 0x%08X\n",
					   nk->val_off);
				ret = -1;
			}
		}
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r15
movq 0x4862(%rip), %r14      # 0x6110
leaq 0x1a47(%rip), %rdx      # 0x32fc
pushq $0x50
popq %rcx
movq %r14, %rdi
callq 0x2e77
pushq $-0x1
popq %r12
testl %eax, %eax
jne 0x1a93
movl %ebx, %eax
addq %rax, %r14
testb $0x20, 0x6(%r14)
jne 0x18f9
leaq 0x54(%r14), %rdi
movzwl 0x50(%r14), %esi
callq 0x1aa1
leaq 0x1a1a(%rip), %rdi      # 0x3307
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x1910
movzwl 0x50(%r14), %esi
leaq 0x54(%r14), %rdx
leaq 0x19f6(%rip), %rdi      # 0x32ff
xorl %eax, %eax
callq 0x10b0
xorl %ebp, %ebp
testb $0x4, 0x6(%r14)
jne 0x194e
movl 0x18(%r14), %edi
callq 0x1879
testq %rax, %rax
je 0x1930
incl 0x24(%rax)
orb $0x2, 0x28(%rax)
jmp 0x194e
movl 0x18(%r14), %ecx
leaq 0x19d3(%rip), %rdi      # 0x330e
leaq 0x19ba(%rip), %rdx      # 0x32fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x2c88
pushq $-0x1
popq %rbp
movl 0x38(%r14), %edi
cmpl $-0x1, %edi
je 0x1988
callq 0x1879
testq %rax, %rax
je 0x196a
incl 0x24(%rax)
orb $0x8, 0x28(%rax)
jmp 0x1988
movl 0x38(%r14), %ecx
leaq 0x19cc(%rip), %rdi      # 0x3341
leaq 0x1980(%rip), %rdx      # 0x32fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x2c88
pushq $-0x1
popq %rbp
movl 0x34(%r14), %edi
callq 0x1879
testq %rax, %rax
je 0x19c4
incl 0x24(%rax)
orb $0x4, 0x28(%rax)
movl 0x34(%r14), %esi
movq 0x4768(%rip), %rdi      # 0x6110
leaq 0x1b28(%rip), %rdx      # 0x34d7
pushq $0x10
popq %rcx
callq 0x2e77
testl %eax, %eax
je 0x19e2
leaq 0x19f6(%rip), %rdi      # 0x33b8
jmp 0x19cb
leaq 0x19ad(%rip), %rdi      # 0x3378
movl 0x34(%r14), %ecx
leaq 0x1926(%rip), %rdx      # 0x32fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x2c88
pushq $-0x1
popq %rbp
cmpl $0x0, 0x1c(%r14)
je 0x1a3f
movl 0x24(%r14), %edi
callq 0x1879
testq %rax, %rax
je 0x1a21
incl 0x24(%rax)
orb $0x10, 0x28(%rax)
movl 0x24(%r14), %esi
xorl %edx, %edx
cmpl $0x0, 0x2c(%r14)
setne %dl
movq %r15, %rdi
callq 0x1b89
testl %eax, %eax
je 0x1a3f
leaq 0x1a0f(%rip), %rdi      # 0x342e
jmp 0x1a28
leaq 0x19cd(%rip), %rdi      # 0x33f5
movl 0x24(%r14), %ecx
leaq 0x18c9(%rip), %rdx      # 0x32fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x2c88
pushq $-0x1
popq %rbp
cmpl $0x0, 0x2c(%r14)
je 0x1a96
movl 0x30(%r14), %edi
callq 0x1879
testq %rax, %rax
je 0x1a78
incl 0x24(%rax)
orb $0x20, 0x28(%rax)
movl 0x2c(%r14), %edx
movl 0x30(%r14), %esi
movq %r15, %rdi
callq 0x1ce6
testl %eax, %eax
je 0x1a96
leaq 0x1a28(%rip), %rdi      # 0x349e
jmp 0x1a7f
leaq 0x19e7(%rip), %rdi      # 0x3466
movl 0x30(%r14), %ecx
leaq 0x1872(%rip), %rdx      # 0x32fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x2c88
movl %r12d, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq