// File: /workspace/github_c_makefile_star2_O1/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 0xd93b(%rip), %rbx      # 0x29fd0
movq (%rbx), %rcx
testq %rax, %rax
je 0x1c6f7
leaq 0x8(%rax), %rdx
movq %rdx, 0x8(%r15)
movq (%rax), %rdx
leaq 0x4288(%rip), %rsi      # 0x20937
movq %rcx, %rdi
xorl %eax, %eax
callq 0x2250
movq 0x8(%r15), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x1c70d
leaq 0x4276(%rip), %r14      # 0x20942
cmpb $0x0, (%rcx)
je 0x1c70d
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 0x1c6cc
jmp 0x1c70d
leaq 0x424f(%rip), %rdi      # 0x2094d
movl $0x7, %esi
movl $0x1, %edx
callq 0x2380
movq 0x18(%r15), %rdx
testq %rdx, %rdx
je 0x1c727
movq (%rbx), %rdi
leaq 0x421e(%rip), %rsi      # 0x2093e
xorl %eax, %eax
callq 0x2250
movq %r15, (%rsp)
movq (%r15), %r13
movl (%r13), %r12d
testl %r12d, %r12d
je 0x1c7cc
leaq 0x4(%r13), %r14
xorl %ebp, %ebp
movq %rbp, %r15
movb (%r14), %al
xorl %ebx, %ebx
testb %al, %al
setne %bl
addl %ebx, %ebx
testb %al, %al
je 0x1c761
leaq 0x2(%rbx), %rax
cmpq $0x0, 0x4(%r14)
cmovneq %rax, %rbx
movq 0x4(%r14), %rdi
testq %rdi, %rdi
je 0x1c776
callq 0x2140
addq %rax, %rbx
addq $0x2, %rbx
leaq 0x6(%rbx), %rbp
cmpl $0x4, %r12d
cmovneq %rbx, %rbp
cmpl $0x6, %r12d
je 0x1c79b
cmpl $0x5, %r12d
movq 0xd83d(%rip), %rbx      # 0x29fd0
jne 0x1c7a6
addq $0x6, %rbp
jmp 0x1c7a6
addq $0x6, %rbp
movq 0xd82a(%rip), %rbx      # 0x29fd0
addq $0x3, %rbp
andq $-0x4, %rbp
cmpq %rbp, %r15
cmovaq %r15, %rbp
movl 0x34(%r14), %r12d
addq $0x38, %r14
testl %r12d, %r12d
jne 0x1c741
addq $0x4, %rbp
jmp 0x1c7d1
movl $0x4, %ebp
leaq 0x419b(%rip), %r15      # 0x20973
leaq 0x297d(%rip), %r12      # 0x1f15c
movl (%r13), %eax
cmpl $0x1, %eax
je 0x1c8c6
testl %eax, %eax
je 0x1c8f5
movq (%rbx), %rdi
leaq 0x1354(%rip), %rsi      # 0x1db52
xorl %eax, %eax
callq 0x2250
movslq %eax, %r14
movsbl 0x4(%r13), %edx
testl %edx, %edx
je 0x1c827
movq (%rbx), %rdi
leaq 0x413a(%rip), %rsi      # 0x20955
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
cmpq $0x0, 0x8(%r13)
je 0x1c84b
cmpb $0x0, 0x4(%r13)
je 0x1c84b
movq (%rbx), %rdi
leaq 0xbb4(%rip), %rsi       # 0x1d3f3
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
movq 0x8(%r13), %rdx
testq %rdx, %rdx
je 0x1c86a
movq (%rbx), %rdi
leaq 0x40fb(%rip), %rsi      # 0x20959
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
movl (%r13), %eax
addl $-0x4, %eax
cmpl $0x2, %eax
ja 0x1c895
movl %eax, %eax
leaq 0x3fc1(%rip), %rcx      # 0x20840
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq (%rbx), %rdi
xorl %eax, %eax
callq 0x2250
cltq
addq %rax, %r14
movq %rbp, %rdx
subq %r14, %rdx
jae 0x1c8ad
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x2200
movq %rbp, %rdx
movq (%rbx), %rdi
addl $0x2, %edx
movq 0x18(%r13), %r8
movq %r15, %rsi
movq %r12, %rcx
xorl %eax, %eax
callq 0x2250
jmp 0x1c8ec
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x2200
movq (%rbx), %rsi
movq 0x18(%r13), %rdi
callq 0x2180
movq (%rbx), %rsi
movl $0xa, %edi
callq 0x2200
addq $0x38, %r13
jmp 0x1c7df
movq (%rsp), %rax
movq 0x20(%rax), %rdx
testq %rdx, %rdx
je 0x1c921
movq (%rbx), %rdi
leaq 0x4032(%rip), %rsi      # 0x2093e
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