This source file includes following definitions.
- main
 
#include "Halide.h"
#include <stdio.h>
using namespace Halide;
int main(int argc, char **argv) {
    Func first, second;
    Var x, y, yi;
    ImageParam tmp(Int(32), 2);
    
    first(x, y) = x + y;
    
    second(x, y) = tmp(x-1, y-1) + tmp(x+3, y+1);
    
    
    
    Buffer<int> out(1024, 1024);
    
    second.infer_input_bounds(out);
    
    Buffer<int> b = tmp.get();
    assert(b.data());
    assert(b.extent(0) == 1028);
    assert(b.extent(1) == 1026);
    
    
    first.realize(b);
    second.realize(out);
    
    Func first_and_second;
    first_and_second(x, y) = first(x-1, y-1) + first(x+3, y+1);
    Buffer<int> reference = first_and_second.realize(1024, 1024);
    for (int y = 0; y < 1024; y++) {
        for (int x = 0; x < 1024; x++) {
            if (out(x, y) != reference(x, y)) {
                printf("out(%d, %d) = %d instead of %d\n",
                       x, y, out(x, y), reference(x, y));
                return -1;
            }
        }
    }
    printf("Success!\n");
    return 0;
}