// File: /workspace/github_c_makefile_star2_O2/rsa9000[P]regfanalysistools/regfwalk.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;
	size_t pref_len = strlen(pref);
	char __pref[pref_len + 3];
	struct cell *cell;
	int res, ret = 0;

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

	snprintf(__pref, sizeof(__pref), "%s  ", pref);

	printf("%snk.{off,len} = 0x%08X, 0x%08X\n", pref, off, -rc->sz);

	if (nk->flags & REGF_NK_F_ASCII)
		printf("%snk.name = %.*s\n", pref, nk->name_sz, nk->name);
	else
		printf("%snk.name = %ls\n", pref,
		       regf_unicode2wchar(nk->name, nk->name_sz));
	printf("%snk.flags = 0x%02X (%s)\n", pref, nk->flags, regf_parse_nk_flags(nk->flags));
	printf("%snk.cname{sz,off} = 0x%08X, 0x%08X\n", pref, nk->cname_sz, nk->cname_off);
	printf("%snk.timestamp = 0x%016"PRIX64"\n", pref, nk->timestamp);
	printf("%snk.parent = 0x%08X\n", pref, nk->parent_off);
	printf("%snk.security = 0x%08X\n", pref, nk->sec_off);
	printf("%snk.skeys{num,off,max(name),max(cname)} = 0x%08X, 0x%08X, 0x%08X, 0x%08X\n",
	       pref, nk->skey_num, nk->skey_off, nk->skey_name_max, nk->skey_cname_max);
	printf("%snk.vskeys{num,off} = 0x%08X 0x%08X\n", pref, nk->vskey_num,
	       nk->vskey_off);
	printf("%snk.vals{num,off,max(name),max(data)} = 0x%08X, 0x%08X, 0x%08X, 0x%08X\n",
	       pref, nk->val_num, nk->val_off, nk->val_name_max, nk->val_data_max);

	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);
			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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r12d
