// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0xb8(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
addq $0xb8, %rcx
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0xa0(%rax), %rsi
callq 0x4a2d0
cmpl $0x0, %eax
jne 0x4a0f3
movl $0x1, %edi
movl $0x20, %esi
callq 0xc870
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x49ff7
movq 0x33023(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1c0f1(%rip), %rsi     # 0x660d0
leaq 0x2240e(%rip), %rdx     # 0x6c3f4
movl $0xd98, %ecx            # imm = 0xD98
movb $0x0, %al
callq 0xc8f0
jmp 0x4a2ba
jmp 0x49ff9
leaq 0x22982(%rip), %rdi     # 0x6c982
callq 0xcd80
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x4a042
movq 0x32fd8(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1c0a6(%rip), %rsi     # 0x660d0
leaq 0x223c3(%rip), %rdx     # 0x6c3f4
movl $0xd9b, %ecx            # imm = 0xD9B
movb $0x0, %al
callq 0xc8f0
jmp 0x4a284
jmp 0x4a044
leaq -0xa0(%rbp), %rdi
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movq 0x78(%rax), %r8
movl $0x20, %esi
leaq 0x22927(%rip), %rdx     # 0x6c989
movb $0x0, %al
callq 0xc5d0
leaq -0xa0(%rbp), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x4a0b4
movq 0x32f66(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1c034(%rip), %rsi     # 0x660d0
leaq 0x22351(%rip), %rdx     # 0x6c3f4
movl $0xda1, %ecx            # imm = 0xDA1
movb $0x0, %al
callq 0xc8f0
jmp 0x4a284
jmp 0x4a0b6
jmp 0x4a0b8
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
addq $0x18, %rcx
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x4a0f3
movl $0x1, %edi
movl $0xc0, %esi
callq 0xc870
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
jne 0x4a13c
movq 0x32ede(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x1bfac(%rip), %rsi     # 0x660d0
leaq 0x222c9(%rip), %rdx     # 0x6c3f4
movl $0xda8, %ecx            # imm = 0xDA8
movb $0x0, %al
callq 0xc8f0
jmp 0x4a284
jmp 0x4a13e
movq -0x18(%rbp), %rax
cvttsd2si 0x68(%rax), %rax
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x18(%rbp), %rax
cvttsd2si 0x70(%rax), %rax
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x18(%rbp), %rax
movsd 0x80(%rax), %xmm0
movq -0xa8(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movq -0x18(%rbp), %rax
movsd 0x88(%rax), %xmm0
movq -0xa8(%rbp), %rax
movsd %xmm0, 0x38(%rax)
movq -0xa8(%rbp), %rax
movl $0x1, 0x4c(%rax)
movq -0x18(%rbp), %rax
movq 0xa8(%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, 0xa0(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xcd80
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, 0xa8(%rax)
movq -0xa8(%rbp), %rax
movq 0xa8(%rax), %rdi
movl $0x2e, %esi
callq 0xc520
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0x4a21a
movq -0xb0(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0xa0(%rax), %rsi
callq 0x4a340
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0xa8(%rbp), %rax
movq $0x0, 0xb8(%rax)
movq -0xa8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0xa8(%rbp), %rcx
addq $0xb8, %rcx
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x4a2ba
cmpq $0x0, -0x20(%rbp)
je 0x4a2ba
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0xc0d0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xc0d0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xc0d0
movq -0x20(%rbp), %rdi
callq 0xc0d0
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)