// File: AndreRenaud[P]simple_uart/./acutest.h
// Function: acutest_cmdline_read_
static int
acutest_cmdline_read_(const ACUTEST_CMDLINE_OPTION_* options, int argc, char** argv,
                      int (*callback)(int /*optval*/, const char* /*arg*/))
{

    const ACUTEST_CMDLINE_OPTION_* opt;
    char auxbuf[ACUTEST_CMDLINE_AUXBUF_SIZE_+1];
    int after_doubledash = 0;
    int i = 1;
    int ret = 0;

    auxbuf[ACUTEST_CMDLINE_AUXBUF_SIZE_] = '\0';

    while(i < argc) {
        if(after_doubledash  ||  strcmp(argv[i], "-") == 0) {
            /* Non-option argument. */
            ret = callback(ACUTEST_CMDLINE_OPTID_NONE_, argv[i]);
        } else if(strcmp(argv[i], "--") == 0) {
            /* End of options. All the remaining members are non-option arguments. */
            after_doubledash = 1;
        } else if(argv[i][0] != '-') {
            /* Non-option argument. */
            ret = callback(ACUTEST_CMDLINE_OPTID_NONE_, argv[i]);
        } else {
            for(opt = options; opt->id != 0; opt++) {
                if(opt->longname != NULL  &&  strncmp(argv[i], "--", 2) == 0) {
                    size_t len = strlen(opt->longname);
                    if(strncmp(argv[i]+2, opt->longname, len) == 0) {
                        /* Regular long option. */
                        if(argv[i][2+len] == '\0') {
                            /* with no argument provided. */
                            if(!(opt->flags & ACUTEST_CMDLINE_OPTFLAG_REQUIREDARG_))
                                ret = callback(opt->id, NULL);
                            else
                                ret = callback(ACUTEST_CMDLINE_OPTID_MISSINGARG_, argv[i]);
                            break;
                        } else if(argv[i][2+len] == '=') {
                            /* with an argument provided. */
                            if(opt->flags & (ACUTEST_CMDLINE_OPTFLAG_OPTIONALARG_ | ACUTEST_CMDLINE_OPTFLAG_REQUIREDARG_)) {
                                ret = callback(opt->id, argv[i]+2+len+1);
                            } else {
                                snprintf(auxbuf, sizeof(auxbuf), "--%s", opt->longname);
                                ret = callback(ACUTEST_CMDLINE_OPTID_BOGUSARG_, auxbuf);
                            }
                            break;
                        } else {
                            continue;
                        }
                    }
                } else if(opt->shortname != '\0'  &&  argv[i][0] == '-') {
                    if(argv[i][1] == opt->shortname) {
                        /* Regular short option. */
                        if(opt->flags & ACUTEST_CMDLINE_OPTFLAG_REQUIREDARG_) {
                            if(argv[i][2] != '\0')
                                ret = callback(opt->id, argv[i]+2);
                            else if(i+1 < argc)
                                ret = callback(opt->id, argv[++i]);
                            else
                                ret = callback(ACUTEST_CMDLINE_OPTID_MISSINGARG_, argv[i]);
                            break;
                        } else {
                            ret = callback(opt->id, NULL);

                            /* There might be more (argument-less) short options
                             * grouped together. */
                            if(ret == 0  &&  argv[i][2] != '\0')
                                ret = acutest_cmdline_handle_short_opt_group_(options, argv[i]+2, callback);
                            break;
                        }
                    }
                }
            }

            if(opt->id == 0) {  /* still not handled? */
                if(argv[i][0] != '-') {
                    /* Non-option argument. */
                    ret = callback(ACUTEST_CMDLINE_OPTID_NONE_, argv[i]);
                } else {
                    /* Unknown option. */
                    char* badoptname = argv[i];

                    if(strncmp(badoptname, "--", 2) == 0) {
                        /* Strip any argument from the long option. */
                        char* assignment = strchr(badoptname, '=');
                        if(assignment != NULL) {
                            size_t len = (size_t)(assignment - badoptname);
                            if(len > ACUTEST_CMDLINE_AUXBUF_SIZE_)
                                len = ACUTEST_CMDLINE_AUXBUF_SIZE_;
                            strncpy(auxbuf, badoptname, len);
                            auxbuf[len] = '\0';
                            badoptname = auxbuf;
                        }
                    }

                    ret = callback(ACUTEST_CMDLINE_OPTID_UNKNOWN_, badoptname);
                }
            }
        }

        if(ret != 0)
            return ret;
        i++;
    }

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x1, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movb $0x0, -0x40(%rbp)
movl -0x68(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x3e1d
cmpl $0x0, -0x64(%rbp)
jne 0x39d2
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x5f38(%rip), %rsi      # 0x9900
callq 0x2200
cmpl $0x0, %eax
jne 0x39ee
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
xorl %edi, %edi
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3e01
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x5efe(%rip), %rsi      # 0x98ff
callq 0x2200
cmpl $0x0, %eax
jne 0x3a17
movl $0x1, -0x64(%rbp)
jmp 0x3dff
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x3a47
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
xorl %edi, %edi
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3dfd
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x3d0c
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3bc4
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x5e80(%rip), %rsi      # 0x98ff
movl $0x2, %edx
callq 0x2080
cmpl $0x0, %eax
jne 0x3bc4
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2130
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x2, %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x78(%rbp), %rdx
callq 0x2080
cmpl $0x0, %eax
jne 0x3bbf
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x78(%rbp), %rcx
addq $0x2, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x3b2e
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x3b0f
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %edi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3b29
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movl $0x80000002, %edi       # imm = 0x80000002
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3d0c
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x78(%rbp), %rcx
addq $0x2, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x3bba
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x3b84
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %edi
movq -0x20(%rbp), %rcx
movslq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
addq $0x2, %rsi
addq -0x78(%rbp), %rsi
addq $0x1, %rsi
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3bb5
leaq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
movl $0x21, %esi
leaq 0x5d66(%rip), %rdx      # 0x9902
movb $0x0, %al
callq 0x2170
movq -0x28(%rbp), %rax
leaq -0x60(%rbp), %rsi
movl $0x80000003, %edi       # imm = 0x80000003
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3d0c
jmp 0x3cfb
jmp 0x3cf9
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x3cf7
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x3cf7
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x3cf5
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x3ca4
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x3c55
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %edi
movq -0x20(%rbp), %rcx
movslq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
addq $0x2, %rsi
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3ca2
movl -0x68(%rbp), %eax
addl $0x1, %eax
cmpl -0x14(%rbp), %eax
jge 0x3c86
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %edi
movq -0x20(%rbp), %rcx
movl -0x68(%rbp), %edx
addl $0x1, %edx
movl %edx, -0x68(%rbp)
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rsi
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3ca0
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
movl $0x80000002, %edi       # imm = 0x80000002
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3ca2
jmp 0x3d0c
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x10(%rcx), %edi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jne 0x3cf3
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x3cf3
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x2, %rsi
movq -0x28(%rbp), %rdx
callq 0x5bf0
movl %eax, -0x6c(%rbp)
jmp 0x3d0c
jmp 0x3cf7
jmp 0x3cf9
jmp 0x3cfb
movq -0x30(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x30(%rbp)
jmp 0x3a4f
movq -0x30(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x3dfb
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x3d4a
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rsi
xorl %edi, %edi
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3df9
movq -0x20(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
leaq 0x5b9a(%rip), %rsi      # 0x98ff
movl $0x2, %edx
callq 0x2080
cmpl $0x0, %eax
jne 0x3de7
movq -0x80(%rbp), %rdi
movl $0x3d, %esi
callq 0x2150
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x3de5
movq -0x88(%rbp), %rax
movq -0x80(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x90(%rbp)
cmpq $0x20, -0x90(%rbp)
jbe 0x3dbd
movq $0x20, -0x90(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x90(%rbp), %rdx
callq 0x2070
movq -0x90(%rbp), %rax
movb $0x0, -0x60(%rbp,%rax)
leaq -0x60(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x3de7
movq -0x28(%rbp), %rax
movq -0x80(%rbp), %rsi
movl $0x80000001, %edi       # imm = 0x80000001
callq *%rax
movl %eax, -0x6c(%rbp)
jmp 0x3dfb
jmp 0x3dfd
jmp 0x3dff
jmp 0x3e01
cmpl $0x0, -0x6c(%rbp)
je 0x3e0f
movl -0x6c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3e23
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x39a3
movl -0x6c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop