// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pif.c
// Function: do_pif_section_win386
static void do_pif_section_win386(deark *c, struct pif_ctx *d, i64 pos1, i64 len)
{
	i64 pos = pos1;
	i64 n;
	UI flags;

	if(len<104) return;
	n = de_getu16le_p(&pos);
	de_dbg(c, "max conventional mem: %"I64_FMT, n);
	n = de_getu16le_p(&pos);
	de_dbg(c, "min conventional mem: %"I64_FMT, n);
	pos += 2; // fg priority
	pos += 2; // bg priority
	n = de_getu16le_p(&pos);
	de_dbg(c, "max EMS: %"I64_FMT, n);
	n = de_getu16le_p(&pos);
	de_dbg(c, "min EMS: %"I64_FMT, n);
	n = de_getu16le_p(&pos);
	de_dbg(c, "max XMS: %"I64_FMT, n);
	n = de_getu16le_p(&pos);
	de_dbg(c, "min XMS: %"I64_FMT, n);
	flags = (UI)de_getu32le_p(&pos);
	de_dbg(c, "flags1: 0x%08x", (UI)flags);
	flags = (UI)de_getu16le_p(&pos);
	de_dbg(c, "flags2: 0x%04x", (UI)flags);

	// TODO: More fields

	pos = pos1 + 40;
	ucstring_empty(d->tmpstr);
	// TODO: There are questions about whether this is OEM or ANSI
	dbuf_read_to_ucstring(c->infile, pos, 64, d->tmpstr, DE_CONVFLAG_STOP_AT_NUL,
		d->input_encoding_oem);
	ucstring_strip_trailing_spaces(d->tmpstr);
	de_dbg(c, "params: \"%s\"", ucstring_getpsz_d(d->tmpstr));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x68, -0x20(%rbp)
jge 0x11845c
jmp 0x118643
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xac787(%rip), %rsi     # 0x1c4c07
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xac776(%rip), %rsi     # 0x1c4c21
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xac74d(%rip), %rsi     # 0x1c4c3b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xac72f(%rip), %rsi     # 0x1c4c48
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xac6a9(%rip), %rsi     # 0x1c4bed
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xac68b(%rip), %rsi     # 0x1c4bfa
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165580
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq 0xac6bd(%rip), %rsi     # 0x1c4c55
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq 0xac6a3(%rip), %rsi     # 0x1c4c64
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x171210
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movl (%rax), %r9d
movl $0x40, %edx
movl $0x1, %r8d
callq 0x1669f0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x171360
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x172650
movq -0x40(%rbp), %rdi
movq %rax, %rdx
leaq 0xa4f14(%rip), %rsi     # 0x1bd550
movb $0x0, %al
callq 0x15b0d0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)