// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/wmf.c
// Function: handler_CREATEPENINDIRECT
static int handler_CREATEPENINDIRECT(deark *c, lctx *d, struct decoder_params *dp)
{
	u32 colorref;
	i64 pos = dp->dpos;
	unsigned int width;
	unsigned int style;
	unsigned int base_style;
	de_ucstring *style_descr = NULL;

	if(dp->dlen<10) goto done;
	style = (unsigned int)de_getu16le_p(&pos);
	base_style = style&0x0f; // ?
	style_descr = ucstring_create(c);
	ucstring_append_flags_item(style_descr, get_penbasestyle_name(base_style));
	if((style&0x0f00)==0x0100) ucstring_append_flags_item(style_descr, "PS_ENDCAP_SQUARE");
	if((style&0x0f00)==0x0200) ucstring_append_flags_item(style_descr, "PS_ENDCAP_FLAG");
	if((style&0xf000)==0x1000) ucstring_append_flags_item(style_descr, "PS_JOIN_BEVEL");
	if((style&0xf000)==0x2000) ucstring_append_flags_item(style_descr, "PS_JOIN_MITER");
	de_dbg(c, "style: 0x%04x (%s)", style, ucstring_getpsz(style_descr));

	if(base_style!=0x5) {
		width = (unsigned int)de_getu32le(pos);
		width &= 0x0000ffffU;
		de_dbg(c, "width: %u", width);
	}
	pos += 4;

	if(base_style!=0x5) {
		colorref = (u32)de_getu32le(pos);
		do_dbg_colorref(c, d, dp, colorref);
	}

done:
	ucstring_destroy(style_descr);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpq $0xa, 0x28(%rax)
jge 0x139fa8
jmp 0x13a10f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %edi
callq 0x13a820
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x172680
movl -0x30(%rbp), %eax
andl $0xf00, %eax            # imm = 0xF00
cmpl $0x100, %eax            # imm = 0x100
jne 0x13a00d
movq -0x40(%rbp), %rdi
leaq 0x92cf2(%rip), %rsi     # 0x1cccfa
callq 0x172680
movl -0x30(%rbp), %eax
andl $0xf00, %eax            # imm = 0xF00
cmpl $0x200, %eax            # imm = 0x200
jne 0x13a02c
movq -0x40(%rbp), %rdi
leaq 0x92ce4(%rip), %rsi     # 0x1ccd0b
callq 0x172680
movl -0x30(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x1000, %eax           # imm = 0x1000
jne 0x13a04b
movq -0x40(%rbp), %rdi
leaq 0x92cd4(%rip), %rsi     # 0x1ccd1a
callq 0x172680
movl -0x30(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x2000, %eax           # imm = 0x2000
jne 0x13a06a
movq -0x40(%rbp), %rdi
leaq 0x92cc3(%rip), %rsi     # 0x1ccd28
callq 0x172680
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rdi
callq 0x172500
movq -0x58(%rbp), %rdi
movl -0x4c(%rbp), %edx
movq %rax, %rcx
leaq 0x92ca4(%rip), %rsi     # 0x1ccd36
movb $0x0, %al
callq 0x15b0d0
cmpl $0x5, -0x34(%rbp)
je 0x13a0d3
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x165540
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x92c7d(%rip), %rsi     # 0x1ccd49
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
cmpl $0x5, -0x34(%rbp)
je 0x13a10d
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x165540
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq 0x13a380
jmp 0x13a10f
movq -0x40(%rbp), %rdi
callq 0x171750
movl $0x1, %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)