// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x95(%rax), %eax
cmpl $0xf, %eax
jne 0x152c7
cmpq $0x0, -0x20(%rbp)
je 0x152c7
cmpq $0x0, -0x18(%rbp)
jne 0x152c7
movq 0x67d4f(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x511ed(%rip), %rsi     # 0x664a0
movb $0x0, %al
callq 0xc8f0
movq $0x0, -0x8(%rbp)
jmp 0x15657
movl $0x1, %edi
movl $0x118, %esi            # imm = 0x118
callq 0xc870
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1530a
movq 0x67d10(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x50dde(%rip), %rsi     # 0x660d0
leaq 0x51033(%rip), %rdx     # 0x6632c
movl $0x1451, %ecx           # imm = 0x1451
movb $0x0, %al
callq 0xc8f0
jmp 0x15646
jmp 0x1530c
movl $0x1, %edi
movl $0x28, %esi
callq 0xc870
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x15358
movq 0x67cc2(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x50d90(%rip), %rsi     # 0x660d0
leaq 0x50fe5(%rip), %rdx     # 0x6632c
movl $0x1454, %ecx           # imm = 0x1454
movb $0x0, %al
callq 0xc8f0
jmp 0x15646
jmp 0x1535a
movl $0x1, %edi
movl $0x28, %esi
callq 0xc870
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x153a8
movq 0x67c72(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x50d40(%rip), %rsi     # 0x660d0
leaq 0x50f95(%rip), %rdx     # 0x6632c
movl $0x1457, %ecx           # imm = 0x1457
movb $0x0, %al
callq 0xc8f0
jmp 0x15646
jmp 0x153aa
movl $0x1, %edi
movl $0x28, %esi
callq 0xc870
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x153f8
movq 0x67c22(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x50cf0(%rip), %rsi     # 0x660d0
leaq 0x50f45(%rip), %rdx     # 0x6632c
movl $0x145a, %ecx           # imm = 0x145A
movb $0x0, %al
callq 0xc8f0
jmp 0x15646
jmp 0x153fa
movl $0x1, %edi
movl $0x18, %esi
callq 0xc870
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0xc8(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0xc8(%rax)
jne 0x1544e
movq 0x67bcc(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x50c9a(%rip), %rsi     # 0x660d0
leaq 0x50eef(%rip), %rdx     # 0x6632c
movl $0x145d, %ecx           # imm = 0x145D
movb $0x0, %al
callq 0xc8f0
jmp 0x15646
jmp 0x15450
movl $0x1, %edi
movl $0x18, %esi
callq 0xc870
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
jne 0x154a4
movq 0x67b76(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x50c44(%rip), %rsi     # 0x660d0
leaq 0x50e99(%rip), %rdx     # 0x6632c
movl $0x1460, %ecx           # imm = 0x1460
movb $0x0, %al
callq 0xc8f0
jmp 0x15646
jmp 0x154a6
cmpq $0x0, -0x18(%rbp)
je 0x154ed
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
jne 0x154d5
movq -0x18(%rbp), %rdi
addq $0x1, %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rcx, (%rax)
jmp 0x154eb
movq -0x18(%rbp), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rcx, (%rax)
jmp 0x154ed
cmpq $0x0, -0x20(%rbp)
je 0x15536
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
jne 0x1551d
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
jmp 0x15534
movq -0x20(%rbp), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
jmp 0x15536
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0x14880
cmpl $0x0, %eax
je 0x1554c
jmp 0x15646
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x14880
cmpl $0x0, %eax
je 0x15563
jmp 0x15646
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x14880
cmpl $0x0, %eax
je 0x1557a
jmp 0x15646
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x12, %eax
jne 0x15592
movq -0x28(%rbp), %rax
movb $0x1, 0x94(%rax)
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x13, %eax
jne 0x155aa
movq -0x28(%rbp), %rax
movb $0x1, 0x94(%rax)
movq -0x10(%rbp), %rax
movb 0x95(%rax), %cl
movq -0x28(%rbp), %rax
movq 0xd0(%rax), %rax
movb %cl, 0x6(%rax)
movq -0x10(%rbp), %rax
movb 0x95(%rax), %cl
movq -0x28(%rbp), %rax
movq 0xc8(%rax), %rax
movb %cl, 0x6(%rax)
movq -0x28(%rbp), %rax
movq 0xc8(%rax), %rax
movb $0x1, 0x5(%rax)
movq -0x10(%rbp), %rax
movb 0x168(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x9f(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x110(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
addq $0x110, %rcx            # imm = 0x110
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x15657
movq -0x28(%rbp), %rdi
callq 0x141f0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)