// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x23e6f
movq 0x591a6(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x43c51(%rip), %rsi     # 0x67aad
movb $0x0, %al
callq 0xc8f0
movl $0xc, -0x4(%rbp)
jmp 0x240c9
movq -0x18(%rbp), %rax
cmpb $0x0, 0x94(%rax)
je 0x23ea0
movq 0x59175(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x43c63(%rip), %rsi     # 0x67af0
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x240c9
movq -0x18(%rbp), %rax
movq 0x128(%rax), %rax
cmpq $0x0, (%rax)
jne 0x23ed5
movq 0x59140(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x43c9e(%rip), %rsi     # 0x67b60
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x240c9
movq -0x18(%rbp), %rax
movq 0x128(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x23f42
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
jne 0x23f2f
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x8(%rax)
jne 0x23f2f
movq 0x590e6(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x43c89(%rip), %rsi     # 0x67ba5
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x240c9
jmp 0x23f31
movq -0x30(%rbp), %rax
movq 0x110(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x23ee7
movl $0x1, %edi
movl $0xc0, %esi
callq 0xc870
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x23f8c
movq 0x59095(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x42163(%rip), %rsi     # 0x660d0
leaq 0x43b2c(%rip), %rdx     # 0x67aa0
movl $0x109, %ecx            # imm = 0x109
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x240c9
jmp 0x23f8e
cmpq $0x0, -0x20(%rbp)
je 0x23fd3
movq -0x20(%rbp), %rax
movl (%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x20(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movq -0x28(%rbp), %rax
movsd 0x43ab1(%rip), %xmm0    # 0x67a90
movsd %xmm0, 0x68(%rax)
movq -0x28(%rbp), %rax
movsd 0x43a98(%rip), %xmm0    # 0x67a88
movsd %xmm0, 0x70(%rax)
movq -0x28(%rbp), %rax
movsd 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2401a
jp 0x2401a
movq -0x28(%rbp), %rax
movsd 0x43a83(%rip), %xmm0    # 0x67a98
movsd %xmm0, 0x8(%rax)
movq -0x28(%rbp), %rax
movsd 0x10(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2403f
jp 0x2403f
movq -0x28(%rbp), %rax
movsd 0x43a5e(%rip), %xmm0    # 0x67a98
movsd %xmm0, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0xb8(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x68(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
addq $0xb8, %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x68(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movb $0x1, 0x94(%rax)
movq -0x18(%rbp), %rax
movb $0x1, 0x97(%rax)
movq -0x10(%rbp), %rax
movb 0x30(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x169(%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)