// File: /workspace/github_c_makefile_star2_O0/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
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq 0x7447(%rip), %rax      # 0x9100
movl -0x14(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1080
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdx
movq %rdx, %rax
addq $0x3, %rax
movq %rax, -0x68(%rbp)
movq %rsp, %rcx
movq %rcx, -0x38(%rbp)
addq $0x12, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x60(%rbp)
movq %rcx, %rsp
movq %rax, -0x40(%rbp)
movl $0x0, -0x50(%rbp)
movq 0x73e7(%rip), %rdi      # 0x9100
movl -0x14(%rbp), %esi
leaq 0x49ad(%rip), %rdx      # 0x66d0
movl $0x50, %ecx
callq 0x4fd0
cmpl $0x0, %eax
je 0x1d45
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x54(%rbp)
jmp 0x219d
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdi
movq -0x10(%rbp), %rcx
leaq 0x4605(%rip), %rdx      # 0x635d
movb $0x0, %al
callq 0x10b0
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rax
xorl %ecx, %ecx
subl (%rax), %ecx
leaq 0x45ed(%rip), %rdi      # 0x6362
movb $0x0, %al
callq 0x10a0
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x1db0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movzwl 0x4c(%rax), %edx
movq -0x28(%rbp), %rcx
addq $0x50, %rcx
leaq 0x45dc(%rip), %rdi      # 0x6383
movb $0x0, %al
callq 0x10a0
jmp 0x1de2
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rax
movzwl 0x4c(%rax), %esi
callq 0x21e0
movq -0x70(%rbp), %rsi
movq %rax, %rdx
leaq 0x45ba(%rip), %rdi      # 0x6395
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0x74(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x2340
movq -0x80(%rbp), %rsi
movl -0x74(%rbp), %edx
movq %rax, %rcx
leaq 0x4593(%rip), %rdi      # 0x63a6
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movzwl 0x4e(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x34(%rax), %ecx
leaq 0x458c(%rip), %rdi      # 0x63c0
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x4597(%rip), %rdi      # 0x63e5
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x14(%rax), %edx
leaq 0x4599(%rip), %rdi      # 0x6400
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %edx
leaq 0x4596(%rip), %rdi      # 0x6416
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x18(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x28(%rbp), %rax
movl 0x38(%rax), %r8d
movq -0x28(%rbp), %rax
movl 0x3c(%rax), %r9d
leaq 0x457e(%rip), %rdi      # 0x642e
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x1c(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x24(%rax), %ecx
leaq 0x45a9(%rip), %rdi      # 0x6479
movb $0x0, %al
callq 0x10a0
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x28(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %ecx
movq -0x28(%rbp), %rax
movl 0x40(%rax), %r8d
movq -0x28(%rbp), %rax
movl 0x44(%rax), %r9d
leaq 0x459f(%rip), %rdi      # 0x649f
movb $0x0, %al
callq 0x10a0
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x1f66
movq -0x28(%rbp), %rax
movl 0x14(%rax), %edi
callq 0x1c10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x1f56
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x45a9(%rip), %rdi      # 0x64e8
leaq 0x478a(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x1f64
movq -0x48(%rbp), %rdi
movl $0x2, %esi
callq 0x1c70
jmp 0x1f66
movq -0x28(%rbp), %rax
cmpl $-0x1, 0x34(%rax)
je 0x1fbf
movq -0x28(%rbp), %rax
movl 0x34(%rax), %edi
callq 0x1c10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x1faf
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x34(%rax), %ecx
leaq 0x4583(%rip), %rdi      # 0x651b
leaq 0x4731(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fbd
movq -0x48(%rbp), %rdi
movl $0x8, %esi
callq 0x1c70
jmp 0x1fbf
movq -0x28(%rbp), %rax
movl 0x30(%rax), %edi
callq 0x1c10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x1ffe
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %ecx
leaq 0x456b(%rip), %rdi      # 0x6552
leaq 0x46e2(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x204d
movq -0x48(%rbp), %rdi
movl $0x4, %esi
callq 0x1c70
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %esi
callq 0x2570
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x204b
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %ecx
leaq 0x455c(%rip), %rdi      # 0x6592
leaq 0x4693(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x204d
movq -0x28(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x20eb
movq -0x28(%rbp), %rax
movl 0x20(%rax), %edi
callq 0x1c10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x209a
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
leaq 0x454c(%rip), %rdi      # 0x65cf
leaq 0x4646(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x20e9
movq -0x48(%rbp), %rdi
movl $0x10, %esi
callq 0x1c70
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x2630
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x20e7
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ecx
leaq 0x4536(%rip), %rdi      # 0x6608
leaq 0x45f7(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x20e9
jmp 0x20eb
movq -0x28(%rbp), %rax
cmpl $0x0, 0x28(%rax)
je 0x2190
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %edi
callq 0x1c10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x2138
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %ecx
leaq 0x451f(%rip), %rdi      # 0x6640
leaq 0x45a8(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x218e
movq -0x48(%rbp), %rdi
movl $0x20, %esi
callq 0x1c70
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %esi
movq -0x28(%rbp), %rax
movl 0x28(%rax), %edx
callq 0x2790
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x218c
movl -0x14(%rbp), %esi
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %ecx
leaq 0x4501(%rip), %rdi      # 0x6678
leaq 0x4552(%rip), %rdx      # 0x66d0
movb $0x0, %al
callq 0x4c10
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
jmp 0x218e
jmp 0x2190
movl -0x50(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x54(%rbp)
movq -0x38(%rbp), %rax
movq %rax, %rsp
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax)