// File: /workspace/github_c_makefile_star2_O1/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_merge_range
lxw_error
worksheet_merge_range(lxw_worksheet *self, lxw_row_t first_row,
                      lxw_col_t first_col, lxw_row_t last_row,
                      lxw_col_t last_col, const char *string,
                      lxw_format *format)
{
    lxw_merged_range *merged_range;
    lxw_row_t tmp_row;
    lxw_col_t tmp_col;
    lxw_error err;

    /* Excel doesn't allow a single cell to be merged */
    if (first_row == last_row && first_col == last_col)
        return LXW_ERROR_PARAMETER_VALIDATION;

    /* Swap last row/col with first row/col as necessary */
    if (first_row > last_row) {
        tmp_row = last_row;
        last_row = first_row;
        first_row = tmp_row;
    }
    if (first_col > last_col) {
        tmp_col = last_col;
        last_col = first_col;
        first_col = tmp_col;
    }

    /* Check that column number is valid and store the max value */
    err = _check_dimensions(self, last_row, last_col, LXW_FALSE, LXW_FALSE);
    if (err)
        return err;

    /* Store the merge range. */
    merged_range = calloc(1, sizeof(lxw_merged_range));
    RETURN_ON_MEM_ERROR(merged_range, LXW_ERROR_MEMORY_MALLOC_FAILED);

    merged_range->first_row = first_row;
    merged_range->first_col = first_col;
    merged_range->last_row = last_row;
    merged_range->last_col = last_col;

    STAILQ_INSERT_TAIL(self->merged_ranges, merged_range, list_pointers);
    self->merged_range_count++;

    /* Write the first cell */
    worksheet_write_string(self, first_row, first_col, string, format);

    /* Pad out the rest of the area with formatted blank cells. */
    for (tmp_row = first_row; tmp_row <= last_row; tmp_row++) {
        for (tmp_col = first_col; tmp_col <= last_col; tmp_col++) {
            if (tmp_row == first_row && tmp_col == first_col)
                continue;

            worksheet_write_blank(self, tmp_row, tmp_col, format);
        }
    }

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r13d
movl %ecx, %ebx
movq %rdi, %r14
cmpl %ecx, %esi
sete %cl
cmpw %r13w, %dx
sete %dil
movl $0xd, %eax
testb %dil, %cl
jne 0x3b1c8
movq %r9, %r15
cmpl %ebx, %esi
movl %ebx, %r12d
cmoval %esi, %r12d
cmovbl %esi, %ebx
cmpw %r13w, %dx
movl %r13d, %ebp
cmoval %edx, %ebp
cmovbl %edx, %r13d
movzwl %bp, %edx
movq %r14, %rdi
movl %r12d, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x39aa6
testl %eax, %eax
jne 0x3b1c8
movl $0x1, %edi
movl $0x18, %esi
callq 0xc7f0
testq %rax, %rax
je 0x3b1d7
movq 0x40(%rsp), %r8
movl %ebx, (%rax)
movw %r13w, 0x8(%rax)
movl %r12d, 0x4(%rax)
movw %bp, 0xa(%rax)
movq %rax, %rcx
addq $0x10, %rcx
movq $0x0, 0x10(%rax)
movq 0x40(%r14), %rdx
movq 0x8(%rdx), %rdx
movq %rax, (%rdx)
movq 0x40(%r14), %rax
movq %rcx, 0x8(%rax)
incw 0x1f4(%r14)
movzwl %r13w, %r13d
movq %r14, %rdi
movl %ebx, %esi
movl %r13d, %edx
movq %r15, %rcx
callq 0xc0f0
movl %ebx, %r15d
movl %r12d, 0x4(%rsp)
xorl %r12d, %r12d
cmpl %ebx, %r15d
sete %al
testw %r12w, %r12w
sete %cl
testb %cl, %al
jne 0x3b1a6
leal (%r12,%r13), %eax
movzwl %ax, %edx
movq %r14, %rdi
movl %r15d, %esi
movq 0x40(%rsp), %rcx
callq 0xc590
leal (%r12,%r13), %eax
incl %eax
movl %r12d, %ecx
incl %ecx
movl %ecx, %r12d
cmpw %bp, %ax
jbe 0x3b17e
incl %r15d
movl 0x4(%rsp), %r12d
cmpl %r12d, %r15d
jbe 0x3b17b
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xf240
movl $0x1, %eax
jmp 0x3b1c8