// File: /workspace/github_c_makefile_star2_O2/Paxa[P]fast_excel/libxlsxwriter/src/chart.c
// Function: chart_add_series
lxw_chart_series *
chart_add_series(lxw_chart *self, const char *categories, const char *values)
{
    lxw_chart_series *series;

    /* Scatter charts require categories and values. */
    if (self->chart_group == LXW_CHART_SCATTER && values && !categories) {
        LXW_WARN("chart_add_series(): scatter charts must have "
                 "'categories' and 'values'");

        return NULL;
    }

    /* Create a new object to hold the series. */
    series = calloc(1, sizeof(lxw_chart_series));
    GOTO_LABEL_ON_MEM_ERROR(series, mem_error);

    series->categories = calloc(1, sizeof(lxw_series_range));
    GOTO_LABEL_ON_MEM_ERROR(series->categories, mem_error);

    series->values = calloc(1, sizeof(lxw_series_range));
    GOTO_LABEL_ON_MEM_ERROR(series->values, mem_error);

    series->title.range = calloc(1, sizeof(lxw_series_range));
    GOTO_LABEL_ON_MEM_ERROR(series->title.range, mem_error);

    series->x_error_bars = calloc(1, sizeof(lxw_series_error_bars));
    GOTO_LABEL_ON_MEM_ERROR(series->x_error_bars, mem_error);

    series->y_error_bars = calloc(1, sizeof(lxw_series_error_bars));
    GOTO_LABEL_ON_MEM_ERROR(series->y_error_bars, mem_error);

    if (categories) {
        if (categories[0] == '=')
            series->categories->formula = lxw_strdup(categories + 1);
        else
            series->categories->formula = lxw_strdup(categories);
    }

    if (values) {
        if (values[0] == '=')
            series->values->formula = lxw_strdup(values + 1);
        else
            series->values->formula = lxw_strdup(values);
    }

    if (_chart_init_data_cache(series->categories) != LXW_NO_ERROR)
        goto mem_error;

    if (_chart_init_data_cache(series->values) != LXW_NO_ERROR)
        goto mem_error;

    if (_chart_init_data_cache(series->title.range) != LXW_NO_ERROR)
        goto mem_error;

    if (self->type == LXW_CHART_SCATTER_SMOOTH)
        series->smooth = LXW_TRUE;

    if (self->type == LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS)
        series->smooth = LXW_TRUE;

    series->y_error_bars->chart_group = self->chart_group;
    series->x_error_bars->chart_group = self->chart_group;
    series->x_error_bars->is_x = LXW_TRUE;

    series->default_label_position = self->default_label_position;

    STAILQ_INSERT_TAIL(self->series_list, series, list_pointers);

    return series;

mem_error:
    _chart_series_free(series);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
testq %rsi, %rsi
jne 0x1245d
testq %r15, %r15
je 0x1245d
cmpb $0xf, 0x95(%r14)
je 0x125ca
pushq $0x1
popq %rdi
movl $0x118, %esi            # imm = 0x118
callq 0xc850
movq %rax, %rbx
testq %rax, %rax
je 0x125e8
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0xc850
movq %rax, (%rbx)
testq %rax, %rax
je 0x125ef
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0xc850
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x125f6
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0xc850
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x125fd
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0xc850
movq %rax, 0xc8(%rbx)
testq %rax, %rax
je 0x12604
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0xc850
movq %rax, 0xd0(%rbx)
testq %rax, %rax
je 0x1260b
testq %r12, %r12
je 0x12511
xorl %edi, %edi
cmpb $0x3d, (%r12)
sete %dil
addq %r12, %rdi
callq 0xcd50
movq (%rbx), %rcx
movq %rax, (%rcx)
testq %r15, %r15
je 0x1252f
xorl %edi, %edi
cmpb $0x3d, (%r15)
sete %dil
addq %r15, %rdi
callq 0xcd50
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movq (%rbx), %rdi
callq 0x116ad
testl %eax, %eax
jne 0x1262f
movq 0x8(%rbx), %rdi
callq 0x116ad
testl %eax, %eax
jne 0x1262f
movq 0x30(%rbx), %rdi
callq 0x116ad
testl %eax, %eax
jne 0x1262f
movb 0x8(%r14), %al
andb $-0x2, %al
cmpb $0x12, %al
jne 0x12572
movb $0x1, 0x94(%rbx)
movb 0x95(%r14), %al
movq 0xd0(%rbx), %rcx
movb %al, 0x6(%rcx)
movq 0xc8(%rbx), %rcx
movb %al, 0x6(%rcx)
movb $0x1, 0x5(%rcx)
movb 0x168(%r14), %al
movb %al, 0x9f(%rbx)
movq %rbx, %rax
addq $0x110, %rax            # imm = 0x110
andq $0x0, 0x110(%rbx)
movq 0x128(%r14), %rcx
movq 0x8(%rcx), %rcx
movq %rbx, (%rcx)
movq 0x128(%r14), %rcx
movq %rax, 0x8(%rcx)
jmp 0x12639
movq 0x40a27(%rip), %rax     # 0x52ff8
movq (%rax), %rcx
leaq 0x2b075(%rip), %rdi     # 0x3d650
pushq $0x52
popq %rsi
pushq $0x1
popq %rdx
callq 0xd000
jmp 0x12637
movl $0x1451, %ecx           # imm = 0x1451
jmp 0x12610
movl $0x1454, %ecx           # imm = 0x1454
jmp 0x12610
movl $0x1457, %ecx           # imm = 0x1457
jmp 0x12610
movl $0x145a, %ecx           # imm = 0x145A
jmp 0x12610
movl $0x145d, %ecx           # imm = 0x145D
jmp 0x12610
movl $0x1460, %ecx           # imm = 0x1460
movq 0x409e1(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0x2aabf(%rip), %rsi     # 0x3d0e0
leaq 0x2aeb4(%rip), %rdx     # 0x3d4dc
xorl %eax, %eax
callq 0xc8d0
movq %rbx, %rdi
callq 0x11041
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq