// File: moya-lang[P]Arguments/Example2.cpp
// Function: main
int main(int argc, const char **argv)
{
    Syntax syntax("My simple command-line tool", "1.0.0.1");

    syntax.add(Command("ignored", "ignored", "ignored", "General information on my application."));
    syntax.add(Parameter("first-param", "-a", "This is a required parameter with associated value.", true, true));
    syntax.add(Parameter("second-param", "-b", "This is an optional parameter without associated value.", false, false));

    Arguments arguments(argc, argv);
    Parser parser(syntax, arguments);
    if (!parser.parse()) {
        Help help(syntax, parser, arguments);
        return help.run();
    }

    std::cout << "Application started normally." << std::endl;
    std::cout << "Following arguments were parsed:" << std::endl;

    for (auto item : parser)
        std::cout << "   '" << item.first << "' = '" << item.second << "'" << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x540, %rsp            # imm = 0x540
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x4a0(%rbp)
callq 0x33b0
movq -0x4a0(%rbp), %rdx
leaq 0x6a7a(%rip), %rsi      # 0xa004
leaq -0x88(%rbp), %rdi
callq 0x3f60
jmp 0x3598
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x4a8(%rbp)
callq 0x33b0
movq -0x4a8(%rbp), %rdx
leaq 0x6a67(%rip), %rsi      # 0xa020
leaq -0xc0(%rbp), %rdi
callq 0x3f60
jmp 0x35c7
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x4010
jmp 0x35e0
leaq -0xc0(%rbp), %rdi
callq 0x3150
leaq -0xc1(%rbp), %rdi
callq 0x3280
leaq -0x88(%rbp), %rdi
callq 0x3150
leaq -0x89(%rbp), %rdi
callq 0x3280
leaq -0x181(%rbp), %rdi
movq %rdi, -0x4b0(%rbp)
callq 0x33b0
movq -0x4b0(%rbp), %rdx
leaq 0x69f7(%rip), %rsi      # 0xa028
leaq -0x180(%rbp), %rdi
callq 0x3f60
jmp 0x363f
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x4b8(%rbp)
callq 0x33b0
movq -0x4b8(%rbp), %rdx
leaq 0x69c8(%rip), %rsi      # 0xa028
leaq -0x1a8(%rbp), %rdi
callq 0x3f60
jmp 0x366e
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x33b0
movq -0x4c0(%rbp), %rdx
leaq 0x6999(%rip), %rsi      # 0xa028
leaq -0x1d0(%rbp), %rdi
callq 0x3f60
jmp 0x369d
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x4c8(%rbp)
callq 0x33b0
movq -0x4c8(%rbp), %rdx
leaq 0x6972(%rip), %rsi      # 0xa030
leaq -0x1f8(%rbp), %rdi
callq 0x3f60
jmp 0x36cc
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
leaq -0x1d0(%rbp), %rcx
leaq -0x1f8(%rbp), %r8
callq 0x40b0
jmp 0x36f6
leaq -0x68(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x4080
jmp 0x3708
leaq -0x160(%rbp), %rdi
callq 0x4190
leaq -0x1f8(%rbp), %rdi
callq 0x3150
leaq -0x1f9(%rbp), %rdi
callq 0x3280
leaq -0x1d0(%rbp), %rdi
callq 0x3150
leaq -0x1d1(%rbp), %rdi
callq 0x3280
leaq -0x1a8(%rbp), %rdi
callq 0x3150
leaq -0x1a9(%rbp), %rdi
callq 0x3280
leaq -0x180(%rbp), %rdi
callq 0x3150
leaq -0x181(%rbp), %rdi
callq 0x3280
leaq -0x289(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x33b0
movq -0x4d0(%rbp), %rdx
leaq 0x68c2(%rip), %rsi      # 0xa057
leaq -0x288(%rbp), %rdi
callq 0x3f60
jmp 0x37a3
leaq -0x2b1(%rbp), %rdi
movq %rdi, -0x4d8(%rbp)
callq 0x33b0
movq -0x4d8(%rbp), %rdx
leaq 0x689f(%rip), %rsi      # 0xa063
leaq -0x2b0(%rbp), %rdi
callq 0x3f60
jmp 0x37d2
leaq -0x2d9(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x33b0
movq -0x4e0(%rbp), %rdx
leaq 0x6873(%rip), %rsi      # 0xa066
leaq -0x2d8(%rbp), %rdi
callq 0x3f60
jmp 0x3801
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
leaq -0x2b0(%rbp), %rdx
leaq -0x2d8(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x4240
jmp 0x382d
leaq -0x68(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x41f0
jmp 0x383f
leaq -0x268(%rbp), %rdi
callq 0x4320
leaq -0x2d8(%rbp), %rdi
callq 0x3150
leaq -0x2d9(%rbp), %rdi
callq 0x3280
leaq -0x2b0(%rbp), %rdi
callq 0x3150
leaq -0x2b1(%rbp), %rdi
callq 0x3280
leaq -0x288(%rbp), %rdi
callq 0x3150
leaq -0x289(%rbp), %rdi
callq 0x3280
leaq -0x369(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x33b0
movq -0x4e8(%rbp), %rdx
leaq 0x67e6(%rip), %rsi      # 0xa09a
leaq -0x368(%rbp), %rdi
callq 0x3f60
jmp 0x38c2
leaq -0x391(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x33b0
movq -0x4f0(%rbp), %rdx
leaq 0x67c4(%rip), %rsi      # 0xa0a7
leaq -0x390(%rbp), %rdi
callq 0x3f60
jmp 0x38f1
leaq -0x3b9(%rbp), %rdi
movq %rdi, -0x4f8(%rbp)
callq 0x33b0
movq -0x4f8(%rbp), %rdx
leaq 0x6798(%rip), %rsi      # 0xa0aa
leaq -0x3b8(%rbp), %rdi
callq 0x3f60
jmp 0x3920
leaq -0x348(%rbp), %rdi
leaq -0x368(%rbp), %rsi
leaq -0x390(%rbp), %rdx
leaq -0x3b8(%rbp), %rcx
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0x4240
jmp 0x3949
leaq -0x68(%rbp), %rdi
leaq -0x348(%rbp), %rsi
callq 0x41f0
jmp 0x395b
leaq -0x348(%rbp), %rdi
callq 0x4320
leaq -0x3b8(%rbp), %rdi
callq 0x3150
leaq -0x3b9(%rbp), %rdi
callq 0x3280
leaq -0x390(%rbp), %rdi
callq 0x3150
leaq -0x391(%rbp), %rdi
callq 0x3280
leaq -0x368(%rbp), %rdi
callq 0x3150
leaq -0x369(%rbp), %rdi
callq 0x3280
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq -0x3d0(%rbp), %rdi
callq 0x4360
jmp 0x39c4
leaq -0x410(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x3d0(%rbp), %rdx
callq 0x4390
jmp 0x39dd
leaq -0x410(%rbp), %rdi
callq 0x43d0
movb %al, -0x4f9(%rbp)
jmp 0x39f1
movb -0x4f9(%rbp), %al
testb $0x1, %al
jne 0x3d53
jmp 0x3a01
leaq -0x438(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x410(%rbp), %rdx
leaq -0x3d0(%rbp), %rcx
callq 0x4500
jmp 0x3a21
leaq -0x438(%rbp), %rdi
callq 0x4550
movl %eax, -0x500(%rbp)
jmp 0x3a35
movl -0x500(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x43c(%rbp)
jmp 0x3f11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3aab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3a93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3150
leaq -0xc1(%rbp), %rdi
callq 0x3280
leaq -0x88(%rbp), %rdi
callq 0x3150
leaq -0x89(%rbp), %rdi
callq 0x3280
jmp 0x3f47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3b98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3b80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3b68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3b50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3b44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4190
leaq -0x1f8(%rbp), %rdi
callq 0x3150
leaq -0x1f9(%rbp), %rdi
callq 0x3280
leaq -0x1d0(%rbp), %rdi
callq 0x3150
leaq -0x1d1(%rbp), %rdi
callq 0x3280
leaq -0x1a8(%rbp), %rdi
callq 0x3150
leaq -0x1a9(%rbp), %rdi
callq 0x3280
leaq -0x180(%rbp), %rdi
callq 0x3150
leaq -0x181(%rbp), %rdi
callq 0x3280
jmp 0x3f3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3c56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3c3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3c26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3c1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x4320
leaq -0x2d8(%rbp), %rdi
callq 0x3150
leaq -0x2d9(%rbp), %rdi
callq 0x3280
leaq -0x2b0(%rbp), %rdi
callq 0x3150
leaq -0x2b1(%rbp), %rdi
callq 0x3280
leaq -0x288(%rbp), %rdi
callq 0x3150
leaq -0x289(%rbp), %rdi
callq 0x3280
jmp 0x3f3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3d14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3cfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3ce4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3cd8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x4320
leaq -0x3b8(%rbp), %rdi
callq 0x3150
leaq -0x3b9(%rbp), %rdi
callq 0x3280
leaq -0x390(%rbp), %rdi
callq 0x3150
leaq -0x391(%rbp), %rdi
callq 0x3280
leaq -0x368(%rbp), %rdi
callq 0x3150
leaq -0x369(%rbp), %rdi
callq 0x3280
jmp 0x3f3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3f3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3f32
movq 0xb27e(%rip), %rdi      # 0xefd8
leaq 0x6381(%rip), %rsi      # 0xa0e2
callq 0x3210
movq %rax, -0x508(%rbp)
jmp 0x3d6f
movq -0x508(%rbp), %rdi
movq 0xb24b(%rip), %rsi      # 0xefc8
callq 0x3250
jmp 0x3d84
movq 0xb24d(%rip), %rdi      # 0xefd8
leaq 0x636e(%rip), %rsi      # 0xa100
callq 0x3210
movq %rax, -0x510(%rbp)
jmp 0x3da0
movq -0x510(%rbp), %rdi
movq 0xb21a(%rip), %rsi      # 0xefc8
callq 0x3250
jmp 0x3db5
leaq -0x410(%rbp), %rax
movq %rax, -0x448(%rbp)
movq -0x448(%rbp), %rdi
callq 0x4860
movq %rax, -0x450(%rbp)
movq -0x448(%rbp), %rdi
callq 0x4890
movq %rax, -0x458(%rbp)
leaq -0x450(%rbp), %rdi
leaq -0x458(%rbp), %rsi
callq 0x48c0
testb $0x1, %al
jne 0x3e05
jmp 0x3f00
leaq -0x450(%rbp), %rdi
callq 0x48f0
movq %rax, %rsi
leaq -0x498(%rbp), %rdi
callq 0x4910
jmp 0x3e22
movq 0xb1af(%rip), %rdi      # 0xefd8
leaq 0x62f1(%rip), %rsi      # 0xa121
callq 0x3210
movq %rax, -0x518(%rbp)
jmp 0x3e3e
movq -0x518(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x31f0
movq %rax, -0x520(%rbp)
jmp 0x3e5a
movq -0x520(%rbp), %rdi
leaq 0x62be(%rip), %rsi      # 0xa126
callq 0x3210
movq %rax, -0x528(%rbp)
jmp 0x3e76
movq -0x528(%rbp), %rdi
leaq -0x478(%rbp), %rsi
callq 0x31f0
movq %rax, -0x530(%rbp)
jmp 0x3e92
movq -0x530(%rbp), %rdi
leaq 0x6284(%rip), %rsi      # 0xa124
callq 0x3210
movq %rax, -0x538(%rbp)
jmp 0x3eae
movq -0x538(%rbp), %rdi
movq 0xb10c(%rip), %rsi      # 0xefc8
callq 0x3250
jmp 0x3ec3
leaq -0x498(%rbp), %rdi
callq 0x4970
leaq -0x450(%rbp), %rdi
callq 0x49a0
jmp 0x3de9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x498(%rbp), %rdi
callq 0x4970
jmp 0x3f32
movl $0x0, -0x4(%rbp)
movl $0x1, -0x43c(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x49d0
leaq -0x68(%rbp), %rdi
callq 0x49f0
movl -0x4(%rbp), %eax
addq $0x540, %rsp            # imm = 0x540
popq %rbp
retq
leaq -0x410(%rbp), %rdi
callq 0x49d0
leaq -0x68(%rbp), %rdi
callq 0x49f0
movq -0x98(%rbp), %rdi
callq 0x33a0
nopw %cs:(%rax,%rax)
nopl (%rax)