// File: /workspace/github_c_makefile_star2_O3/hfiguiere[P]exifprobe/process.c
// Function: new_summary_entry
struct image_summary *
new_summary_entry(struct image_summary *prev_entry,int fileformat,int datatype)
{
    struct image_summary *new = NULL;
    int chpr = 0;

    /* Make entries only for types which describe image data, i.e.    */
    /* not EXIF, Interop, etc.                                        */
    switch(datatype)
    {
        case EXIF_IFD:
        case INTEROP_IFD:
        case GPS_IFD:
            break;
        default:
            if(Debug & SCAN_DEBUG)
            {
                chpr = newline(1);
                printred("DEBUG: NEW SUMMARY ");
            }
            new = (struct image_summary *)malloc(sizeof(struct image_summary));
            if(new)
            {
                if(Debug & SCAN_DEBUG)
                    printf("%#lx\n",(unsigned long)new);
                memset(new,0,sizeof(struct image_summary));
                new->datatype = datatype;
                new->ifdnum = -1;
                new->subifdnum = -1;
                new->length = 0;
                new->offset = 0;
                new->subfiletype = -1;
                memset(new->filesubformatAPPN,0,16);
                if(prev_entry)
                {
                    if(Debug & SCAN_DEBUG)
                    {
                        printred("DEBUG: PREV ENTRY ");
                        chpr += printf("%#x, next=%#x, offset=%ld, lock=%d",
                                        (unsigned int)prev_entry,
                                        (unsigned int)prev_entry->next_entry,
                                        prev_entry->offset,prev_entry->entry_lock);
                        chpr = newline(chpr);
                    }
                    /* make sure to attach at the end of the chain        */
                    while(prev_entry->next_entry)
                    {
                        prev_entry = prev_entry->next_entry;
                        if(Debug & SCAN_DEBUG)
                        {
                            printred(" PREV ENTRY ");
                            chpr += printf("%#x, next=%#x, offset=%ld, lock=%d",
                                            (unsigned int)prev_entry,
                                            (unsigned int)prev_entry->next_entry,
                                            prev_entry->offset,prev_entry->entry_lock);
                            chpr = newline(chpr);
                        }
                    }
                    new->prev_entry = prev_entry;
                    if(Debug & SCAN_DEBUG)
                    {
                        printred("DEBUG: FOUND PREV ENTRY ");
                        chpr += printf("%#x, next=%#x, offset=%ld, lock=%d",
                                            (unsigned int)prev_entry,
                                            (unsigned int)prev_entry->next_entry,
                                            prev_entry->offset,prev_entry->entry_lock);
                        chpr = newline(chpr);
                    }
                    if(prev_entry->fileformat)
                        new->fileformat = prev_entry->fileformat;
                    prev_entry->next_entry = new;
                    if(Debug & SCAN_DEBUG)
                    {
                        printred("DEBUG: NEW ENTRY ");
                        chpr += printf(" next=%#x, prev offset=%d, prev lock=%d",
                                            (unsigned int)prev_entry->next_entry,
                                            (unsigned int)prev_entry->offset,prev_entry->entry_lock);
                        chpr = newline(chpr);
                    }
                }
                else
                    new->fileformat = fileformat;
            }
            else
            {
                printred("Memory allocation for image summary failed");
                if(prev_entry)
                    chpr += printf(" summary will be incomplete");
                else
                    chpr += printf(" no summary will be printed");
                newline(chpr);
            }
            if(Debug & SCAN_DEBUG)
                chpr = newline(1);
            break;
    }
    return(new);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r12d
leal -0x2(%r12), %eax
xorl %r14d, %r14d
cmpl $0x3, %eax
jae 0xfca7
xorl %ebx, %ebx
jmp 0xfebf
movl %esi, %ebp
movq %rdi, %r15
leaq 0x4d9bd(%rip), %rax     # 0x5d670
movq %rax, %r13
testb $0x4, (%rax)
je 0xfcd4
movl $0x1, %edi
callq 0x1707a
movl %eax, %r14d
leaq 0x34d51(%rip), %rdi     # 0x44a20
callq 0x5c26
movl $0x128, %edi            # imm = 0x128
callq 0x31e0
movq %rax, %rbx
testq %rax, %rax
je 0xfe74
testb $0x4, (%r13)
je 0xfd02
leaq 0x34d3c(%rip), %rdi     # 0x44a34
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
movl $0x128, %edx            # imm = 0x128
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3140
movl %r12d, 0x118(%rbx)
movq $-0x1, 0x11c(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%rbx)
movl $0xffffffff, 0xc4(%rbx) # imm = 0xFFFFFFFF
movups %xmm0, 0x1c(%rbx)
testq %r15, %r15
je 0xfea9
movq %r13, %rbp
movl (%r13), %eax
testb $0x4, %al
je 0xfd8c
leaq 0x34ce4(%rip), %rdi     # 0x44a3a
callq 0x5c26
movq 0x90(%r15), %rcx
movl 0x8(%r15), %edx
movl 0x10(%r15), %r8d
leaq 0x34cdc(%rip), %rdi     # 0x44a4d
movl %r15d, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, %r14d
movl (%rbp), %eax
movq 0x8(%r15), %rcx
testq %rcx, %rcx
je 0xfde8
leaq 0x34ca4(%rip), %r12     # 0x44a40
leaq 0x34caa(%rip), %r13     # 0x44a4d
movq %rcx, %r15
testb $0x4, %al
je 0xfddf
movq %r12, %rdi
callq 0x5c26
movq 0x90(%r15), %rcx
movl 0x8(%r15), %edx
movl 0x10(%r15), %r8d
movq %r13, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, %r14d
movl (%rbp), %eax
movq 0x8(%r15), %rcx
testq %rcx, %rcx
jne 0xfda3
movq %r15, (%rbx)
testb $0x4, %al
je 0xfe29
leaq 0x34c7a(%rip), %rdi     # 0x44a70
callq 0x5c26
movq 0x90(%r15), %rcx
movl 0x8(%r15), %edx
movl 0x10(%r15), %r8d
leaq 0x34c3c(%rip), %rdi     # 0x44a4d
movl %r15d, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
movl %eax, %r14d
movl 0x14(%r15), %eax
testl %eax, %eax
je 0xfe34
movl %eax, 0x14(%rbx)
movq %rbx, 0x8(%r15)
testb $0x4, (%rbp)
je 0xfeaf
leaq 0x34c44(%rip), %rdi     # 0x44a89
callq 0x5c26
movl 0x90(%r15), %edx
movl 0x8(%r15), %esi
movl 0x10(%r15), %ecx
leaq 0x34c3b(%rip), %rdi     # 0x44a9b
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
jmp 0xfeaf
leaq 0x34c48(%rip), %rdi     # 0x44ac3
callq 0x5c26
testq %r15, %r15
leaq 0x34c80(%rip), %rax     # 0x44b0a
leaq 0x34c5d(%rip), %rdi     # 0x44aee
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x1707a
jmp 0xfeac
movl %ebp, 0x14(%rbx)
movq %r13, %rbp
testb $0x4, (%rbp)
je 0xfebf
movl $0x1, %edi
callq 0x1707a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq