// File: /workspace/github_c_makefile_star2_O3/atomlang[P]atomlang/cli/thirdparty/argparse/argparse.c
// Function: argparse_usage
void
argparse_usage(struct argparse *self)
{
    if (self->usages) {
        fprintf(stdout, "Usage: %s\n", *self->usages++);
        while (*self->usages && **self->usages)
            fprintf(stdout, "   or: %s\n", *self->usages++);
    } else {
        fprintf(stdout, "Usage:\n");
    }

    // print description
    if (self->description)
        fprintf(stdout, "%s\n", self->description);


    const struct argparse_option *options;

    // figure out best width
    size_t usage_opts_width = 0;
    size_t len;
    options = self->options;
    for (; options->type != ARGPARSE_OPT_END; options++) {
        len = 0;
        if ((options)->short_name) {
            len += 2;
        }
        if ((options)->short_name && (options)->long_name) {
            len += 2;           // separator ", "
        }
        if ((options)->long_name) {
            len += strlen((options)->long_name) + 2;
        }
        if (options->type == ARGPARSE_OPT_INTEGER) {
            len += strlen("=<int>");
        }
        if (options->type == ARGPARSE_OPT_FLOAT) {
            len += strlen("=<flt>");
        } else if (options->type == ARGPARSE_OPT_STRING) {
            len += strlen("=<str>");
        }
        len = (len + 3) - ((len + 3) & 3);
        if (usage_opts_width < len) {
            usage_opts_width = len;
        }
    }
    usage_opts_width += 4;      // 4 spaces prefix

    options = self->options;
    for (; options->type != ARGPARSE_OPT_END; options++) {
        size_t pos = 0;
        size_t pad = 0;
        if (options->type == ARGPARSE_OPT_GROUP) {
            fputc('\n', stdout);
            fprintf(stdout, "%s", options->help);
            fputc('\n', stdout);
            continue;
        }
        pos = fprintf(stdout, "    ");
        if (options->short_name) {
            pos += fprintf(stdout, "-%c", options->short_name);
        }
        if (options->long_name && options->short_name) {
            pos += fprintf(stdout, ", ");
        }
        if (options->long_name) {
            pos += fprintf(stdout, "--%s", options->long_name);
        }
        if (options->type == ARGPARSE_OPT_INTEGER) {
            pos += fprintf(stdout, "=<int>");
        } else if (options->type == ARGPARSE_OPT_FLOAT) {
            pos += fprintf(stdout, "=<flt>");
        } else if (options->type == ARGPARSE_OPT_STRING) {
            pos += fprintf(stdout, "=<str>");
        }
        if (pos <= usage_opts_width) {
            pad = usage_opts_width - pos;
        } else {
            fputc('\n', stdout);
            pad = usage_opts_width;
        }
        fprintf(stdout, "%*s%s\n", (int)pad + 2, "", options->help);
    }

    // print epilog
    if (self->epilog)
        fprintf(stdout, "%s\n", self->epilog);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x8(%rdi), %rax
movq 0xd7e1(%rip), %rbx      # 0x28fd0
movq (%rbx), %rcx
testq %rax, %rax
je 0x1b851
leaq 0x8(%rax), %rdx
movq %rdx, 0x8(%r15)
movq (%rax), %rdx
leaq 0x4162(%rip), %rsi      # 0x1f96b
movq %rcx, %rdi
xorl %eax, %eax
callq 0x2250
movq 0x8(%r15), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x1b867
leaq 0x4150(%rip), %r14      # 0x1f976
cmpb $0x0, (%rcx)
je 0x1b867
movq (%rbx), %rdi
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x2250
movq 0x8(%r15), %rax
movq (%rax), %rcx
testq %rcx, %rcx
jne 0x1b826
jmp 0x1b867
leaq 0x4129(%rip), %rdi      # 0x1f981
movl $0x7, %esi
movl $0x1, %edx
callq 0x2380
movq 0x18(%r15), %rdx
testq %rdx, %rdx
je 0x1b881
movq (%rbx), %rdi
leaq 0x40f8(%rip), %rsi      # 0x1f972
xorl %eax, %eax
callq 0x2250
movq %r15, (%rsp)
movq (%r15), %rbx
movl (%rbx), %r13d
testl %r13d, %r13d
je 0x1b908
leaq 0x4(%rbx), %r15
xorl %ebp, %ebp
movl %r13d, %r14d
movq %rbp, %r12
movq 0x4(%r15), %rdi
xorl %eax, %eax
testq %rdi, %rdi
setne %al
cmpb $0x0, (%r15)
leaq 0x2(%rax,%rax), %rax
movl $0x0, %ebp
cmovneq %rax, %rbp
testq %rdi, %rdi
je 0x1b8cb
callq 0x2140
addq %rax, %rbp
addq $0x2, %rbp
leaq 0x6(%rbp), %rax
cmpl $0x4, %r14d
cmoveq %rax, %rbp
cmpl $0x6, %r14d
je 0x1b8e3
cmpl $0x5, %r14d
jne 0x1b8e6
movq %rax, %rbp
addq $0x3, %rbp
andq $-0x4, %rbp
cmpq %rbp, %r12
cmovaq %r12, %rbp
movl 0x34(%r15), %r14d
addq $0x38, %r15
testl %r14d, %r14d
jne 0x1b899
addq $0x4, %rbp
jmp 0x1b90d
movl $0x4, %ebp
leaq 0x4093(%rip), %r15      # 0x1f9a7
leaq 0x2881(%rip), %r12      # 0x1e19c
cmpl $0x1, %r13d
je 0x1ba0c
testl %r13d, %r13d
je 0x1ba46
movq 0xd69b(%rip), %r13      # 0x28fd0
movq (%r13), %rdi
leaq 0x1212(%rip), %rsi      # 0x1cb52
xorl %eax, %eax
callq 0x2250
movslq %eax, %r14
movsbl 0x4(%rbx), %edx
testl %edx, %edx
je 0x1b969
movq (%r13), %rdi
leaq 0x402c(%rip), %rsi      # 0x1f989
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
je 0x1b9af
cmpb $0x0, 0x4(%rbx)
je 0x1b998
movq (%r13), %rdi
leaq 0xa70(%rip), %rsi       # 0x1c3f3
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
je 0x1b9af
movq (%r13), %rdi
leaq 0x3fea(%rip), %rsi      # 0x1f98d
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
movl (%rbx), %eax
addl $-0x4, %eax
cmpl $0x2, %eax
ja 0x1b9d9
movl %eax, %eax
leaq 0x3eb2(%rip), %rcx      # 0x1f874
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq (%r13), %rdi
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
movq %rbp, %rdx
subq %r14, %rdx
jae 0x1b9f2
movq (%r13), %rsi
movl $0xa, %edi
callq 0x2200
movq %rbp, %rdx
movq (%r13), %rdi
addl $0x2, %edx
movq 0x18(%rbx), %r8
movq %r15, %rsi
movq %r12, %rcx
xorl %eax, %eax
callq 0x2250
jmp 0x1ba39
movq 0xd5bd(%rip), %r14      # 0x28fd0
movq (%r14), %rsi
movl $0xa, %edi
callq 0x2200
movq (%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0x2180
movq (%r14), %rsi
movl $0xa, %edi
callq 0x2200
movl 0x38(%rbx), %r13d
addq $0x38, %rbx
jmp 0x1b91b
movq (%rsp), %rax
movq 0x20(%rax), %rdx
testq %rdx, %rdx
movq 0xd578(%rip), %rax      # 0x28fd0
je 0x1ba79
movq (%rax), %rdi
leaq 0x3f0e(%rip), %rsi      # 0x1f972
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2250
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq