// File: vssense[P]Compiler/src/shlang/flag_manager.cpp
// Function: GetFlag(char const**, FlagInfo*, int*)
void GetFlag(const char** argv, FlagInfo* info, int* offset)
{
    assert(argv);
    assert(info);

    if (strcmp(argv[*offset], flags[0]) == 0)
    {
        printf("%s\n", help_message);
    }
    else if (strcmp(argv[*offset], flags[1]) == 0)
    {
        info->output_file = argv[++*offset];
    }
    else if (strcmp(argv[*offset], flags[2]) == 0)
    {
        info->asm_listing_required = true;
    }
    else if (strcmp(argv[*offset], flags[3]) == 0)
    {
        info->speed_optimization_required = true;
    }
    else if (strcmp(argv[*offset], flags[4]) == 0)
    {
        info->memory_optimization_required = true;
    }
    else if (strcmp(argv[*offset], flags[5]) == 0)
    {
        info->parser_dump_required = true;
    }
    else if (strcmp(argv[*offset], flags[6]) == 0)
    {
        info->tree_dump_required = true;
    }
    else if (strcmp(argv[*offset], flags[7]) == 0)
    {
        info->nametable_dump_required = true;
    }
    else if (strcmp(argv[*offset], flags[8]) == 0)
    {
        info->emit_tree_requiered = true;
    }
    else if (strcmp(argv[*offset], flags[9]) == 0)
    {
        info->emit_code_requiered = true;
    }
    else
    {
        printf("Unknown flag <%s>. Use -h for help.\n", argv[*offset]);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x146d
jmp 0x148c
leaq 0x108e(%rip), %rdi      # 0x2502
leaq 0x108c(%rip), %rsi      # 0x2507
movl $0x19, %edx
leaq 0x109c(%rip), %rcx      # 0x2523
callq 0x1060
cmpq $0x0, -0x10(%rbp)
je 0x1495
jmp 0x14b4
leaq 0xb68(%rip), %rdi       # 0x2004
leaq 0x1064(%rip), %rsi      # 0x2507
movl $0x1a, %edx
leaq 0x1074(%rip), %rcx      # 0x2523
callq 0x1060
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2b96(%rip), %rsi      # 0x4060
callq 0x1080
cmpl $0x0, %eax
jne 0x14ee
movq 0x2bd5(%rip), %rsi      # 0x40b0
leaq 0x1070(%rip), %rdi      # 0x2552
movb $0x0, %al
callq 0x1030
jmp 0x16bf
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2b64(%rip), %rsi      # 0x4068
callq 0x1080
cmpl $0x0, %eax
jne 0x1531
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rdx
movl (%rdx), %ecx
addl $0x1, %ecx
movl %ecx, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x16bd
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2b29(%rip), %rsi      # 0x4070
callq 0x1080
cmpl $0x0, %eax
jne 0x155e
movq -0x10(%rbp), %rax
movb $0x1, 0x15(%rax)
jmp 0x16bb
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2b04(%rip), %rsi      # 0x4078
callq 0x1080
cmpl $0x0, %eax
jne 0x158b
movq -0x10(%rbp), %rax
movb $0x1, 0x16(%rax)
jmp 0x16b9
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2adf(%rip), %rsi      # 0x4080
callq 0x1080
cmpl $0x0, %eax
jne 0x15b8
movq -0x10(%rbp), %rax
movb $0x1, 0x17(%rax)
jmp 0x16b7
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2aba(%rip), %rsi      # 0x4088
callq 0x1080
cmpl $0x0, %eax
jne 0x15e5
movq -0x10(%rbp), %rax
movb $0x1, 0x12(%rax)
jmp 0x16b5
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2a95(%rip), %rsi      # 0x4090
callq 0x1080
cmpl $0x0, %eax
jne 0x1612
movq -0x10(%rbp), %rax
movb $0x1, 0x13(%rax)
jmp 0x16b3
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2a70(%rip), %rsi      # 0x4098
callq 0x1080
cmpl $0x0, %eax
jne 0x163c
movq -0x10(%rbp), %rax
movb $0x1, 0x14(%rax)
jmp 0x16b1
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2a4e(%rip), %rsi      # 0x40a0
callq 0x1080
cmpl $0x0, %eax
jne 0x1666
movq -0x10(%rbp), %rax
movb $0x1, 0x10(%rax)
jmp 0x16af
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x2a2c(%rip), %rsi      # 0x40a8
callq 0x1080
cmpl $0x0, %eax
jne 0x1690
movq -0x10(%rbp), %rax
movb $0x1, 0x11(%rax)
jmp 0x16ad
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xeb0(%rip), %rdi       # 0x2556
movb $0x0, %al
callq 0x1030
jmp 0x16af
jmp 0x16b1
jmp 0x16b3
jmp 0x16b5
jmp 0x16b7
jmp 0x16b9
jmp 0x16bb
jmp 0x16bd
jmp 0x16bf
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)