// File: /workspace/github_c_makefile_star2_O3/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 0x56e0(%rip), %r14      # 0x7100
callq 0x1080
movq %rax, %rbx
movq %rsp, %r13
addq $0x12, %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
leaq 0x2c2f(%rip), %rdx      # 0x466f
movq %r14, %rdi
movl %r15d, %esi
movl $0x50, %ecx
callq 0x3480
testl %eax, %eax
jne 0x1f36
movl %r15d, %eax
addq %rax, %r14
addq $0x3, %rbx
leaq 0x2893(%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 0x2878(%rip), %rdi      # 0x4301
movq %r12, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x10a0
testb $0x20, 0x6(%r14)
jne 0x1ac1
leaq 0x54(%r14), %rdi
movzwl 0x50(%r14), %esi
callq 0x1fae
leaq 0x2882(%rip), %rdi      # 0x4334
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10a0
jmp 0x1adb
movzwl 0x50(%r14), %edx
leaq 0x54(%r14), %rcx
leaq 0x2851(%rip), %rdi      # 0x4322
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movzwl 0x6(%r14), %ebx
testl %ebx, %ebx
movl %r15d, -0x2c(%rbp)
je 0x1af9
cmpl $0x80, %ebx
jae 0x1b05
leaq 0x5729(%rip), %r13      # 0x7220
jmp 0x1b20
leaq 0x2763(%rip), %r15      # 0x4263
jmp 0x1c56
movl $0x6e6b6e, 0x5714(%rip) # imm = 0x6E6B6E
movl $0x6e75202c, 0x5707(%rip) # imm = 0x6E75202C
leaq 0x5706(%rip), %r13      # 0x7226
testb $0x40, %bl
je 0x1b4c
leaq 0x56f4(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2b1a(%rip), %rdx      # 0x4657
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x20, %bl
je 0x1b78
leaq 0x56c8(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2af7(%rip), %rdx      # 0x4660
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x10, %bl
je 0x1ba4
leaq 0x569c(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2ad3(%rip), %rdx      # 0x4668
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x8, %bl
je 0x1bd0
leaq 0x5670(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2ab1(%rip), %rdx      # 0x4672
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x4, %bl
je 0x1bfc
leaq 0x5644(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2a8d(%rip), %rdx      # 0x467a
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
testb $0x2, %bl
je 0x1c28
leaq 0x5618(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2a69(%rip), %rdx      # 0x4682
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
cltq
addq %rax, %r13
leaq 0x55f3(%rip), %r15      # 0x7222
testb $0x1, %bl
je 0x1c56
leaq 0x55e5(%rip), %rsi      # 0x7220
subq %r13, %rsi
addq $0x100, %rsi            # imm = 0x100
leaq 0x2a3d(%rip), %rdx      # 0x4689
movq %r13, %rdi
xorl %eax, %eax
callq 0x10b0
leaq 0x26e8(%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 0x26e0(%rip), %rdi      # 0x435f
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movq 0xc(%r14), %rdx
leaq 0x26f0(%rip), %rdi      # 0x4384
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x18(%r14), %edx
leaq 0x26f6(%rip), %rdi      # 0x439f
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x34(%r14), %edx
leaq 0x26f7(%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 0x26ee(%rip), %rdi      # 0x43cd
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x20(%r14), %edx
movl 0x28(%r14), %ecx
leaq 0x2720(%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 0x2725(%rip), %rdi      # 0x443e
movq %r12, %rsi
xorl %eax, %eax
callq 0x10a0
testb $0x4, 0x6(%r14)
jne 0x1d77
movl 0x18(%r14), %esi
leaq 0x53e3(%rip), %rdi      # 0x7118
callq 0x330d
leaq 0x53df(%rip), %rcx      # 0x7120
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
movl -0x2c(%rbp), %ebx
jne 0x1d7c
movl 0x18(%r14), %ecx
leaq 0x2728(%rip), %rdi      # 0x4487
leaq 0x2909(%rip), %rdx      # 0x466f
movl %ebx, %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x1d83
movl -0x2c(%rbp), %ebx
jmp 0x1d83
incl 0x24(%rax)
orb $0x2, 0x28(%rax)
movl 0x38(%r14), %esi
cmpl $-0x1, %esi
je 0x1dd9
leaq 0x5385(%rip), %rdi      # 0x7118
callq 0x330d
leaq 0x5381(%rip), %rcx      # 0x7120
cmpq %rcx, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1dd2
movl 0x38(%r14), %ecx
leaq 0x2700(%rip), %rdi      # 0x44ba
leaq 0x28ae(%rip), %rdx      # 0x466f
movl %ebx, %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x1dd9
incl 0x24(%rax)
orb $0x8, 0x28(%rax)
movl 0x34(%r14), %esi
leaq 0x5334(%rip), %rdi      # 0x7118
callq 0x330d
leaq 0x5330(%rip), %r15      # 0x7120
cmpq %r15, %rax
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
jne 0x1e0d
movl 0x34(%r14), %ecx
leaq 0x26e6(%rip), %rdi      # 0x44f1
jmp 0x1e48
incl 0x24(%rax)
orb $0x4, 0x28(%rax)
movl 0x34(%r14), %ebx
movq 0x52e1(%rip), %r12      # 0x7100
leaq 0x286e(%rip), %rdx      # 0x4694
movq %r12, %rdi
movl %ebx, %esi
movl $0x10, %ecx
callq 0x3480
testl %eax, %eax
je 0x1f4e
movl 0x34(%r14), %ecx
leaq 0x26e9(%rip), %rdi      # 0x4531
leaq 0x2820(%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 0x1ecc
movl 0x24(%r14), %esi
leaq 0x52a3(%rip), %rdi      # 0x7118
callq 0x330d
cmpq %r15, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1e93
leaq 0x26dd(%rip), %rdi      # 0x456e
jmp 0x1eb1
incl 0x24(%rax)
orb $0x10, 0x28(%rax)
movl 0x24(%r14), %esi
movq %r13, %rdi
callq 0x209b
testl %eax, %eax
je 0x1ecc
leaq 0x26f6(%rip), %rdi      # 0x45a7
movl 0x24(%r14), %ecx
leaq 0x27b3(%rip), %rdx      # 0x466f
movl -0x2c(%rbp), %esi
xorl %eax, %eax
callq 0x1339
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $0x0, 0x2c(%r14)
je 0x1f3c
movl 0x30(%r14), %esi
leaq 0x523a(%rip), %rdi      # 0x7118
callq 0x330d
cmpq %r15, %rax
sete %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
je 0x1eff
leaq 0x26e5(%rip), %rdi      # 0x45df
movl -0x2c(%rbp), %esi
jmp 0x1f24
incl 0x24(%rax)
orb $0x20, 0x28(%rax)
movl 0x2c(%r14), %edx
movl 0x30(%r14), %esi
movq %r13, %rdi
callq 0x2173
testl %eax, %eax
movl -0x2c(%rbp), %esi
je 0x1f3c
leaq 0x26f3(%rip), %rdi      # 0x4617
movl 0x30(%r14), %ecx
leaq 0x2740(%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 0x273c(%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 0x2739(%rip), %rdi      # 0x46b8
movq %r13, %rsi
xorl %eax, %eax
callq 0x10a0
movl 0x10(%r12,%rbx), %edx
movl %r15d, %r12d
leaq 0x5188(%rip), %r15      # 0x7120
leaq 0x273c(%rip), %rdi      # 0x46db
movq %r13, %rsi
xorl %eax, %eax
callq 0x10a0
jmp 0x1e63