// File: /workspace/github_c_makefile_star2_O3/hfiguiere[P]exifprobe/process.c
// Function: process_appn
unsigned long
process_appn(FILE *inptr,unsigned long appn_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 = 0L;
    int chpr = 0;
    int tagwidth = 13;

    if(inptr)
    {
        if(summary_entry)
        {
            summary_entry->filesubformat |= FILESUBFMT_APPN;
            summary_entry->filesubformatAPPN[tag & 0xf] = 1;
        }
        name = tagname(tag);    /* never null                         */
        app_length = read_ushort(inptr,TIFF_MOTOROLA,appn_offset + 2);
        print_tag_address(SECTION,appn_offset,indent,"@");
        if(PRINT_SECTION)
            chpr += printf("<%s> %#x length %u, ",name,tag,app_length);
        app_string = read_appstring(inptr,tag,HERE);
        if(PRINT_SECTION)
            chpr += printf("%s",app_string ? app_string : "NULL ID");
        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);
                tagwidth = 13;
                if((tag & 0xf) > 9)
                    --tagwidth;
                chpr += printf("%-*.*s%d",tagwidth,tagwidth,"APP",tag & 0xf);
            }
            if((PRINT_VALUE))
                chpr += printf(" = @%lu:%-9u",appn_offset,app_length);
            chpr = newline(chpr);
        }

        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)
            {
                chpr = newline(1);
                hexdump(inptr,appn_offset,app_length + 2,dumplength,16,
                            indent,SMALLINDENT);
                chpr = newline(1);
            }
        }
        else if(PRINT_SECTION)
        {
            chpr += printf(" - unknown format (not dumped: use -A)");
            chpr = newline(chpr);
        }

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
testq %rdi, %rdi
je 0x161ae
movl %r9d, %r13d
movl %edx, %ebp
movq %rdi, %r15
movq %r8, 0x30(%rsp)
testq %rcx, %rcx
je 0x16055
orb $-0x80, 0x19(%rcx)
movl %ebp, %eax
andl $0xf, %eax
movl $0x1, 0x1c(%rcx,%rax,4)
movzwl %bp, %ebx
movl %ebx, %edi
callq 0xaad8
movq %rax, 0x20(%rsp)
leaq 0x2(%r12), %r14
movq %r15, 0x28(%rsp)
movq %r15, %rdi
movl $0x4d4d, %esi           # imm = 0x4D4D
movq %r14, %rdx
callq 0x45af
movl %eax, %r15d
leaq 0x2b054(%rip), %rcx     # 0x410dc
movl $0x40000, %edi          # imm = 0x40000
movq %r12, %rsi
movl %r13d, 0x14(%rsp)
movl %r13d, %edx
callq 0x55eb
leaq 0x420dc(%rip), %rax     # 0x58180
xorl %r13d, %r13d
testb $0x4, 0x2(%rax)
movzwl %r15w, %eax
movq %rax, 0x18(%rsp)
je 0x160d3
leaq 0x2f013(%rip), %rdi     # 0x450d0
movq 0x20(%rsp), %rsi
movl %ebx, %edx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x3120
movl %eax, %r13d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x28(%rsp), %r15
movq %r15, %rdi
movl %ebx, %esi
callq 0x50a4
leaq 0x42092(%rip), %rcx     # 0x58180
movq (%rcx), %rcx
btl $0x12, %ecx
jb 0x161bf
testl $0x4003333, %ecx        # imm = 0x4003333
je 0x161de
leaq 0x2b84b(%rip), %rcx     # 0x41959
movl $0x4003333, %edi        # imm = 0x4003333
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl 0x14(%rsp), %edx
callq 0x55eb
leaq 0x42058(%rip), %rax     # 0x58180
movq (%rax), %rax
testl $0x3003, %eax           # imm = 0x3003
je 0x16182
testb $0x40, %al
je 0x1614c
leaq 0x2f3ae(%rip), %rdi     # 0x454eb
movq 0x30(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
andl $0xf, %ebp
cmpw $0xa, %bp
movl $0x0, %edx
adcl $0xc, %edx
leaq 0x2f22b(%rip), %rdi     # 0x4538d
leaq 0x2f22d(%rip), %rcx     # 0x45396
movl %edx, %esi
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
leaq 0x42001(%rip), %rax     # 0x58180
movq (%rax), %rax
testb $0x30, %al
movq 0x18(%rsp), %rbx
je 0x161a1
leaq 0x2ef5c(%rip), %rdi     # 0x450ee
movq %r12, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x1707a
movl %eax, %r13d
jmp 0x161e3
addq $0x2, %r12
xorl %ebp, %ebp
movq %r12, %r14
xorl %r13d, %r13d
jmp 0x162f6
testq %rax, %rax
leaq 0x2f1bc(%rip), %rsi     # 0x45385
cmovneq %rax, %rsi
leaq 0x2aec3(%rip), %rdi     # 0x41097
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movq 0x18(%rsp), %rbx
leaq 0x41f96(%rip), %rax     # 0x58180
movq (%rax), %rax
btl $0x16, %eax
jb 0x16213
btl $0x12, %eax
jae 0x16296
leaq 0x2f196(%rip), %rdi     # 0x4539a
xorl %eax, %eax
callq 0x3120
movl %eax, %r15d
addl %r13d, %r15d
jmp 0x16286
leaq 0x431fe(%rip), %rax     # 0x59418
movq (%rax), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
sete %cl
addq $0x2, %rbx
cmpq %rbx, %rax
seta %dl
orb %cl, %dl
movq %rbx, %rbp
jne 0x16250
movq %rax, %rbp
testq %rax, %rax
jne 0x1624b
leaq 0x431c0(%rip), %rax     # 0x59408
movq (%rax), %rbp
testq %rbp, %rbp
je 0x16296
movq %r15, %r13
movl $0x1, %r15d
movl $0x1, %edi
callq 0x1707a
movl $0x2, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
movl $0x10, %r8d
movl 0x14(%rsp), %r9d
callq 0x7480
movl %r15d, %edi
callq 0x1707a
movl %eax, %r13d
movq 0x28(%rsp), %r15
movq 0x18(%rsp), %rbp
leaq (%r12,%rbp), %rbx
leaq (%r12,%rbp), %rsi
incq %rsi
leaq 0x2ae4c(%rip), %rcx     # 0x410f9
movl $0x40000, %edi          # imm = 0x40000
movl 0x14(%rsp), %edx
callq 0x55eb
leaq 0x41ebe(%rip), %rax     # 0x58180
testb $0x4, 0x2(%rax)
je 0x162e9
leaq 0x2b860(%rip), %rdi     # 0x41b2f
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x3120
addl %eax, %r13d
movl %r13d, %edi
callq 0x1707a
movl %eax, %r13d
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3210
addq %rbp, %r14
movl %r13d, %edi
callq 0x17a82
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq