// File: /workspace/github_c_makefile_star2_O2/sebbekarlsson[P]cola/src/interpret.c
// Function: interpret_visit
ast_node* interpret_visit(ast_node* node) {
    if (!node)
        error_in_interpreter("Encountered a NULL node\n");
    
    switch (node->type) {
        case AST_TYPE_RETURN:
            return interpret_visit_return((ast_node_return*)node);
            break;
        case AST_TYPE_COMPOUND:
            return interpret_visit_compound((ast_node_compound*)node);
            break;
        case AST_TYPE_BINOP:
            return interpret_visit_binop((ast_node_binop*)node);
            break;
        case AST_TYPE_EMPTY:
            return interpret_visit_empty((ast_node_empty*)node);
            break;
        case AST_TYPE_CHAR:
            return interpret_visit_char((ast_node_char*)node);
            break;
        case AST_TYPE_IF:
            return interpret_visit_if((ast_node_if*)node);
            break;
        case AST_TYPE_ELSE:
            return interpret_visit_else((ast_node_else*)node);
            break;
        case AST_TYPE_WHILE:
            return interpret_visit_while((ast_node_while*)node);
            break;
        case AST_TYPE_FOREACH:
            return interpret_visit_foreach((ast_node_foreach*)node);
            break;
        case AST_TYPE_INTEGER:
            return interpret_visit_integer((ast_node_integer*)node);
            break;
        case AST_TYPE_FLOAT:
            return interpret_visit_float((ast_node_float*)node);
            break;
        case AST_TYPE_STRING:
            return interpret_visit_string((ast_node_string*)node);
            break;
        case AST_TYPE_COMPONENT:
            return interpret_visit_component((ast_node_component*)node);
            break;
        case AST_TYPE_VECPTR:
            return interpret_visit_vecptr((ast_node_vecptr*)node);
            break;
        case AST_TYPE_VECTOR:
            return interpret_visit_vector((ast_node_vector*)node);
            break;
        case AST_TYPE_VARIABLE:
            return interpret_visit_variable((ast_node_variable*)node);
            break;
        case AST_TYPE_FUNCTION_CALL:
            return interpret_visit_function_call((ast_node_function_call*)node);
            break;
        case AST_TYPE_VARIABLE_DEFINITION:
            return interpret_visit_variable_definition((ast_node_variable_definition*)node);
            break;
        case AST_TYPE_FUNCTION_DEFINITION:
            return interpret_visit_function_definition((ast_node_function_definition*)node);
            break;
        case AST_TYPE_INTERPRETER_INSTR:
            return interpret_visit_interpreter_instr((ast_node_interpreter_instr*)node);
            break;
        default:
            printf("Unhandled AST node (%d)\n", node->type);
            return (void*)0;
            break;
    }

    return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x1b9a
leaq 0x35bf(%rip), %rdi      # 0x5154
callq 0x1ad9
movl (%rbx), %esi
cmpq $0x15, %rsi
ja 0x1c08
leaq 0x34eb(%rip), %rax      # 0x5094
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1c89
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x29f5
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2890
movq %rbx, %rdi
callq 0x29d2
jmp 0x1bb2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x277d
movq %rbx, %rdi
callq 0x2952
jmp 0x1bb2
leaq 0x355e(%rip), %rdi      # 0x516d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x10a0
jmp 0x1bb2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1cdc
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1c97
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23d8
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2415
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x280a
movq %rbx, %rdi
callq 0x25db
jmp 0x1bb2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x247c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2435