// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/chart.c
// Function: chart_write_legend
STATIC void
_chart_write_legend(lxw_chart *self)
{
    uint8_t has_overlay = LXW_FALSE;
    uint16_t index;

    if (self->legend.position == LXW_CHART_LEGEND_NONE)
        return;

    lxw_xml_start_tag(self->file, "c:legend", NULL);

    /* Write the c:legendPos element. */
    switch (self->legend.position) {
        case LXW_CHART_LEGEND_LEFT:
            _chart_write_legend_pos(self, "l");
            break;
        case LXW_CHART_LEGEND_TOP:
            _chart_write_legend_pos(self, "t");
            break;
        case LXW_CHART_LEGEND_BOTTOM:
            _chart_write_legend_pos(self, "b");
            break;
        case LXW_CHART_LEGEND_TOP_RIGHT:
            _chart_write_legend_pos(self, "tr");
            break;
        case LXW_CHART_LEGEND_OVERLAY_RIGHT:
            _chart_write_legend_pos(self, "r");
            has_overlay = LXW_TRUE;
            break;
        case LXW_CHART_LEGEND_OVERLAY_LEFT:
            _chart_write_legend_pos(self, "l");
            has_overlay = LXW_TRUE;
            break;
        case LXW_CHART_LEGEND_OVERLAY_TOP_RIGHT:
            _chart_write_legend_pos(self, "tr");
            has_overlay = LXW_TRUE;
            break;
        default:
            _chart_write_legend_pos(self, "r");
    }

    /* Remove series labels from the legend. */
    for (index = 0; index < self->delete_series_count; index++) {
        /* Write the c:legendEntry element. */
        _chart_write_legend_entry(self, index);
    }

    /* Write the c:layout element. */
    _chart_write_layout(self);

    if (self->chart_group == LXW_CHART_PIE
        || self->chart_group == LXW_CHART_DOUGHNUT) {
        /* Write the c:overlay element. */
        if (has_overlay)
            _chart_write_overlay(self);

        /* Write the c:txPr element for Pie/Doughnut charts. */
        _chart_write_tx_pr_pie(self, LXW_FALSE, self->legend.font);
    }
    else {
        /* Write the c:txPr element for all other charts. */
        if (self->legend.font)
            _chart_write_tx_pr(self, LXW_FALSE, self->legend.font);

        /* Write the c:overlay element. */
        if (has_overlay)
            _chart_write_overlay(self);
    }

    lxw_xml_end_tag(self->file, "c:legend");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movb $0x0, -0x9(%rbp)
movq -0x8(%rbp), %rax
movzbl 0xb8(%rax), %eax
cmpl $0x0, %eax
jne 0x21655
jmp 0x21806
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq 0x46011(%rip), %rsi     # 0x67674
xorl %eax, %eax
movl %eax, %edx
callq 0xc390
movq -0x8(%rbp), %rax
movzbl 0xb8(%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x6, %eax
ja 0x2172a
movq -0x18(%rbp), %rax
leaq 0x44c4c(%rip), %rcx     # 0x662e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
leaq 0x45bbf(%rip), %rsi     # 0x67267
callq 0x21b00
jmp 0x2173a
movq -0x8(%rbp), %rdi
leaq 0x45a1c(%rip), %rsi     # 0x670d9
callq 0x21b00
jmp 0x2173a
movq -0x8(%rbp), %rdi
leaq 0x44936(%rip), %rsi     # 0x66005
callq 0x21b00
jmp 0x2173a
movq -0x8(%rbp), %rdi
leaq 0x45a48(%rip), %rsi     # 0x67129
callq 0x21b00
jmp 0x2173a
movq -0x8(%rbp), %rdi
leaq 0x459d6(%rip), %rsi     # 0x670c9
callq 0x21b00
movb $0x1, -0x9(%rbp)
jmp 0x2173a
movq -0x8(%rbp), %rdi
leaq 0x45b5e(%rip), %rsi     # 0x67267
callq 0x21b00
movb $0x1, -0x9(%rbp)
jmp 0x2173a
movq -0x8(%rbp), %rdi
leaq 0x45a0a(%rip), %rsi     # 0x67129
callq 0x21b00
movb $0x1, -0x9(%rbp)
jmp 0x2173a
movq -0x8(%rbp), %rdi
leaq 0x45994(%rip), %rsi     # 0x670c9
callq 0x21b00
movw $0x0, -0xc(%rbp)
movzwl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xc8(%rcx), %ecx
cmpl %ecx, %eax
jge 0x2176e
movq -0x8(%rbp), %rdi
movzwl -0xc(%rbp), %esi
callq 0x21bd0
movw -0xc(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xc(%rbp)
jmp 0x21740
movq -0x8(%rbp), %rdi
callq 0x1d4f0
movq -0x8(%rbp), %rax
movzbl 0x95(%rax), %eax
cmpl $0xe, %eax
je 0x21797
movq -0x8(%rbp), %rax
movzbl 0x95(%rax), %eax
cmpl $0xa, %eax
jne 0x217be
cmpb $0x0, -0x9(%rbp)
je 0x217a6
movq -0x8(%rbp), %rdi
callq 0x21c40
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rdx
xorl %esi, %esi
callq 0x21d10
jmp 0x217f3
movq -0x8(%rbp), %rax
cmpq $0x0, 0xb0(%rax)
je 0x217e2
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rdx
xorl %esi, %esi
callq 0x1a140
cmpb $0x0, -0x9(%rbp)
je 0x217f1
movq -0x8(%rbp), %rdi
callq 0x21c40
jmp 0x217f3
movq -0x8(%rbp), %rax
movq (%rax), %rdi
leaq 0x45e73(%rip), %rsi     # 0x67674
callq 0xc060
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)