// File: ridiculousfish[P]docopt_fish/docopt_fish_test.cpp
// Function: run_1_annotated_suggestion_test(unsigned long, unsigned long, char const*, std::pair<char const*, unsigned long>, std::vector<docopt_fish::annotated_option_t, std::allocator<docopt_fish::annotated_option_t>> const&)
static void run_1_annotated_suggestion_test(unsigned long test_idx, unsigned long arg_idx, const char *joined_argv, std::pair<const char *, size_t> expected_token_and_offset, const std::vector<annotated_option_t> &dopts) {
    
    // Separate argv by spaces
    // Ensure we have at least one argument (partial last)
    string_list_t argv = split(to_string(joined_argv), " ");
    if (argv.empty()) argv.push_back(string_t());
    
    // Prepend the program name for every test case
    argv.insert(argv.begin(), to_string("prog"));
    
    /* Perform the parsing */
    std::vector<doc_error_t> error_list;
    vector<size_t> unused_args;
    argument_parser_t parser;
    parser.set_options(dopts);
    suggestion_list_t results = parser.suggest_next_argument(argv, 0);
    
    const char *joined_expected_results = expected_token_and_offset.first;
    
    bool expects_error = ! strcmp(joined_expected_results, ERROR_EXPECTED);
    bool did_error = ! unused_args.empty() || ! error_list.empty();
    
    if (expects_error && ! did_error) {
        err("Direct option suggestion test %lu.%lu was expected to fail, but did not", test_idx, arg_idx);
    } else if (did_error && ! expects_error) {
        err("Direct option suggestion test %lu.%lu was expected to succeed, but instead errored", test_idx, arg_idx);
        for (size_t i=0; i < error_list.size(); i++) {
            fprintf(stderr, "\t%ls\n", wide(error_list.at(i).text));
        }
    } else if (! did_error && ! expects_error) {
        // joined_expected_results is a space-separated list
        string_t expected = to_string(joined_expected_results);
        string_t actual = join(results, " ");
        if (expected != actual) {
            if (expected != actual) {
                err("Annotated suggestion test %lu.%lu: Wrong suggestions. Expected '%ls', got '%ls'", test_idx, arg_idx, wide(expected), wide(actual));
            }
        }
        
        // Verify offsets
        size_t expected_offset = expected_token_and_offset.second;
        for (const suggestion_t &s : results) {
            if (s.offset != expected_offset) {
                err("Annotated suggestion test %lu.%lu: Wrong offset. Expected %lu, got %lu", test_idx, arg_idx, expected_offset, s.offset);
                break;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rcx, -0x10(%rbp)
movq %r8, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x28(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x3af90
movq -0x1e8(%rbp), %rsi
leaq 0xa150(%rip), %rdx      # 0x4bd85
leaq -0x48(%rbp), %rdi
callq 0x40c20
jmp 0x41c40
leaq -0x68(%rbp), %rdi
callq 0x8590
leaq -0x48(%rbp), %rdi
callq 0x13730
testb $0x1, %al
jne 0x41c58
jmp 0x41cc2
leaq -0x98(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x8150
movq -0x1f0(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x18c20
jmp 0x41c7d
leaq -0x98(%rbp), %rdi
callq 0x8590
jmp 0x41cc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8590
jmp 0x422bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8590
jmp 0x422b2
leaq -0x48(%rbp), %rdi
callq 0x19820
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x440d0
leaq 0xbe4a(%rip), %rsi      # 0x4db36
leaq -0xc8(%rbp), %rdi
callq 0x3af90
jmp 0x41cfa
movq -0xa0(%rbp), %rsi
leaq -0x48(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x44090
movq %rax, -0x1f8(%rbp)
jmp 0x41d1a
movq -0x1f8(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x8590
leaq -0xe8(%rbp), %rdi
callq 0xbe50
leaq -0x100(%rbp), %rdi
callq 0xcf10
leaq -0x108(%rbp), %rdi
callq 0xab20
jmp 0x41d5a
movq -0x30(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x467c0
jmp 0x41d6c
leaq -0x108(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xaa20
jmp 0x41d81
leaq -0x120(%rbp), %rdi
callq 0xe890
leaq -0x138(%rbp), %rdi
leaq -0x108(%rbp), %rsi
leaq -0x48(%rbp), %rdx
xorl %ecx, %ecx
callq 0xa620
jmp 0x41da8
movq -0x10(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rdi
leaq 0xadea(%rip), %rsi      # 0x4cbab
callq 0x8490
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x141(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x44140
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x1f9(%rbp)
jne 0x41df3
jmp 0x41e07
leaq -0xe8(%rbp), %rdi
callq 0xbfd0
xorb $-0x1, %al
movb %al, -0x1f9(%rbp)
movb -0x1f9(%rbp), %al
andb $0x1, %al
movb %al, -0x142(%rbp)
testb $0x1, -0x141(%rbp)
je 0x41eca
testb $0x1, -0x142(%rbp)
jne 0x41eca
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0xd158(%rip), %rdi      # 0x4ef96
xorl %eax, %eax
callq 0x3b570
jmp 0x41e47
jmp 0x42240
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x422b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x8590
jmp 0x422b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4229a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4228e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xe890
jmp 0x4228e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x42282
testb $0x1, -0x142(%rbp)
je 0x4203e
testb $0x1, -0x141(%rbp)
jne 0x4203e
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq 0xd0eb(%rip), %rdi      # 0x4efde
xorl %eax, %eax
callq 0x3b570
jmp 0x41efc
movq $0x0, -0x150(%rbp)
movq -0x150(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0xf550
movq %rax, %rcx
movq -0x208(%rbp), %rax
cmpq %rcx, %rax
jae 0x42039
movq 0x36095(%rip), %rax     # 0x77fd0
movq (%rax), %rax
movq %rax, -0x218(%rbp)
movq -0x150(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x44180
movq %rax, -0x210(%rbp)
jmp 0x41f61
movq -0x210(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x228(%rbp)
leaq -0x171(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x85e0
movq -0x228(%rbp), %rsi
movq -0x220(%rbp), %rdx
leaq -0x170(%rbp), %rdi
callq 0x2be70
jmp 0x41fa2
leaq -0x170(%rbp), %rdi
callq 0x407f0
movq %rax, -0x230(%rbp)
jmp 0x41fb7
movq -0x230(%rbp), %rdx
movq -0x218(%rbp), %rdi
leaq 0xca7c(%rip), %rsi      # 0x4ea48
movb $0x0, %al
callq 0x84b0
leaq -0x170(%rbp), %rdi
callq 0x81c0
leaq -0x171(%rbp), %rdi
callq 0x8380
movq -0x150(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x150(%rbp)
jmp 0x41f07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x42028
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x81c0
leaq -0x171(%rbp), %rdi
callq 0x8380
jmp 0x42282
jmp 0x4223e
testb $0x1, -0x142(%rbp)
jne 0x4223c
testb $0x1, -0x141(%rbp)
jne 0x4223c
movq -0x140(%rbp), %rsi
leaq -0x198(%rbp), %rdi
callq 0x3af90
jmp 0x4206d
leaq 0x9d11(%rip), %rdx      # 0x4bd85
leaq -0x1b8(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x3b020
jmp 0x42089
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x470e0
testb $0x1, %al
jne 0x420a5
jmp 0x42150
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x470e0
testb $0x1, %al
jne 0x420c1
jmp 0x4214e
movq -0x18(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x240(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3b6c0
movq %rax, -0x238(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x3b6c0
movq -0x248(%rbp), %rsi
movq -0x240(%rbp), %rdx
movq -0x238(%rbp), %rcx
movq %rax, %r8
leaq 0xcf1c(%rip), %rdi      # 0x4f031
xorl %eax, %eax
callq 0x3b570
jmp 0x4211e
jmp 0x4214e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4222e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x8590
jmp 0x4222e
jmp 0x42150
movq -0x8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
leaq -0x138(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0x15f00
movq %rax, -0x1d0(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0x15d60
movq %rax, -0x1d8(%rbp)
leaq -0x1d0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x15ff0
testb $0x1, %al
jne 0x421a8
jmp 0x42214
leaq -0x1d0(%rbp), %rdi
callq 0x15fb0
movq %rax, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
movq 0x88(%rax), %rax
cmpq -0x1c0(%rbp), %rax
je 0x42201
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x1c0(%rbp), %rcx
movq -0x1e0(%rbp), %rax
movq 0x88(%rax), %r8
leaq 0xce8b(%rip), %rdi      # 0x4f081
xorl %eax, %eax
callq 0x3b570
jmp 0x421ff
jmp 0x42214
jmp 0x42203
leaq -0x1d0(%rbp), %rdi
callq 0x161a0
jmp 0x4218f
leaq -0x1b8(%rbp), %rdi
callq 0x8590
leaq -0x198(%rbp), %rdi
callq 0x8590
jmp 0x4223c
leaq -0x198(%rbp), %rdi
callq 0x8590
jmp 0x42282
jmp 0x4223e
jmp 0x42240
leaq -0x138(%rbp), %rdi
callq 0x13c10
leaq -0x108(%rbp), %rdi
callq 0xac20
leaq -0x100(%rbp), %rdi
callq 0xd160
leaq -0xe8(%rbp), %rdi
callq 0xc3d0
leaq -0x48(%rbp), %rdi
callq 0x12f80
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
leaq -0x138(%rbp), %rdi
callq 0x13c10
leaq -0x108(%rbp), %rdi
callq 0xac20
leaq -0x100(%rbp), %rdi
callq 0xd160
leaq -0xe8(%rbp), %rdi
callq 0xc3d0
leaq -0x48(%rbp), %rdi
callq 0x12f80
movq -0x70(%rbp), %rdi
callq 0x85d0
nopw %cs:(%rax,%rax)