// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/wri.c
// Function: do_para_fprop
static void do_para_fprop(deark *c, lctx *d, struct para_info *pinfo,
	i64 bfprop, u8 is_dup)
{
	i64 fprop_dlen = 0;

	// bfprop is a pointer into the 123 bytes of data starting
	// at pos+4. The maximum sensible value is at most 122.
	if(bfprop<=122) {
		// It appears that the length prefix does not include itself,
		// contrary to what one source says.
		fprop_dlen = (i64)de_getbyte(pinfo->bfprop_offset);
		if(!is_dup) de_dbg(c, "fprop dlen: %d", (int)fprop_dlen);
	}

	if(fprop_dlen>=2) {
		pinfo->justification = de_getbyte(pinfo->bfprop_offset + 1 + 1) & 0x03;
		if(!is_dup && pinfo->justification!=0) {
			de_dbg(c, "justification: %d", (int)pinfo->justification);
		}
	}

	if(fprop_dlen>=17) {
		pinfo->papflags = de_getbyte(pinfo->bfprop_offset + 1 + 16);
		if(!is_dup) {
			de_ucstring *flagstr = ucstring_create(c);
			if(pinfo->papflags&0x06) {
				ucstring_append_flags_item(flagstr, (pinfo->papflags&0x01)?"footer":"header");
				ucstring_append_flags_item(flagstr, (pinfo->papflags&0x08)?"print on first page":
					"do not print on first page");
			}
			if(pinfo->papflags&0x10) ucstring_append_flags_item(flagstr, "picture");
			de_dbg(c, "paragraph flags: 0x%02x (%s)", (unsigned int)pinfo->papflags,
				ucstring_getpsz(flagstr));
			ucstring_destroy(flagstr);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x7a, -0x20(%rbp)
jg 0x13c749
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x165060
movzbl %al, %eax
movq %rax, -0x30(%rbp)
cmpb $0x0, -0x21(%rbp)
jne 0x13c747
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
leaq 0x90e3a(%rip), %rsi     # 0x1cd57a
movb $0x0, %al
callq 0x15b0d0
jmp 0x13c749
cmpq $0x2, -0x30(%rbp)
jl 0x13c7ab
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
addq $0x1, %rsi
addq $0x1, %rsi
callq 0x165060
movzbl %al, %eax
andl $0x3, %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x19(%rax)
cmpb $0x0, -0x21(%rbp)
jne 0x13c7a9
movq -0x18(%rbp), %rax
movzbl 0x19(%rax), %eax
cmpl $0x0, %eax
je 0x13c7a9
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x19(%rax), %edx
leaq 0x90de7(%rip), %rsi     # 0x1cd589
movb $0x0, %al
callq 0x15b0d0
jmp 0x13c7ab
cmpq $0x11, -0x30(%rbp)
jl 0x13c8b4
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
addq $0x1, %rsi
addq $0x10, %rsi
callq 0x165060
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x18(%rax)
cmpb $0x0, -0x21(%rbp)
jne 0x13c8b2
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x18(%rax), %eax
andl $0x6, %eax
cmpl $0x0, %eax
je 0x13c855
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x18(%rax), %ecx
andl $0x1, %ecx
leaq 0x64f37(%rip), %rsi     # 0x1a1750
leaq 0x7fee6(%rip), %rax     # 0x1bc706
cmpl $0x0, %ecx
cmovneq %rax, %rsi
callq 0x172680
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x18(%rax), %ecx
andl $0x8, %ecx
leaq 0x90d59(%rip), %rsi     # 0x1cd59b
leaq 0x90d59(%rip), %rax     # 0x1cd5a2
cmpl $0x0, %ecx
cmovneq %rax, %rsi
callq 0x172680
movq -0x18(%rbp), %rax
movzbl 0x18(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x13c875
movq -0x38(%rbp), %rdi
leaq 0x7325b(%rip), %rsi     # 0x1afacb
callq 0x172680
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x18(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x172500
movq -0x48(%rbp), %rdi
movl -0x3c(%rbp), %edx
movq %rax, %rcx
leaq 0x90d14(%rip), %rsi     # 0x1cd5b6
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rdi
callq 0x171750
jmp 0x13c8b4
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)