// File: /workspace/github_c_makefile_star2_O2/Paxa[P]fast_excel/libxlsxwriter/src/styles.c
// Function: write_fill
STATIC void
_write_fill(lxw_styles *self, lxw_format *format, uint8_t is_dxf)
{
    struct xml_attribute_list attributes;
    struct xml_attribute *attribute;

    uint8_t pattern = format->pattern;
    lxw_color_t bg_color = format->bg_color;
    lxw_color_t fg_color = format->fg_color;

    char *patterns[] = {
        "none",
        "solid",
        "mediumGray",
        "darkGray",
        "lightGray",
        "darkHorizontal",
        "darkVertical",
        "darkDown",
        "darkUp",
        "darkGrid",
        "darkTrellis",
        "lightHorizontal",
        "lightVertical",
        "lightDown",
        "lightUp",
        "lightGrid",
        "lightTrellis",
        "gray125",
        "gray0625",
    };

    if (is_dxf) {
        bg_color = format->dxf_bg_color;
        fg_color = format->dxf_fg_color;
    }

    LXW_INIT_ATTRIBUTES();

    /* Special handling for pattern only case. */
    if (!bg_color && !fg_color && pattern) {
        _write_default_fill(self, patterns[pattern]);
        LXW_FREE_ATTRIBUTES();
        return;
    }

    lxw_xml_start_tag(self->file, "fill", NULL);

    /* None/Solid patterns are handled differently for dxf formats. */
    if (pattern && !(is_dxf && pattern <= LXW_PATTERN_SOLID))
        LXW_PUSH_ATTRIBUTES_STR("patternType", patterns[pattern]);

    lxw_xml_start_tag(self->file, "patternFill", &attributes);

    if (fg_color != LXW_COLOR_UNSET)
        _write_fg_color(self, fg_color);

    _write_bg_color(self, bg_color, pattern);

    lxw_xml_end_tag(self->file, "patternFill");
    lxw_xml_end_tag(self->file, "fill");

    LXW_FREE_ATTRIBUTES();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movb 0x1f4(%rsi), %al
movzbl %al, %r13d
xorl %eax, %eax
testl %edx, %edx
setne %al
movl 0x1e4(%rsi,%rax,8), %r15d
movl 0x1e8(%rsi,%rax,8), %ebp
movq %rsp, %r12
andq $0x0, (%r12)
movq %r12, 0x8(%r12)
movl %ebp, %eax
orl %r15d, %eax
sete %al
testb %r13b, %r13b
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x21f2e
leaq 0x30e27(%rip), %rax     # 0x52d20
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
callq 0x21e02
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2212f
movq 0x1040(%rdi), %rax
movq %rax, (%rsp)
testq %rax, %rax
jne 0x21f27
movq %r12, 0x8(%rsp)
callq 0xc0d0
jmp 0x21f05
movl %edx, %r14d
movq (%rbx), %rdi
leaq 0x2057b(%rip), %rsi     # 0x424b6
xorl %edx, %edx
callq 0xc380
testq %r13, %r13
je 0x21f8b
testb %r14b, %r14b
setne %al
cmpb $0x1, %r13b
sete %cl
testb %cl, %al
jne 0x21f8b
leaq 0x30dc1(%rip), %rax     # 0x52d20
movq (%rax,%r13,8), %rsi
leaq 0x1e6d4(%rip), %rdi     # 0x4063e
callq 0xc030
andq $0x0, 0x1040(%rax)
leaq 0x1040(%rax), %rcx
movq 0x8(%rsp), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%rsp)
movq (%rbx), %rdi
leaq 0x1e6b5(%rip), %rsi     # 0x4064a
movq %rsp, %r14
movq %r14, %rdx
callq 0xc380
testl %r15d, %r15d
je 0x2203e
leaq 0x10(%rsp), %r12
andq $0x0, (%r12)
movq %r12, 0x8(%r12)
andl $0xffffff, %r15d        # imm = 0xFFFFFF
leaq 0x1e403(%rip), %rdx     # 0x403c9
leaq 0x20(%rsp), %rdi
pushq $0x20
popq %rsi
movl %r15d, %ecx
xorl %eax, %eax
callq 0xc5b0
leaq 0x1e3f1(%rip), %rdi     # 0x403d0
leaq 0x20(%rsp), %rsi
callq 0xc030
leaq 0x1040(%rax), %rcx
andq $0x0, 0x1040(%rax)
movq 0x8(%r12), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%r12)
movq (%rbx), %rdi
leaq 0x1e6fc(%rip), %rsi     # 0x4070b
movq %r12, %rdx
callq 0xcc70
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2203e
movq 0x1040(%rdi), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0x22037
movq %r12, 0x18(%rsp)
callq 0xc0d0
jmp 0x22017
leaq 0x10(%rsp), %r12
andq $0x0, (%r12)
movq %r12, 0x8(%r12)
testl %ebp, %ebp
je 0x2207e
andl $0xffffff, %ebp         # imm = 0xFFFFFF
leaq 0x1e36b(%rip), %rdx     # 0x403c9
leaq 0x20(%rsp), %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc5b0
leaq 0x1e357(%rip), %rdi     # 0x403d0
movq %r15, %rsi
jmp 0x22092
cmpb $0x1, %r13b
ja 0x220e2
leaq 0x1cded(%rip), %rdi     # 0x3ee78
leaq 0x1e681(%rip), %rsi     # 0x40713
callq 0xc030
leaq 0x1040(%rax), %rcx
andq $0x0, 0x1040(%rax)
leaq 0x10(%rsp), %rdx
movq 0x8(%rdx), %rsi
movq %rax, (%rsi)
movq %rcx, 0x8(%rdx)
movq (%rbx), %rdi
leaq 0x1e656(%rip), %rsi     # 0x40716
callq 0xcc70
jmp 0x220e2
movq 0x1040(%rdi), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0x220dd
movq %r12, 0x18(%rsp)
callq 0xc0d0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
jne 0x220c7
movq (%rbx), %rdi
leaq 0x1e554(%rip), %rsi     # 0x4064a
callq 0xc060
movq (%rbx), %rdi
leaq 0x203b1(%rip), %rsi     # 0x424b6
callq 0xc060
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2212f
movq 0x1040(%rdi), %rax
movq %rax, (%rsp)
testq %rax, %rax
jne 0x22128
movq %r14, 0x8(%rsp)
callq 0xc0d0
jmp 0x2210a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq