// File: /workspace/github_c_makefile_star2_O1/Paxa[P]fast_excel/libxlsxwriter/src/chartsheet.c
// Function: chartsheet_set_chart_opt
lxw_error
chartsheet_set_chart_opt(lxw_chartsheet *self,
                         lxw_chart *chart, lxw_chart_options *user_options)
{
    lxw_object_properties *object_props;
    lxw_chart_series *series;

    if (!chart) {
        LXW_WARN("chartsheet_set_chart()/_opt(): chart must be non-NULL.");
        return LXW_ERROR_NULL_PARAMETER_IGNORED;
    }

    /* Check that the chart isn't being used more than once. */
    if (chart->in_use) {
        LXW_WARN("chartsheet_set_chart()/_opt(): the same chart object "
                 "cannot be set for a chartsheet more than once.");

        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    /* Check that the chart has a data series. */
    if (STAILQ_EMPTY(chart->series_list)) {
        LXW_WARN("chartsheet_set_chart()/_opt(): chart must have a series.");

        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    /* Check that the chart has a 'values' series. */
    STAILQ_FOREACH(series, chart->series_list, list_pointers) {
        if (!series->values->formula && !series->values->sheetname) {
            LXW_WARN("chartsheet_set_chart()/_opt(): chart must have a "
                     "'values' series.");

            return LXW_ERROR_PARAMETER_VALIDATION;
        }
    }

    /* Create a new object to hold the chart image properties. */
    object_props = calloc(1, sizeof(lxw_object_properties));
    RETURN_ON_MEM_ERROR(object_props, LXW_ERROR_MEMORY_MALLOC_FAILED);

    if (user_options) {
        object_props->x_offset = user_options->x_offset;
        object_props->y_offset = user_options->y_offset;
        object_props->x_scale = user_options->x_scale;
        object_props->y_scale = user_options->y_scale;
    }

    object_props->width = 480;
    object_props->height = 288;

    if (object_props->x_scale == 0.0)
        object_props->x_scale = 1;

    if (object_props->y_scale == 0.0)
        object_props->y_scale = 1;

    /* Store chart references so they can be ordered in the workbook. */
    object_props->chart = chart;

    /* Store the chart data in the embedded worksheet. */
    STAILQ_INSERT_TAIL(self->worksheet->chart_data, object_props,
                       list_pointers);

    chart->in_use = LXW_TRUE;
    chart->is_chartsheet = LXW_TRUE;

    chart->is_protected = self->is_protected;

    self->chart = chart;

    return LXW_NO_ERROR;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x1bab0
movq %rsi, %rbx
cmpb $0x0, 0x94(%rsi)
jne 0x1babc
movq 0x128(%rbx), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x1bac3
movq %rdx, %r15
movq %rdi, %r14
movq 0x8(%rax), %rcx
cmpq $0x0, (%rcx)
jne 0x1b9be
cmpq $0x0, 0x8(%rcx)
je 0x1bad6
movq 0x110(%rax), %rax
testq %rax, %rax
jne 0x1b9a9
movl $0x1, %edi
movl $0xc0, %esi
callq 0xc7f0
testq %rax, %rax
je 0x1baca
testq %r15, %r15
je 0x1ba09
movl (%r15), %ecx
movl %ecx, (%rax)
movl 0x4(%r15), %ecx
movl %ecx, 0x4(%rax)
movsd 0x8(%r15), %xmm0
movsd %xmm0, 0x8(%rax)
movsd 0x10(%r15), %xmm0
movsd %xmm0, 0x10(%rax)
movabsq $0x407e000000000000, %rcx # imm = 0x407E000000000000
movq %rcx, 0x68(%rax)
movabsq $0x4072000000000000, %rcx # imm = 0x4072000000000000
movq %rcx, 0x70(%rax)
movsd 0x8(%rax), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
jne 0x1ba44
jp 0x1ba44
movq %rcx, 0x8(%rax)
movsd 0x10(%rax), %xmm1
ucomisd %xmm0, %xmm1
jne 0x1ba55
jp 0x1ba55
movq %rcx, 0x10(%rax)
movq %rbx, 0x90(%rax)
movq %rax, %rcx
addq $0xb8, %rcx
movq $0x0, 0xb8(%rax)
movq 0x8(%r14), %rdx
movq 0x68(%rdx), %rdx
movq 0x8(%rdx), %rdx
movq %rax, (%rdx)
movq 0x8(%r14), %rax
movq 0x68(%rax), %rax
movq %rcx, 0x8(%rax)
movb $0x1, %al
movb %al, 0x94(%rbx)
movb %al, 0x97(%rbx)
movb 0x30(%r14), %al
movb %al, 0x169(%rbx)
movq %rbx, 0x10(%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
callq 0xd8c6
movl $0xc, %eax
jmp 0x1baaa
callq 0xd84e
jmp 0x1badb
callq 0xd8aa
jmp 0x1badb
callq 0xd86a
movl $0x1, %eax
jmp 0x1baaa
callq 0xd88e
movl $0xd, %eax
jmp 0x1baaa