// File: /workspace/github_c_makefile_star2_O1/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 0x3bffd(%rip), %r14     # 0x58180
testb $-0x80, (%r14)
je 0x1c19f
movq 0x3be38(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
callq 0x31d0
movl %eax, %edi
callq 0x30c0
leaq 0x2bab2(%rip), %rdx     # 0x47c58
movl %ebp, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3240
cmpl $-0x1, %eax
je 0x1c5e6
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
leaq 0x2b908(%rip), %r12     # 0x47ad0
movzbl %al, %eax
addl $-0x41, %eax
cmpl $0x34, %eax
ja 0x1c60a
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
orb $0x40, 0x2(%r14)
movq 0x3bdec(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1c5bd
cmpb $0x61, (%rdi)
jne 0x1c598
leaq 0x3d210(%rip), %rax     # 0x59418
jmp 0x1c53b
movq 0x3bdc4(%rip), %r13     # 0x57fd8
movq (%r13), %rax
movzbl (%rax), %eax
cmpl $0x60, %eax
jg 0x1c23f
leal -0x4e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1c25e
leaq 0x2b999(%rip), %rax     # 0x47bc8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x1, %esi
jmp 0x1c2ac
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1c26a
leaq 0x2b99e(%rip), %rax     # 0x47bec
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x2, %esi
jmp 0x1c2ac
cmpl $0x41, %eax
jne 0x1c2c0
movl $0x8000000, %esi        # imm = 0x8000000
jmp 0x1c2ac
cmpl $0x61, %eax
jne 0x1c2b7
movl $0x40000000, %esi       # imm = 0x40000000
jmp 0x1c2ac
movl $0x20, %esi
jmp 0x1c2ac
movl $0x10, %esi
jmp 0x1c2ac
movl $0x200, %esi            # imm = 0x200
jmp 0x1c2ac
movl $0x1000, %esi           # imm = 0x1000
jmp 0x1c2ac
movl $0x100, %esi            # imm = 0x100
jmp 0x1c2ac
movl $0x2000, %esi           # imm = 0x2000
jmp 0x1c2ac
movl $0x4000000, %esi        # imm = 0x4000000
jmp 0x1c2ac
movl $0x2000000, %esi        # imm = 0x2000000
movq (%r14), %rdi
callq 0x179de
movq %rax, (%r14)
incq (%r13)
jmp 0x1c20d
testl %eax, %eax
jne 0x1c2b7
jmp 0x1c5bd
movq 0x3bd08(%rip), %r13     # 0x57fd8
movq (%r13), %rax
movzbl (%rax), %eax
cmpl $0x64, %eax
jle 0x1c2fe
leal -0x65(%rax), %ecx
cmpl $0x8, %ecx
ja 0x1c312
leaq 0x2b8b9(%rip), %rax     # 0x47ba4
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq (%r14), %rdi
movl $0x4003333, %esi        # imm = 0x4003333
jmp 0x1c333
cmpl $0x4d, %eax
je 0x1c34a
cmpl $0x61, %eax
jne 0x1c353
movq (%r14), %rdi
movl $0x100000, %esi         # imm = 0x100000
jmp 0x1c333
cmpl $0x73, %eax
jne 0x1c33b
movq (%r14), %rdi
movl $0x40000, %esi          # imm = 0x40000
jmp 0x1c333
movq (%r14), %rdi
movl $0x80000, %esi          # imm = 0x80000
jmp 0x1c333
movq (%r14), %rdi
movl $0x40, %esi
callq 0x179de
movq %rax, (%r14)
incq (%r13)
jmp 0x1c2c9
movq (%r14), %rax
orq $0x4, %rax
jmp 0x1c338
movq (%r14), %rax
orq $0xc, %rax
jmp 0x1c338
testl %eax, %eax
jne 0x1c33b
jmp 0x1c5bd
movq 0x3bc75(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3d0db(%rip), %rcx     # 0x59448
jmp 0x1c5ba
movq (%r14), %rdi
movl $0x1000000, %esi        # imm = 0x1000000
jmp 0x1c55c
movq 0x3bc52(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1c397
cmpb $0x61, (%rdi)
jne 0x1c574
leaq 0x3d06a(%rip), %rax     # 0x59408
jmp 0x1c53b
movq $0x501c1020, (%r14)     # imm = 0x501C1020
jmp 0x1c5bd
callq 0x1c933
jmp 0x1c5bd
movq $0x111f3323, (%r14)     # imm = 0x111F3323
jmp 0x1c5bd
movq 0x3bc0c(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3d049(%rip), %rcx     # 0x59428
jmp 0x1c5ba
movq (%r14), %rax
movl %eax, %ecx
shrl %ecx
andl $0x10111, %ecx          # imm = 0x10111
andq $-0x20223, %rax         # imm = 0xFFFDFDDD
jmp 0x1c4d8
movq (%r14), %rdi
xorl %esi, %esi
jmp 0x1c55c
movq 0x3bbcb(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
movl %eax, 0x41251(%rip)     # 0x5d670
jmp 0x1c5bd
movq (%r14), %rdi
movl $0x30000, %esi          # imm = 0x30000
jmp 0x1c55c
movq (%r14), %rax
btl $0x1c, %eax
jb 0x1c566
btl $0x1d, %eax
jb 0x1c5db
orq $0x10000000, %rax       # imm = 0x10000000
jmp 0x1c561
movq $0x40, (%r14)
jmp 0x1c5bd
movq 0x3bb72(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3cfe8(%rip), %rcx     # 0x59458
jmp 0x1c5ba
movq $0x40101060, (%r14)     # imm = 0x40101060
jmp 0x1c5bd
movq 0x3bb50(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3cfce(%rip), %rcx     # 0x59460
movq %rax, (%rcx)
movq (%r14), %rdi
movl $0x400, %esi            # imm = 0x400
jmp 0x1c55c
movq 0x3bb2f(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1c5bd
callq 0x3260
movl %eax, %edi
callq 0x1bfd9
jmp 0x1c5bd
movq (%r14), %rax
leal (%rax,%rax), %ecx
andl $0x20222, %ecx          # imm = 0x20222
andq $-0x10112, %rax         # imm = 0xFFFEFEEE
orq %rcx, %rax
jmp 0x1c561
movq 0x3baf1(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1c4f8
cmpb $0x61, (%rdi)
jne 0x1c586
leaq 0x3cf21(%rip), %rax     # 0x59420
jmp 0x1c53b
movq 0x3bad0(%rip), %rax     # 0x57fd8
movq (%rax), %rax
leaq 0x3cf3e(%rip), %rcx     # 0x59450
jmp 0x1c5ba
orb $0x20, 0x2(%r14)
movq 0x3bab5(%rip), %rax     # 0x57fd8
movq (%rax), %rdi
testq %rdi, %rdi
je 0x1c5bd
cmpb $0x61, (%rdi)
jne 0x1c5aa
leaq 0x3ced5(%rip), %rax     # 0x59410
movq %r15, (%rax)
jmp 0x1c5bd
movq (%r14), %rdi
movl $0x4000, %esi           # imm = 0x4000
jmp 0x1c55c
movq (%r14), %rdi
movl $0x80, %esi
jmp 0x1c55c
movq (%r14), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x179de
movq %rax, (%r14)
jmp 0x1c5bd
andq $-0x30000001, %rax      # imm = 0xCFFFFFFF
orq $0x20000000, %rax       # imm = 0x20000000
jmp 0x1c561
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3ce84(%rip), %rcx     # 0x59408
jmp 0x1c5ba
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3ce8a(%rip), %rcx     # 0x59420
jmp 0x1c5ba
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3ce70(%rip), %rcx     # 0x59418
jmp 0x1c5ba
xorl %esi, %esi
xorl %edx, %edx
callq 0x3250
leaq 0x3ce56(%rip), %rcx     # 0x59410
movq %rax, (%rcx)
leaq 0x2b694(%rip), %rdx     # 0x47c58
movl %ebp, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3240
cmpl $-0x1, %eax
jne 0x1c1c8
jmp 0x1c5e6
andq $-0x30000001, %rax      # imm = 0xCFFFFFFF
jmp 0x1c561
movq 0x3b9e3(%rip), %rax     # 0x57fd0
movl (%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1c6be
xorl %edi, %edi
callq 0x3290
callq 0x1c6be
movl $0x1, %edi
callq 0x3290