// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_ne_one_nameinfo
static void do_ne_one_nameinfo(deark *c, lctx *d, i64 npos)
{
	i64 rsrc_offset;
	i64 rsrc_size;
	i64 is_named;
	i64 rnID;
	i64 rnNameOffset;
	i64 x;
	u8 looks_like_ishield_sfx_ne = 0;
	de_finfo *fi = NULL;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	rsrc_offset = de_getu16le(npos);
	if(d->ne_rcalign_shift>0) rsrc_offset <<= d->ne_rcalign_shift;
	rsrc_size = de_getu16le(npos+2);
	if(d->ne_rcalign_shift>0) rsrc_size <<= d->ne_rcalign_shift;

	de_dbg(c, "NAMEINFO at %"I64_FMT", dpos=%"I64_FMT", dlen=%"I64_FMT, npos,
		rsrc_offset, rsrc_size);
	de_dbg_indent(c, 1);

	rnID = 0;
	rnNameOffset = 0;
	x = de_getu16le(npos+6);
	if(x&0x8000) {
		is_named = 0;
		rnID = x-0x8000;
	}
	else {
		is_named = 1;
		rnNameOffset = d->ne_rsrc_tbl_offset + x;
	}

	if(is_named) {
		de_dbg(c, "id name offset: %"I64_FMT, rnNameOffset);
	}
	else {
		de_dbg(c, "id number: %d", (int)rnID);
	}

	if(!d->ne_have_type) goto done;

	fi = de_finfo_create(c);

	if(is_named) {
		// Names are prefixed with a single-byte length.
		x = (i64)de_getbyte(rnNameOffset);
		if(x>0) {
			struct de_stringreaderdata *rname_srd = NULL;

			rname_srd = dbuf_read_string(c->infile, rnNameOffset+1, x, x, 0, DE_ENCODING_ASCII);
			de_dbg(c, "resource name: \"%s\"", ucstring_getpsz(rname_srd->str));
			if(c->filenames_from_file)
				de_finfo_set_name_from_ucstring(c, fi, rname_srd->str, 0);

			if(d->ne_rsrc_type_id==1024 && rsrc_size>=20 &&
				!de_strcmp(rname_srd->sz, "MYRESOURCE"))
			{
				looks_like_ishield_sfx_ne = 1;
			}

			de_destroy_stringreaderdata(c, rname_srd);
		}
	}

	if(looks_like_ishield_sfx_ne) {
		d->might_be_ishield_sfx_ne = 1;
		d->ishield_sfx_ne_rsrc_pos = rsrc_offset;
		d->ishield_sfx_ne_rsrc_len = rsrc_size;
	}

	if(rsrc_size>0) {
		const char *rsrcname;

		if(d->ne_rsrc_type_info && d->ne_rsrc_type_info->name)
			rsrcname = d->ne_rsrc_type_info->name;
		else
			rsrcname = "?";

		de_dbg(c, "resource at %"I64_FMT", len=%"I64_FMT", type_id=%u (%s)", rsrc_offset,
			rsrc_size, (UI)d->ne_rsrc_type_id, rsrcname);
		de_dbg_indent(c, 1);
		if(looks_like_ishield_sfx_ne) {
			de_dbg(c, "[InstallShield SFX data]");
		}
		do_ne_pe_extract_resource(c, d, d->ne_rsrc_type_id, d->ne_rsrc_type_info,
			rsrc_offset, rsrc_size, fi);
		de_dbg_indent(c, -1);
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x49(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x5c(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165280
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x68(%rax)
jbe 0x62e23
movq -0x10(%rbp), %rax
movl 0x68(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, %ecx
shlq %cl, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x2, %rsi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x68(%rax)
jbe 0x62e5a
movq -0x10(%rbp), %rax
movl 0x68(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, %ecx
shlq %cl, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq 0x1462a3(%rip), %rsi    # 0x1a9114
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x6, %rsi
callq 0x165280
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
andq $0x8000, %rax           # imm = 0x8000
cmpq $0x0, %rax
je 0x62ed7
movq $0x0, -0x30(%rbp)
movq -0x48(%rbp), %rax
subq $0x8000, %rax           # imm = 0x8000
movq %rax, -0x38(%rbp)
jmp 0x62eef
movq $0x1, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x62f0e
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x146233(%rip), %rsi    # 0x1a9138
movb $0x0, %al
callq 0x15b0d0
jmp 0x62f26
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
leaq 0x14622d(%rip), %rsi    # 0x1a914c
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x6c(%rax)
jne 0x62f35
jmp 0x63129
movq -0x8(%rbp), %rdi
callq 0x15d230
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x63030
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x165060
movzbl %al, %eax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jle 0x6302e
movq $0x0, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
addq $0x1, %rsi
movq -0x48(%rbp), %rdx
movq -0x48(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1664c0
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x172500
movq -0x78(%rbp), %rdi
movq %rax, %rdx
leaq 0x146195(%rip), %rsi    # 0x1a915a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
cmpb $0x0, 0xd0(%rax)
je 0x62ff0
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rdx
xorl %ecx, %ecx
callq 0x15d2c0
movq -0x10(%rbp), %rax
cmpl $0x400, 0x70(%rax)      # imm = 0x400
jne 0x63021
cmpq $0x14, -0x28(%rbp)
jl 0x63021
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x14615b(%rip), %rsi    # 0x1a916e
callq 0x191a0
cmpl $0x0, %eax
jne 0x63021
movb $0x1, -0x49(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x166830
jmp 0x63030
cmpb $0x0, -0x49(%rbp)
je 0x6305f
movq -0x10(%rbp), %rax
movb $0x1, 0x80(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x90(%rax)
cmpq $0x0, -0x28(%rbp)
jle 0x63127
movq -0x10(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x63096
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x63096
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0x630a1
leaq 0x154b90(%rip), %rax    # 0x1b7c2d
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x70(%rax), %r8d
movq -0x70(%rbp), %r9
leaq 0x1460b9(%rip), %rsi    # 0x1a9179
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
cmpb $0x0, -0x49(%rbp)
je 0x630ed
movq -0x8(%rbp), %rdi
leaq 0x1460bd(%rip), %rsi    # 0x1a91a3
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x70(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x58(%rbp), %rax
movq %rax, (%rsp)
callq 0x62d40
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
jmp 0x63129
movq -0x8(%rbp), %rdi
movl -0x5c(%rbp), %esi
callq 0x15b5a0
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x15d260
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)