// File: ridiculousfish[P]docopt_fish/docopt_fish_parse_tree.cpp
// Function: docopt_fish::usage_t::build_from_variables(std::vector<docopt_fish::rstring_t, std::allocator<docopt_fish::rstring_t>> const&, bool)
usage_t usage_t::build_from_variables(const std::vector<rstring_t> &variables,
                                      bool include_options_shortcut) {
    // Note this is safe because string literals are immortal
    usage_t usage;
    usage.prog_name = CONST_RSTRING("command");

    vector<expression_list_t> &alternations = usage.alternation_list.alternations;
    alternations.reserve(variables.size() + (include_options_shortcut ? 1 : 0));

    // Helper to build an options expression_t
    auto make_options_expr = []() -> expression_t {
        expression_t options_expr;
        options_expr.production = 3;
        options_expr.options_shortcut.present = true;
        return options_expr;
    };

    // Helper to build a variable expression
    auto make_variable_expr = [](const rstring_t &var_str) -> expression_t {
        simple_clause_t sclause;
        emplace_unique(&sclause.variable, variable_clause_t{var_str});
        expression_t expr;
        expr.production = 0;
        emplace_unique(&expr.simple_clause, std::move(sclause));
        return expr;
    };

    // Set variable clauses
    for (const rstring_t &var : variables) {
        expression_list_t exprs(make_variable_expr(var));
        if (include_options_shortcut) {
            exprs.expressions.push_back(make_options_expr());
        }
        alternations.push_back(std::move(exprs));
    }

    // Also include just an options clause
    if (include_options_shortcut) {
        alternations.emplace_back(expression_list_t(make_options_expr()));
    }
    return usage;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x1e8(%rbp)
movb %dl, %al
movq %rdi, %rcx
movq %rcx, -0x1e0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movb $0x0, -0x12(%rbp)
callq 0x27550
leaq 0x25095(%rip), %rsi     # 0x4bf00
leaq -0x30(%rbp), %rdi
movl $0x7, %edx
callq 0x275a0
jmp 0x26e7b
movq -0x1e8(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movups -0x30(%rbp), %xmm0
movups %xmm0, (%rax)
addq $0x18, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1be60
movq -0x1f0(%rbp), %rdi
movq %rax, %rsi
movzbl -0x11(%rbp), %eax
andl $0x1, %eax
addq %rax, %rsi
callq 0x275d0
jmp 0x26ec8
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x276d0
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
callq 0x27700
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x27730
testb $0x1, %al
jne 0x26f00
jmp 0x27024
leaq -0x60(%rbp), %rdi
callq 0x27770
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
leaq -0x4a(%rbp), %rsi
callq 0x27100
jmp 0x26f23
leaq -0x88(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x27790
jmp 0x26f38
leaq -0xf0(%rbp), %rdi
callq 0x202d0
testb $0x1, -0x11(%rbp)
je 0x26fe7
leaq -0x88(%rbp), %rax
movq %rax, -0x1f8(%rbp)
leaq -0x158(%rbp), %rdi
leaq -0x49(%rbp), %rsi
callq 0x271d0
jmp 0x26f6e
movq -0x1f8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x277e0
jmp 0x26f83
leaq -0x158(%rbp), %rdi
callq 0x202d0
jmp 0x26fe7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x270e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x202d0
jmp 0x270e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x27013
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x202d0
jmp 0x27013
movq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x27810
jmp 0x26ff9
leaq -0x88(%rbp), %rdi
callq 0x20130
leaq -0x60(%rbp), %rdi
callq 0x27840
jmp 0x26eea
leaq -0x88(%rbp), %rdi
callq 0x20130
jmp 0x270e9
testb $0x1, -0x11(%rbp)
je 0x270c3
movq -0x48(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x1d8(%rbp), %rdi
leaq -0x49(%rbp), %rsi
callq 0x271d0
jmp 0x2704b
leaq -0x170(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x27790
jmp 0x27060
movq -0x200(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x27860
jmp 0x27075
leaq -0x170(%rbp), %rdi
callq 0x20130
leaq -0x1d8(%rbp), %rdi
callq 0x202d0
jmp 0x270c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x270b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x20130
leaq -0x1d8(%rbp), %rdi
callq 0x202d0
jmp 0x270e9
movb $0x1, -0x12(%rbp)
testb $0x1, -0x12(%rbp)
jne 0x270d9
movq -0x1e8(%rbp), %rdi
callq 0x1bf80
movq -0x1e0(%rbp), %rax
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq -0x1e8(%rbp), %rdi
callq 0x1bf80
movq -0x38(%rbp), %rdi
callq 0x85d0
nop