// File: /workspace/github_c_makefile_star2_O1/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, %r15d
movq %rdi, %r12
movq 0x56e7(%rip), %r14      # 0x7100
callq 0x1080
movq %rax, %rbx
movq %rsp, %r13
addq $0x12, %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
leaq 0x2c36(%rip), %rdx      # 0x466f
movq %r14, %rdi
movl %r15d, %esi
movl $0x50, %ecx
callq 0x349b
testl %eax, %eax
jne 0x1f2f
movl %r15d, %eax
addq %rax, %r14
addq $0x3, %rbx
leaq 0x289a(%rip), %rdx      # 0x42fc
movq %r13, -0x38(%rbp)
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rcx
xorl %eax, %eax
callq 0x10b0
xorl %ecx, %ecx
subl (%r14), %ecx
leaq 0x287f(%rip), %rdi      # 0x4301
movq %r12, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x10a0
testb $0x20, 0x6(%r14)
jne 0x1aba
leaq 0x54(%r14), %rdi
movzwl 0x50(%r14), %esi
callq 0x1fa7
leaq 0x2889(%rip), %rdi      # 0x4334
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x1ad4
movzwl 0x50(%r14), %edx
leaq 0x54(%r14), %rcx
leaq 0x2858(%rip), %rdi      # 0x4322
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%r14), %ebx
testl %ebx, %ebx
movl %r15d, -0x2c(%rbp)
je 0x1af2
cmpl $0x80, %ebx
jae 0x1afe
leaq 0x5730(%rip), %r13      # 0x7220
jmp 0x1b19
leaq 0x276a(%rip), %r15      # 0x4263
jmp 0x1c4f
movl $0x6e6b6e, 0x571b(%rip) # imm = 0x6E6B6E
movl $0x6e75202c, 0x570e(%rip) # imm = 0x6E75202C
leaq 0x570d(%rip), %r13      # 0x7226
testb $0x40, %bl
je 0x1b45
leaq 0x56fb(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2b21(%rip), %rdx      # 0x4657
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x20, %bl
je 0x1b71
leaq 0x56cf(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2afe(%rip), %rdx      # 0x4660
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x10, %bl
je 0x1b9d
leaq 0x56a3(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2ada(%rip), %rdx      # 0x4668
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x8, %bl
je 0x1bc9
leaq 0x5677(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2ab8(%rip), %rdx      # 0x4672
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x4, %bl
je 0x1bf5
leaq 0x564b(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2a94(%rip), %rdx      # 0x467a
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x2, %bl
je 0x1c21
leaq 0x561f(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2a70(%rip), %rdx      # 0x4682
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
leaq 0x55fa(%rip), %r15      # 0x7222
testb $0x1, %bl
je 0x1c4f
leaq 0x55ec(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2a44(%rip), %rdx      # 0x4689
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0x26ef(%rip), %rdi      # 0x4345
xorl %r13d, %r13d
movq %r12, %rsi
movl %ebx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x10a0
movzwl 0x52(%r14), %edx
movl 0x38(%r14), %ecx
leaq 0x26e7(%rip), %rdi      # 0x435f
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movq 0xc(%r14), %rdx
leaq 0x26f7(%rip), %rdi      # 0x4384
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x18(%r14), %edx
leaq 0x26fd(%rip), %rdi      # 0x439f
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x34(%r14), %edx
leaq 0x26fe(%rip), %rdi      # 0x43b5
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x1c(%r14), %edx
movl 0x24(%r14), %ecx
movl 0x3c(%r14), %r8d
movl 0x40(%r14), %r9d
leaq 0x26f5(%rip), %rdi      # 0x43cd
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x20(%r14), %edx
movl 0x28(%r14), %ecx
leaq 0x2727(%rip), %rdi      # 0x4418
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x2c(%r14), %edx
movl 0x30(%r14), %ecx
movl 0x44(%r14), %r8d
movl 0x48(%r14), %r9d
leaq 0x272c(%rip), %rdi      # 0x443e
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
testb $0x4, 0x6(%r14)
jne 0x1d70
movl 0x18(%r14), %esi
leaq 0x53ea(%rip), %rdi      # 0x7118
callq 0x3329
leaq 0x53e6(%rip), %rcx      # 0x7120
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
movl -0x2c(%rbp), %ebx
jne 0x1d75
movl 0x18(%r14), %ecx
leaq 0x272f(%rip), %rdi      # 0x4487
leaq 0x2910(%rip), %rdx      # 0x466f
movl %ebx, %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x1d7c
movl -0x2c(%rbp), %ebx
jmp 0x1d7c
incl 0x24(%rax)
orb $0x2, 0x28(%rax)
movl 0x38(%r14), %esi
cmpl $-0x1, %esi
je 0x1dd2
leaq 0x538c(%rip), %rdi      # 0x7118
callq 0x3329
leaq 0x5388(%rip), %rcx      # 0x7120
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1dcb
movl 0x38(%r14), %ecx
leaq 0x2707(%rip), %rdi      # 0x44ba
leaq 0x28b5(%rip), %rdx      # 0x466f
movl %ebx, %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x1dd2
incl 0x24(%rax)
orb $0x8, 0x28(%rax)
movl 0x34(%r14), %esi
leaq 0x533b(%rip), %rdi      # 0x7118
callq 0x3329
leaq 0x5337(%rip), %r15      # 0x7120
cmpq %r15, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1e06
movl 0x34(%r14), %ecx
leaq 0x26ed(%rip), %rdi      # 0x44f1
jmp 0x1e41
incl 0x24(%rax)
orb $0x4, 0x28(%rax)
movl 0x34(%r14), %ebx
movq 0x52e8(%rip), %r12      # 0x7100
leaq 0x2875(%rip), %rdx      # 0x4694
movq %r12, %rdi
movl %ebx, %esi
movl $0x10, %ecx
callq 0x349b
testl %eax, %eax
je 0x1f47
movl 0x34(%r14), %ecx
leaq 0x26f0(%rip), %rdi      # 0x4531
leaq 0x2827(%rip), %rdx      # 0x466f
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq -0x38(%rbp), %r13
cmpl $0x0, 0x1c(%r14)
je 0x1ec5
movl 0x24(%r14), %esi
leaq 0x52aa(%rip), %rdi      # 0x7118
callq 0x3329
cmpq %r15, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1e8c
leaq 0x26e4(%rip), %rdi      # 0x456e
jmp 0x1eaa
incl 0x24(%rax)
orb $0x10, 0x28(%rax)
movl 0x24(%r14), %esi
movq %r13, %rdi
callq 0x2094
testl %eax, %eax
je 0x1ec5
leaq 0x26fd(%rip), %rdi      # 0x45a7
movl 0x24(%r14), %ecx
leaq 0x27ba(%rip), %rdx      # 0x466f
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $0x0, 0x2c(%r14)
je 0x1f35
movl 0x30(%r14), %esi
leaq 0x5241(%rip), %rdi      # 0x7118
callq 0x3329
cmpq %r15, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1ef8
leaq 0x26ec(%rip), %rdi      # 0x45df
movl -0x2c(%rbp), %esi
jmp 0x1f1d
incl 0x24(%rax)
orb $0x20, 0x28(%rax)
movl 0x2c(%r14), %edx
movl 0x30(%r14), %esi
movq %r13, %rdi
callq 0x21a9
testl %eax, %eax
movl -0x2c(%rbp), %esi
je 0x1f35
leaq 0x26fa(%rip), %rdi      # 0x4617
movl 0x30(%r14), %ecx
leaq 0x2747(%rip), %rdx      # 0x466f
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
subl (%r12,%rbx), %ecx
leaq 0x2743(%rip), %rdi      # 0x4697
movl %r13d, %r15d
movq -0x38(%rbp), %r13
movq %r13, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x10a0
movl 0x8(%r12,%rbx), %edx
movl 0xc(%r12,%rbx), %ecx
leaq 0x2740(%rip), %rdi      # 0x46b8
movq %r13, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x10(%r12,%rbx), %edx
movl %r15d, %r12d
leaq 0x518f(%rip), %r15      # 0x7120
leaq 0x2743(%rip), %rdi      # 0x46db
movq %r13, %rsi
xorl %eax, %eax
callq 0x10a0
jmp 0x1e5c