// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/workbook.c
// Function: lxw_workbook_free
void
lxw_workbook_free(lxw_workbook *workbook)
{
    lxw_sheet *sheet;
    struct lxw_worksheet_name *worksheet_name;
    struct lxw_worksheet_name *next_worksheet_name;
    struct lxw_chartsheet_name *chartsheet_name;
    struct lxw_chartsheet_name *next_chartsheet_name;
    struct lxw_image_md5 *image_md5;
    struct lxw_image_md5 *next_image_md5;
    lxw_chart *chart;
    lxw_format *format;
    lxw_defined_name *defined_name;
    lxw_defined_name *defined_name_tmp;
    lxw_custom_property *custom_property;

    if (!workbook)
        return;

    _free_doc_properties(workbook->properties);

    free(workbook->filename);

    /* Free the sheets in the workbook. */
    if (workbook->sheets) {
        while (!STAILQ_EMPTY(workbook->sheets)) {
            sheet = STAILQ_FIRST(workbook->sheets);

            if (sheet->is_chartsheet)
                lxw_chartsheet_free(sheet->u.chartsheet);
            else
                lxw_worksheet_free(sheet->u.worksheet);

            STAILQ_REMOVE_HEAD(workbook->sheets, list_pointers);
            free(sheet);
        }
        free(workbook->sheets);
    }

    /* Free the sheet lists. The worksheet objects are freed above. */
    free(workbook->worksheets);
    free(workbook->chartsheets);

    /* Free the charts in the workbook. */
    if (workbook->charts) {
        while (!STAILQ_EMPTY(workbook->charts)) {
            chart = STAILQ_FIRST(workbook->charts);
            STAILQ_REMOVE_HEAD(workbook->charts, list_pointers);
            lxw_chart_free(chart);
        }
        free(workbook->charts);
    }

    /* Free the formats in the workbook. */
    if (workbook->formats) {
        while (!STAILQ_EMPTY(workbook->formats)) {
            format = STAILQ_FIRST(workbook->formats);
            STAILQ_REMOVE_HEAD(workbook->formats, list_pointers);
            lxw_format_free(format);
        }
        free(workbook->formats);
    }

    /* Free the defined_names in the workbook. */
    if (workbook->defined_names) {
        defined_name = TAILQ_FIRST(workbook->defined_names);
        while (defined_name) {

            defined_name_tmp = TAILQ_NEXT(defined_name, list_pointers);
            free(defined_name);
            defined_name = defined_name_tmp;
        }
        free(workbook->defined_names);
    }

    /* Free the custom_properties in the workbook. */
    if (workbook->custom_properties) {
        while (!STAILQ_EMPTY(workbook->custom_properties)) {
            custom_property = STAILQ_FIRST(workbook->custom_properties);
            STAILQ_REMOVE_HEAD(workbook->custom_properties, list_pointers);
            _free_custom_doc_property(custom_property);
        }
        free(workbook->custom_properties);
    }

    if (workbook->worksheet_names) {
        for (worksheet_name =
             RB_MIN(lxw_worksheet_names, workbook->worksheet_names);
             worksheet_name; worksheet_name = next_worksheet_name) {

            next_worksheet_name = RB_NEXT(lxw_worksheet_names,
                                          workbook->worksheet_name,
                                          worksheet_name);
            RB_REMOVE(lxw_worksheet_names, workbook->worksheet_names,
                      worksheet_name);
            free(worksheet_name);
        }

        free(workbook->worksheet_names);
    }

    if (workbook->chartsheet_names) {
        for (chartsheet_name =
             RB_MIN(lxw_chartsheet_names, workbook->chartsheet_names);
             chartsheet_name; chartsheet_name = next_chartsheet_name) {

            next_chartsheet_name = RB_NEXT(lxw_chartsheet_names,
                                           workbook->chartsheet_name,
                                           chartsheet_name);
            RB_REMOVE(lxw_chartsheet_names, workbook->chartsheet_names,
                      chartsheet_name);
            free(chartsheet_name);
        }

        free(workbook->chartsheet_names);
    }

    if (workbook->image_md5s) {
        for (image_md5 = RB_MIN(lxw_image_md5s, workbook->image_md5s);
             image_md5; image_md5 = next_image_md5) {

            next_image_md5 =
                RB_NEXT(lxw_image_md5s, workbook->image_md5, image_md5);
            RB_REMOVE(lxw_image_md5s, workbook->image_md5s, image_md5);
            free(image_md5->md5);
            free(image_md5);
        }

        free(workbook->image_md5s);
    }

    if (workbook->header_image_md5s) {
        for (image_md5 = RB_MIN(lxw_image_md5s, workbook->header_image_md5s);
             image_md5; image_md5 = next_image_md5) {

            next_image_md5 =
                RB_NEXT(lxw_image_md5s, workbook->image_md5, image_md5);
            RB_REMOVE(lxw_image_md5s, workbook->header_image_md5s, image_md5);
            free(image_md5->md5);
            free(image_md5);
        }

        free(workbook->header_image_md5s);
    }

    if (workbook->background_md5s) {
        for (image_md5 = RB_MIN(lxw_image_md5s, workbook->background_md5s);
             image_md5; image_md5 = next_image_md5) {

            next_image_md5 =
                RB_NEXT(lxw_image_md5s, workbook->image_md5, image_md5);
            RB_REMOVE(lxw_image_md5s, workbook->background_md5s, image_md5);
            free(image_md5->md5);
            free(image_md5);
        }

        free(workbook->background_md5s);
    }

    lxw_hash_free(workbook->used_xf_formats);
    lxw_hash_free(workbook->used_dxf_formats);
    lxw_sst_free(workbook->sst);
    free((void *) workbook->options.tmpdir);
    free(workbook->ordered_charts);
    free(workbook->vba_project);
    free(workbook->vba_project_signature);
    free(workbook->vba_codename);
    free(workbook);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x3afb8
jmp 0x3b51f
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0x3b530
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3b084
jmp 0x3afe6
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3affd
jmp 0x3b077
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3b024
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xcd90
jmp 0x3b031
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xce60
jmp 0x3b033
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x3b067
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x3b069
movq -0x10(%rbp), %rdi
callq 0xc0d0
jmp 0x3afe6
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x3b122
jmp 0x3b0ab
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, (%rax)
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b0c2
jmp 0x3b115
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq 0x178(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x3b108
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x3b10a
movq -0x48(%rbp), %rdi
callq 0xc760
jmp 0x3b0ab
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x3b1a6
jmp 0x3b12f
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpq $0x0, (%rax)
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b146
jmp 0x3b199
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq (%rax), %rax
movq 0x230(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x3b18c
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x3b18e
movq -0x50(%rbp), %rdi
callq 0xd080
jmp 0x3b12f
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x3b1f6
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x3b1e9
movq -0x58(%rbp), %rax
movq 0x288(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
callq 0xc0d0
movq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x3b1c0
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x3b277
jmp 0x3b203
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
cmpq $0x0, (%rax)
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b21a
jmp 0x3b26a
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movq (%rax), %rax
movq 0x30(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x78(%rcx), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x3b25d
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x3b25f
movq -0x68(%rbp), %rdi
callq 0x3b5e0
jmp 0x3b203
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x3b2dd
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3b630
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x3b2d0
movq -0x18(%rbp), %rdi
callq 0x3b690
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x3b750
movq -0x18(%rbp), %rdi
callq 0xc0d0
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x3b298
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x3b343
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3b9b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3b336
movq -0x28(%rbp), %rdi
callq 0x3ba10
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x3bad0
movq -0x28(%rbp), %rdi
callq 0xc0d0
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x3b2fe
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x3b3b6
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3bd30
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x3b3a9
movq -0x38(%rbp), %rdi
callq 0x3bd90
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x3be50
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xc0d0
movq -0x38(%rbp), %rdi
callq 0xc0d0
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x3b364
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x3b429
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3bd30
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x3b41c
movq -0x38(%rbp), %rdi
callq 0x3bd90
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x3be50
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xc0d0
movq -0x38(%rbp), %rdi
callq 0xc0d0
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x3b3d7
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x3b49c
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3bd30
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x3b48f
movq -0x38(%rbp), %rdi
callq 0x3bd90
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x3be50
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xc0d0
movq -0x38(%rbp), %rdi
callq 0xc0d0
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x3b44a
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rdi
callq 0xd0e0
movq -0x8(%rbp), %rax
movq 0xe0(%rax), %rdi
callq 0xd0e0
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0xd140
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rdi
callq 0xc0d0
movq -0x8(%rbp), %rdi
callq 0xc0d0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)