// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0xb8(%rdx)
leaq 0xb8(%rdx), %rax
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 0x2e8d0
leaq 0x40(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq 0x78(%rbx), %rdi
callq 0x3b083
testq %rax, %rax
je 0x2e8d0
cmpl $0x0, (%rax)
je 0x2e8d0
xorl %r12d, %r12d
jmp 0x2e95b
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0xc850
testq %rax, %rax
je 0x2eb4d
movq %rax, %r12
leaq 0x15677(%rip), %rdi     # 0x43f65
callq 0xcd50
movq %rax, (%r12)
testq %rax, %rax
je 0x2eb82
movq 0x78(%r15), %r8
leaq 0x15661(%rip), %rdx     # 0x43f6c
leaq 0x40(%rsp), %r14
pushq $0x20
popq %rsi
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc5b0
movq %r14, %rdi
callq 0xcd50
movq %rax, 0x8(%r12)
testq %rax, %rax
je 0x2eba1
movq %r12, %rax
addq $0x18, %rax
andq $0x0, 0x18(%r12)
movq 0x230(%rbx), %rcx
movq 0x8(%rcx), %rcx
movq %r12, (%rcx)
movq 0x230(%rbx), %rcx
movq %rax, 0x8(%rcx)
pushq $0x1
popq %rdi
movl $0xc0, %esi
callq 0xc850
testq %rax, %rax
je 0x2eb15
movq %rax, %r14
movupd 0x68(%r15), %xmm0
cvttpd2dq %xmm0, %xmm1
movapd %xmm1, %xmm2
addpd 0x14cc6(%rip), %xmm0    # 0x43650
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 0xcd50
movq %rax, 0xa0(%r14)
movq 0x28(%r15), %rdi
callq 0xcd50
movq %rax, 0xa8(%r14)
pushq $0x2e
popq %rsi
movq %rax, %rdi
callq 0xc500
testq %rax, %rax
je 0x2e9e9
movb $0x0, (%rax)
movq 0xa0(%r15), %r13
testq %r13, %r13
je 0x2ea91
leaq 0x10(%rsp), %rsi
movq %r13, 0x8(%rsi)
movq 0x78(%rbx), %rdi
callq 0x3b083
movq %rax, %r15
testq %rax, %rax
jne 0x2ea9e
leaq 0x210(%rbx), %r15
movl 0x210(%rbx), %ebp
incl %ebp
movl %ebp, 0x210(%rbx)
pushq $0x1
popq %rdi
pushq $0x30
popq %rsi
callq 0xc850
testq %rax, %rax
je 0x2ea9e
movq %rax, %r12
movq %r15, (%rsp)
movl %ebp, (%rax)
movq %r13, %rdi
callq 0xcd50
movq %rax, 0x8(%r12)
movq 0x78(%rbx), %rdx
xorl %ecx, %ecx
pushq $0x10
popq %rbp
pushq $0x18
popq %r15
movq %rdx, 0x8(%rsp)
xorl %eax, %eax
movq (%rdx), %r13
testq %r13, %r13
je 0x2eae1
movq %r12, %rdi
movq %r13, %rsi
callq 0x3b076
movq %rbp, %rdx
testl %eax, %eax
js 0x2ea89
movq %r15, %rdx
je 0x2eb44
addq %r13, %rdx
movq %r13, %rcx
jmp 0x2ea66
leaq 0x210(%rbx), %r15
incl 0x210(%rbx)
movl (%r15), %eax
movl %eax, 0x4c(%r14)
movq %r14, %rax
addq $0xb8, %rax
andq $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
movq %rcx, 0x20(%r12)
movl $0x1, 0x28(%r12)
movq 0x8(%rsp), %r9
movq %r9, %rdx
testq %rcx, %rcx
movq (%rsp), %r15
je 0x2ebf3
testl %eax, %eax
js 0x2ebef
leaq 0x18(%rcx), %rdx
jmp 0x2ebf3
movq 0x244dc(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0xe5ba(%rip), %rsi      # 0x3d0e0
leaq 0x14eb3(%rip), %rdx     # 0x439e0
movl $0xda8, %ecx            # imm = 0xDA8
xorl %eax, %eax
callq 0xc8d0
testq %r12, %r12
jne 0x2ebc5
jmp 0x2eacf
movq (%rsp), %r15
jmp 0x2ea9e
movq 0x244a4(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0xe582(%rip), %rsi      # 0x3d0e0
leaq 0x14e7b(%rip), %rdx     # 0x439e0
movl $0xd98, %ecx            # imm = 0xD98
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc8d0
movq 0x2446f(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0xe54d(%rip), %rsi      # 0x3d0e0
leaq 0x14e46(%rip), %rdx     # 0x439e0
movl $0xd9b, %ecx            # imm = 0xD9B
jmp 0x2ebbe
movq 0x24450(%rip), %rax     # 0x52ff8
movq (%rax), %rdi
leaq 0xe52e(%rip), %rsi      # 0x3d0e0
leaq 0x14e27(%rip), %rdx     # 0x439e0
movl $0xda1, %ecx            # imm = 0xDA1
xorl %eax, %eax
callq 0xc8d0
movq (%r12), %rdi
callq 0xc0d0
movq 0x8(%r12), %rdi
callq 0xc0d0
movq 0x10(%r12), %rdi
callq 0xc0d0
movq %r12, %rdi
callq 0xc0d0
jmp 0x2eacf
leaq 0x10(%rcx), %rdx
movq %r12, (%rdx)
testq %rcx, %rcx
je 0x2edae
cmpl $0x1, 0x28(%rcx)
jne 0x2edae
movq 0x20(%rcx), %rax
movq 0x10(%rax), %rdx
cmpq %rdx, %rcx
je 0x2ec3b
testq %rdx, %rdx
je 0x2ec27
cmpl $0x1, 0x28(%rdx)
jne 0x2ec27
andl $0x0, 0x28(%rdx)
jmp 0x2ec4e
movq 0x10(%rcx), %rdx
cmpq %r12, %rdx
je 0x2ec75
movq %rcx, %rdx
movq %r12, %rcx
jmp 0x2ece8
movq 0x18(%rax), %rsi
testq %rsi, %rsi
je 0x2ec61
cmpl $0x1, 0x28(%rsi)
jne 0x2ec61
andl $0x0, 0x28(%rsi)
andl $0x0, 0x28(%rcx)
movl $0x1, 0x28(%rax)
movq %rax, %rcx
jmp 0x2eda2
movq 0x18(%rcx), %rsi
cmpq %r12, %rsi
je 0x2ec98
movq %rcx, %rsi
movq %r12, %rcx
jmp 0x2ed5b
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%rcx)
testq %rsi, %rsi
je 0x2ecc2
movq %rcx, 0x20(%rsi)
movq 0x20(%rcx), %rsi
movq %rsi, 0x20(%rdx)
movq %r9, %rdi
testq %rsi, %rsi
jne 0x2ecca
jmp 0x2ecda
movq 0x10(%rsi), %rdx
movq %rdx, 0x18(%rcx)
testq %rdx, %rdx
je 0x2ed31
movq %rcx, 0x20(%rdx)
movq 0x20(%rcx), %rdx
movq %rdx, 0x20(%rsi)
movq %r9, %rdi
testq %rdx, %rdx
jne 0x2ed39
jmp 0x2ed49
movq %rax, 0x20(%rdx)
movq 0x20(%rcx), %rsi
leaq 0x10(%rsi), %r8
leaq 0x18(%rsi), %rdi
cmpq 0x10(%rsi), %rcx
cmoveq %r8, %rdi
movq %rdx, (%rdi)
movq %rcx, 0x18(%rdx)
movq %rdx, 0x20(%rcx)
movq %r12, %rdx
andl $0x0, 0x28(%rdx)
movl $0x1, 0x28(%rax)
movq 0x18(%rax), %rdx
movq 0x10(%rdx), %rsi
movq %rsi, 0x18(%rax)
testq %rsi, %rsi
je 0x2ed08
movq %rax, 0x20(%rsi)
movq 0x20(%rax), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x2ed28
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %rax
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rax, 0x10(%rdx)
jmp 0x2ed9e
movq %rax, 0x20(%rsi)
movq 0x20(%rcx), %rdx
leaq 0x10(%rdx), %r8
leaq 0x18(%rdx), %rdi
cmpq 0x10(%rdx), %rcx
cmoveq %r8, %rdi
movq %rsi, (%rdi)
movq %rcx, 0x10(%rsi)
movq %rsi, 0x20(%rcx)
movq 0x10(%rax), %rdx
movq %r12, %rsi
andl $0x0, 0x28(%rsi)
movl $0x1, 0x28(%rax)
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%rax)
testq %rsi, %rsi
je 0x2ed77
movq %rax, 0x20(%rsi)
movq 0x20(%rax), %rdi
movq %rdi, 0x20(%rdx)
movq %r9, %rsi
testq %rdi, %rdi
je 0x2ed97
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %rax
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rax, 0x18(%rdx)
movq %rdx, 0x20(%rax)
movq %rcx, %r12
movq 0x20(%rcx), %rcx
jmp 0x2ebf6
movq (%r9), %rax
andl $0x0, 0x28(%rax)
jmp 0x2ea9e