// File: /workspace/github_c_makefile_star2_O1/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 0xfb83
xorl %ebx, %ebx
jmp 0xfd98
movl %esi, %ebp
movq %rdi, %r15
leaq 0x4dae1(%rip), %rax     # 0x5d670
movq %rax, %r13
testb $0x4, (%rax)
je 0xfbb0
movl $0x1, %edi
callq 0x16b56
movl %eax, %r14d
leaq 0x34e31(%rip), %rdi     # 0x449dc
callq 0x5c33
movl $0x128, %edi            # imm = 0x128
callq 0x31e0
movq %rax, %rbx
testq %rax, %rax
je 0xfd4d
testb $0x4, (%r13)
je 0xfbde
leaq 0x34e1c(%rip), %rdi     # 0x449f0
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 0xfd82
movq %r13, %rbp
testb $0x4, (%r13)
je 0xfc64
leaq 0x34dc5(%rip), %rdi     # 0x449f6
callq 0x5c33
movq 0x90(%r15), %rcx
movl 0x8(%r15), %edx
movl 0x10(%r15), %r8d
leaq 0x34dbd(%rip), %rdi     # 0x44a09
movl %r15d, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movl %eax, %r14d
movq 0x8(%r15), %rax
testq %rax, %rax
je 0xfcbf
leaq 0x34d88(%rip), %r12     # 0x449fc
leaq 0x34d8e(%rip), %r13     # 0x44a09
movq %rax, %r15
testb $0x4, (%rbp)
je 0xfcb6
movq %r12, %rdi
callq 0x5c33
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 0x16b56
movl %eax, %r14d
movq 0x8(%r15), %rax
testq %rax, %rax
jne 0xfc7b
movq %r15, (%rbx)
testb $0x4, (%rbp)
je 0xfd02
leaq 0x34d5d(%rip), %rdi     # 0x44a2c
callq 0x5c33
movq 0x90(%r15), %rcx
movl 0x8(%r15), %edx
movl 0x10(%r15), %r8d
leaq 0x34d1f(%rip), %rdi     # 0x44a09
movl %r15d, %esi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
movl %eax, %r14d
movl 0x14(%r15), %eax
testl %eax, %eax
je 0xfd0d
movl %eax, 0x14(%rbx)
movq %rbx, 0x8(%r15)
testb $0x4, (%rbp)
je 0xfd88
leaq 0x34d27(%rip), %rdi     # 0x44a45
callq 0x5c33
movl 0x90(%r15), %edx
movl 0x8(%r15), %esi
movl 0x10(%r15), %ecx
leaq 0x34d1e(%rip), %rdi     # 0x44a57
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
jmp 0xfd88
leaq 0x34d2b(%rip), %rdi     # 0x44a7f
callq 0x5c33
testq %r15, %r15
leaq 0x34d63(%rip), %rax     # 0x44ac6
leaq 0x34d40(%rip), %rdi     # 0x44aaa
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x3120
addl %eax, %r14d
movl %r14d, %edi
callq 0x16b56
jmp 0xfd85
movl %ebp, 0x14(%rbx)
movq %r13, %rbp
testb $0x4, (%rbp)
je 0xfd98
movl $0x1, %edi
callq 0x16b56
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq