// File: /workspace/github_c_makefile_star2_O1/hfiguiere[P]exifprobe/process.c
// Function: process_app12
unsigned long
process_app12(FILE *inptr,unsigned long app12_offset,unsigned short tag,
                struct image_summary *summary_entry,char *parent_name,
                int indent)
{
    char *app_string,*name;
    unsigned short app_length = 0;
    unsigned long dumplength = 0UL;
    unsigned long offset = 0UL;
    unsigned long end_offset = 0UL;
    unsigned long size = 0UL;
    int chpr = 0;
    int nextch;

    if(inptr)
    {
        if(summary_entry)
        {
            summary_entry->filesubformat |= FILESUBFMT_APPN;
            summary_entry->filesubformatAPPN[12] = 1;
        }
        name = tagname(tag);    /* never null                         */
        app_length = read_ushort(inptr,TIFF_MOTOROLA,app12_offset + 2);
        print_tag_address(SECTION,app12_offset,indent,"@");
        if(PRINT_SECTION)
            chpr += printf("<%s> %#x length %u, ",name,tag,app_length);
        else if((PRINT_ENTRY))
        {
            /* ###%%% pseudo-tags fpr LIST Mode here */
            print_tag_address(ENTRY,HERE,indent,"*");
            if((PRINT_TAGINFO))
            {
                if((PRINT_LONGNAMES))
                    chpr += printf("%s.",parent_name);
                chpr += printf("%-14.14s","APP12");
            }
            if((PRINT_VALUE))
                chpr += printf(" = @%lu:%-9u",app12_offset,app_length);
            chpr = newline(chpr);
        }
        app_string = read_appstring(inptr,tag,HERE);
        if(PRINT_SECTION)
            chpr += printf("\'%s\'",app_string ? app_string : "NULL ID");

        if(PRINT_APPNDUMP)
        {
            if((Max_appdump == DUMPALL) || (Max_appdump > (app_length + 2)))
                dumplength = app_length + 2;
            else if(Max_appdump > 0L)
                dumplength = Max_appdump;
            else
                dumplength = Max_undefined;
            if(dumplength)
            {
                if(PRINT_SECTION)
                    chpr = newline(chpr);
                hexdump(inptr,app12_offset,app_length + 2,dumplength,16,
                            indent + SMALLINDENT,SMALLINDENT);
                chpr = newline(1);
            }
        }
        else if((PRINT_APPENTRY) && (PRINT_ENTRY))
        {
            /* ###%%% in LIST mode, these should get an "APP12." prefix */
            end_offset = app12_offset + app_length + 1;
            offset = ftell(inptr);
            nextch = skip_past_newline(inptr,end_offset);
            offset = ftell(inptr);
            if(PRINT_SECTION)
                chpr = newline(chpr);
            if(offset < end_offset)
                nextch = putword(inptr,nextch,end_offset,indent);
            chpr = newline(chpr);
            offset = ftell(inptr);
            while(nextch && (nextch != EOF) && (offset < end_offset))
            {
                nextch = putword(inptr,nextch,end_offset,indent);
                if(nextch)
                    chpr = newline(chpr);
                offset = ftell(inptr);
            }
            while(offset < end_offset)
            {
                nextch = skip_to_bracket(inptr,end_offset);
                if(nextch == EOF)
                {
                    break;
                }
                size = ftell(inptr) - offset;
                if(nextch == '[')
                    --size;
                if(size > 1)
                {
                    chpr += printf(" length %lu",size);
                    if(Max_undefined)
                    {
                        chpr = newline(chpr);
                        hexdump(inptr,offset,size, Max_undefined,16,
                                    indent + SMALLINDENT,
                                    SMALLINDENT);
                        chpr = newline(1);
                        nextch = fgetc(inptr);
                        if((nextch == EOF) || (ftell(inptr) >= end_offset))
                            break;
                    }
                    else
                    {
                        printred(" (not dumped; use -U)");
                        chpr = newline(chpr);
                    }
                }
                else
                    chpr = newline(chpr);
                if(nextch)
                    nextch = putword(inptr,nextch,end_offset,indent);
                offset = ftell(inptr);
            }
        }

        print_tag_address(SECTION,app12_offset + app_length + 1,indent,"-");
        if(PRINT_SECTION)
        {
            chpr += printf("</%s>",name);
            chpr = newline(chpr);
        }
    }
    setcharsprinted(chpr);
    return(app12_offset + app_length + 2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r15
movq %rdi, 0x10(%rsp)
testq %rdi, %rdi
je 0x156d5
movl %r9d, %r14d
movq %r8, %rbx
testq %rcx, %rcx
je 0x15613
orb $-0x80, 0x19(%rcx)
movl $0x1, 0x4c(%rcx)
movzwl %dx, %r12d
movl %r12d, %edi
callq 0xa958
movq %rax, %r13
leaq 0x2(%r15), %rdx
movq 0x10(%rsp), %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
callq 0x4574
movl %eax, %ebp
leaq 0x2ba9e(%rip), %rcx     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq %r15, %rsi
movl %r14d, %edx
callq 0x5605
leaq 0x42b2b(%rip), %rax     # 0x58180
movq (%rax), %rax
btl $0x12, %eax
movzwl %bp, %ebp
movq %r13, 0x38(%rsp)
jb 0x156df
testl $0x4003333, %eax        # imm = 0x4003333
je 0x156f7
leaq 0x2c2e1(%rip), %rcx     # 0x41959
movl $0x4003333, %edi        # imm = 0x4003333
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %r14d, %edx
callq 0x5605
leaq 0x42aef(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x156fc
movq %rbp, %r13
xorl %ebp, %ebp
testb $0x40, %al
je 0x156b7
leaq 0x2fdfc(%rip), %rdi     # 0x454a7
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
leaq 0x2f9e3(%rip), %rdi     # 0x450a1
leaq 0x2e43d(%rip), %rsi     # 0x43b02
xorl %eax, %eax
callq 0x3120
movl %eax, %ebx
addl %ebp, %ebx
movq %r13, %rbp
jmp 0x156fe
xorl %ebp, %ebp
xorl %r13d, %r13d
jmp 0x15ab9
leaq 0x2f9a6(%rip), %rdi     # 0x4508c
movq %r13, %rsi
movl %r12d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x3120
jmp 0x15726
xorl %r13d, %r13d
jmp 0x15729
xorl %ebx, %ebx
leaq 0x42a7b(%rip), %rax     # 0x58180
testb $0x30, (%rax)
je 0x1571f
leaq 0x2f999(%rip), %rdi     # 0x450aa
movq %r15, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3120
addl %eax, %ebx
movl %ebx, %edi
callq 0x16b56
movl %eax, %r13d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rdi
movl %r12d, %esi
callq 0x50e2
leaq 0x42a3e(%rip), %rcx     # 0x58180
testb $0x4, 0x2(%rcx)
je 0x15767
testq %rax, %rax
leaq 0x2fbef(%rip), %rsi     # 0x45341
cmovneq %rax, %rsi
leaq 0x31e3b(%rip), %rdi     # 0x47598
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x42a12(%rip), %rax     # 0x58180
movq (%rax), %rax
btl $0x16, %eax
movq %r15, 0x40(%rsp)
jb 0x15807
btl $0x14, %eax
setae %cl
testl $0x4003333, %eax        # imm = 0x4003333
sete %al
orb %cl, %al
jne 0x15a6b
movq %r14, 0x18(%rsp)
leaq (%r15,%rbp), %r12
incq %r12
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x3190
movq %r14, %rdi
movq %r12, %rsi
callq 0x15d9b
movl %eax, %ebx
movq %r14, %rdi
callq 0x3190
movq %rax, %r14
leaq 0x429b1(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x157e0
movl %r13d, %edi
callq 0x16b56
movl %eax, %r13d
cmpq %r12, %r14
jae 0x1587a
movq 0x10(%rsp), %r15
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq 0x18(%rsp), %r14
movl %r14d, %ecx
callq 0x15dd3
movl %eax, %ebx
jmp 0x15884
leaq 0x43c0a(%rip), %rcx     # 0x59418
movq (%rcx), %rbx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rbx
je 0x15828
leaq 0x2(%rbp), %rcx
cmpq %rcx, %rbx
jbe 0x15a3e
leaq 0x2(%rbp), %rbx
testq %rbx, %rbx
je 0x15a6b
btl $0x12, %eax
jae 0x15843
movl %r13d, %edi
callq 0x16b56
leaq 0x2(%rbp), %rdx
leal 0x2(%r14), %r9d
movl $0x2, (%rsp)
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rcx
movl $0x10, %r8d
callq 0x7446
movl $0x1, %edi
callq 0x16b56
movl %eax, %r13d
jmp 0x15a6b
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r15
movl %r13d, %edi
callq 0x16b56
movl %eax, %r13d
movq %r15, %rdi
callq 0x3190
movq %rax, %r15
leal -0x1(%rbx), %eax
cmpl $-0x2, %eax
setb %al
cmpq %r12, %r15
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x158ee
movq 0x10(%rsp), %r15
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %r14d, %ecx
callq 0x15dd3
movl %eax, %ebx
testl %eax, %eax
je 0x158d6
movl %r13d, %edi
callq 0x16b56
movl %eax, %r13d
movq %r15, %rdi
callq 0x3190
movq %rax, %r15
leal -0x1(%rbx), %eax
cmpl $-0x3, %eax
ja 0x158ee
cmpq %r12, %r15
jb 0x158b0
cmpq %r12, %r15
jae 0x15a6b
leal 0x2(%r14), %eax
movl %eax, 0x34(%rsp)
movq %rbp, 0x28(%rsp)
movq %r12, 0x20(%rsp)
movq %r12, %rsi
movl %r13d, %r12d
movq %r14, %r13
movq %rbp, %r14
movq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x15ed0
cmpl $-0x1, %eax
je 0x15a56
movl %eax, %ebx
movq %rbp, %rdi
callq 0x3190
movq %rax, %r14
subq %r15, %r14
xorl %eax, %eax
cmpl $0x5b, %ebx
sete %al
subq %rax, %r14
cmpq $0x2, %r14
jb 0x159e5
leaq 0x32dc3(%rip), %rdi     # 0x4871a
movq %r14, %rsi
xorl %eax, %eax
callq 0x3120
movl %eax, %ebp
addl %r12d, %ebp
leaq 0x43a9b(%rip), %r12     # 0x59408
cmpq $0x0, (%r12)
je 0x159ea
movl %ebp, %edi
callq 0x16b56
movq (%r12), %rcx
movl $0x2, (%rsp)
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rdi, %r15
movq %r14, %rdx
movl $0x10, %r8d
movl 0x34(%rsp), %r9d
callq 0x7446
movl $0x1, %edi
callq 0x16b56
movl %eax, %r13d
movq %r15, %rdi
callq 0x3150
cmpl $-0x1, %eax
movq 0x20(%rsp), %r12
je 0x15a61
movl %eax, %ebx
movq %r15, %rdi
callq 0x3190
cmpq %r12, %rax
movq 0x18(%rsp), %r14
movq 0x28(%rsp), %rbp
jb 0x15a0f
jmp 0x15a6b
movl %r12d, %ebp
jmp 0x159f6
leaq 0x2f98c(%rip), %rdi     # 0x4537d
callq 0x5c33
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %r12
movl %ebp, %edi
callq 0x16b56
movl %eax, %r13d
movq 0x28(%rsp), %rbp
testl %ebx, %ebx
movq 0x10(%rsp), %r15
je 0x15a28
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl %r14d, %ecx
callq 0x15dd3
movq %r15, %rdi
callq 0x3190
movq %rax, %r15
cmpq %r12, %rax
jb 0x15909
jmp 0x15a6b
testq %rbx, %rbx
jne 0x1582c
leaq 0x439ba(%rip), %rcx     # 0x59408
movq (%rcx), %rbx
jmp 0x1582c
movq %r14, %rbp
movq %r13, %r14
movl %r12d, %r13d
jmp 0x15a6b
movq 0x18(%rsp), %r14
movq 0x28(%rsp), %rbp
movq 0x40(%rsp), %r15
leaq (%r15,%rbp), %rsi
incq %rsi
leaq 0x2b67b(%rip), %rcx     # 0x410f9
movl $0x40000, %edi          # imm = 0x40000
movl %r14d, %edx
callq 0x5605
leaq 0x426ee(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x15ab9
leaq 0x2c090(%rip), %rdi     # 0x41b2f
movq 0x38(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x16b56
movl %eax, %r13d
movl %r13d, %edi
callq 0x17530
movzwl %bp, %eax
addq %r15, %rax
addq $0x2, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq