// File: /workspace/github_c_makefile_star2_O1/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 0x56e1(%rip), %r14      # 0x7110
leaq 0x28c6(%rip), %rdx      # 0x42fc
movq %r14, %rdi
movl $0x50, %ecx
callq 0x321f
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1c95
movl %ebx, %eax
addq %rax, %r14
testb $0x20, 0x6(%r14)
jne 0x1a7d
leaq 0x54(%r14), %rdi
movzwl 0x50(%r14), %esi
callq 0x1ca0
leaq 0x2896(%rip), %rdi      # 0x4307
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x1a94
movzwl 0x50(%r14), %esi
leaq 0x54(%r14), %rdx
leaq 0x2872(%rip), %rdi      # 0x42ff
xorl %eax, %eax
callq 0x10b0
xorl %ebp, %ebp
testb $0x4, 0x6(%r14)
jne 0x1aed
movl 0x18(%r14), %esi
leaq 0x5680(%rip), %rdi      # 0x7128
callq 0x30ad
leaq 0x567c(%rip), %rcx      # 0x7130
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1ae6
movl 0x18(%r14), %ecx
leaq 0x283f(%rip), %rdi      # 0x430e
leaq 0x2826(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x1aed
incl 0x24(%rax)
orb $0x2, 0x28(%rax)
movl 0x38(%r14), %esi
cmpl $-0x1, %esi
je 0x1b42
leaq 0x562b(%rip), %rdi      # 0x7128
callq 0x30ad
leaq 0x5627(%rip), %rcx      # 0x7130
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1b3b
movl 0x38(%r14), %ecx
leaq 0x281d(%rip), %rdi      # 0x4341
leaq 0x27d1(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x1b42
incl 0x24(%rax)
orb $0x8, 0x28(%rax)
movl 0x34(%r14), %esi
leaq 0x55db(%rip), %rdi      # 0x7128
callq 0x30ad
leaq 0x55d7(%rip), %r12      # 0x7130
cmpq %r12, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1b72
leaq 0x2808(%rip), %rdi      # 0x4378
jmp 0x1ba0
incl 0x24(%rax)
orb $0x4, 0x28(%rax)
movl 0x34(%r14), %esi
movq 0x558c(%rip), %rdi      # 0x7110
leaq 0x294c(%rip), %rdx      # 0x44d7
movl $0x10, %ecx
callq 0x321f
testl %eax, %eax
je 0x1bb9
leaq 0x2818(%rip), %rdi      # 0x43b8
movl 0x34(%r14), %ecx
leaq 0x2751(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x0, 0x1c(%r14)
je 0x1c2a
movl 0x24(%r14), %esi
leaq 0x555d(%rip), %rdi      # 0x7128
callq 0x30ad
cmpq %r12, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1be9
leaq 0x280e(%rip), %rdi      # 0x43f5
jmp 0x1c11
incl 0x24(%rax)
orb $0x10, 0x28(%rax)
movl 0x24(%r14), %esi
xorl %edx, %edx
cmpl $0x0, 0x2c(%r14)
setne %dl
movq %r15, %rdi
callq 0x1d8d
testl %eax, %eax
je 0x1c2a
leaq 0x281d(%rip), %rdi      # 0x442e
movl 0x24(%r14), %ecx
leaq 0x26e0(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x0, 0x2c(%r14)
je 0x1c95
movl 0x30(%r14), %esi
leaq 0x54ec(%rip), %rdi      # 0x7128
callq 0x30ad
cmpq %r12, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1c5a
leaq 0x280e(%rip), %rdi      # 0x4466
jmp 0x1c7c
incl 0x24(%rax)
orb $0x20, 0x28(%rax)
movl 0x2c(%r14), %edx
movl 0x30(%r14), %esi
movq %r15, %rdi
callq 0x1f59
testl %eax, %eax
je 0x1c95
leaq 0x2822(%rip), %rdi      # 0x449e
movl 0x30(%r14), %ecx
leaq 0x2675(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq