#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#define N_FEATURES {n_features}
#define N_CLASSES {n_classes}

{left_childs}
{right_childs}
{thresholds}
{indices}
{classes}

int findMax(int nums[N_CLASSES]) {{
    int index = 0;
    for (int i = 0; i < N_CLASSES; i++) {{
        index = nums[i] > nums[index] ? i : index;
    }}
    return index;
}}

int {method_name}(double features[N_FEATURES], int node) {{
    if (thresholds[node] != -2) {{
        if (features[indices[node]] <= thresholds[node]) {{
            return {method_name}(features, lChilds[node]);
        }} else {{
            return {method_name}(features, rChilds[node]);
        }}
    }}
    return findMax(classes[node]);
}}

int main(int argc, const char * argv[]) {{

    /* Features: */
    double features[argc-1];
    int i;
    for (i = 1; i < argc; i++) {{
        features[i-1] = atof(argv[i]);
    }}

    /* Prediction: */
    printf("%d", {method_name}(features, 0));
    return 0;

}}
