// File: /workspace/github_c_makefile_star2_O2/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 0xef35
xorl %ebx, %ebx
jmp 0xf0ff
movl %esi, %ebp
movq %rdi, %r15
leaq 0x4d72f(%rip), %r13     # 0x5c670
testb $0x4, (%r13)
je 0xef5f
pushq $0x1
popq %rdi
callq 0x160f7
movl %eax, %r14d
leaq 0x33a82(%rip), %rdi     # 0x429dc
callq 0x56e2
movl $0x128, %edi            # imm = 0x128
callq 0x31e0
movq %rax, %rbx
testq %rax, %rax
je 0xefd1
testb $0x4, (%r13)
je 0xef89
leaq 0x33a71(%rip), %rdi     # 0x429f0
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)
orq $-0x1, 0x11c(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%rbx)
orl $-0x1, 0xc4(%rbx)
movups %xmm0, 0x1c(%rbx)
testq %r15, %r15
je 0xeffe
testb $0x4, (%r13)
je 0xf039
leaq 0x33a27(%rip), %rdi     # 0x429f6
jmp 0xf006
leaq 0x33aa7(%rip), %rdi     # 0x42a7f
callq 0x56e2
testq %r15, %r15
leaq 0x33adf(%rip), %rax     # 0x42ac6
leaq 0x33abc(%rip), %rdi     # 0x42aaa
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x3120
jmp 0xf0e5
movl %ebp, 0x14(%rbx)
jmp 0xf0f0
callq 0x56e2
movq 0x90(%r15), %rcx
movl 0x8(%r15), %edx
movl 0x10(%r15), %r8d
leaq 0x339e8(%rip), %rdi     # 0x42a09
movl %r15d, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %r14d
movl (%r13), %eax
leaq 0x339b8(%rip), %rdi     # 0x429fc
movq %r15, %r12
movq 0x8(%r12), %r15
testq %r15, %r15
je 0xf05a
movq %r15, %r12
testb $0x4, %al
je 0xf047
jmp 0xf006
movq %r12, (%rbx)
testb $0x4, (%r13)
je 0xf0a1
leaq 0x339c1(%rip), %rdi     # 0x42a2c
callq 0x56e2
movq 0x90(%r12), %rcx
movl 0x8(%r12), %edx
movl 0x10(%r12), %r8d
leaq 0x33980(%rip), %rdi     # 0x42a09
movl %r12d, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
movl %eax, %r14d
movl 0x14(%r12), %eax
testl %eax, %eax
je 0xf0ad
movl %eax, 0x14(%rbx)
movq %rbx, 0x8(%r12)
testb $0x4, (%r13)
je 0xf0f0
leaq 0x33985(%rip), %rdi     # 0x42a45
callq 0x56e2
movl 0x90(%r12), %edx
movl 0x8(%r12), %esi
movl 0x10(%r12), %ecx
leaq 0x33979(%rip), %rdi     # 0x42a57
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x160f7
testb $0x4, (%r13)
je 0xf0ff
pushq $0x1
popq %rdi
callq 0x160f7
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq