// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_insert_chart_opt
lxw_error
worksheet_insert_chart_opt(lxw_worksheet *self,
                           lxw_row_t row_num, lxw_col_t col_num,
                           lxw_chart *chart, lxw_chart_options *user_options)
{
    lxw_object_properties *object_props;
    lxw_chart_series *series;

    if (!chart) {
        LXW_WARN("worksheet_insert_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("worksheet_insert_chart()/_opt(): the same chart object "
                 "cannot be inserted in a worksheet more than once.");

        return LXW_ERROR_PARAMETER_VALIDATION;
    }

    /* Check that the chart has a data series. */
    if (STAILQ_EMPTY(chart->series_list)) {
        LXW_WARN
            ("worksheet_insert_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("worksheet_insert_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->object_position = user_options->object_position;
        object_props->description = lxw_strdup(user_options->description);
        object_props->decorative = user_options->decorative;
    }

    /* Copy other options or set defaults. */
    object_props->row = row_num;
    object_props->col = col_num;

    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;

    STAILQ_INSERT_TAIL(self->chart_data, object_props, list_pointers);

    chart->in_use = LXW_TRUE;

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movw %dx, %ax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movw %ax, -0x16(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x55a19
movq 0x275fc(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x17ec1(%rip), %rsi     # 0x6d8c7
movb $0x0, %al
callq 0xc8f0
movl $0xc, -0x4(%rbp)
jmp 0x55c90
movq -0x20(%rbp), %rax
cmpb $0x0, 0x94(%rax)
je 0x55a4a
movq 0x275cb(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x17ed5(%rip), %rsi     # 0x6d90c
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x55c90
movq -0x20(%rbp), %rax
movq 0x128(%rax), %rax
cmpq $0x0, (%rax)
jne 0x55a7f
movq 0x27596(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x17f15(%rip), %rsi     # 0x6d981
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x55c90
movq -0x20(%rbp), %rax
movq 0x128(%rax), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x55aec
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
jne 0x55ad9
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x8(%rax)
jne 0x55ad9
movq 0x2753c(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x17f02(%rip), %rsi     # 0x6d9c8
movb $0x0, %al
callq 0xc8f0
movl $0xd, -0x4(%rbp)
jmp 0x55c90
jmp 0x55adb
movq -0x38(%rbp), %rax
movq 0x110(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x55a91
movl $0x1, %edi
movl $0xc0, %esi
callq 0xc870
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x55b36
movq 0x274eb(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x105b9(%rip), %rsi     # 0x660d0
leaq 0x168d6(%rip), %rdx     # 0x6c3f4
movl $0x2990, %ecx           # imm = 0x2990
movb $0x0, %al
callq 0xc8f0
movl $0x1, -0x4(%rbp)
jmp 0x55c90
jmp 0x55b38
cmpq $0x0, -0x28(%rbp)
je 0x55bb4
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x28(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x30(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movq -0x28(%rbp), %rax
movb 0x18(%rax), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x40(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
movb 0x28(%rax), %cl
movq -0x30(%rbp), %rax
movb %cl, 0xb0(%rax)
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
movw -0x16(%rbp), %cx
movq -0x30(%rbp), %rax
movw %cx, 0x1c(%rax)
movq -0x30(%rbp), %rax
movsd 0x11eba(%rip), %xmm0    # 0x67a90
movsd %xmm0, 0x68(%rax)
movq -0x30(%rbp), %rax
movsd 0x11ea1(%rip), %xmm0    # 0x67a88
movsd %xmm0, 0x70(%rax)
movq -0x30(%rbp), %rax
movsd 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x55c11
jp 0x55c11
movq -0x30(%rbp), %rax
movsd 0x11e8c(%rip), %xmm0    # 0x67a98
movsd %xmm0, 0x8(%rax)
movq -0x30(%rbp), %rax
movsd 0x10(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x55c36
jp 0x55c36
movq -0x30(%rbp), %rax
movsd 0x11e67(%rip), %xmm0    # 0x67a98
movsd %xmm0, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0xb8(%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
addq $0xb8, %rcx
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movb $0x1, 0x94(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)