// File: /workspace/github_c_makefile_star2_O3/atomlang[P]atomlang/cli/thirdparty/argparse/argparse.c
// Function: argparse_getvalue
static int
argparse_getvalue(struct argparse *self, const struct argparse_option *opt,
                  int flags)
{
    const char *s = NULL;
    if (!opt->value)
        goto skipped;
    switch (opt->type) {
    case ARGPARSE_OPT_BOOLEAN:
        if (flags & OPT_UNSET) {
            *(int *)opt->value = *(int *)opt->value - 1;
        } else {
            *(int *)opt->value = *(int *)opt->value + 1;
        }
        if (*(int *)opt->value < 0) {
            *(int *)opt->value = 0;
        }
        break;
    case ARGPARSE_OPT_BIT:
        if (flags & OPT_UNSET) {
            *(int *)opt->value &= ~opt->data;
        } else {
            *(int *)opt->value |= opt->data;
        }
        break;
    case ARGPARSE_OPT_STRING:
        if (self->optvalue) {
            *(const char **)opt->value = self->optvalue;
            self->optvalue             = NULL;
        } else if (self->argc > 1) {
            self->argc--;
            *(const char **)opt->value = *++self->argv;
        } else {
            argparse_error(self, opt, "requires a value", flags);
        }
        break;
    case ARGPARSE_OPT_INTEGER:
        errno = 0;
        if (self->optvalue) {
            *(int *)opt->value = strtol(self->optvalue, (char **)&s, 0);
            self->optvalue     = NULL;
        } else if (self->argc > 1) {
            self->argc--;
            *(int *)opt->value = strtol(*++self->argv, (char **)&s, 0);
        } else {
            argparse_error(self, opt, "requires a value", flags);
        }
        if (errno == ERANGE)
            argparse_error(self, opt, "numerical result out of range", flags);
        if (s[0] != '\0') // no digits or contains invalid characters
            argparse_error(self, opt, "expects an integer value", flags);
        break;
    case ARGPARSE_OPT_FLOAT:
        errno = 0;
        if (self->optvalue) {
            *(float *)opt->value = strtof(self->optvalue, (char **)&s);
            self->optvalue       = NULL;
        } else if (self->argc > 1) {
            self->argc--;
            *(float *)opt->value = strtof(*++self->argv, (char **)&s);
        } else {
            argparse_error(self, opt, "requires a value", flags);
        }
        if (errno == ERANGE)
            argparse_error(self, opt, "numerical result out of range", flags);
        if (s[0] != '\0') // no digits or contains invalid characters
            argparse_error(self, opt, "expects a numerical value", flags);
        break;
    default:
        assert(0);
    }

skipped:
    if (opt->callback) {
        return opt->callback(self, opt);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq $0x0, (%rsp)
movq 0x10(%rsi), %rax
testq %rax, %rax
je 0x1bd8e
movl (%rbx), %ecx
addl $-0x2, %ecx
cmpl $0x4, %ecx
ja 0x1bdd9
movl %edx, %ebp
leaq 0x3c4c(%rip), %rdx      # 0x1f860
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
andl $0x1, %ebp
negl %ebp
orl $0x1, %ebp
addl (%rax), %ebp
xorl %ecx, %ecx
testl %ebp, %ebp
cmovgl %ebp, %ecx
jmp 0x1bcd3
movq 0x48(%r14), %rcx
testq %rcx, %rcx
je 0x1bcda
movq %rcx, (%rax)
movq $0x0, 0x48(%r14)
jmp 0x1bd8e
callq 0x2060
movq %rax, %r15
movl $0x0, (%rax)
movq 0x48(%r14), %rdi
testq %rdi, %rdi
je 0x1bd05
movq %rsp, %rsi
xorl %edx, %edx
callq 0x2270
movq 0x10(%rbx), %rcx
movl %eax, (%rcx)
movq $0x0, 0x48(%r14)
jmp 0x1bd38
callq 0x2060
movq %rax, %r15
movl $0x0, (%rax)
movq 0x48(%r14), %rdi
testq %rdi, %rdi
je 0x1bd50
movq %rsp, %rsi
callq 0x2190
movq 0x10(%rbx), %rax
movss %xmm0, (%rax)
movq $0x0, 0x48(%r14)
jmp 0x1bd7f
movl 0x28(%rbx), %edx
movl (%rax), %ecx
testb $0x1, %bpl
jne 0x1bccf
orl %edx, %ecx
jmp 0x1bcd3
notl %edx
andl %edx, %ecx
movl %ecx, (%rax)
jmp 0x1bd8e
movl 0x28(%r14), %ecx
cmpl $0x2, %ecx
jl 0x1bdbf
decl %ecx
movl %ecx, 0x28(%r14)
movq 0x30(%r14), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x30(%r14)
movq 0x8(%rcx), %rcx
movq %rcx, (%rax)
jmp 0x1bd8e
movl 0x28(%r14), %eax
cmpl $0x2, %eax
jl 0x1bdbf
decl %eax
movl %eax, 0x28(%r14)
movq 0x30(%r14), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x30(%r14)
movq 0x8(%rax), %rdi
movq %rsp, %rsi
xorl %edx, %edx
callq 0x2270
movq 0x10(%rbx), %rcx
movl %eax, (%rcx)
cmpl $0x22, (%r15)
je 0x1bdb6
movq (%rsp), %rax
cmpb $0x0, (%rax)
je 0x1bd8e
leaq 0x3d05(%rip), %rsi      # 0x1fa53
jmp 0x1bdcf
movl 0x28(%r14), %eax
cmpl $0x2, %eax
jl 0x1bdbf
decl %eax
movl %eax, 0x28(%r14)
movq 0x30(%r14), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x30(%r14)
movq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x2190
movq 0x10(%rbx), %rax
movss %xmm0, (%rax)
cmpl $0x22, (%r15)
je 0x1bdb6
movq (%rsp), %rax
cmpb $0x0, (%rax)
jne 0x1bdc8
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x1bda9
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c78(%rip), %rsi      # 0x1fa35
jmp 0x1bdcf
leaq 0x3c5e(%rip), %rsi      # 0x1fa24
jmp 0x1bdcf
leaq 0x3c9d(%rip), %rsi      # 0x1fa6c
movq %rbx, %rdi
movl %ebp, %edx
callq 0x1bdf8
leaq 0x3808(%rip), %rdi      # 0x1f5e8
leaq 0x3c9f(%rip), %rsi      # 0x1fa86
leaq 0x3cbb(%rip), %rcx      # 0x1faa9
movl $0x76, %edx
callq 0x2170