// File: /workspace/github_c_makefile_star2_O2/hfiguiere[P]exifprobe/options.c
// Function: process_options
int
process_options(int argc,char **argv)
{
    int opt;
    unsigned long bits;
    int nv;

    if((CHECK_TTY_FOR_COLOR))
    {
        if(isatty(fileno(stdout)) == 0)
            Print_options &= ~PCOLOR;
    }
    while((opt = getopt(argc,argv,"ace:hil:m:np:s:tuA:B:C:DILM:N:O:RSU:VXY:Z")) != EOF)
    {
        switch(opt & 0xff)
        {
            case 'I':   /* Indent: after -> before -> none -> after   */
                        if(PRINT_INDENT_AFTER_ADDRESS)
                        {
                            Print_options &= ~INDENT_AFTER_ADDRESS;
                            Print_options |= INDENT_BEFORE_ADDRESS;
                        }
                        else if(PRINT_INDENT_BEFORE_ADDRESS)
                            Print_options &= ~(INDENT_BEFORE_ADDRESS|INDENT_AFTER_ADDRESS);
                        else
                        {
                            Print_options &= ~INDENT_BEFORE_ADDRESS;
                            Print_options |= INDENT_AFTER_ADDRESS;
                        }
                        break;
            /* Modes: structural (default), report, or list           */
            case 'S':   Print_options = DEFAULT_OPTIONS; break;
            case 'R':   Print_options = REPORT_OPTIONS; break;
            case 'L':   Print_options = LIST_OPTIONS; break;


            /* Want hex?...or decimal                                 */
            case 'D':   bits = Print_options & HEX_ONLY;
                        bits = (bits << 1) & DECIMAL_ONLY;
                        Print_options &= ~HEX_ONLY;
                        Print_options |= bits;
                        break;
            case 'X':   bits = Print_options & DECIMAL_ONLY;
                        bits = (bits >> 1) & HEX_ONLY;
                        Print_options &= ~DECIMAL_ONLY;
                        Print_options |= bits;
                        break;

            /* Zero all print options; leaves only image summary and  */
            /* filetype/fileformat. Leave LONGNAMES on.               */
            case 'Z':   Print_options = LONGNAMES_FLAG; break;

            /* toggle use of color highlighting                       */
            case 'c':   Print_options = toggle(Print_options,PCOLOR); break;
            /* toggle printing of offset values in IFDs "(i)nline"    */
            /* with the directory entry (not at the value offset)     */
            case 'i':   Print_options = toggle(Print_options,VALUE_AT_OFFSET); break;

            case 'a':   Print_options = toggle(Print_options,HEXADDRESS | DECADDRESS); break;

            /* 'e'ntry options; which parts of an entry to            */
            /* (de)activate                                           */
            case 'e':   while(*optarg)
                        {
                            switch(*optarg)
                            {
                                case 't': Print_options = toggle(Print_options,TAGNAME); break;
                                case 'n': Print_options = toggle(Print_options,DECTAGNO); break;
                                case 'N': Print_options = toggle(Print_options,HEXTAGNO); break;
                                case 'T': Print_options = toggle(Print_options,TYPE); break;
                                case 'v': Print_options = toggle(Print_options,DECVALUE); break;
                                case 'V': Print_options = toggle(Print_options,HEXVALUE); break;
                                case 'o': Print_options = toggle(Print_options,DECOFFSET); break;
                                case 'O': Print_options = toggle(Print_options,HEXOFFSET); break;
                                case 'r': Print_options = toggle(Print_options,RELOFFSET); break;
                                case 'R': Print_options = toggle(Print_options,RAW_VALUES); break;
                                case 'a': Print_options = toggle(Print_options,ASCII_IGNORE_LENGTH); break;
                                case 'A': Print_options = toggle(Print_options,MULTIVAL_PRINT_ALL); break;
                            }
                            ++optarg;
                        }
                        break;

            case 'n': Print_options = toggle(Print_options,FILENAMES); break;

            /* 'p'rint options; which sections/features to            */
            /* (de)activeate                                          */
            case 'p':   while(*optarg)
                        {
                            switch(*optarg)
                            {
                                case 'l': Print_options = toggle(Print_options,LONGNAMES_FLAG); break;
                                case 's': Print_options = toggle(Print_options,SECTION); break;
                                case 'a': Print_options = toggle(Print_options,APP_ENTRY); break;
                                case 'g': Print_options = toggle(Print_options,SEGMENT); break;
                                case 'm': Print_options |= MAKERNOTE_SCHEME; break;
                                case 'M': Print_options |= MAKERNOTE_SCHEME|SCHEME_DEBUG; break;
                                case 'e': Print_options = toggle(Print_options,ENTRY); break;
                            }
                            ++optarg;
                        }
                        break;

            case 'B':   /* dump binary image segments and failed Jpeg */
                        /* image segments                             */
                        if(optarg)
                        {
                            if(*optarg == 'a')
                                Max_imgdump = DUMPALL;
                            else
                                Max_imgdump = strtoul(optarg,NULL,0);
                        }
                        else
                            Max_imgdump = DUMPALL;
                        break;
            case 'U':   /* dump UNDEFINED segments                    */
                        /* Also affects raw image sections            */
                        if(optarg)
                        {
                            if(*optarg == 'a')
                                Max_undefined = DUMPALL;
                            else
                                Max_undefined = strtoul(optarg,NULL,0);
                        }
                        else
                            Max_undefined = DUMPALL;
                        break;
            case 'M':   /* dump MakerNotes                            */
                        Print_options |= MAKERDUMP;
                        if(optarg)
                        {
                            if(*optarg == 'a')
                                Max_makerdump = DUMPALL;
                            else
                                Max_makerdump = strtoul(optarg,NULL,0);
                        }
                        break;
            case 'N':   /* force a noteversion                        */
                        if(optarg)
                        {
                            nv = atoi(optarg);
                            setoptionnoteversion(nv);
                        }
                        break;
            case 'A':   /* dump APPn segments                         */
                        Print_options |= APPNDUMP;
                        if(optarg)
                        {
                            if(*optarg == 'a')
                                Max_appdump = DUMPALL;
                            else
                                Max_appdump = strtoul(optarg,NULL,0);
                        }
                        break;
            /* Options to force makernote routines to use a specific  */
            /* set of routines to interpret MakerNotes. Scheme        */
            /* detection is automatic and (largely) unaffected        */
            /* (except for certain details which are unavoidably      */
            /* maker-specific). This may be used to check whether a   */
            /* set of MakerNote tags for an undocumented camera       */
            /* actually match a set for which routines exist for      */
            /* another camera                                         */

            /* "Software" has proven unreliable for identification    */
            /* purposes, and is not used for anything. Changing it    */
            /* here will accomplish nothing.                          */

            case 'm':   Use_Make_name = optarg;
                        break;
            case 'l':   Use_Model_name = optarg;
                        break;
            case 's':   Use_Software_name = optarg; /* useless        */
                        break;

            /* help and version                                       */
            case 'h':   usage(); exit(0); break;
            case 'V':   print_version(); break;

            /* Y is this happpening? Random debug for development     */
            /* only; e.g bit 0x4 shows summary debug, bit 0x8 shows   */
            /* noteversion debug...                                   */
            case 'Y':   Debug = strtoul(optarg,(char **)0,0); break;

            /* Print make and/or model names of digital cameras       */
            /* "known" to the program. The format is -C make+model,   */
            /* where 'make' and 'model' are strings subjected to a    */
            /* simple substring match with known info. A missing      */
            /* pattern matches everything, so "-C +" prints all known */
            /* makes and models. As a special case "-C -" prints all  */
            /* makes. Make and Model are significant only for         */
            /* MakerNotes.                                            */
            case 'C':   Camera_name_pattern = optarg;
                        Print_options = toggle(Print_options,CAMERA_NAMES);
                        break;
            case 'O':   Start_offset = strtoul(optarg,0,0);
                        break;
            case 't':   Print_options = toggle(Print_options,TTY_COLOR_CHECK); 
                        break;
            case 'u':   Print_options = toggle(Print_options,UNICODE_FLAG); 
                        break;
            default:    usage();
                        exit(1);
                        break;
        }
    }
    return(optind);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x3bd51(%rip), %r15     # 0x57180
testb $-0x80, (%r15)
je 0x1b44b
movq 0x3bb8c(%rip), %rax     # 0x56fc8
movq (%rax), %rdi
callq 0x31d0
movl %eax, %edi
callq 0x30c0
leaq 0x2a7f6(%rip), %r14     # 0x45c48
leaq 0x2a667(%rip), %r13     # 0x45ac0
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3240
cmpl $-0x1, %eax
je 0x1b8a9
movzbl %al, %eax
addl $-0x41, %eax
cmpl $0x34, %eax
ja 0x1b8cd
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
orb $0x40, 0x2(%r15)
movq 0x3bb42(%rip), %rax     # 0x56fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1b459
cmpb $0x61, (%rdi)
jne 0x1b86b
leaq 0x3cf6a(%rip), %rax     # 0x58418
jmp 0x1b73b
movq 0x3bb1e(%rip), %rax     # 0x56fd8
movq (%rax), %rax
leaq 0x3cf84(%rip), %rcx     # 0x58448
movq %rax, (%rcx)
jmp 0x1b459
movq (%r15), %rdi
movl $0x1000000, %esi        # imm = 0x1000000
jmp 0x1b81a
movq 0x3bafb(%rip), %rax     # 0x56fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1b4ee
cmpb $0x61, (%rdi)
jne 0x1b83b
leaq 0x3cf13(%rip), %rax     # 0x58408
jmp 0x1b73b
movq $0x501c1020, (%r15)     # imm = 0x501C1020
jmp 0x1b459
callq 0x1bbdd
jmp 0x1b459
movq $0x111f3323, (%r15)     # imm = 0x111F3323
jmp 0x1b459
movq 0x3bab5(%rip), %rax     # 0x56fd8
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3cef2(%rip), %rcx     # 0x58428
movq %rax, (%rcx)
jmp 0x1b459
movq (%r15), %rax
movl %eax, %ecx
shrl %ecx
andl $0x10111, %ecx          # imm = 0x10111
andq $-0x20223, %rax         # imm = 0xFFFDFDDD
jmp 0x1b6ce
movq (%r15), %rdi
xorl %esi, %esi
jmp 0x1b81a
movq 0x3ba71(%rip), %rax     # 0x56fd8
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
movl %eax, 0x410f7(%rip)     # 0x5c670
jmp 0x1b459
movq (%r15), %rdi
movl $0x30000, %esi          # imm = 0x30000
jmp 0x1b81a
movq (%r15), %rax
btl $0x1c, %eax
jb 0x1b827
btl $0x1d, %eax
jb 0x1b89b
orq $0x10000000, %rax       # imm = 0x10000000
movq %rax, (%r15)
jmp 0x1b459
movq $0x40, (%r15)
jmp 0x1b459
movq 0x3ba15(%rip), %r12     # 0x56fd8
movq (%r12), %rax
movzbl (%rax), %eax
leal -0x65(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1b5ec
leaq 0x2a5bb(%rip), %rax     # 0x45b94
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq (%r15), %rdi
movl $0x4003333, %esi        # imm = 0x4003333
jmp 0x1b63a
cmpl $0x4d, %eax
je 0x1b629
cmpl $0x61, %eax
je 0x1b61f
cmpl $0x73, %eax
je 0x1b632
testl %eax, %eax
jne 0x1b642
jmp 0x1b459
movq (%r15), %rdi
movl $0x80000, %esi          # imm = 0x80000
jmp 0x1b63a
movq (%r15), %rax
orq $0x4, %rax
jmp 0x1b63f
movq (%r15), %rdi
pushq $0x40
popq %rsi
jmp 0x1b63a
movq (%r15), %rdi
movl $0x100000, %esi         # imm = 0x100000
jmp 0x1b63a
movq (%r15), %rax
orq $0xc, %rax
jmp 0x1b63f
movq (%r15), %rdi
movl $0x40000, %esi          # imm = 0x40000
callq 0x16ec2
movq %rax, (%r15)
movq (%r12), %rax
incq %rax
movq %rax, (%r12)
jmp 0x1b5c7
movq 0x3b97f(%rip), %rax     # 0x56fd8
movq (%rax), %rax
leaq 0x3cdf5(%rip), %rcx     # 0x58458
movq %rax, (%rcx)
jmp 0x1b459
movq $0x40101060, (%r15)     # imm = 0x40101060
jmp 0x1b459
movq 0x3b95a(%rip), %rax     # 0x56fd8
movq (%rax), %rax
leaq 0x3cdd8(%rip), %rcx     # 0x58460
movq %rax, (%rcx)
movq (%r15), %rdi
movl $0x400, %esi            # imm = 0x400
jmp 0x1b81a
movq 0x3b939(%rip), %rax     # 0x56fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1b459
callq 0x3260
movl %eax, %edi
callq 0x1b29e
jmp 0x1b459
movq (%r15), %rax
leal (%rax,%rax), %ecx
andl $0x20222, %ecx          # imm = 0x20222
andq $-0x10112, %rax         # imm = 0xFFFEFEEE
orq %rcx, %rax
movq %rax, (%r15)
jmp 0x1b459
movq 0x3b8f8(%rip), %rax     # 0x56fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1b6f1
cmpb $0x61, (%rdi)
jne 0x1b853
leaq 0x3cd28(%rip), %rax     # 0x58420
jmp 0x1b73b
movq 0x3b8d7(%rip), %rax     # 0x56fd8
movq (%rax), %rax
leaq 0x3cd45(%rip), %rcx     # 0x58450
movq %rax, (%rcx)
jmp 0x1b459
orb $0x20, 0x2(%r15)
movq 0x3b8b9(%rip), %rax     # 0x56fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1b459
cmpb $0x61, (%rdi)
jne 0x1b883
leaq 0x3ccd5(%rip), %rax     # 0x58410
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, (%rax)
jmp 0x1b459
movq (%r15), %rdi
movl $0x4000, %esi           # imm = 0x4000
jmp 0x1b81a
movq 0x3b87c(%rip), %r12     # 0x56fd8
movq (%r12), %rax
movzbl (%rax), %eax
leal -0x4e(%rax), %ecx
cmpl $0x8, %ecx
jbe 0x1b787
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1b79b
leaq 0x2a462(%rip), %rax     # 0x45bdc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
pushq $0x2
jmp 0x1b7d7
leaq 0x2a42a(%rip), %rax     # 0x45bb8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
pushq $0x1
jmp 0x1b7d7
cmpl $0x41, %eax
je 0x1b7fa
cmpl $0x61, %eax
je 0x1b801
testl %eax, %eax
jne 0x1b7e3
jmp 0x1b459
movl $0x2000, %esi           # imm = 0x2000
jmp 0x1b7d8
movl $0x100, %esi            # imm = 0x100
jmp 0x1b7d8
pushq $0x10
jmp 0x1b7d7
movl $0x2000000, %esi        # imm = 0x2000000
jmp 0x1b7d8
movl $0x1000, %esi           # imm = 0x1000
jmp 0x1b7d8
movl $0x200, %esi            # imm = 0x200
jmp 0x1b7d8
pushq $0x20
popq %rsi
movq (%r15), %rdi
callq 0x16ec2
movq %rax, (%r15)
movq (%r12), %rax
incq %rax
movq %rax, (%r12)
jmp 0x1b760
movl $0x4000000, %esi        # imm = 0x4000000
jmp 0x1b7d8
movl $0x8000000, %esi        # imm = 0x8000000
jmp 0x1b7d8
movl $0x40000000, %esi       # imm = 0x40000000
jmp 0x1b7d8
movq (%r15), %rdi
movl $0x80, %esi
jmp 0x1b81a
movq (%r15), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x16ec2
movq %rax, (%r15)
jmp 0x1b459
andq $-0x30000001, %rax      # imm = 0xCFFFFFFF
orq $0x20000000, %rax       # imm = 0x20000000
movq %rax, (%r15)
jmp 0x1b459
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3cbbd(%rip), %rcx     # 0x58408
movq %rax, (%rcx)
jmp 0x1b459
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3cbbd(%rip), %rcx     # 0x58420
movq %rax, (%rcx)
jmp 0x1b459
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3cb9d(%rip), %rcx     # 0x58418
movq %rax, (%rcx)
jmp 0x1b459
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3cb7d(%rip), %rcx     # 0x58410
movq %rax, (%rcx)
jmp 0x1b459
andq $-0x30000001, %rax      # imm = 0xCFFFFFFF
movq %rax, (%r15)
jmp 0x1b459
movq 0x3b720(%rip), %rax     # 0x56fd0
movl (%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1b97a
xorl %edi, %edi
callq 0x3290
callq 0x1b97a
pushq $0x1
popq %rdi
callq 0x3290