// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_set_column_opt
lxw_error
worksheet_set_column_opt(lxw_worksheet *self,
                         lxw_col_t firstcol,
                         lxw_col_t lastcol,
                         double width,
                         lxw_format *format,
                         lxw_row_col_options *user_options)
{
    lxw_col_options *copied_options;
    uint8_t ignore_row = LXW_TRUE;
    uint8_t ignore_col = LXW_TRUE;
    uint8_t hidden = LXW_FALSE;
    uint8_t level = 0;
    uint8_t collapsed = LXW_FALSE;
    lxw_col_t col;
    lxw_error err;

    if (user_options) {
        hidden = user_options->hidden;
        level = user_options->level;
        collapsed = user_options->collapsed;
    }

    /* Ensure second col is larger than first. */
    if (firstcol > lastcol) {
        lxw_col_t tmp = firstcol;
        firstcol = lastcol;
        lastcol = tmp;
    }

    /* Ensure that the cols are valid and store max and min values.
     * NOTE: The check shouldn't modify the row dimensions and should only
     *       modify the column dimensions in certain cases. */
    if (format != NULL || (width != LXW_DEF_COL_WIDTH && hidden))
        ignore_col = LXW_FALSE;

    err = _check_dimensions(self, 0, firstcol, ignore_row, ignore_col);

    if (!err)
        err = _check_dimensions(self, 0, lastcol, ignore_row, ignore_col);

    if (err)
        return err;

    /* Resize the col_options array if required. */
    if (firstcol >= self->col_options_max) {
        lxw_col_t col_tmp;
        lxw_col_t old_size = self->col_options_max;
        lxw_col_t new_size = _next_power_of_two(firstcol + 1);
        lxw_col_options **new_ptr = realloc(self->col_options,
                                            new_size *
                                            sizeof(lxw_col_options *));

        if (new_ptr) {
            for (col_tmp = old_size; col_tmp < new_size; col_tmp++)
                new_ptr[col_tmp] = NULL;

            self->col_options = new_ptr;
            self->col_options_max = new_size;
        }
        else {
            return LXW_ERROR_MEMORY_MALLOC_FAILED;
        }
    }

    /* Resize the col_formats array if required. */
    if (lastcol >= self->col_formats_max) {
        lxw_col_t col;
        lxw_col_t old_size = self->col_formats_max;
        lxw_col_t new_size = _next_power_of_two(lastcol + 1);
        lxw_format **new_ptr = realloc(self->col_formats,
                                       new_size * sizeof(lxw_format *));

        if (new_ptr) {
            for (col = old_size; col < new_size; col++)
                new_ptr[col] = NULL;

            self->col_formats = new_ptr;
            self->col_formats_max = new_size;
        }
        else {
            return LXW_ERROR_MEMORY_MALLOC_FAILED;
        }
    }

    /* Store the column options. */
    copied_options = calloc(1, sizeof(lxw_col_options));
    RETURN_ON_MEM_ERROR(copied_options, LXW_ERROR_MEMORY_MALLOC_FAILED);

    /* Ensure the level is <= 7). */
    if (level > 7)
        level = 7;

    if (level > self->outline_col_level)
        self->outline_col_level = level;

    /* Set the column properties. */
    copied_options->firstcol = firstcol;
    copied_options->lastcol = lastcol;
    copied_options->width = width;
    copied_options->format = format;
    copied_options->hidden = hidden;
    copied_options->level = level;
    copied_options->collapsed = collapsed;

    free(self->col_options[firstcol]);
    self->col_options[firstcol] = copied_options;

    /* Store the column formats for use when writing cell data. */
    for (col = firstcol; col <= lastcol; col++) {
        self->col_formats[col] = format;
    }

    /* Store the column change to allow optimizations. */
    self->col_size_changed = LXW_TRUE;

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %rbx
movl %edx, %r14d
movq %rdi, %r15
testq %r8, %r8
je 0x3ae93
movb (%r8), %dl
movb 0x1(%r8), %al
movl %eax, 0xc(%rsp)
movb 0x2(%r8), %r12b
jmp 0x3aea0
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
xorl %edx, %edx
cmpw %r14w, %si
movl %r14d, %r13d
cmoval %esi, %r13d
cmovbl %esi, %r14d
movzwl %r14w, %esi
testq %rbx, %rbx
movl %edx, 0x1c(%rsp)
movq %rsi, 0x20(%rsp)
jne 0x3aede
ucomisd 0xb87f(%rip), %xmm0     # 0x46748
setp %al
setne %cl
orb %al, %cl
testb %dl, %dl
setne %al
testb %al, %cl
je 0x3b11d
movl $0x17, %eax
cmpl $0x3fff, %esi           # imm = 0x3FFF
ja 0x3b13c
cmpw %r14w, 0xac(%r15)
jbe 0x3af01
movw %r14w, 0xac(%r15)
cmpw %r14w, 0xae(%r15)
jae 0x3af13
movw %r14w, 0xae(%r15)
xorl %ecx, %ecx
movzwl %r13w, %ebp
movzbl %cl, %r8d
movq %r15, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl $0x1, %ecx
movsd %xmm0, 0x30(%rsp)
callq 0x39d04
testl %eax, %eax
jne 0x3b13c
movl %r12d, 0x18(%rsp)
movzwl 0xf8(%r15), %r12d
cmpw %r12w, %r14w
jb 0x3afdc
movq 0x20(%rsp), %rax
shrl %eax
orl %r14d, %eax
movl $0xffff, %esi           # imm = 0xFFFF
movl %eax, %ecx
andl %esi, %ecx
shrl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
andl %esi, %eax
shrl $0x4, %eax
orl %ecx, %eax
movzbl %ah, %ecx
orl %eax, %ecx
movq %rcx, 0x28(%rsp)
leal 0x1(%rcx), %eax
movq 0xf0(%r15), %rdi
movl %eax, 0x10(%rsp)
andl %eax, %esi
shll $0x3, %esi
callq 0xcbf0
testq %rax, %rax
je 0x3b137
movq 0x28(%rsp), %rcx
cmpw %r12w, %cx
jb 0x3afc9
leaq (%rax,%r12,8), %rdi
subl %r12d, %ecx
movzwl %cx, %ecx
leaq 0x8(,%rcx,8), %rdx
xorl %esi, %esi
movq %rax, %r12
callq 0xc640
movq %r12, %rax
movq %rax, 0xf0(%r15)
movl 0x10(%rsp), %eax
movw %ax, 0xf8(%r15)
movzwl 0x118(%r15), %eax
cmpw %ax, %r13w
jb 0x3b067
movq %rax, 0x10(%rsp)
shrl %ebp
orl %r13d, %ebp
movl $0xffff, %esi           # imm = 0xFFFF
movl %ebp, %ecx
andl %esi, %ecx
shrl $0x2, %ecx
orl %ebp, %ecx
movl %ecx, %eax
andl %esi, %eax
shrl $0x4, %eax
orl %ecx, %eax
movzbl %ah, %ebp
orl %eax, %ebp
leal 0x1(%rbp), %r12d
movq 0x110(%r15), %rdi
andl %r12d, %esi
shll $0x3, %esi
callq 0xcbf0
testq %rax, %rax
je 0x3b137
movq 0x10(%rsp), %rcx
cmpw %r12w, %cx
jae 0x3b058
leaq (%rax,%rcx,8), %rdi
subl %ecx, %ebp
movzwl %bp, %ecx
leaq 0x8(,%rcx,8), %rdx
xorl %esi, %esi
movq %rax, %rbp
callq 0xc640
movq %rbp, %rax
movq %rax, 0x110(%r15)
movw %r12w, 0x118(%r15)
movl $0x1, %edi
movl $0x20, %esi
callq 0xc7f0
testq %rax, %rax
je 0x3b132
movq %rax, %r12
movzbl 0xc(%rsp), %ecx
cmpb $0x7, %cl
movl $0x7, %eax
cmovbl %ecx, %eax
cmpb 0x1ab(%r15), %al
jbe 0x3b0a2
movb %al, 0x1ab(%r15)
movw %r14w, (%r12)
movw %r13w, 0x2(%r12)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%r12)
movq %rbx, 0x10(%r12)
movl 0x1c(%rsp), %ecx
movb %cl, 0x18(%r12)
movb %al, 0x19(%r12)
movl 0x18(%rsp), %eax
movb %al, 0x1a(%r12)
movq 0xf0(%r15), %rax
movq 0x20(%rsp), %rbp
shll $0x3, %ebp
movq (%rax,%rbp), %rdi
callq 0xc0c0
movq 0xf0(%r15), %rax
movq %r12, (%rax,%rbp)
movq 0x110(%r15), %rax
movzwl %r14w, %ecx
movq %rbx, (%rax,%rcx,8)
incl %r14d
cmpw %r13w, %r14w
jbe 0x3b0f9
movb $0x1, 0x11a(%r15)
xorl %eax, %eax
jmp 0x3b13c
movb $0x1, %cl
movl $0x17, %eax
cmpl $0x3fff, %esi           # imm = 0x3FFF
jbe 0x3af15
jmp 0x3b13c
callq 0xf5ff
movl $0x1, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq