// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq 0x643a(%rip), %rax      # 0x8100
movl -0x14(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x38(%rbp)
movq 0x6416(%rip), %rdi      # 0x8100
movl -0x14(%rbp), %esi
leaq 0x363d(%rip), %rdx      # 0x5331
movl $0x50, %ecx
callq 0x4b20
cmpl $0x0, %eax
je 0x1d0f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2008
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x1d3f
movq -0x28(%rbp), %rax
movzwl 0x4c(%rax), %esi
movq -0x28(%rbp), %rdx
addq $0x50, %rdx
leaq 0x35fe(%rip), %rdi      # 0x5334
movb $0x0, %al
callq 0x10a0
jmp 0x1d65
movq -0x28(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rax
movzwl 0x4c(%rax), %esi
callq 0x2050
movq %rax, %rsi
leaq 0x35de(%rip), %rdi      # 0x533c
movb $0x0, %al
callq 0x10a0
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x1dc4
movq -0x28(%rbp), %rax
movl 0x14(%rax), %edi
callq 0x1c20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1db4
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x35a6(%rip), %rdi      # 0x5343
leaq 0x358d(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x1dc2
movq -0x30(%rbp), %rdi
movl $0x2, %esi
callq 0x1c80
jmp 0x1dc4
movq -0x28(%rbp), %rax
cmpl $-0x1, 0x34(%rax)
je 0x1e1d
movq -0x28(%rbp), %rax
movl 0x34(%rax), %edi
callq 0x1c20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1e0d
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x34(%rax), %ecx
leaq 0x3580(%rip), %rdi      # 0x5376
leaq 0x3534(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e1b
movq -0x30(%rbp), %rdi
movl $0x8, %esi
callq 0x1c80
jmp 0x1e1d
movq -0x28(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x1c20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1e5c
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %ecx
leaq 0x3568(%rip), %rdi      # 0x53ad
leaq 0x34e5(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x1eab
movq -0x30(%rbp), %rdi
movl $0x4, %esi
callq 0x1c80
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %esi
callq 0x21b0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1ea9
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %ecx
leaq 0x3559(%rip), %rdi      # 0x53ed
leaq 0x3496(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x1eab
movq -0x28(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x1f5d
movq -0x28(%rbp), %rax
movl 0x20(%rax), %edi
callq 0x1c20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1ef8
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
leaq 0x3549(%rip), %rdi      # 0x542a
leaq 0x3449(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x1f5b
movq -0x30(%rbp), %rdi
movl $0x10, %esi
callq 0x1c80
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x20(%rax), %esi
movq -0x28(%rbp), %rax
movl 0x28(%rax), %ecx
xorl %edx, %edx
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
callq 0x2220
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1f59
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
leaq 0x351f(%rip), %rdi      # 0x5463
leaq 0x33e6(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x1f5b
jmp 0x1f5d
movq -0x28(%rbp), %rax
cmpl $0x0, 0x28(%rax)
je 0x2002
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %edi
callq 0x1c20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1faa
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %ecx
leaq 0x3508(%rip), %rdi      # 0x549b
leaq 0x3397(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x2000
movq -0x30(%rbp), %rdi
movl $0x20, %esi
callq 0x1c80
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %esi
movq -0x28(%rbp), %rax
movl 0x28(%rax), %edx
callq 0x2360
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1ffe
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %ecx
leaq 0x34ea(%rip), %rdi      # 0x54d3
leaq 0x3341(%rip), %rdx      # 0x5331
movb $0x0, %al
callq 0x4760
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
jmp 0x2000
jmp 0x2002
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)