// File: /workspace/github_c_makefile_star2_O3/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 0x1bc9f
movq %rsi, %rbx
cmpb $0x0, 0x94(%rsi)
jne 0x1bcab
movq 0x128(%rbx), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x1bcb2
movq %rdx, %r15
movq %rdi, %r14
movq 0x8(%rax), %rcx
cmpq $0x0, (%rcx)
jne 0x1bbc7
cmpq $0x0, 0x8(%rcx)
je 0x1bcc5
movq 0x110(%rax), %rax
testq %rax, %rax
jne 0x1bbb2
movl $0x1, %edi
movl $0xc0, %esi
callq 0xc7f0
testq %rax, %rax
je 0x1bcb9
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
testq %r15, %r15
je 0x1bc30
movq (%r15), %rdx
movq %rdx, (%rax)
movupd 0x8(%r15), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movupd %xmm0, 0x8(%rax)
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
movaps 0x26022(%rip), %xmm2    # 0x41c40
movups %xmm2, 0x68(%rax)
jne 0x1bc43
jp 0x1bc43
ucomisd %xmm1, %xmm0
movq %rcx, 0x8(%rax)
jmp 0x1bc47
movapd 0x26008(%rip), %xmm0    # 0x41c40
movupd %xmm0, 0x68(%rax)
movq %rcx, 0x8(%rax)
jmp 0x1bc4b
ucomisd %xmm1, %xmm0
jne 0x1bc4f
jp 0x1bc4f
movq %rcx, 0x10(%rax)
movq %rbx, 0x90(%rax)
movq %rax, %rcx
addq $0xb8, %rcx
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 0xd8b8
movl $0xc, %eax
jmp 0x1bc99
callq 0xd840
jmp 0x1bcca
callq 0xd89c
jmp 0x1bcca
callq 0xd85c
movl $0x1, %eax
jmp 0x1bc99
callq 0xd880
movl $0xd, %eax
jmp 0x1bc99