// File: /workspace/github_c_makefile_star2_O3/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 0x56da(%rip), %r14      # 0x7110
leaq 0x28bf(%rip), %rdx      # 0x42fc
movq %r14, %rdi
movl $0x50, %ecx
callq 0x3208
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1c9c
movl %ebx, %eax
addq %rax, %r14
testb $0x20, 0x6(%r14)
jne 0x1a84
leaq 0x54(%r14), %rdi
movzwl 0x50(%r14), %esi
callq 0x1ca7
leaq 0x288f(%rip), %rdi      # 0x4307
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x1a9b
movzwl 0x50(%r14), %esi
leaq 0x54(%r14), %rdx
leaq 0x286b(%rip), %rdi      # 0x42ff
xorl %eax, %eax
callq 0x10b0
xorl %ebp, %ebp
testb $0x4, 0x6(%r14)
jne 0x1af4
movl 0x18(%r14), %esi
leaq 0x5679(%rip), %rdi      # 0x7128
callq 0x3095
leaq 0x5675(%rip), %rcx      # 0x7130
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1aed
movl 0x18(%r14), %ecx
leaq 0x2838(%rip), %rdi      # 0x430e
leaq 0x281f(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x1af4
incl 0x24(%rax)
orb $0x2, 0x28(%rax)
movl 0x38(%r14), %esi
cmpl $-0x1, %esi
je 0x1b49
leaq 0x5624(%rip), %rdi      # 0x7128
callq 0x3095
leaq 0x5620(%rip), %rcx      # 0x7130
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1b42
movl 0x38(%r14), %ecx
leaq 0x2816(%rip), %rdi      # 0x4341
leaq 0x27ca(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x1b49
incl 0x24(%rax)
orb $0x8, 0x28(%rax)
movl 0x34(%r14), %esi
leaq 0x55d4(%rip), %rdi      # 0x7128
callq 0x3095
leaq 0x55d0(%rip), %r12      # 0x7130
cmpq %r12, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1b79
leaq 0x2801(%rip), %rdi      # 0x4378
jmp 0x1ba7
incl 0x24(%rax)
orb $0x4, 0x28(%rax)
movl 0x34(%r14), %esi
movq 0x5585(%rip), %rdi      # 0x7110
leaq 0x2945(%rip), %rdx      # 0x44d7
movl $0x10, %ecx
callq 0x3208
testl %eax, %eax
je 0x1bc0
leaq 0x2811(%rip), %rdi      # 0x43b8
movl 0x34(%r14), %ecx
leaq 0x274a(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x0, 0x1c(%r14)
je 0x1c31
movl 0x24(%r14), %esi
leaq 0x5556(%rip), %rdi      # 0x7128
callq 0x3095
cmpq %r12, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1bf0
leaq 0x2807(%rip), %rdi      # 0x43f5
jmp 0x1c18
incl 0x24(%rax)
orb $0x10, 0x28(%rax)
movl 0x24(%r14), %esi
xorl %edx, %edx
cmpl $0x0, 0x2c(%r14)
setne %dl
movq %r15, %rdi
callq 0x1d94
testl %eax, %eax
je 0x1c31
leaq 0x2816(%rip), %rdi      # 0x442e
movl 0x24(%r14), %ecx
leaq 0x26d9(%rip), %rdx      # 0x42fc
movl %ebx, %esi
xorl %eax, %eax
callq 0x1359
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x0, 0x2c(%r14)
je 0x1c9c
movl 0x30(%r14), %esi
leaq 0x54e5(%rip), %rdi      # 0x7128
callq 0x3095
cmpq %r12, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1c61
leaq 0x2807(%rip), %rdi      # 0x4466
jmp 0x1c83
incl 0x24(%rax)
orb $0x20, 0x28(%rax)
movl 0x2c(%r14), %edx
movl 0x30(%r14), %esi
movq %r15, %rdi
callq 0x1f20
testl %eax, %eax
je 0x1c9c
leaq 0x281b(%rip), %rdi      # 0x449e
movl 0x30(%r14), %ecx
leaq 0x266e(%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