// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/palmpdb.c
// Function: do_pqa_app_info_block
static void do_pqa_app_info_block(deark *c, lctx *d, i64 pos1, i64 len)
{
	u32 sig;
	u32 ux;
	i64 n;
	de_ucstring *s = NULL;
	i64 pos = pos1;

	sig = (u32)de_getu32be_p(&pos);
	if(sig!=CODE_lnch) return; // Apparently not a PQA appinfo block
	de_dbg(c, "PQA sig: 0x%08x", (unsigned int)sig);

	ux = (u32)de_getu16be_p(&pos);
	de_dbg(c, "hdrVersion: 0x%04x", (unsigned int)ux);
	ux = (u32)de_getu16be_p(&pos);
	de_dbg(c, "encVersion: 0x%04x", (unsigned int)ux);

	s = ucstring_create(c);

	n = de_getu16be_p(&pos);
	dbuf_read_to_ucstring_n(c->infile, pos, n*2, DE_DBG_MAX_STRLEN, s,
		DE_CONVFLAG_STOP_AT_NUL, DE_ENCODING_PALM);
	de_dbg(c, "verStr: \"%s\"", ucstring_getpsz(s));
	ucstring_empty(s);
	pos += 2*n;

	n = de_getu16be_p(&pos);
	dbuf_read_to_ucstring_n(c->infile, pos, n*2, DE_DBG_MAX_STRLEN, s,
		DE_CONVFLAG_STOP_AT_NUL, DE_ENCODING_PALM);
	de_dbg(c, "pqaTitle: \"%s\"", ucstring_getpsz(s));
	ucstring_empty(s);
	pos += 2*n;

	de_dbg(c, "icon");
	de_dbg_indent(c, 1);
	n = de_getu16be_p(&pos); // iconWords (length prefix)
	extract_item(c, d, pos, 2*n, "icon.palm", NULL, DE_CREATEFLAG_IS_AUX, 1);
	pos += 2*n;
	de_dbg_indent(c, -1);

	de_dbg(c, "smIcon");
	de_dbg_indent(c, 1);
	n = de_getu16be_p(&pos); // smIconWords
	extract_item(c, d, pos, 2*n, "smicon.palm", NULL, DE_CREATEFLAG_IS_AUX, 1);
	pos += 2*n;
	de_dbg_indent(c, -1);

	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1654b0
movl %eax, -0x24(%rbp)
cmpl $0x6c6e6368, -0x24(%rbp) # imm = 0x6C6E6368
je 0x100fea
jmp 0x101273
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %edx
leaq 0xc0354(%rip), %rsi     # 0x1c134c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165210
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %edx
leaq 0xc033b(%rip), %rsi     # 0x1c135c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165210
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %edx
leaq 0xc0325(%rip), %rsi     # 0x1c136f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165210
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
shlq %rdx
movq -0x38(%rbp), %r8
movl $0x1f4, %ecx            # imm = 0x1F4
movl $0x1, %r9d
movl $0x13, (%rsp)
callq 0x166a40
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rdi
callq 0x172500
movq -0x50(%rbp), %rdi
movq %rax, %rdx
leaq 0xc02c2(%rip), %rsi     # 0x1c1382
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rdi
callq 0x171210
movq -0x30(%rbp), %rax
shlq %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165210
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
shlq %rdx
movq -0x38(%rbp), %r8
movl $0x1f4, %ecx            # imm = 0x1F4
movl $0x1, %r9d
movl $0x13, (%rsp)
callq 0x166a40
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
callq 0x172500
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0xc024e(%rip), %rsi     # 0x1c138f
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rdi
callq 0x171210
movq -0x30(%rbp), %rax
shlq %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xaf2df(%rip), %rsi     # 0x1b044a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165210
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rcx
shlq %rcx
leaq 0xc01f8(%rip), %r8      # 0x1c13a7
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x100500
movq -0x30(%rbp), %rax
shlq %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rdi
leaq 0xc01ae(%rip), %rsi     # 0x1c139e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x165210
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rcx
shlq %rcx
leaq 0xc0171(%rip), %r8      # 0x1c13a5
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x100500
movq -0x30(%rbp), %rax
shlq %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x38(%rbp), %rdi
callq 0x171750
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)