// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: get_image_properties
STATIC lxw_error
_get_image_properties(lxw_object_properties *image_props)
{
    unsigned char signature[4];
#ifndef USE_NO_MD5
    uint8_t i;
    MD5_CTX md5_context;
    size_t size_read;
    char buffer[LXW_IMAGE_BUFFER_SIZE];
    unsigned char md5_checksum[LXW_MD5_SIZE];
#endif

    /* Read 4 bytes to look for the file header/signature. */
    if (fread(signature, 1, 4, image_props->stream) < 4) {
        LXW_WARN_FORMAT1("worksheet image insertion: "
                         "couldn't read image type for: %s.",
                         image_props->filename);
        return LXW_ERROR_IMAGE_DIMENSIONS;
    }

    if (memcmp(&signature[1], "PNG", 3) == 0) {
        if (_process_png(image_props) != LXW_NO_ERROR)
            return LXW_ERROR_IMAGE_DIMENSIONS;
    }
    else if (signature[0] == 0xFF && signature[1] == 0xD8) {
        if (_process_jpeg(image_props) != LXW_NO_ERROR)
            return LXW_ERROR_IMAGE_DIMENSIONS;
    }
    else if (memcmp(signature, "BM", 2) == 0) {
        if (_process_bmp(image_props) != LXW_NO_ERROR)
            return LXW_ERROR_IMAGE_DIMENSIONS;
    }
    else if (memcmp(signature, "GIF8", 4) == 0) {
        if (_process_gif(image_props) != LXW_NO_ERROR)
            return LXW_ERROR_IMAGE_DIMENSIONS;
    }
    else {
        LXW_WARN_FORMAT1("worksheet image insertion: "
                         "unsupported image format for: %s.",
                         image_props->filename);
        return LXW_ERROR_IMAGE_DIMENSIONS;
    }

#ifndef USE_NO_MD5
    /* Calculate an MD5 checksum for the image so that we can remove duplicate
     * images to reduce the xlsx file size.*/
    rewind(image_props->stream);

    MD5_Init(&md5_context);

    size_read = fread(buffer, 1, LXW_IMAGE_BUFFER_SIZE, image_props->stream);
    while (size_read) {
        MD5_Update(&md5_context, buffer, (unsigned long) size_read);
        size_read =
            fread(buffer, 1, LXW_IMAGE_BUFFER_SIZE, image_props->stream);
    }

    MD5_Final(md5_checksum, &md5_context);

    /* Create a 32 char hex string buffer for the MD5 checksum. */
    image_props->md5 = calloc(1, LXW_MD5_SIZE * 2 + 1);

    /* If this calloc fails we just return and don't remove duplicates. */
    RETURN_ON_MEM_ERROR(image_props->md5, LXW_NO_ERROR);

    /* Convert the 16 byte MD5 buffer to a 32 char hex string. */
    for (i = 0; i < LXW_MD5_SIZE; i++) {
        lxw_snprintf(&image_props->md5[2 * i], 3, "%02x", md5_checksum[i]);
    }
#endif

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4f8, %rsp            # imm = 0x4F8
movq %rdi, %rbx
movq 0x48(%rdi), %rcx
leaq 0x14(%rsp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0xc2f0
cmpq $0x3, %rax
jbe 0x33d59
movzwl 0x15(%rsp), %eax
xorl $0x4e50, %eax           # imm = 0x4E50
movzbl 0x17(%rsp), %ecx
xorl $0x47, %ecx
orw %ax, %cx
je 0x3399f
cmpb $-0x1, 0x14(%rsp)
jne 0x33bb9
cmpb $-0x28, 0x15(%rsp)
jne 0x33bb9
xorl %eax, %eax
movw %ax, 0x20(%rsp)
movw %ax, 0x10(%rsp)
movq 0x48(%rbx), %r14
movq %r14, %rdi
movq $-0x2, %rsi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33ec3
movq %r14, %rdi
callq 0xc8a0
testl %eax, %eax
jne 0x33ec3
movaps 0x12fc5(%rip), %xmm0    # 0x46680
movaps %xmm0, 0x30(%rsp)
movd 0x12fd8(%rip), %xmm0    # 0x466a0
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
movdqa %xmm0, 0x40(%rsp)
xorl %r13d, %r13d
movl $0x2, %esi
movl $0x1, %edx
leaq 0x58(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33946
movl $0x2, %esi
movl $0x1, %edx
leaq 0xf0(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33946
movzwl 0x58(%rsp), %eax
movl %eax, %r12d
rolw $0x8, %r12w
movw %r12w, 0x58(%rsp)
movzwl 0xf0(%rsp), %ecx
rolw $0x8, %cx
movw %cx, 0xf0(%rsp)
movzwl %cx, %r15d
leal -0x2(%r15), %ebp
movl %r12d, %ecx
andl $0xfff0, %ecx           # imm = 0xFFF0
cmpw $-0x40, %cx
jne 0x337ee
movzwl %ax, %eax
cmpl $0xc4ff, %eax           # imm = 0xC4FF
je 0x337ee
cmpl $0xc8ff, %eax           # imm = 0xC8FF
je 0x337ee
cmpl $0xccff, %eax           # imm = 0xCCFF
je 0x337ee
movl $0x1, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33ec3
movl $0x2, %esi
movl $0x1, %edx
leaq 0x10(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33946
movl $0x2, %esi
movl $0x1, %edx
leaq 0x20(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
movzwl 0x20(%rsp), %r13d
testq %rax, %rax
je 0x33946
rolw $0x8, 0x10(%rsp)
rolw $0x8, %r13w
movw %r13w, 0x20(%rsp)
addl $-0xb, %r15d
movl %r15d, %ebp
cmpw $-0x20, %r12w
je 0x33809
movzwl %r12w, %eax
cmpl $0xffda, %eax           # imm = 0xFFDA
jne 0x33917
jmp 0x33946
xorl %eax, %eax
movw %ax, 0x1c(%rsp)
movw %ax, 0x18(%rsp)
movb $0x1, 0xf(%rsp)
movl $0x7, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33ec3
movl $0x1, %esi
movl $0x1, %edx
leaq 0xf(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33946
movl $0x2, %esi
movl $0x1, %edx
leaq 0x1c(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33946
movl $0x2, %esi
movl $0x1, %edx
leaq 0x18(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33946
movzbl 0xf(%rsp), %eax
movd %eax, %xmm0
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
movzwl 0x1c(%rsp), %eax
movd %eax, %xmm1
pinsrw $0x1, 0x18(%rsp), %xmm1
pcmpeqb 0x40(%rsp), %xmm0
movdqa %xmm1, %xmm2
psrlw $0x8, %xmm2
psllw $0x8, %xmm1
por %xmm2, %xmm1
punpcklwd 0x12deb(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1],xmm1[2],mem[2],xmm1[3],mem[3]
cvtdq2pd %xmm1, %xmm1
pshuflw $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1,4,5,6,7]
pshufd $0x55, %xmm0, %xmm2     # xmm2 = xmm0[1,1,1,1]
movdqa %xmm1, %xmm3
pand %xmm2, %xmm3
pandn 0x30(%rsp), %xmm2
por %xmm3, %xmm2
mulpd 0x12db3(%rip), %xmm1    # 0x466b0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
andpd %xmm0, %xmm1
pandn %xmm2, %xmm0
por %xmm1, %xmm0
movdqa %xmm0, 0x30(%rsp)
addl $-0xc, %ebp
movq %r14, %rdi
callq 0xc8a0
testl %eax, %eax
jne 0x33936
movl %ebp, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33946
movq %r14, %rdi
callq 0xc8a0
testl %eax, %eax
je 0x336d5
testw %r13w, %r13w
je 0x33ec3
movb $0x2, 0x50(%rbx)
movzwl %r13w, %eax
movd %eax, %xmm0
pinsrw $0x2, 0x10(%rsp), %xmm0
cvtdq2pd %xmm0, %xmm0
movupd %xmm0, 0x68(%rbx)
xorpd %xmm0, %xmm0
movapd 0x30(%rsp), %xmm1
cmpneqpd %xmm1, %xmm0
andpd %xmm0, %xmm1
andnpd 0x12cf9(%rip), %xmm0    # 0x46680
orpd %xmm1, %xmm0
movupd %xmm0, 0x80(%rbx)
leaq 0xf2e1(%rip), %rdi      # 0x42c7b
jmp 0x33deb
xorl %eax, %eax
movl %eax, 0x20(%rsp)
movl %eax, 0x10(%rsp)
movq 0x48(%rbx), %r14
movl $0x4, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33ec3
movq %r14, %rdi
callq 0xc8a0
testl %eax, %eax
jne 0x33ec3
movsd 0x11921(%rip), %xmm0    # 0x45300
leaq 0xf0(%rsp), %r15
leaq 0x58(%rsp), %r12
xorl %ebp, %ebp
movapd %xmm0, 0x30(%rsp)
movapd %xmm0, 0x40(%rsp)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33d6a
movl $0x1, %esi
movl $0x4, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0xc2f0
cmpq $0x4, %rax
jb 0x33d6a
movl 0xf0(%rsp), %r13d
bswapl %r13d
movl %r13d, 0xf0(%rsp)
cmpl $0x52444849, 0x58(%rsp) # imm = 0x52444849
je 0x33a5a
addl $0x4, %r13d
jmp 0x33ab2
movl $0x4, %esi
movl $0x1, %edx
leaq 0x20(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33d66
movl $0x4, %esi
movl $0x1, %edx
leaq 0x10(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
movl 0x20(%rsp), %ebp
testq %rax, %rax
je 0x33d6a
bswapl %ebp
movl %ebp, 0x20(%rsp)
movl 0x10(%rsp), %eax
bswapl %eax
movl %eax, 0x10(%rsp)
addl $-0x4, %r13d
cmpl $0x73594870, 0x58(%rsp) # imm = 0x73594870
jne 0x33b72
xorl %eax, %eax
movl %eax, 0x1c(%rsp)
movl %eax, 0x18(%rsp)
movb $0x1, 0xf(%rsp)
movl $0x4, %esi
movl $0x1, %edx
leaq 0x1c(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33d6a
movl $0x4, %esi
movl $0x1, %edx
leaq 0x18(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33d6a
movl $0x1, %esi
movl $0x1, %edx
leaq 0xf(%rsp), %rdi
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
je 0x33d6a
cmpb $0x1, 0xf(%rsp)
jne 0x33b6e
movl 0x1c(%rsp), %eax
bswapl %eax
movl 0x18(%rsp), %ecx
bswapl %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd 0x12ba6(%rip), %xmm1    # 0x466f8
mulsd %xmm1, %xmm0
movapd %xmm0, 0x40(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
mulsd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
addl $-0x9, %r13d
cmpl $0x444e4549, 0x58(%rsp) # imm = 0x444E4549
je 0x33d6a
movq %r14, %rdi
callq 0xc8a0
testl %eax, %eax
jne 0x33ba4
movl %r13d, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33ec3
movq %r14, %rdi
callq 0xc8a0
testl %eax, %eax
je 0x339fa
jmp 0x33d6a
cmpw $0x4d42, 0x14(%rsp)     # imm = 0x4D42
je 0x33c94
cmpl $0x38464947, 0x14(%rsp) # imm = 0x38464947
jne 0x33f04
xorl %eax, %eax
movw %ax, 0xf0(%rsp)
movw %ax, 0x58(%rsp)
movq 0x48(%rbx), %r14
movl $0x2, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33ec3
leaq 0xf0(%rsp), %rdi
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
jne 0x33c2a
movw $0x0, 0xf0(%rsp)
leaq 0x58(%rsp), %rdi
movl $0x2, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
jne 0x33c4d
movw $0x0, 0x58(%rsp)
movzwl 0xf0(%rsp), %eax
testw %ax, %ax
je 0x33ec3
movb $0x4, 0x50(%rbx)
movzwl %ax, %eax
movd %eax, %xmm0
pinsrw $0x2, 0x58(%rsp), %xmm0
cvtdq2pd %xmm0, %xmm0
movups %xmm0, 0x68(%rbx)
movapd 0x12a00(%rip), %xmm0    # 0x46680
movupd %xmm0, 0x80(%rbx)
leaq 0xf001(%rip), %rdi      # 0x42c90
jmp 0x33deb
xorl %eax, %eax
movl %eax, 0xf0(%rsp)
movl %eax, 0x58(%rsp)
movq 0x48(%rbx), %r14
movl $0xe, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0xcb40
testl %eax, %eax
jne 0x33ec3
leaq 0xf0(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
jne 0x33ce9
movl $0x0, 0xf0(%rsp)
leaq 0x58(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0xc2f0
testq %rax, %rax
jne 0x33d0d
movl $0x0, 0x58(%rsp)
movl 0xf0(%rsp), %eax
testl %eax, %eax
je 0x33ec3
movb $0x3, 0x50(%rbx)
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x68(%rbx)
movl 0x58(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x70(%rbx)
movapd 0x1293b(%rip), %xmm0    # 0x46680
movupd %xmm0, 0x80(%rbx)
leaq 0xef32(%rip), %rdi      # 0x42c86
jmp 0x33deb
movq %rbx, %rdi
callq 0xf176
jmp 0x33edf
movl 0x20(%rsp), %ebp
testl %ebp, %ebp
je 0x33ec3
movb $0x1, 0x50(%rbx)
movl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x68(%rbx)
movl 0x10(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x70(%rbx)
xorpd %xmm0, %xmm0
movapd 0x40(%rsp), %xmm3
movapd %xmm3, %xmm1
cmpneqsd %xmm0, %xmm1
andpd %xmm1, %xmm3
movsd 0x1154b(%rip), %xmm2    # 0x45300
andnpd %xmm2, %xmm1
orpd %xmm3, %xmm1
movlpd %xmm1, 0x80(%rbx)
movapd 0x30(%rsp), %xmm1
cmpneqsd %xmm1, %xmm0
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movlpd %xmm0, 0x88(%rbx)
leaq 0xee86(%rip), %rdi      # 0x42c71
callq 0xcce0
movq %rax, 0x78(%rbx)
movq 0x48(%rbx), %rdi
callq 0xc500
leaq 0x58(%rsp), %rdi
callq 0xcec0
movq 0x48(%rbx), %rcx
leaq 0xf0(%rsp), %rdi
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
callq 0xc2f0
testq %rax, %rax
je 0x33e5d
leaq 0x58(%rsp), %r14
leaq 0xf0(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xd000
movq 0x48(%rbx), %rcx
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
callq 0xc2f0
testq %rax, %rax
jne 0x33e34
leaq 0x20(%rsp), %r15
leaq 0x58(%rsp), %rsi
movq %r15, %rdi
callq 0xc2d0
movl $0x1, %edi
movl $0x21, %esi
callq 0xc7f0
movq %rax, 0xa0(%rbx)
testq %rax, %rax
je 0x33efa
xorl %r14d, %r14d
leaq 0x14a01(%rip), %r12     # 0x48895
xorl %r13d, %r13d
movq 0xa0(%rbx), %rdi
addq %r13, %rdi
movzbl (%r15), %ecx
movl $0x3, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0xc570
incq %r15
addq $0x2, %r13
cmpq $0x20, %r13
jne 0x33e97
jmp 0x33ee5
movq 0x2312e(%rip), %rax     # 0x56ff8
movq (%rax), %rdi
movq 0x20(%rbx), %rdx
leaq 0x149d1(%rip), %rsi     # 0x488a9
xorl %eax, %eax
callq 0xc870
movl $0x1a, %r14d
movl %r14d, %eax
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xf14c
xorl %r14d, %r14d
jmp 0x33ee5
movq %rbx, %rdi
callq 0xf12d
jmp 0x33edf