// File: ridiculousfish[P]docopt_fish/docopt_fish_test.cpp
// Function: run_1_validation_test(char const*, char const*, char const*, unsigned long, unsigned long)
static void run_1_validation_test(const char *usage, const char *joined_argv, const char *expected_valids_str, size_t test_idx, size_t arg_idx) {
    /* Separate argv by spaces */
    string_list_t argv = split_nonempty(joined_argv, ' ');
    
    std::string expected_valids = expected_valids_str;
    
    /* Prepend the program name for every argument */
    argv.insert(argv.begin(), to_string("prog"));
    
    assert(expected_valids.size() + 1 == argv.size());
    
    /* Usage as a string */
    const string_t usage_str(usage, usage + strlen(usage));
    
    /* Perform the parsing */
    argument_parser_t parser(usage_str, nullptr);
    
    /* Validate arguments */
    std::vector<argument_status_t> statuses = parser.validate_arguments(argv, flag_match_allow_incomplete);
    
    /* Construct a string out of statuses */
    assert(statuses.size() == argv.size());
    
    if (statuses.at(0) != status_valid) {
        err("Test %lu.%lu: Program name not reported as valid!", test_idx, arg_idx);
    }
    
    std::string actual_valids;
    for (size_t i=1; i < statuses.size(); i++) {
        actual_valids.push_back('0' + statuses.at(i));
    }
    
    if (actual_valids != expected_valids) {
        err("Test %lu.%lu: Wrong validation. Expected '%s', got '%s'", test_idx, arg_idx, expected_valids.c_str(), actual_valids.c_str());
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movl $0x20, %edx
callq 0x40670
movq -0x18(%rbp), %rax
movq %rax, -0x130(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x85e0
movq -0x130(%rbp), %rsi
movq -0x128(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x2be70
jmp 0x43495
leaq -0x61(%rbp), %rdi
callq 0x8380
leaq -0x40(%rbp), %rdi
callq 0x19820
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x440d0
leaq 0xa671(%rip), %rsi      # 0x4db36
leaq -0xa8(%rbp), %rdi
callq 0x3af90
jmp 0x434d3
movq -0x80(%rbp), %rsi
leaq -0x40(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x44090
movq %rax, -0x138(%rbp)
jmp 0x434f0
movq -0x138(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x8590
leaq -0x60(%rbp), %rdi
callq 0x8210
addq $0x1, %rax
movq %rax, -0x140(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xc910
movq %rax, %rcx
movq -0x140(%rbp), %rax
cmpq %rcx, %rax
jne 0x43538
jmp 0x4359f
leaq 0xc12d(%rip), %rdi      # 0x4f66c
leaq 0xb5c5(%rip), %rsi      # 0x4eb0b
movl $0x212, %edx            # imm = 0x212
leaq 0xc144(%rip), %rcx      # 0x4f696
callq 0x81e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x8380
jmp 0x438ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x438a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x8590
jmp 0x438a4
movq -0x8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x8110
movq %rax, %rcx
movq -0x158(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x150(%rbp)
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x8130
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdx
movq -0x148(%rbp), %rcx
leaq -0xd0(%rbp), %rdi
callq 0x43f20
jmp 0x435f9
leaq -0xd1(%rbp), %rdi
callq 0x85f0
xorl %eax, %eax
movl %eax, %edx
leaq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xab40
jmp 0x4361e
leaq -0xf8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq 0xa460
jmp 0x4363c
leaq -0xf8(%rbp), %rdi
callq 0x26bc0
movq %rax, -0x160(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xc910
movq %rax, %rcx
movq -0x160(%rbp), %rax
cmpq %rcx, %rax
jne 0x43669
jmp 0x436c7
leaq 0xc07b(%rip), %rdi      # 0x4f6eb
leaq 0xb494(%rip), %rsi      # 0x4eb0b
movl $0x21e, %edx            # imm = 0x21E
leaq 0xc013(%rip), %rcx      # 0x4f696
callq 0x81e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xd1(%rbp), %rdi
callq 0x85f0
jmp 0x438a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x43898
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4388c
xorl %eax, %eax
movl %eax, %esi
leaq -0xf8(%rbp), %rdi
callq 0xd100
movq %rax, -0x168(%rbp)
jmp 0x436e0
movq -0x168(%rbp), %rax
cmpl $0x1, (%rax)
je 0x43717
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq 0xc00f(%rip), %rdi      # 0x4f70a
xorl %eax, %eax
callq 0x3b570
jmp 0x43704
jmp 0x43717
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x43880
leaq -0x118(%rbp), %rdi
callq 0x8480
movq $0x1, -0x120(%rbp)
movq -0x120(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x26bc0
movq %rax, %rcx
movq -0x170(%rbp), %rax
cmpq %rcx, %rax
jae 0x437c3
movq -0x120(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0xd100
movq %rax, -0x178(%rbp)
jmp 0x43773
movq -0x178(%rbp), %rax
movl (%rax), %eax
addl $0x30, %eax
movsbl %al, %esi
leaq -0x118(%rbp), %rdi
callq 0x8290
jmp 0x43790
jmp 0x43792
movq -0x120(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
jmp 0x4372e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x81c0
jmp 0x43880
leaq -0x118(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x49a10
testb $0x1, %al
jne 0x437d9
jmp 0x43835
movq -0x20(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x80f0
movq %rax, -0x180(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x80f0
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x180(%rbp), %rcx
movq %rax, %r8
leaq 0xbf12(%rip), %rdi      # 0x4f73c
xorl %eax, %eax
callq 0x3b570
jmp 0x43833
jmp 0x43835
leaq -0x118(%rbp), %rdi
callq 0x81c0
leaq -0xf8(%rbp), %rdi
callq 0xd1c0
leaq -0xe0(%rbp), %rdi
callq 0xac20
leaq -0xd0(%rbp), %rdi
callq 0x8590
leaq -0x60(%rbp), %rdi
callq 0x81c0
leaq -0x40(%rbp), %rdi
callq 0x12f80
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
leaq -0xf8(%rbp), %rdi
callq 0xd1c0
leaq -0xe0(%rbp), %rdi
callq 0xac20
leaq -0xd0(%rbp), %rdi
callq 0x8590
leaq -0x60(%rbp), %rdi
callq 0x81c0
leaq -0x40(%rbp), %rdi
callq 0x12f80
movq -0x70(%rbp), %rdi
callq 0x85d0
nop