// File: /workspace/github_c_makefile_star2_O3/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 $0x98, %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), %rsi
testq %rsi, %rsi
je 0x31ada
movq 0x78(%rbx), %rdi
callq 0x3ded8
testq %rax, %rax
je 0x31ada
cmpl $0x0, (%rax)
je 0x31ada
xorl %r12d, %r12d
jmp 0x31b6e
movl $0x1, %edi
movl $0x20, %esi
callq 0xc7f0
testq %rax, %rax
je 0x31f2a
movq %rax, %r12
leaq 0x1547d(%rip), %rdi     # 0x46f79
callq 0xcce0
movq %rax, (%r12)
testq %rax, %rax
je 0x31f31
movq 0x78(%r15), %r8
leaq 0x15467(%rip), %rdx     # 0x46f80
leaq 0x10(%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 0x31f38
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 0x31ea8
movq %rax, %r14
movupd 0x68(%r15), %xmm0
cvttpd2dq %xmm0, %xmm1
movapd %xmm1, %xmm2
addpd 0x14ad1(%rip), %xmm0    # 0x46670
cvttpd2dq %xmm0, %xmm0
psrad $0x1f, %xmm2
andpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movlpd %xmm0, 0x28(%rax)
movups 0x80(%r15), %xmm0
movups %xmm0, 0x30(%rax)
movl $0x1, 0x4c(%rax)
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 0x31c00
movb $0x0, (%rax)
movq 0xa0(%r15), %r13
testq %r13, %r13
je 0x31e99
movq 0x78(%rbx), %rdi
movq %r13, %rsi
callq 0x3ded8
movq %rax, %r15
testq %rax, %rax
jne 0x31ee4
leaq 0x210(%rbx), %r15
movl 0x210(%rbx), %r12d
incl %r12d
movl %r12d, 0x210(%rbx)
movl $0x1, %edi
movl $0x30, %esi
callq 0xc7f0
testq %rax, %rax
je 0x31ee4
movq %rax, %rbp
movl %r12d, (%rax)
movq %r13, %rdi
callq 0xcce0
movq %rax, %r13
movq %rax, 0x8(%rbp)
movq 0x78(%rbx), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x31ed3
movq %rax, 0x8(%rsp)
movq %rcx, %r12
movq 0x8(%rcx), %rsi
movq %r13, %rdi
callq 0xc800
movl $0x10, %ecx
testl %eax, %eax
js 0x31ca5
movl $0x18, %ecx
je 0x31ee4
movq (%r12,%rcx), %rcx
testq %rcx, %rcx
jne 0x31c82
movq %r12, 0x20(%rbp)
movl $0x1, 0x28(%rbp)
notl %eax
shrl $0x1f, %eax
movq %rbp, 0x10(%r12,%rax,8)
xorl %eax, %eax
movq 0x8(%rsp), %r9
cmpl $0x1, 0x28(%r12)
jne 0x31e94
movq 0x20(%r12), %rcx
movq 0x10(%rcx), %rdx
cmpq %rdx, %r12
je 0x31d09
testq %rdx, %rdx
je 0x31cf4
cmpl $0x1, 0x28(%rdx)
jne 0x31cf4
movl %eax, 0x28(%rdx)
jmp 0x31d1b
movq 0x10(%r12), %rdx
cmpq %rbp, %rdx
je 0x31d44
movq %r12, %rdx
movq %rbp, %r12
jmp 0x31dc1
movq 0x18(%rcx), %rsi
testq %rsi, %rsi
je 0x31d2f
cmpl $0x1, 0x28(%rsi)
jne 0x31d2f
movl %eax, 0x28(%rsi)
movl %eax, 0x28(%r12)
movl $0x1, 0x28(%rcx)
movq %rcx, %r12
jmp 0x31e83
movq 0x18(%r12), %rsi
cmpq %rbp, %rsi
je 0x31d69
movq %r12, %rsi
movq %rbp, %r12
jmp 0x31e39
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%r12)
testq %rsi, %rsi
je 0x31d99
movq %r12, 0x20(%rsi)
movq 0x20(%r12), %rsi
movq %rsi, 0x20(%rdx)
movq %r9, %rdi
testq %rsi, %rsi
jne 0x31da2
jmp 0x31db2
movq 0x10(%rsi), %rdx
movq %rdx, 0x18(%r12)
testq %rdx, %rdx
je 0x31e0d
movq %r12, 0x20(%rdx)
movq 0x20(%r12), %rdx
movq %rdx, 0x20(%rsi)
movq %r9, %rdi
testq %rdx, %rdx
jne 0x31e16
jmp 0x31e26
movq %rcx, 0x20(%rdx)
movq 0x20(%r12), %rsi
leaq 0x10(%rsi), %r8
leaq 0x18(%rsi), %rdi
cmpq 0x10(%rsi), %r12
cmoveq %r8, %rdi
movq %rdx, (%rdi)
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 0x31de4
movq %rcx, 0x20(%rsi)
movq 0x20(%rcx), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x31e04
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x10(%rdx)
jmp 0x31e7f
movq %rcx, 0x20(%rsi)
movq 0x20(%r12), %rdx
leaq 0x10(%rdx), %r8
leaq 0x18(%rdx), %rdi
cmpq 0x10(%rdx), %r12
cmoveq %r8, %rdi
movq %rsi, (%rdi)
movq %r12, 0x10(%rsi)
movq %rsi, 0x20(%r12)
movq 0x10(%rcx), %rdx
movq %rbp, %rsi
movl $0x0, 0x28(%rsi)
movl $0x1, 0x28(%rcx)
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%rcx)
testq %rsi, %rsi
je 0x31e58
movq %rcx, 0x20(%rsi)
movq 0x20(%rcx), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x31e78
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 0x31cca
movq (%r9), %rbp
jmp 0x31edd
leaq 0x210(%rbx), %r15
incl 0x210(%rbx)
jmp 0x31ee4
movq 0x25149(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
leaq 0xe227(%rip), %rsi      # 0x400e0
leaq 0x14b34(%rip), %rdx     # 0x469f4
movl $0xda8, %ecx            # imm = 0xDA8
xorl %eax, %eax
callq 0xc870
testq %r12, %r12
jne 0x31f3d
jmp 0x31f18
movl $0x1, 0x28(%rbp)
movq %rbp, (%rax)
movl $0x0, 0x28(%rbp)
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 $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xed55
jmp 0x31f18
callq 0xed31
jmp 0x31f3d
callq 0xed07
movq (%r12), %rdi
callq 0xc0c0
movq 0x8(%r12), %rdi
callq 0xc0c0
movq 0x10(%r12), %rdi
callq 0xc0c0
movq %r12, %rdi
callq 0xc0c0
jmp 0x31f18