movq %rdi, %r14
movq 0x5868(%rip), %r13      # 0x7100
callq 0x1080
movq %rax, %rbx
movq %rsp, %r15
addq $0x12, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
leaq 0x2db7(%rip), %rdx      # 0x466f
pushq $0x50
popq %rcx
movq %r13, %rdi
movl %r12d, %esi
callq 0x31cb
pushq $-0x1
popq %rcx
testl %eax, %eax
je 0x18d5
movl %ecx, %r14d
jmp 0x1d95
movl %r12d, %eax
addq %rax, %r13
addq $0x3, %rbx
leaq 0x2a16(%rip), %rdx      # 0x42fc
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
xorl %eax, %eax
callq 0x10b0
xorl %ecx, %ecx
subl (%r13), %ecx
leaq 0x29fe(%rip), %rdi      # 0x4301
movq %r14, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x10a0
testb $0x20, 0x6(%r13)
movq %r14, -0x40(%rbp)
jne 0x193f
leaq 0x54(%r13), %rdi
movzwl 0x50(%r13), %esi
callq 0x1da7
leaq 0x2a04(%rip), %rdi      # 0x4334
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x1959
movzwl 0x50(%r13), %edx
leaq 0x54(%r13), %rcx
leaq 0x29d3(%rip), %rdi      # 0x4322
movq %r14, %rsi
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%r13), %ebx
testl %ebx, %ebx
movq %r15, -0x38(%rbp)
movl %r12d, -0x2c(%rbp)
je 0x197a
cmpw $0x80, %bx
jae 0x1986
leaq 0x58a8(%rip), %r14      # 0x7220
jmp 0x19a1
leaq 0x28e2(%rip), %r15      # 0x4263
jmp 0x1ad7
movl $0x6e6b6e, 0x5893(%rip) # imm = 0x6E6B6E
movl $0x6e75202c, 0x5886(%rip) # imm = 0x6E75202C
leaq 0x5885(%rip), %r14      # 0x7226
testb $0x40, %bl
je 0x19cd
leaq 0x5873(%rip), %rsi      # 0x7220
subq %r14, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2c99(%rip), %rdx      # 0x4657
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r14
testb $0x20, %bl
je 0x19f9
leaq 0x5847(%rip), %rsi      # 0x7220
subq %r14, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2c76(%rip), %rdx      # 0x4660
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r14
testb $0x10, %bl
je 0x1a25
leaq 0x581b(%rip), %rsi      # 0x7220
subq %r14, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2c52(%rip), %rdx      # 0x4668
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r14
testb $0x8, %bl
je 0x1a51
leaq 0x57ef(%rip), %rsi      # 0x7220
subq %r14, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2c30(%rip), %rdx      # 0x4672
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r14
testb $0x4, %bl
je 0x1a7d
leaq 0x57c3(%rip), %rsi      # 0x7220
subq %r14, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2c0c(%rip), %rdx      # 0x467a
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r14
testb $0x2, %bl
je 0x1aa9
leaq 0x5797(%rip), %rsi      # 0x7220
subq %r14, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2be8(%rip), %rdx      # 0x4682
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r14
leaq 0x5772(%rip), %r15      # 0x7222
testb $0x1, %bl
je 0x1ad7
leaq 0x5764(%rip), %rsi      # 0x7220
subq %r14, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2bbc(%rip), %rdx      # 0x4689
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0x2867(%rip), %rdi      # 0x4345
xorl %r14d, %r14d
movq -0x40(%rbp), %r12
movq %r12, %rsi
movl %ebx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x10a0
movzwl 0x52(%r13), %edx
movl 0x38(%r13), %ecx
leaq 0x285b(%rip), %rdi      # 0x435f
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movq 0xc(%r13), %rdx
leaq 0x286b(%rip), %rdi      # 0x4384
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x18(%r13), %edx
leaq 0x2871(%rip), %rdi      # 0x439f
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x34(%r13), %edx
leaq 0x2872(%rip), %rdi      # 0x43b5
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x1c(%r13), %edx
movl 0x24(%r13), %ecx
movl 0x3c(%r13), %r8d
movl 0x40(%r13), %r9d
leaq 0x2869(%rip), %rdi      # 0x43cd
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x20(%r13), %edx
movl 0x28(%r13), %ecx
leaq 0x289b(%rip), %rdi      # 0x4418
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x2c(%r13), %edx
movl 0x30(%r13), %ecx
movl 0x44(%r13), %r8d
movl 0x48(%r13), %r9d
leaq 0x28a0(%rip), %rdi      # 0x443e
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
testb $0x4, 0x6(%r13)
jne 0x1bca
movl 0x18(%r13), %edi
callq 0x1859
testq %rax, %rax
movl -0x2c(%rbp), %r15d
je 0x1bd0
incl 0x24(%rax)
orb $0x2, 0x28(%rax)
jmp 0x1bf0
movl -0x2c(%rbp), %r15d
jmp 0x1bf0
movl 0x18(%r13), %ecx
leaq 0x28ac(%rip), %rdi      # 0x4487
leaq 0x2a8d(%rip), %rdx      # 0x466f
movl %r15d, %esi
xorl %eax, %eax
callq 0x2fdc
pushq $-0x1
popq %r14
movl 0x38(%r13), %edi
cmpl $-0x1, %edi
je 0x1c2c
callq 0x1859
testq %rax, %rax
je 0x1c0c
incl 0x24(%rax)
orb $0x8, 0x28(%rax)
jmp 0x1c2c
movl 0x38(%r13), %ecx
leaq 0x28a3(%rip), %rdi      # 0x44ba
leaq 0x2a51(%rip), %rdx      # 0x466f
movl %r15d, %esi
xorl %eax, %eax
callq 0x2fdc
pushq $-0x1
popq %r14
movl 0x34(%r13), %edi
callq 0x1859
testq %rax, %rax
je 0x1c71
incl 0x24(%rax)
orb $0x4, 0x28(%rax)
movl 0x34(%r13), %ebx
movq 0x54b4(%rip), %r12      # 0x7100
leaq 0x2a41(%rip), %rdx      # 0x4694
pushq $0x10
popq %rcx
movq %r12, %rdi
movl %ebx, %esi
callq 0x31cb
testl %eax, %eax
je 0x1c93
movl 0x34(%r13), %ecx
leaq 0x28c2(%rip), %rdi      # 0x4531
jmp 0x1c7c
movl 0x34(%r13), %ecx
leaq 0x2875(%rip), %rdi      # 0x44f1
leaq 0x29ec(%rip), %rdx      # 0x466f
movl %r15d, %esi
xorl %eax, %eax
callq 0x2fdc
pushq $-0x1
popq %r14
jmp 0x1ce5
xorl %ecx, %ecx
subl (%r12,%rbx), %ecx
leaq 0x29f7(%rip), %rdi      # 0x4697
movq -0x38(%rbp), %r15
movq %r15, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x10a0
movl 0x8(%r12,%rbx), %edx
movl 0xc(%r12,%rbx), %ecx
leaq 0x29f7(%rip), %rdi      # 0x46b8
movq %r15, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x10(%r12,%rbx), %edx
leaq 0x2a04(%rip), %rdi      # 0x46db
movq %r15, %rsi
movl -0x2c(%rbp), %r15d
xorl %eax, %eax
callq 0x10a0
cmpl $0x0, 0x1c(%r13)
je 0x1d3b
movl 0x24(%r13), %edi
callq 0x1859
testq %rax, %rax
je 0x1d1b
incl 0x24(%rax)
orb $0x10, 0x28(%rax)
movl 0x24(%r13), %esi
movq -0x38(%rbp), %rdi
callq 0x1e8f
testl %eax, %eax
je 0x1d3b
leaq 0x288e(%rip), %rdi      # 0x45a7
jmp 0x1d22
leaq 0x284c(%rip), %rdi      # 0x456e
movl 0x24(%r13), %ecx
leaq 0x2942(%rip), %rdx      # 0x466f
movl %r15d, %esi
xorl %eax, %eax
callq 0x2fdc
pushq $-0x1
popq %r14
cmpl $0x0, 0x2c(%r13)
je 0x1d95
movl 0x30(%r13), %edi
callq 0x1859
testq %rax, %rax
je 0x1d75
incl 0x24(%rax)
orb $0x20, 0x28(%rax)
movl 0x2c(%r13), %edx
movl 0x30(%r13), %esi
movq -0x38(%rbp), %rdi
callq 0x1f63
testl %eax, %eax
je 0x1d95
leaq 0x28a4(%rip), %rdi      # 0x4617
jmp 0x1d7c
leaq 0x2863(%rip), %rdi      # 0x45df
movl 0x30(%r13), %ecx
leaq 0x28e8(%rip), %rdx      # 0x466f
movl %r15d, %esi
xorl %eax, %eax
callq 0x2fdc
pushq $-0x1
popq %r14
movl %r14d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq