#ifndef __X10_ARRAY_REGION_H
#define __X10_ARRAY_REGION_H

#include <x10rt.h>


#define X10_LANG_OBJECT_H_NODEPS
#include <x10/lang/Object.h>
#undef X10_LANG_OBJECT_H_NODEPS
#define X10_LANG_ITERABLE_H_NODEPS
#include <x10/lang/Iterable.h>
#undef X10_LANG_ITERABLE_H_NODEPS
namespace x10 { namespace array { 
class Point;
} } 
#define X10_LANG_INT_H_NODEPS
#include <x10/lang/Int.h>
#undef X10_LANG_INT_H_NODEPS
#define X10_LANG_BOOLEAN_H_NODEPS
#include <x10/lang/Boolean.h>
#undef X10_LANG_BOOLEAN_H_NODEPS
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace array { 
class EmptyRegion;
} } 
namespace x10 { namespace array { 
class FullRegion;
} } 
namespace x10 { namespace array { 
class PolyMatBuilder;
} } 
namespace x10 { namespace array { 
class PolyRow;
} } 
namespace x10 { namespace array { 
class MatBuilder;
} } 
namespace x10 { namespace array { 
class Row;
} } 
namespace x10 { namespace array { 
class PolyMat;
} } 
namespace x10 { namespace array { 
class PolyRegion;
} } 
namespace x10 { namespace array { 
template<class TPMGL(T)> class Array;
} } 
namespace x10 { namespace lang { 
class IllegalArgumentException;
} } 
namespace x10 { namespace lang { 
class String;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(Z1), class TPMGL(U)> class Fun_0_1;
} } 
namespace x10 { namespace array { 
class RectRegion1D;
} } 
namespace x10 { namespace compiler { 
class CompilerFlags;
} } 
namespace x10 { namespace lang { 
class FailedDynamicCheckException;
} } 
namespace x10 { namespace array { 
class RectRegion;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class Iterator;
} } 
namespace x10 { namespace lang { 
class IntRange;
} } 
namespace x10 { namespace lang { 
class Any;
} } 
namespace x10 { namespace compiler { 
class Inline;
} } 
namespace x10 { namespace lang { 
class Place;
} } 
namespace x10 { namespace array { 
class Dist;
} } 
namespace x10 { namespace array { 

class Region : public x10::lang::Object   {
    public:
    RTT_H_DECLS_CLASS
    
    x10_int FMGL(rank);
    
    x10_boolean FMGL(rect);
    
    x10_boolean FMGL(zeroBased);
    
    x10_boolean FMGL(rail);
    
    x10_int rank();
    x10_boolean rect();
    x10_boolean zeroBased();
    x10_boolean rail();
    static x10aux::ref<x10::array::Region> makeEmpty(x10_int rank);
    static x10aux::ref<x10::array::Region> makeFull(x10_int rank);
    static x10aux::ref<x10::array::Region> makeUnit();
    static x10aux::ref<x10::array::Region> makeHalfspace(x10aux::ref<x10::array::Point> normal,
                                                         x10_int k);
    static x10aux::ref<x10::array::Region> makeRectangularPoly(x10aux::ref<x10::array::Array<x10_int> > minArg,
                                                               x10aux::ref<x10::array::Array<x10_int> > maxArg);
    template<class TPMGL(S), class TPMGL(T)> static x10aux::ref<x10::array::Region>
      makeRectangular(x10aux::ref<x10::array::Array<TPMGL(S)> > minArg,
                      x10aux::ref<x10::array::Array<TPMGL(T)> > maxArg);
    static x10aux::ref<x10::array::Region> makeRectangular(
      x10_int min, x10_int max);
    static x10aux::ref<x10::array::Region> make(x10_int min,
                                                x10_int max);
    template<class TPMGL(T)> static x10aux::ref<x10::array::Region>
      make(x10aux::ref<x10::array::Array<TPMGL(T)> > regions);
    static x10aux::ref<x10::array::Region> makeBanded(x10_int size,
                                                      x10_int upper,
                                                      x10_int lower);
    static x10aux::ref<x10::array::Region> makeBanded(x10_int size);
    static x10aux::ref<x10::array::Region> makeUpperTriangular(
      x10_int size);
    static x10aux::ref<x10::array::Region> makeUpperTriangular(
      x10_int rowMin, x10_int colMin, x10_int size);
    static x10aux::ref<x10::array::Region> makeLowerTriangular(
      x10_int size);
    static x10aux::ref<x10::array::Region> makeLowerTriangular(
      x10_int rowMin, x10_int colMin, x10_int size);
    virtual x10_int size() = 0;
    virtual x10_boolean isConvex() = 0;
    virtual x10_boolean isEmpty() = 0;
    virtual x10_int indexOf(x10aux::ref<x10::array::Point> id__81) = 0;
    virtual x10_int indexOf(x10_int i0);
    virtual x10_int indexOf(x10_int i0, x10_int i1);
    virtual x10_int indexOf(x10_int i0, x10_int i1, x10_int i2);
    virtual x10_int indexOf(x10_int i0, x10_int i1, x10_int i2,
                            x10_int i3);
    virtual x10aux::ref<x10::array::Region> boundingBox();
    virtual x10aux::ref<x10::array::Region> computeBoundingBox(
      ) = 0;
    virtual x10aux::ref<x10::lang::Fun_0_1<x10_int, x10_int> >
      min() = 0;
    virtual x10aux::ref<x10::lang::Fun_0_1<x10_int, x10_int> >
      max() = 0;
    virtual x10_int min(x10_int i);
    virtual x10_int max(x10_int i);
    virtual x10aux::ref<x10::array::Point> minPoint();
    virtual x10aux::ref<x10::array::Point> maxPoint();
    virtual x10aux::ref<x10::array::Region> intersection(
      x10aux::ref<x10::array::Region> that) = 0;
    virtual x10_boolean disjoint(x10aux::ref<x10::array::Region> that);
    virtual x10aux::ref<x10::array::Region> product(x10aux::ref<x10::array::Region> that) = 0;
    virtual x10aux::ref<x10::array::Region> translate(x10aux::ref<x10::array::Point> v) = 0;
    virtual x10aux::ref<x10::array::Region> projection(x10_int axis) = 0;
    virtual x10aux::ref<x10::array::Region> eliminate(x10_int axis) = 0;
    virtual x10aux::ref<x10::lang::Iterator<x10aux::ref<x10::array::Point> > >
      iterator() = 0;
    template<class TPMGL(T)> static x10aux::ref<x10::array::Region>
      __implicit_convert(x10aux::ref<x10::array::Array<TPMGL(T)> > a);
    static x10aux::ref<x10::array::Region> __implicit_convert(
      x10aux::ref<x10::array::Array<x10::lang::IntRange> > a);
    static x10aux::ref<x10::array::Region> __implicit_convert(
      x10::lang::IntRange r);
    virtual x10aux::ref<x10::array::Region> __and(x10aux::ref<x10::array::Region> that);
    virtual x10aux::ref<x10::array::Region> __times(x10aux::ref<x10::array::Region> that);
    virtual x10aux::ref<x10::array::Region> __plus(x10aux::ref<x10::array::Point> v);
    virtual x10aux::ref<x10::array::Region> __inv_plus(x10aux::ref<x10::array::Point> v);
    virtual x10aux::ref<x10::array::Region> __minus(x10aux::ref<x10::array::Point> v);
    virtual x10_boolean equals(x10aux::ref<x10::lang::Any> that);
    virtual x10_boolean contains(x10aux::ref<x10::array::Region> that) = 0;
    virtual x10_boolean contains(x10aux::ref<x10::array::Point> p) = 0;
    virtual x10_boolean contains(x10_int i);
    virtual x10_boolean contains(x10_int i0, x10_int i1);
    virtual x10_boolean contains(x10_int i0, x10_int i1, x10_int i2);
    virtual x10_boolean contains(x10_int i0, x10_int i1, x10_int i2,
                                 x10_int i3);
    void _constructor(x10_int r, x10_boolean t, x10_boolean z);
    
    virtual x10aux::ref<x10::array::Dist> __arrow(x10::lang::Place p);
    virtual x10aux::ref<x10::array::Region> x10__array__Region____x10__array__Region__this(
      );
    
    // Serialization
    public: virtual void _serialize_body(x10aux::serialization_buffer& buf);
    
    public: void _deserialize_body(x10aux::deserialization_buffer& buf);
    
};

} } 
#endif // X10_ARRAY_REGION_H

namespace x10 { namespace array { 
class Region;
} } 

#ifndef X10_ARRAY_REGION_H_NODEPS
#define X10_ARRAY_REGION_H_NODEPS
#include <x10/lang/Object.h>
#include <x10/lang/Iterable.h>
#include <x10/array/Point.h>
#include <x10/lang/Int.h>
#include <x10/lang/Boolean.h>
#include <x10/array/EmptyRegion.h>
#include <x10/array/FullRegion.h>
#include <x10/array/PolyMatBuilder.h>
#include <x10/array/PolyRow.h>
#include <x10/array/MatBuilder.h>
#include <x10/array/Row.h>
#include <x10/array/PolyMat.h>
#include <x10/array/PolyRegion.h>
#include <x10/array/Array.h>
#include <x10/lang/IllegalArgumentException.h>
#include <x10/lang/String.h>
#include <x10/lang/Fun_0_1.h>
#include <x10/array/RectRegion1D.h>
#include <x10/compiler/CompilerFlags.h>
#include <x10/lang/FailedDynamicCheckException.h>
#include <x10/array/RectRegion.h>
#include <x10/lang/Iterator.h>
#include <x10/lang/IntRange.h>
#include <x10/lang/Any.h>
#include <x10/compiler/Inline.h>
#include <x10/lang/Place.h>
#include <x10/array/Dist.h>
#ifndef X10_ARRAY_REGION__CLOSURE__4_CLOSURE
#define X10_ARRAY_REGION__CLOSURE__4_CLOSURE
#include <x10/lang/Closure.h>
#include <x10/lang/Fun_0_1.h>
template<class TPMGL(S), class TPMGL(T)> class x10_array_Region__closure__4 : public x10::lang::Closure {
    public:
    
    static typename x10::lang::Fun_0_1<x10_int, TPMGL(S)>::template itable <x10_array_Region__closure__4<TPMGL(S),TPMGL(T) > > _itable;
    static x10aux::itable_entry _itables[2];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    // closure body
    TPMGL(S) __apply(x10_int i) {
        
        //#line 131 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
        return x10aux::nullCheck(minArg)->x10::array::Array<TPMGL(S)>::__apply(
                 i);
        
    }
    
    // captured environment
    x10aux::ref<x10::array::Array<TPMGL(S)> > minArg;
    
    x10aux::serialization_id_t _get_serialization_id() {
        return _serialization_id;
    }
    
    void _serialize_body(x10aux::serialization_buffer &buf) {
        buf.write(this->minArg);
    }
    
    template<class __T> static x10aux::ref<__T> _deserialize(x10aux::deserialization_buffer &buf) {
        x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >* storage = x10aux::alloc<x10_array_Region__closure__4<TPMGL(S),TPMGL(T) > >();
        buf.record_reference(x10aux::ref<x10_array_Region__closure__4<TPMGL(S),TPMGL(T) > >(storage));
        x10aux::ref<x10::array::Array<TPMGL(S)> > that_minArg = buf.read<x10aux::ref<x10::array::Array<TPMGL(S)> > >();
        x10aux::ref<x10_array_Region__closure__4<TPMGL(S),TPMGL(T) > > this_ = new (storage) x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >(that_minArg);
        return this_;
    }
    
    x10_array_Region__closure__4(x10aux::ref<x10::array::Array<TPMGL(S)> > minArg) : minArg(minArg) { }
    
    static const x10aux::serialization_id_t _serialization_id;
    
    static const x10aux::RuntimeType* getRTT() { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, TPMGL(S)> >(); }
    virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, TPMGL(S)> >(); }
    
    x10aux::ref<x10::lang::String> toString() {
        return x10aux::string_utils::lit(this->toNativeString());
    }
    
    const char* toNativeString() {
        return "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10:131";
    }

};

template<class TPMGL(S), class TPMGL(T)> typename x10::lang::Fun_0_1<x10_int, TPMGL(S)>::template itable <x10_array_Region__closure__4<TPMGL(S),TPMGL(T) > >x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >::_itable(&x10::lang::Reference::equals, &x10::lang::Closure::hashCode, &x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >::__apply, &x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >::toString, &x10::lang::Closure::typeName);
template<class TPMGL(S), class TPMGL(T)> x10aux::itable_entry x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >::_itables[2] = {x10aux::itable_entry(&x10aux::getRTT<x10::lang::Fun_0_1<x10_int, TPMGL(S)> >, &x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >::_itable),x10aux::itable_entry(NULL, NULL)};

template<class TPMGL(S), class TPMGL(T)> const x10aux::serialization_id_t x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10_array_Region__closure__4<TPMGL(S),TPMGL(T) >::template _deserialize<x10::lang::Reference>,x10aux::CLOSURE_KIND_NOT_ASYNC);

#endif // X10_ARRAY_REGION__CLOSURE__4_CLOSURE
#ifndef X10_ARRAY_REGION__CLOSURE__3_CLOSURE
#define X10_ARRAY_REGION__CLOSURE__3_CLOSURE
#include <x10/lang/Closure.h>
#include <x10/lang/Fun_0_1.h>
template<class TPMGL(S), class TPMGL(T)> class x10_array_Region__closure__3 : public x10::lang::Closure {
    public:
    
    static typename x10::lang::Fun_0_1<x10_int, x10_int>::template itable <x10_array_Region__closure__3<TPMGL(S),TPMGL(T) > > _itable;
    static x10aux::itable_entry _itables[2];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    // closure body
    x10_int __apply(x10_int arg52508) {
        
        //#line 131 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
        return x10aux::class_cast_unchecked<x10_int>(x10_array_Region__closure__4<TPMGL(S),TPMGL(T)>(minArg).__apply(arg52508));
        
    }
    
    // captured environment
    x10aux::ref<x10::array::Array<TPMGL(S)> > minArg;
    
    x10aux::serialization_id_t _get_serialization_id() {
        return _serialization_id;
    }
    
    void _serialize_body(x10aux::serialization_buffer &buf) {
        buf.write(this->minArg);
    }
    
    template<class __T> static x10aux::ref<__T> _deserialize(x10aux::deserialization_buffer &buf) {
        x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >* storage = x10aux::alloc<x10_array_Region__closure__3<TPMGL(S),TPMGL(T) > >();
        buf.record_reference(x10aux::ref<x10_array_Region__closure__3<TPMGL(S),TPMGL(T) > >(storage));
        x10aux::ref<x10::array::Array<TPMGL(S)> > that_minArg = buf.read<x10aux::ref<x10::array::Array<TPMGL(S)> > >();
        x10aux::ref<x10_array_Region__closure__3<TPMGL(S),TPMGL(T) > > this_ = new (storage) x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >(that_minArg);
        return this_;
    }
    
    x10_array_Region__closure__3(x10aux::ref<x10::array::Array<TPMGL(S)> > minArg) : minArg(minArg) { }
    
    static const x10aux::serialization_id_t _serialization_id;
    
    static const x10aux::RuntimeType* getRTT() { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, x10_int> >(); }
    virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, x10_int> >(); }
    
    x10aux::ref<x10::lang::String> toString() {
        return x10aux::string_utils::lit(this->toNativeString());
    }
    
    const char* toNativeString() {
        return "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10:131";
    }

};

template<class TPMGL(S), class TPMGL(T)> typename x10::lang::Fun_0_1<x10_int, x10_int>::template itable <x10_array_Region__closure__3<TPMGL(S),TPMGL(T) > >x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >::_itable(&x10::lang::Reference::equals, &x10::lang::Closure::hashCode, &x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >::__apply, &x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >::toString, &x10::lang::Closure::typeName);
template<class TPMGL(S), class TPMGL(T)> x10aux::itable_entry x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >::_itables[2] = {x10aux::itable_entry(&x10aux::getRTT<x10::lang::Fun_0_1<x10_int, x10_int> >, &x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >::_itable),x10aux::itable_entry(NULL, NULL)};

template<class TPMGL(S), class TPMGL(T)> const x10aux::serialization_id_t x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10_array_Region__closure__3<TPMGL(S),TPMGL(T) >::template _deserialize<x10::lang::Reference>,x10aux::CLOSURE_KIND_NOT_ASYNC);

#endif // X10_ARRAY_REGION__CLOSURE__3_CLOSURE
#ifndef X10_ARRAY_REGION__CLOSURE__6_CLOSURE
#define X10_ARRAY_REGION__CLOSURE__6_CLOSURE
#include <x10/lang/Closure.h>
#include <x10/lang/Fun_0_1.h>
template<class TPMGL(S), class TPMGL(T)> class x10_array_Region__closure__6 : public x10::lang::Closure {
    public:
    
    static typename x10::lang::Fun_0_1<x10_int, TPMGL(T)>::template itable <x10_array_Region__closure__6<TPMGL(S),TPMGL(T) > > _itable;
    static x10aux::itable_entry _itables[2];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    // closure body
    TPMGL(T) __apply(x10_int i) {
        
        //#line 132 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
        return x10aux::nullCheck(maxArg)->x10::array::Array<TPMGL(T)>::__apply(
                 i);
        
    }
    
    // captured environment
    x10aux::ref<x10::array::Array<TPMGL(T)> > maxArg;
    
    x10aux::serialization_id_t _get_serialization_id() {
        return _serialization_id;
    }
    
    void _serialize_body(x10aux::serialization_buffer &buf) {
        buf.write(this->maxArg);
    }
    
    template<class __T> static x10aux::ref<__T> _deserialize(x10aux::deserialization_buffer &buf) {
        x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >* storage = x10aux::alloc<x10_array_Region__closure__6<TPMGL(S),TPMGL(T) > >();
        buf.record_reference(x10aux::ref<x10_array_Region__closure__6<TPMGL(S),TPMGL(T) > >(storage));
        x10aux::ref<x10::array::Array<TPMGL(T)> > that_maxArg = buf.read<x10aux::ref<x10::array::Array<TPMGL(T)> > >();
        x10aux::ref<x10_array_Region__closure__6<TPMGL(S),TPMGL(T) > > this_ = new (storage) x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >(that_maxArg);
        return this_;
    }
    
    x10_array_Region__closure__6(x10aux::ref<x10::array::Array<TPMGL(T)> > maxArg) : maxArg(maxArg) { }
    
    static const x10aux::serialization_id_t _serialization_id;
    
    static const x10aux::RuntimeType* getRTT() { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, TPMGL(T)> >(); }
    virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, TPMGL(T)> >(); }
    
    x10aux::ref<x10::lang::String> toString() {
        return x10aux::string_utils::lit(this->toNativeString());
    }
    
    const char* toNativeString() {
        return "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10:132";
    }

};

template<class TPMGL(S), class TPMGL(T)> typename x10::lang::Fun_0_1<x10_int, TPMGL(T)>::template itable <x10_array_Region__closure__6<TPMGL(S),TPMGL(T) > >x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >::_itable(&x10::lang::Reference::equals, &x10::lang::Closure::hashCode, &x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >::__apply, &x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >::toString, &x10::lang::Closure::typeName);
template<class TPMGL(S), class TPMGL(T)> x10aux::itable_entry x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >::_itables[2] = {x10aux::itable_entry(&x10aux::getRTT<x10::lang::Fun_0_1<x10_int, TPMGL(T)> >, &x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >::_itable),x10aux::itable_entry(NULL, NULL)};

template<class TPMGL(S), class TPMGL(T)> const x10aux::serialization_id_t x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10_array_Region__closure__6<TPMGL(S),TPMGL(T) >::template _deserialize<x10::lang::Reference>,x10aux::CLOSURE_KIND_NOT_ASYNC);

#endif // X10_ARRAY_REGION__CLOSURE__6_CLOSURE
#ifndef X10_ARRAY_REGION__CLOSURE__5_CLOSURE
#define X10_ARRAY_REGION__CLOSURE__5_CLOSURE
#include <x10/lang/Closure.h>
#include <x10/lang/Fun_0_1.h>
template<class TPMGL(S), class TPMGL(T)> class x10_array_Region__closure__5 : public x10::lang::Closure {
    public:
    
    static typename x10::lang::Fun_0_1<x10_int, x10_int>::template itable <x10_array_Region__closure__5<TPMGL(S),TPMGL(T) > > _itable;
    static x10aux::itable_entry _itables[2];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    // closure body
    x10_int __apply(x10_int arg52509) {
        
        //#line 132 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
        return x10aux::class_cast_unchecked<x10_int>(x10_array_Region__closure__6<TPMGL(S),TPMGL(T)>(maxArg).__apply(arg52509));
        
    }
    
    // captured environment
    x10aux::ref<x10::array::Array<TPMGL(T)> > maxArg;
    
    x10aux::serialization_id_t _get_serialization_id() {
        return _serialization_id;
    }
    
    void _serialize_body(x10aux::serialization_buffer &buf) {
        buf.write(this->maxArg);
    }
    
    template<class __T> static x10aux::ref<__T> _deserialize(x10aux::deserialization_buffer &buf) {
        x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >* storage = x10aux::alloc<x10_array_Region__closure__5<TPMGL(S),TPMGL(T) > >();
        buf.record_reference(x10aux::ref<x10_array_Region__closure__5<TPMGL(S),TPMGL(T) > >(storage));
        x10aux::ref<x10::array::Array<TPMGL(T)> > that_maxArg = buf.read<x10aux::ref<x10::array::Array<TPMGL(T)> > >();
        x10aux::ref<x10_array_Region__closure__5<TPMGL(S),TPMGL(T) > > this_ = new (storage) x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >(that_maxArg);
        return this_;
    }
    
    x10_array_Region__closure__5(x10aux::ref<x10::array::Array<TPMGL(T)> > maxArg) : maxArg(maxArg) { }
    
    static const x10aux::serialization_id_t _serialization_id;
    
    static const x10aux::RuntimeType* getRTT() { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, x10_int> >(); }
    virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Fun_0_1<x10_int, x10_int> >(); }
    
    x10aux::ref<x10::lang::String> toString() {
        return x10aux::string_utils::lit(this->toNativeString());
    }
    
    const char* toNativeString() {
        return "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10:132";
    }

};

template<class TPMGL(S), class TPMGL(T)> typename x10::lang::Fun_0_1<x10_int, x10_int>::template itable <x10_array_Region__closure__5<TPMGL(S),TPMGL(T) > >x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >::_itable(&x10::lang::Reference::equals, &x10::lang::Closure::hashCode, &x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >::__apply, &x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >::toString, &x10::lang::Closure::typeName);
template<class TPMGL(S), class TPMGL(T)> x10aux::itable_entry x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >::_itables[2] = {x10aux::itable_entry(&x10aux::getRTT<x10::lang::Fun_0_1<x10_int, x10_int> >, &x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >::_itable),x10aux::itable_entry(NULL, NULL)};

template<class TPMGL(S), class TPMGL(T)> const x10aux::serialization_id_t x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10_array_Region__closure__5<TPMGL(S),TPMGL(T) >::template _deserialize<x10::lang::Reference>,x10aux::CLOSURE_KIND_NOT_ASYNC);

#endif // X10_ARRAY_REGION__CLOSURE__5_CLOSURE
#ifndef X10_ARRAY_REGION_H_GENERICS
#define X10_ARRAY_REGION_H_GENERICS
#ifndef X10_ARRAY_REGION_H_makeRectangular_500
#define X10_ARRAY_REGION_H_makeRectangular_500
template<class TPMGL(S), class TPMGL(T)> x10aux::ref<x10::array::Region> x10::array::Region::makeRectangular(
  x10aux::ref<x10::array::Array<TPMGL(S)> > minArg, x10aux::ref<x10::array::Array<TPMGL(T)> > maxArg) {
    
    //#line 127 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10If_c
    if ((x10aux::struct_equals(x10aux::nullCheck(minArg)->FMGL(size),
                               ((x10_int)1)))) {
        
        //#line 129 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
        return (__extension__ ({
            
            //#line 129 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
            x10aux::ref<x10::array::Region> __desugarer__var__41__40766 =
              x10aux::class_cast<x10aux::ref<x10::array::Region> >(x10::array::RectRegion1D::_make(x10aux::class_cast_unchecked<x10_int>(x10aux::nullCheck(minArg)->x10::array::Array<TPMGL(S)>::__apply(
                                                                                                                                           ((x10_int)0))),
                                                                                                   x10aux::class_cast_unchecked<x10_int>(x10aux::nullCheck(maxArg)->x10::array::Array<TPMGL(T)>::__apply(
                                                                                                                                           ((x10_int)0)))));
            
            //#line 129 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
            x10aux::ref<x10::array::Region> ret40767;
            
            //#line 129 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10If_c
            if (!((x10aux::struct_equals(x10aux::nullCheck(__desugarer__var__41__40766)->
                                           FMGL(rect), true)) &&
                (x10aux::struct_equals(x10aux::nullCheck(__desugarer__var__41__40766)->
                                         FMGL(rank), x10aux::nullCheck(minArg)->
                                                       FMGL(size)))))
            {
                
                //#line 129 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10If_c
                if (true) {
                    
                    //#line 129 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": polyglot.ast.Throw_c
                    x10aux::throwException(x10aux::nullCheck(x10::lang::FailedDynamicCheckException::_make(x10aux::string_utils::lit("x10.array.Region{self.rect==true, self.rank==minArg.size}"))));
                }
                
            }
            
            //#line 129 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": Eval of x10.ast.X10LocalAssign_c
            ret40767 = __desugarer__var__41__40766;
            ret40767;
        }))
        ;
        
    } else {
        
        //#line 131 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
        x10aux::ref<x10::array::Array<x10_int> > minArray =
          x10::array::Array<x10_int>::_make(x10aux::nullCheck(minArg)->
                                              FMGL(size),
                                            x10aux::ref<x10::lang::Fun_0_1<x10_int, x10_int> >(x10aux::ref<x10_array_Region__closure__3<TPMGL(S),TPMGL(T) > >(new (x10aux::alloc<x10::lang::Fun_0_1<x10_int, x10_int> >(sizeof(x10_array_Region__closure__3<TPMGL(S),TPMGL(T)>)))x10_array_Region__closure__3<TPMGL(S),TPMGL(T)>(minArg))));
        
        //#line 132 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
        x10aux::ref<x10::array::Array<x10_int> > maxArray =
          x10::array::Array<x10_int>::_make(x10aux::nullCheck(maxArg)->
                                              FMGL(size),
                                            x10aux::ref<x10::lang::Fun_0_1<x10_int, x10_int> >(x10aux::ref<x10_array_Region__closure__5<TPMGL(S),TPMGL(T) > >(new (x10aux::alloc<x10::lang::Fun_0_1<x10_int, x10_int> >(sizeof(x10_array_Region__closure__5<TPMGL(S),TPMGL(T)>)))x10_array_Region__closure__5<TPMGL(S),TPMGL(T)>(maxArg))));
        
        //#line 133 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
        return x10::array::RectRegion::_make(minArray, maxArray);
        
    }
    
}
#endif // X10_ARRAY_REGION_H_makeRectangular_500
#ifndef X10_ARRAY_REGION_H_make_503
#define X10_ARRAY_REGION_H_make_503
template<class TPMGL(T)> x10aux::ref<x10::array::Region> x10::array::Region::make(
  x10aux::ref<x10::array::Array<TPMGL(T)> > regions) {
    
    //#line 155 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
    x10aux::ref<x10::array::Region> r = x10aux::nullCheck(regions)->x10::array::Array<TPMGL(T)>::__apply(
                                          ((x10_int)0));
    
    //#line 156 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 156 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
             i = ((x10_int)1); ((i) < (x10aux::nullCheck(regions)->
                                         FMGL(size))); 
                                                       //#line 156 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": Eval of x10.ast.X10LocalAssign_c
                                                       i =
                                                         ((x10_int) ((i) + (((x10_int)1)))))
        {
            
            //#line 157 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": Eval of x10.ast.X10LocalAssign_c
            r = x10aux::nullCheck(r)->product(x10aux::class_cast_unchecked<x10aux::ref<x10::array::Region> >(x10aux::nullCheck(regions)->x10::array::Array<TPMGL(T)>::__apply(
                                                                                                               i)));
        }
    }
    
    //#line 160 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
    return (__extension__ ({
        
        //#line 160 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
        x10aux::ref<x10::array::Region> __desugarer__var__42__40769 =
          r;
        
        //#line 160 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10LocalDecl_c
        x10aux::ref<x10::array::Region> ret40770;
        
        //#line 160 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10If_c
        if (!((x10aux::struct_equals(x10aux::nullCheck(__desugarer__var__42__40769)->
                                       FMGL(rect), true)) &&
            (x10aux::struct_equals(x10aux::nullCheck(__desugarer__var__42__40769)->
                                     FMGL(rank), x10aux::nullCheck(regions)->
                                                   FMGL(size)))))
        {
            
            //#line 160 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10If_c
            if (true) {
                
                //#line 160 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": polyglot.ast.Throw_c
                x10aux::throwException(x10aux::nullCheck(x10::lang::FailedDynamicCheckException::_make(x10aux::string_utils::lit("x10.array.Region{self.rect==true, self.rank==regions.size}"))));
            }
            
        }
        
        //#line 160 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": Eval of x10.ast.X10LocalAssign_c
        ret40770 = __desugarer__var__42__40769;
        ret40770;
    }))
    ;
    
}
#endif // X10_ARRAY_REGION_H_make_503
#ifndef X10_ARRAY_REGION_H_implicit_operator_as_533
#define X10_ARRAY_REGION_H_implicit_operator_as_533
template<class TPMGL(T)> x10aux::ref<x10::array::Region> x10::array::Region::__implicit_convert(
  x10aux::ref<x10::array::Array<TPMGL(T)> > a) {
    
    //#line 404 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/array/Region.x10": x10.ast.X10Return_c
    return x10::array::Region::template make<TPMGL(T) >(a);
    
}
#endif // X10_ARRAY_REGION_H_implicit_operator_as_533
#endif // X10_ARRAY_REGION_H_GENERICS
#endif // __X10_ARRAY_REGION_H_NODEPS
