// File: /workspace/github_c_makefile_star2_O1/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: lxw_worksheet_prepare_header_image
void
lxw_worksheet_prepare_header_image(lxw_worksheet *self,
                                   uint32_t image_ref_id,
                                   lxw_object_properties *object_props)
{
    lxw_rel_tuple *relationship = NULL;
    char filename[LXW_FILENAME_LENGTH];
    lxw_vml_obj *header_image_vml;
    char *extension;

    STAILQ_INSERT_TAIL(self->image_props, object_props, list_pointers);

    if (!_find_vml_drawing_rel_index(self, object_props->md5)) {
        relationship = calloc(1, sizeof(lxw_rel_tuple));
        RETURN_VOID_ON_MEM_ERROR(relationship);

        relationship->type = lxw_strdup("/image");
        GOTO_LABEL_ON_MEM_ERROR(relationship->type, mem_error);

        lxw_snprintf(filename, 32, "../media/image%d.%s", image_ref_id,
                     object_props->extension);

        relationship->target = lxw_strdup(filename);
        GOTO_LABEL_ON_MEM_ERROR(relationship->target, mem_error);

        STAILQ_INSERT_TAIL(self->vml_drawing_links, relationship,
                           list_pointers);
    }

    header_image_vml = calloc(1, sizeof(lxw_vml_obj));
    GOTO_LABEL_ON_MEM_ERROR(header_image_vml, mem_error);

    header_image_vml->width = (uint32_t) object_props->width;
    header_image_vml->height = (uint32_t) object_props->height;
    header_image_vml->x_dpi = object_props->x_dpi;
    header_image_vml->y_dpi = object_props->y_dpi;
    header_image_vml->rel_index = 1;

    header_image_vml->image_position =
        lxw_strdup(object_props->image_position);
    header_image_vml->name = lxw_strdup(object_props->description);

    /* Strip the extension from the filename. */
    extension = strchr(header_image_vml->name, '.');
    if (extension)
        *extension = '\0';

    header_image_vml->rel_index =
        _get_vml_drawing_rel_index(self, object_props->md5);

    STAILQ_INSERT_TAIL(self->header_image_objs, header_image_vml,
                       list_pointers);

    return;

mem_error:
    if (relationship) {
        free(relationship->type);
        free(relationship->target);
        free(relationship->target_mode);
        free(relationship);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
leaq 0xb8(%rdx), %rax
movq $0x0, 0xb8(%rdx)
movq 0x60(%rdi), %rcx
movq 0x8(%rcx), %rcx
movq %rdx, (%rcx)
movq 0x60(%rdi), %rcx
movq %rax, 0x8(%rcx)
movq 0xa0(%rdx), %rax
testq %rax, %rax
je 0x318ac
leaq 0x40(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq 0x78(%rbx), %rdi
callq 0x3dcf6
testq %rax, %rax
je 0x318ac
cmpl $0x0, (%rax)
je 0x318ac
xorl %r12d, %r12d
jmp 0x31940
movl $0x1, %edi
movl $0x20, %esi
callq 0xc7f0
testq %rax, %rax
je 0x31cc7
movq %rax, %r12
leaq 0x155bf(%rip), %rdi     # 0x46e8d
callq 0xcce0
movq %rax, (%r12)
testq %rax, %rax
je 0x31cd1
movq 0x78(%r15), %r8
leaq 0x155a9(%rip), %rdx     # 0x46e94
leaq 0x40(%rsp), %r14
movl $0x20, %esi
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc570
movq %r14, %rdi
callq 0xcce0
movq %rax, 0x8(%r12)
testq %rax, %rax
je 0x31cd8
movq %r12, %rax
addq $0x18, %rax
movq $0x0, 0x18(%r12)
movq 0x230(%rbx), %rcx
movq 0x8(%rcx), %rcx
movq %r12, (%rcx)
movq 0x230(%rbx), %rcx
movq %rax, 0x8(%rcx)
movl $0x1, %edi
movl $0xc0, %esi
callq 0xc7f0
testq %rax, %rax
je 0x31ad5
movq %rax, %r14
cvttsd2si 0x68(%r15), %rax
movl %eax, 0x28(%r14)
cvttsd2si 0x70(%r15), %rax
movl %eax, 0x2c(%r14)
movsd 0x80(%r15), %xmm0
movsd %xmm0, 0x30(%r14)
movsd 0x88(%r15), %xmm0
movsd %xmm0, 0x38(%r14)
movl $0x1, 0x4c(%r14)
movq 0xa8(%r15), %rdi
callq 0xcce0
movq %rax, 0xa0(%r14)
movq 0x28(%r15), %rdi
callq 0xcce0
movq %rax, 0xa8(%r14)
movq %rax, %rdi
movl $0x2e, %esi
callq 0xc4c0
testq %rax, %rax
je 0x319cd
movb $0x0, (%rax)
movq 0xa0(%r15), %r13
testq %r13, %r13
je 0x319f0
leaq 0x10(%rsp), %rsi
movq %r13, 0x8(%rsi)
movq 0x78(%rbx), %rdi
callq 0x3dcf6
movq %rax, %r15
jmp 0x319f3
xorl %r15d, %r15d
testq %r15, %r15
je 0x31a3e
movl (%r15), %eax
movl %eax, 0x4c(%r14)
movq %r14, %rax
addq $0xb8, %rax
movq $0x0, 0xb8(%r14)
movq 0x88(%rbx), %rcx
movq 0x8(%rcx), %rcx
movq %r14, (%rcx)
movq 0x88(%rbx), %rcx
movq %rax, 0x8(%rcx)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x210(%rbx), %r15
movl 0x210(%rbx), %r12d
incl %r12d
movl %r12d, 0x210(%rbx)
testq %r13, %r13
je 0x319f8
movl $0x1, %edi
movl $0x30, %esi
callq 0xc7f0
testq %rax, %rax
je 0x319f8
movq %rax, %rbp
movl %r12d, (%rax)
movq %r13, %rdi
callq 0xcce0
movq %rax, 0x8(%rbp)
movq 0x78(%rbx), %r9
movq (%r9), %rcx
testq %rcx, %rcx
je 0x31adf
movq %rax, %r13
movq %r9, 0x8(%rsp)
movq %rcx, %r12
movq 0x8(%rcx), %rsi
movq %r13, %rdi
callq 0xc800
movl $0x10, %ecx
testl %eax, %eax
js 0x31ab8
movl $0x18, %ecx
je 0x319f8
movq (%r12,%rcx), %rcx
testq %rcx, %rcx
jne 0x31a95
notl %eax
shrl $0x1f, %eax
leaq 0x10(,%rax,8), %rax
movq 0x8(%rsp), %r9
jmp 0x31ae7
movl $0xda8, %esi            # imm = 0xDA8
jmp 0x31cdd
movl $0x18, %eax
xorl %r12d, %r12d
movq %r12, 0x20(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbp)
movl $0x1, 0x28(%rbp)
testq %r12, %r12
je 0x31cea
movq %rbp, (%r12,%rax)
xorl %eax, %eax
cmpl $0x1, 0x28(%r12)
jne 0x31ced
movq 0x20(%r12), %rcx
movq 0x10(%rcx), %rdx
cmpq %rdx, %r12
je 0x31b42
testq %rdx, %rdx
je 0x31b2d
cmpl $0x1, 0x28(%rdx)
je 0x31b51
movq 0x10(%r12), %rdx
cmpq %rbp, %rdx
je 0x31b81
movq %r12, %rdx
movq %rbp, %r12
jmp 0x31bc8
movq 0x18(%rcx), %rdx
testq %rdx, %rdx
je 0x31b68
cmpl $0x1, 0x28(%rdx)
jne 0x31b68
movl %eax, 0x28(%rdx)
movl %eax, 0x28(%r12)
movl $0x1, 0x28(%rcx)
movq %rcx, %r12
jmp 0x31cb4
movq 0x18(%r12), %rdx
cmpq %rbp, %rdx
je 0x31c1b
movq %r12, %rdx
movq %rbp, %r12
jmp 0x31c62
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%r12)
testq %rsi, %rsi
je 0x31b93
movq %r12, 0x20(%rsi)
movq 0x20(%r12), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x31bb9
movq 0x20(%r12), %rdi
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %r12
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %r12, 0x18(%rdx)
movq %rdx, 0x20(%r12)
movq %rbp, %rdx
movl $0x0, 0x28(%rdx)
movl $0x1, 0x28(%rcx)
movq 0x18(%rcx), %rdx
movq 0x10(%rdx), %rsi
movq %rsi, 0x18(%rcx)
testq %rsi, %rsi
je 0x31beb
movq %rcx, 0x20(%rsi)
movq 0x20(%rcx), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x31c0f
movq 0x20(%rcx), %rdi
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x10(%rdx)
jmp 0x31cb0
movq 0x10(%rdx), %rsi
movq %rsi, 0x18(%r12)
testq %rsi, %rsi
je 0x31c2d
movq %r12, 0x20(%rsi)
movq 0x20(%r12), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x31c53
movq 0x20(%r12), %rdi
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %r12
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %r12, 0x10(%rdx)
movq %rdx, 0x20(%r12)
movq %rbp, %rdx
movl $0x0, 0x28(%rdx)
movl $0x1, 0x28(%rcx)
movq 0x10(%rcx), %rdx
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%rcx)
testq %rsi, %rsi
je 0x31c85
movq %rcx, 0x20(%rsi)
movq 0x20(%rcx), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x31ca9
movq 0x20(%rcx), %rdi
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x18(%rdx)
movq %rdx, 0x20(%rcx)
movq %r12, %rbp
movq 0x20(%r12), %r12
testq %r12, %r12
jne 0x31b08
jmp 0x31ced
callq 0xea8f
jmp 0x31a2c
movl $0xd9b, %esi            # imm = 0xD9B
jmp 0x31cdd
movl $0xda1, %esi            # imm = 0xDA1
movq %r12, %rdi
callq 0xea41
jmp 0x31a2c
movq %rbp, (%r9)
movq (%r9), %rax
movl $0x0, 0x28(%rax)
jmp 0x319f8