// File: /workspace/github_c_makefile_star2_O3/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 0x3bb05(%rip), %r14     # 0x58180
testb $-0x80, (%r14)
je 0x1c697
movq 0x3b940(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
callq 0x31d0
movl %eax, %edi
callq 0x30c0
leaq 0x2b5fa(%rip), %rdx     # 0x47c98
movl %ebp, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3240
cmpl $-0x1, %eax
je 0x1caf3
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
leaq 0x2b450(%rip), %r12     # 0x47b10
movzbl %al, %eax
addl $-0x41, %eax
cmpl $0x34, %eax
ja 0x1cb17
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
orb $0x40, 0x2(%r14)
movq 0x3b8f4(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1caca
cmpb $0x61, (%rdi)
jne 0x1caa5
leaq 0x3cd18(%rip), %rax     # 0x59418
jmp 0x1c982
movq 0x3b8cc(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3cd32(%rip), %rcx     # 0x59448
jmp 0x1cac7
movq (%r14), %rdi
movl $0x1000000, %esi        # imm = 0x1000000
jmp 0x1ca69
movq 0x3b8a9(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1c740
cmpb $0x61, (%rdi)
jne 0x1ca81
leaq 0x3ccc1(%rip), %rax     # 0x59408
jmp 0x1c982
movq $0x501c1020, (%r14)     # imm = 0x501C1020
jmp 0x1caca
callq 0x1ce40
jmp 0x1caca
movq $0x111f3323, (%r14)     # imm = 0x111F3323
jmp 0x1caca
movq 0x3b863(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3cca0(%rip), %rcx     # 0x59428
jmp 0x1cac7
movq (%r14), %rax
movl %eax, %ecx
shrl %ecx
andl $0x10111, %ecx          # imm = 0x10111
andq $-0x20223, %rax         # imm = 0xFFFDFDDD
jmp 0x1c91b
movq (%r14), %rdi
xorl %esi, %esi
jmp 0x1ca69
movq 0x3b822(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
movl %eax, 0x40ea8(%rip)     # 0x5d670
jmp 0x1caca
movq (%r14), %rdi
movl $0x30000, %esi          # imm = 0x30000
jmp 0x1ca69
movq (%r14), %rax
btl $0x1c, %eax
jb 0x1ca73
btl $0x1d, %eax
jb 0x1cae8
orq $0x10000000, %rax       # imm = 0x10000000
jmp 0x1ca6e
movq $0x40, (%r14)
jmp 0x1caca
movq 0x3b7c9(%rip), %r13     # 0x57fd8
movq (%r13), %rax
movzbl (%rax), %eax
cmpl $0x64, %eax
jle 0x1c83d
leal -0x65(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1c851
leaq 0x2b3ba(%rip), %rax     # 0x47be4
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq (%r14), %rdi
movl $0x4003333, %esi        # imm = 0x4003333
jmp 0x1c872
cmpl $0x4d, %eax
je 0x1c890
cmpl $0x61, %eax
jne 0x1c899
movq (%r14), %rdi
movl $0x100000, %esi         # imm = 0x100000
jmp 0x1c872
cmpl $0x73, %eax
jne 0x1c87a
movq (%r14), %rdi
movl $0x40000, %esi          # imm = 0x40000
jmp 0x1c872
movq (%r14), %rdi
movl $0x80000, %esi          # imm = 0x80000
jmp 0x1c872
movq (%r14), %rdi
movl $0x40, %esi
callq 0x17f30
movq %rax, (%r14)
movq (%r13), %rax
incq %rax
movq %rax, (%r13)
jmp 0x1c813
movq (%r14), %rax
orq $0x4, %rax
jmp 0x1c877
movq (%r14), %rax
orq $0xc, %rax
jmp 0x1c877
testl %eax, %eax
jne 0x1c87a
jmp 0x1caca
movq 0x3b72f(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3cba5(%rip), %rcx     # 0x59458
jmp 0x1cac7
movq $0x40101060, (%r14)     # imm = 0x40101060
jmp 0x1caca
movq 0x3b70d(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3cb8b(%rip), %rcx     # 0x59460
movq %rax, (%rcx)
movq (%r14), %rdi
movl $0x400, %esi            # imm = 0x400
jmp 0x1ca69
movq 0x3b6ec(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1caca
callq 0x3260
movl %eax, %edi
callq 0x1c4d1
jmp 0x1caca
movq (%r14), %rax
leal (%rax,%rax), %ecx
andl $0x20222, %ecx          # imm = 0x20222
andq $-0x10112, %rax         # imm = 0xFFFEFEEE
orq %rcx, %rax
jmp 0x1ca6e
movq 0x3b6ae(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1c93b
cmpb $0x61, (%rdi)
jne 0x1ca93
leaq 0x3cade(%rip), %rax     # 0x59420
jmp 0x1c982
movq 0x3b68d(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3cafb(%rip), %rcx     # 0x59450
jmp 0x1cac7
orb $0x20, 0x2(%r14)
movq 0x3b672(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1caca
cmpb $0x61, (%rdi)
jne 0x1cab7
leaq 0x3ca8e(%rip), %rax     # 0x59410
movq %r15, (%rax)
jmp 0x1caca
movq (%r14), %rdi
movl $0x4000, %esi           # imm = 0x4000
jmp 0x1ca69
movq 0x3b63a(%rip), %r13     # 0x57fd8
movq (%r13), %rax
movzbl (%rax), %eax
cmpl $0x60, %eax
jg 0x1c9c9
leal -0x4e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1c9e8
leaq 0x2b24f(%rip), %rax     # 0x47c08
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x1, %esi
jmp 0x1ca36
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1c9f4
leaq 0x2b254(%rip), %rax     # 0x47c2c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x2, %esi
jmp 0x1ca36
cmpl $0x41, %eax
jne 0x1ca51
movl $0x8000000, %esi        # imm = 0x8000000
jmp 0x1ca36
cmpl $0x61, %eax
jne 0x1ca41
movl $0x40000000, %esi       # imm = 0x40000000
jmp 0x1ca36
movl $0x20, %esi
jmp 0x1ca36
movl $0x10, %esi
jmp 0x1ca36
movl $0x200, %esi            # imm = 0x200
jmp 0x1ca36
movl $0x1000, %esi           # imm = 0x1000
jmp 0x1ca36
movl $0x100, %esi            # imm = 0x100
jmp 0x1ca36
movl $0x2000, %esi           # imm = 0x2000
jmp 0x1ca36
movl $0x4000000, %esi        # imm = 0x4000000
jmp 0x1ca36
movl $0x2000000, %esi        # imm = 0x2000000
movq (%r14), %rdi
callq 0x17f30
movq %rax, (%r14)
movq (%r13), %rax
incq %rax
movq %rax, (%r13)
jmp 0x1c9a2
testl %eax, %eax
jne 0x1ca41
jmp 0x1caca
movq (%r14), %rdi
movl $0x80, %esi
jmp 0x1ca69
movq (%r14), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x17f30
movq %rax, (%r14)
jmp 0x1caca
andq $-0x30000001, %rax      # imm = 0xCFFFFFFF
orq $0x20000000, %rax       # imm = 0x20000000
jmp 0x1ca6e
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3c977(%rip), %rcx     # 0x59408
jmp 0x1cac7
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3c97d(%rip), %rcx     # 0x59420
jmp 0x1cac7
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3c963(%rip), %rcx     # 0x59418
jmp 0x1cac7
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3c949(%rip), %rcx     # 0x59410
movq %rax, (%rcx)
leaq 0x2b1c7(%rip), %rdx     # 0x47c98
movl %ebp, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3240
cmpl $-0x1, %eax
jne 0x1c6c0
jmp 0x1caf3
andq $-0x30000001, %rax      # imm = 0xCFFFFFFF
jmp 0x1ca6e
movq 0x3b4d6(%rip), %rax     # 0x57fd0
movl (%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1cbcb
xorl %edi, %edi
callq 0x3290
callq 0x1cbcb
movl $0x1, %edi
callq 0x3290