opencv_contrib Documentation

Repository for OpenCV's extra modules

10,214 stars C++ C++ 1 file ยท ~202,927 tokens #opencv
RAW Doc

Technical Documentation: opencv/opencv_contrib

โ„น๏ธ Provenance: Multi-Tier Ingestion ยท CodeWiki Reference

Overview (README.md)

Repository for OpenCV's extra modules

This repository is intended for the development of so-called "extra" modules,
contributed functionality. New modules quite often do not have stable API,
and they are not well-tested. Thus, they shouldn't be released as a part of the
official OpenCV distribution, since the library maintains binary compatibility,
and tries to provide decent performance and stability.

So, all the new modules should be developed separately, and published in the
opencv_contrib repository at first. Later, when the module matures and gains
popularity, it is moved to the central OpenCV repository, and the development team
provides production-quality support for this module.

How to build OpenCV with extra modules

You can build OpenCV, so it will include the modules from this repository. Contrib modules are under constant development and it is recommended to use them alongside the master branch or latest releases of OpenCV.

Here is the CMake command for you:

text
$ cd <opencv_build_directory>
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j5

As the result, OpenCV will be built in the <opencv_build_directory> with all
modules from opencv_contrib repository. If you don't want all of the modules,
use CMake's BUILD_opencv_* options. Like in this example:

text
$ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -DBUILD_opencv_legacy=OFF <opencv_source_directory>

If you also want to build the samples from the "samples" folder of each module, also include the "-DBUILD_EXAMPLES=ON" option.

If you prefer using the GUI version of CMake (cmake-gui), then, you can add opencv_contrib modules within opencv core by doing the following:

  1. Start cmake-gui.

  2. Select the opencv source code folder and the folder where binaries will be built (the 2 upper forms of the interface).

  3. Press the configure button. You will see all the opencv build parameters in the central interface.

  4. Browse the parameters and look for the form called OPENCV_EXTRA_MODULES_PATH (use the search form to focus rapidly on it).

  5. Complete this OPENCV_EXTRA_MODULES_PATH by the proper pathname to the <opencv_contrib>/modules value using its browse button.

  6. Press the configure button followed by the generate button (the first time, you will be asked which makefile style to use).

  7. Build the opencv core with the method you chose (make and make install if you chose Unix makefile at step 6).

  8. To run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.

Update the repository documentation

In order to keep a clean overview containing all contributed modules, the following files need to be created/adapted:

  1. Update the README.md file under the modules folder. Here, you add your model with a single-line description.

  2. Add a README.md inside your own module folder. This README explains which functionality (separate functions) is available, links to the corresponding samples, and explains in somewhat more detail what the module is expected to do. If any extra requirements are needed to build the module without problems, add them here also.


Modules Gapi Doc 10 Hld Overview (`modules/gapi/doc/10-hld-overview.md`)

High-level design overview {#gapi_hld}

[TOC]

G-API High-level design overview

G-API is a heterogeneous framework and provides an unified API to
program image processing pipelines with a number of supported
backends.

The key design idea is to keep pipeline code itself platform-neutral
while specifying which kernels to use and which devices to utilize
using extra parameters at graph compile (configuration) time. This
requirement has led to the following architecture:

There are three layers in this architecture:

  • API Layer -- this is the top layer, which implements G-API
    public interface, its building blocks and semantics.
    When user constructs a pipeline with G-API, he interacts with this
    layer directly, and the entities the user operates on (like cv::GMat
    or cv::GComputation) are provided by this layer.
  • Graph Compiler Layer -- this is the intermediate layer which
    unrolls user computation into a graph and then applies a number of
    transformations to it (e.g. optimizations). This layer is built atop
    of [ADE Framework](@ref gapi_detail_ade).
  • Backends Layer -- this is the lowest level layer, which lists a
    number of Backends. In contrast with the above two layers,
    backends are highly coupled with low-level platform details, with
    every backend standing for every platform. A backend operates on a
    processed graph (coming from the graph compiler) and executes this
    graph optimally for a specific platform or device.

API layer {#gapi_api_layer}

API layer is what user interacts with when defining and using a
pipeline (a Computation in G-API terms). API layer defines a set of
G-API dynamic objects which can be used as inputs, outputs, and
intermediate data objects within a graph:

  • cv::GMat
  • cv::GScalar
  • cv::GArray (template class)

API layer specifies a list of Operations which are defined on these
data objects -- so called kernels. See G-API [core](@ref gapi_core)
and [imgproc](@ref gapi_imgproc) namespaces for details on which
operations G-API provides by default.

G-API is not limited to these operations only -- users can define
their own kernels easily using a special macro G_TYPED_KERNEL().

API layer is also responsible for marshalling and storing operation
parameters on pipeline creation. In addition to the aforementioned
G-API dynamic objects, operations may also accept arbitrary
parameters (more on this [here](@ref gapi_detail_params)), so API
layer captures its values and stores internally upon the moment of
execution.

Finally, cv::GComputation and cv::GCompiled are the remaining
important components of API layer. The former wraps a series of G-API
expressions into an object (graph), and the latter is a product of
graph compilation (see [this chapter](@ref gapi_detail_compiler) for
details).

Graph compiler layer {#gapi_compiler}

Every G-API computation is compiled before it executes. Compilation
process is triggered in two ways:

  • implicitly, when cv::GComputation::apply() is used. In this case,
    graph compilation is then immediately followed by execution.
  • explicitly, when cv::GComputation::compile() is used. In this case,
    a cv::GCompiled object is returned which then can be invoked as a
    C++ functor.

The first way is recommended for cases when input data format is not
known in advance -- e.g. when it comes from an arbitrary input file.
The second way is recommended for deployment (production) scenarios
where input data characteristics are usually predefined.

Graph compilation process is built atop of ADE Framework. Initially, a
bipartite graph is generated from expressions captured by API layer.
This graph contains nodes of two types: Data and Operations. Graph
always starts and ends with a Data node(s), with Operations nodes
in-between. Every Operation node has inputs and outputs, both are Data
nodes.

After the initial graph is generated, it is actually processed by a
number of graph transformations, called passes. ADE Framework acts
as a compiler pass management engine, and passes are written
specifically for G-API.

There are different passes which check graph validity, refine details
on operations and data, organize nodes into clusters ("Islands") based
on affinity or user-specified regioning[TBD], and more. Backends also
are able to inject backend-specific passes into the compilation
process, see more on this in the [dedicated chapter](@ref gapi_detail_meta).

Result of graph compilation is a compiled object, represented by class
cv::GCompiled. A new cv::GCompiled object is always created regardless
if there was an explicit or implicit compilation request (see
above). Actual graph execution happens within cv::GCompiled and is
determined by backends which participated in the graph compilation.

@sa cv::GComputation::apply(), cv::GComputation::compile(), cv::GCompiled

Backends layer {#gapi_backends}

The above diagram lists two backends, OpenCV and Fluid. OpenCV
is so-called "reference backend", which implements G-API operations
using plain old OpenCV functions. This backend is useful for
prototyping on a familiar development system. Fluid is a plugin for
cache-efficient execution on CPU -- it implements a different
execution policy and operates with its own, special kernels. Fluid
backend allows to achieve less memory footprint and better memory
locality when running on CPU.

There may be more backends available, e.g. Halide, OpenCL, etc. --
G-API provides an uniform internal API to develop backends so any
enthusiast or a company are free to scale G-API on a new platform or
accelerator. In terms of OpenCV infrastructure, every new backend is a
new distinct OpenCV module, which extends G-API when build as a part
of OpenCV.

Graph execution {#gapi_compiled}

The way graph executed is defined by backends selected for
compilation. In fact, every backend builds its own execution script as
the final stage of graph compilation process, when an executable
(compiled) object is being generated. For example, in OpenCV backend,
this script is just a topologically-sorted sequence of OpenCV
functions to call; for Fluid backend, it is a similar thing -- a
topologically sorted list of Agents processing lines of input on
every iteration.

Graph execution is triggered in two ways:

  • via cv::GComputation::apply(), with graph compiled in-place exactly
    for the given input data;
  • via cv::GCompiled::operator()(), when the graph has been precompiled.

Both methods are polimorphic and take a variadic number of arguments,
with validity checks performed in runtime. If a number, shapes, and
formats of passed data objects differ from expected, a runtime
exception is thrown. G-API also provides typed wrappers to move
these checks to the compile time -- see cv::GComputationT<>.

G-API graph execution is declared stateless -- it means that a
compiled functor (cv::GCompiled) acts like a pure C++ function and
provides the same result for the same set of input arguments.

Both execution methods take \f$N+M\f$ parameters, where \f$N\f$ is a
number of inputs, and \f$M\f$ is a number of outputs on which a
cv::GComputation is defined. Note that while G-API types (cv::GMat,
etc) are used in definition, the execution methods accept OpenCV's
traditional data types (like cv::Mat) which hold actual data -- see
table in [parameter marshalling](@ref gapi_detail_params).

@sa @ref gapi_impl, @ref gapi_kernel_api


Modules Gapi Doc Slides README (`modules/gapi/doc/slides/README.md`)

G-API Overview

This is the latest overview slide deck on G-API.

Prerequisites

  • Emacs v24 or higher;
  • Org-mode 8.2.10;
  • pdflatex;
  • texlive-latex-recommended (Beamer package);
  • texlive-font-utils (epstopdf);
  • wget (for get_sty.sh).

Building

  1. Download and build the Metropolis theme with the script:
text
$ ./get_sty.sh
  1. Now open gapi_overview.org with Emacs and press C-c C-e l P.

Modules Plot Doc Plot (`modules/plot/doc/plot.rst`)

Plot - Module to Plot Data

.. highlight:: cpp

This Plot module allows you to easily plot data in 1D or 2D. You can change the size of the window, the limits of the axis and the colors of each element.


Modules Xfeatures2d Doc Agast (`modules/xfeatures2d/doc/agast.txt`)

/* This is AGAST and OAST, an optimal and accelerated corner detector
based on the accelerated segment tests
Below is the original copyright and the references */

/*
Copyright (C) 2010 Elmar Mair
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

text
*Redistributions of source code must retain the above copyright
 notice, this list of conditions and the following disclaimer.

*Redistributions in binary form must reproduce the above copyright
 notice, this list of conditions and the following disclaimer in the
 documentation and/or other materials provided with the distribution.

*Neither the name of the University of Cambridge nor the names of
 its contributors may be used to endorse or promote products derived
 from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
The references are:

  • Adaptive and Generic Corner Detection Based on the Accelerated Segment Test,
    Elmar Mair and Gregory D. Hager and Darius Burschka
    and Michael Suppa and Gerhard Hirzinger ECCV 2010
    URL: http://www6.in.tum.de/Main/ResearchAgast
    */

#include "precomp.hpp"
#include "agast_score.hpp"

#ifdef _MSC_VER
#pragma warning( disable : 4127 )
#endif

namespace cv
{

static void AGAST_5_8(InputArray _img, std::vector& keypoints, int threshold)
{

text
cv::Mat img;
if(!_img.getMat().isContinuous())
  img = _img.getMat().clone();
else
  img = _img.getMat();

size_t total = 0;
int xsize = img.cols;
int ysize = img.rows;
size_t nExpectedCorners = keypoints.capacity();
int x, y;
int xsizeB = xsize - 2;
int ysizeB = ysize - 1;
int width;

keypoints.resize(0);

int pixel_5_8_[16];
makeAgastOffsets(pixel_5_8_, (int)img.step, AgastFeatureDetector::AGAST_5_8);

short offset0 = (short) pixel_5_8_[0];
short offset1 = (short) pixel_5_8_[1];
short offset2 = (short) pixel_5_8_[2];
short offset3 = (short) pixel_5_8_[3];
short offset4 = (short) pixel_5_8_[4];
short offset5 = (short) pixel_5_8_[5];
short offset6 = (short) pixel_5_8_[6];
short offset7 = (short) pixel_5_8_[7];

width = xsize;

for(y = 1; y < ysizeB; y++)
{
    x = 0;
    while(true)
    {
      homogeneous:
      {
        x++;
        if(x > xsizeB)
            break;
        else
        {
            const unsigned char* const ptr = img.ptr() + y*width + x;
            const int cb = *ptr + threshold;
            const int c_b = *ptr - threshold;
            if(ptr[offset0] > cb)
              if(ptr[offset2] > cb)
                if(ptr[offset3] > cb)
                  if(ptr[offset5] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset4] > cb)
                        goto success_structured;
                      else
                        if(ptr[offset7] > cb)
                          goto success_structured;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset4] > cb)
                        if(ptr[offset6] > cb)
                          goto success_structured;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset1] > cb)
                      if(ptr[offset4] > cb)
                        goto success_homogeneous;
                      else
                        if(ptr[offset7] > cb)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                else
                  if(ptr[offset7] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset1] > cb)
                          goto success_structured;
                        else
                          if(ptr[offset4] > cb)
                            goto success_structured;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset1] > cb)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    if(ptr[offset5] < c_b)
                      if(ptr[offset3] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
              else
                if(ptr[offset5] > cb)
                  if(ptr[offset7] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset1] > cb)
                        goto success_homogeneous;
                      else
                        if(ptr[offset4] > cb)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
                else
                  if(ptr[offset5] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset2] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset4] < c_b)
                            goto success_structured;
                          else
                            goto homogeneous;
                        else
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset7] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
            else
            if(ptr[offset0] < c_b)
              if(ptr[offset2] < c_b)
                if(ptr[offset7] > cb)
                  if(ptr[offset3] < c_b)
                    if(ptr[offset5] < c_b)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          goto success_structured;
                        else
                          goto structured;
                      else
                        if(ptr[offset4] < c_b)
                          if(ptr[offset6] < c_b)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          goto success_structured;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset5] > cb)
                      if(ptr[offset3] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  if(ptr[offset7] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] < c_b)
                          goto success_structured;
                        else
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset1] < c_b)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset6] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            goto success_structured;
                          else
                            if(ptr[offset4] < c_b)
                              goto success_structured;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset1] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset3] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset4] < c_b)
                            goto success_structured;
                          else
                            goto homogeneous;
                        else
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset1] < c_b)
                          if(ptr[offset4] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
              else
                if(ptr[offset5] > cb)
                  if(ptr[offset3] > cb)
                    if(ptr[offset2] > cb)
                      if(ptr[offset1] > cb)
                        if(ptr[offset4] > cb)
                          goto success_structured;
                        else
                          goto homogeneous;
                      else
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset7] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    goto homogeneous;
                else
                  if(ptr[offset5] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset6] < c_b)
                        if(ptr[offset1] < c_b)
                          goto success_homogeneous;
                        else
                          if(ptr[offset4] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
            else
              if(ptr[offset3] > cb)
                if(ptr[offset5] > cb)
                  if(ptr[offset2] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset4] > cb)
                        goto success_homogeneous;
                      else
                        goto homogeneous;
                    else
                      if(ptr[offset4] > cb)
                        if(ptr[offset6] > cb)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset7] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset6] > cb)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  goto homogeneous;
              else
                if(ptr[offset3] < c_b)
                  if(ptr[offset5] < c_b)
                    if(ptr[offset2] < c_b)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                      else
                        if(ptr[offset4] < c_b)
                          if(ptr[offset6] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset7] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset6] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    goto homogeneous;
                else
                  goto homogeneous;
        }
      }
      structured:
      {
        x++;
        if(x > xsizeB)
            break;
        else
        {
            const unsigned char* const ptr = img.ptr() + y*width + x;
            const int cb = *ptr + threshold;
            const int c_b = *ptr - threshold;
            if(ptr[offset0] > cb)
              if(ptr[offset2] > cb)
                if(ptr[offset3] > cb)
                  if(ptr[offset5] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset1] > cb)
                        goto success_structured;
                      else
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset1] > cb)
                        if(ptr[offset4] > cb)
                          goto success_structured;
                        else
                          goto structured;
                      else
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          goto structured;
                  else
                    if(ptr[offset7] > cb)
                      if(ptr[offset1] > cb)
                        goto success_structured;
                      else
                        goto structured;
                    else
                      if(ptr[offset1] > cb)
                        if(ptr[offset4] > cb)
                          goto success_structured;
                        else
                          goto structured;
                      else
                        goto structured;
                else
                  if(ptr[offset7] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset1] > cb)
                          goto success_structured;
                        else
                          if(ptr[offset4] > cb)
                            goto success_structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset1] > cb)
                          goto success_structured;
                        else
                          goto structured;
                    else
                      goto structured;
                  else
                    if(ptr[offset5] < c_b)
                      if(ptr[offset3] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto structured;
              else
                if(ptr[offset5] > cb)
                  if(ptr[offset7] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset1] > cb)
                        goto success_structured;
                      else
                        if(ptr[offset4] > cb)
                          goto success_structured;
                        else
                          goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
                else
                  if(ptr[offset5] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset2] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset4] < c_b)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset7] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto structured;
                  else
                    goto homogeneous;
            else
            if(ptr[offset0] < c_b)
              if(ptr[offset2] < c_b)
                if(ptr[offset7] > cb)
                  if(ptr[offset3] < c_b)
                    if(ptr[offset5] < c_b)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          goto success_structured;
                        else
                          goto structured;
                      else
                        if(ptr[offset4] < c_b)
                          if(ptr[offset6] < c_b)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          goto success_structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset5] > cb)
                      if(ptr[offset3] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto homogeneous;
                    else
                      goto structured;
                else
                  if(ptr[offset7] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] < c_b)
                          goto success_structured;
                        else
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset1] < c_b)
                          goto success_structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset6] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            goto success_structured;
                          else
                            if(ptr[offset4] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset1] < c_b)
                            goto success_structured;
                          else
                            goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset3] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset4] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          if(ptr[offset4] < c_b)
                            if(ptr[offset6] < c_b)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset1] < c_b)
                          if(ptr[offset4] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
              else
                if(ptr[offset5] > cb)
                  if(ptr[offset3] > cb)
                    if(ptr[offset2] > cb)
                      if(ptr[offset1] > cb)
                        if(ptr[offset4] > cb)
                          goto success_structured;
                        else
                          goto structured;
                      else
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset7] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset6] > cb)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    goto structured;
                else
                  if(ptr[offset5] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset6] < c_b)
                        if(ptr[offset1] < c_b)
                          goto success_structured;
                        else
                          if(ptr[offset4] < c_b)
                            goto success_structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    goto homogeneous;
            else
              if(ptr[offset3] > cb)
                if(ptr[offset5] > cb)
                  if(ptr[offset2] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset4] > cb)
                        goto success_homogeneous;
                      else
                        goto homogeneous;
                    else
                      if(ptr[offset4] > cb)
                        if(ptr[offset6] > cb)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset7] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset6] > cb)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  goto homogeneous;
              else
                if(ptr[offset3] < c_b)
                  if(ptr[offset5] < c_b)
                    if(ptr[offset2] < c_b)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          goto success_homogeneous;
                        else
                          goto homogeneous;
                      else
                        if(ptr[offset4] < c_b)
                          if(ptr[offset6] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset7] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset6] < c_b)
                            goto success_homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    goto homogeneous;
                else
                  goto homogeneous;
        }
      }
        success_homogeneous:
        if(total == nExpectedCorners)
        {
            if(nExpectedCorners == 0)
            {
                nExpectedCorners = 512;
                keypoints.reserve(nExpectedCorners);
            }
            else
            {
                nExpectedCorners *= 2;
                keypoints.reserve(nExpectedCorners);
            }
        }
        keypoints.push_back(KeyPoint(Point2f((float)x, (float)y), 1.0f));
        total++;
        goto homogeneous;
        success_structured:
        if(total == nExpectedCorners)
        {
            if(nExpectedCorners == 0)
            {
                nExpectedCorners = 512;
                keypoints.reserve(nExpectedCorners);
            }
            else
            {
                nExpectedCorners *= 2;
                keypoints.reserve(nExpectedCorners);
            }
        }
        keypoints.push_back(KeyPoint(Point2f((float)x, (float)y), 1.0f));
        total++;
        goto structured;
    }
}

}

static void AGAST_7_12d(InputArray _img, std::vector& keypoints, int threshold)
{
cv::Mat img;
if(!_img.getMat().isContinuous())
img = _img.getMat().clone();
else
img = _img.getMat();

text
size_t total = 0;
int xsize = img.cols;
int ysize = img.rows;
size_t nExpectedCorners = keypoints.capacity();
int x, y;
int xsizeB = xsize - 4;
int ysizeB = ysize - 3;
int width;

keypoints.resize(0);

int pixel_7_12d_[16];
makeAgastOffsets(pixel_7_12d_, (int)img.step, AgastFeatureDetector::AGAST_7_12d);

short offset0 = (short) pixel_7_12d_[0];
short offset1 = (short) pixel_7_12d_[1];
short offset2 = (short) pixel_7_12d_[2];
short offset3 = (short) pixel_7_12d_[3];
short offset4 = (short) pixel_7_12d_[4];
short offset5 = (short) pixel_7_12d_[5];
short offset6 = (short) pixel_7_12d_[6];
short offset7 = (short) pixel_7_12d_[7];
short offset8 = (short) pixel_7_12d_[8];
short offset9 = (short) pixel_7_12d_[9];
short offset10 = (short) pixel_7_12d_[10];
short offset11 = (short) pixel_7_12d_[11];

width = xsize;

for(y = 3; y < ysizeB; y++)
{
    x = 2;
    while(true)
    {
      homogeneous:
      {
        x++;
        if(x > xsizeB)
            break;
        else
        {
            const unsigned char* const ptr = img.ptr() + y*width + x;
            const int cb = *ptr + threshold;
            const int c_b = *ptr - threshold;
            if(ptr[offset0] > cb)
              if(ptr[offset5] > cb)
                if(ptr[offset2] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset6] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset4] > cb)
                            goto success_homogeneous;
                          else
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset4] > cb)
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset6] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset3] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset6] > cb)
                            goto success_homogeneous;
                          else
                            if(ptr[offset11] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset7] > cb)
                              if(ptr[offset8] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  if(ptr[offset9] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset8] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
              else
                if(ptr[offset5] < c_b)
                  if(ptr[offset9] > cb)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset4] < c_b)
                        if(ptr[offset11] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset2] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset2] < c_b)
                                  if(ptr[offset7] < c_b)
                                    if(ptr[offset8] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset10] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset2] < c_b)
                                  if(ptr[offset7] < c_b)
                                    if(ptr[offset1] < c_b)
                                      goto success_structured;
                                    else
                                      if(ptr[offset8] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                        else
                          if(ptr[offset2] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset1] < c_b)
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset1] > cb)
                                if(ptr[offset2] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset11] > cb)
                        if(ptr[offset10] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset1] > cb)
                              if(ptr[offset2] > cb)
                                goto success_homogeneous;
                              else
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset1] > cb)
                                if(ptr[offset2] > cb)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset7] > cb)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset9] < c_b)
                      if(ptr[offset2] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset4] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    if(ptr[offset11] < c_b)
                                      if(ptr[offset10] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                    else
                                      goto structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset7] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset4] < c_b)
                                      goto success_structured;
                                    else
                                      if(ptr[offset11] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                  else
                                    if(ptr[offset3] < c_b)
                                      if(ptr[offset4] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                    else
                                      goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset4] < c_b)
                                  if(ptr[offset3] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset10] < c_b)
                                      goto success_structured;
                                    else
                                      goto homogeneous;
                                else
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset11] < c_b)
                                      goto success_structured;
                                    else
                                      goto homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset2] < c_b)
                                if(ptr[offset1] < c_b)
                                  if(ptr[offset3] < c_b)
                                    if(ptr[offset4] < c_b)
                                      goto success_structured;
                                    else
                                      goto homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset2] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        if(ptr[offset2] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              if(ptr[offset7] < c_b)
                                if(ptr[offset1] < c_b)
                                  if(ptr[offset6] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  if(ptr[offset6] < c_b)
                                    if(ptr[offset8] < c_b)
                                      goto success_homogeneous;
                                    else
                                      goto homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                else
                  if(ptr[offset2] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset8] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    if(ptr[offset9] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              if(ptr[offset1] > cb)
                                goto success_homogeneous;
                              else
                                if(ptr[offset6] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
            else
            if(ptr[offset0] < c_b)
              if(ptr[offset2] > cb)
                if(ptr[offset5] > cb)
                  if(ptr[offset7] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset1] > cb)
                            goto success_homogeneous;
                          else
                            if(ptr[offset8] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset9] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                goto success_structured;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset9] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    if(ptr[offset9] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  if(ptr[offset9] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset3] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
              else
                if(ptr[offset2] < c_b)
                  if(ptr[offset9] > cb)
                    if(ptr[offset5] > cb)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset10] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_structured;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset11] > cb)
                                    if(ptr[offset10] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset7] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  if(ptr[offset4] > cb)
                                    goto success_structured;
                                  else
                                    if(ptr[offset11] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  if(ptr[offset3] > cb)
                                    if(ptr[offset4] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset4] > cb)
                                if(ptr[offset3] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset3] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset5] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset11] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset1] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset9] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset6] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset4] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset4] < c_b)
                                      if(ptr[offset7] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                    else
                                      goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset11] < c_b)
                              if(ptr[offset3] < c_b)
                                if(ptr[offset4] < c_b)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset10] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset4] < c_b)
                                  if(ptr[offset3] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset10] < c_b)
                                      goto success_structured;
                                    else
                                      goto homogeneous;
                                else
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset11] < c_b)
                                      goto success_structured;
                                    else
                                      goto homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset3] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset8] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset3] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset5] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset11] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset1] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                else
                  if(ptr[offset9] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset3] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    if(ptr[offset5] > cb)
                      if(ptr[offset9] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset4] > cb)
                                if(ptr[offset3] > cb)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset10] > cb)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
            else
              if(ptr[offset5] > cb)
                if(ptr[offset9] > cb)
                  if(ptr[offset6] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset8] > cb)
                            goto success_homogeneous;
                          else
                            if(ptr[offset1] > cb)
                              if(ptr[offset2] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
                else
                  if(ptr[offset2] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
              else
                if(ptr[offset5] < c_b)
                  if(ptr[offset9] < c_b)
                    if(ptr[offset6] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset8] < c_b)
                              goto success_homogeneous;
                            else
                              if(ptr[offset1] < c_b)
                                if(ptr[offset2] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset11] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    if(ptr[offset2] < c_b)
                      if(ptr[offset3] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  goto homogeneous;
        }
      }
      structured:
      {
        x++;
        if(x > xsizeB)
            break;
        else
        {
            const unsigned char* const ptr = img.ptr() + y*width + x;
            const int cb = *ptr + threshold;
            const int c_b = *ptr - threshold;
            if(ptr[offset0] > cb)
              if(ptr[offset5] > cb)
                if(ptr[offset2] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset6] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset4] > cb)
                            goto success_structured;
                          else
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset4] > cb)
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset10] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset6] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset3] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset6] > cb)
                            goto success_structured;
                          else
                            if(ptr[offset11] > cb)
                              goto success_structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset7] > cb)
                              if(ptr[offset8] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                else
                  if(ptr[offset9] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset8] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
              else
                if(ptr[offset5] < c_b)
                  if(ptr[offset9] > cb)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset4] < c_b)
                        if(ptr[offset11] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset2] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset2] < c_b)
                                  if(ptr[offset7] < c_b)
                                    if(ptr[offset8] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset10] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset2] < c_b)
                                  if(ptr[offset7] < c_b)
                                    if(ptr[offset1] < c_b)
                                      goto success_structured;
                                    else
                                      if(ptr[offset8] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                        else
                          if(ptr[offset2] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset1] < c_b)
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset1] > cb)
                                if(ptr[offset2] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset11] > cb)
                        if(ptr[offset10] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset1] > cb)
                              if(ptr[offset2] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset1] > cb)
                                if(ptr[offset2] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset9] < c_b)
                      if(ptr[offset2] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset4] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    if(ptr[offset11] < c_b)
                                      if(ptr[offset10] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset7] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset4] < c_b)
                                      goto success_structured;
                                    else
                                      if(ptr[offset11] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                  else
                                    if(ptr[offset3] < c_b)
                                      if(ptr[offset4] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                    else
                                      goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset4] < c_b)
                                  if(ptr[offset3] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset10] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset11] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset2] < c_b)
                                if(ptr[offset1] < c_b)
                                  if(ptr[offset3] < c_b)
                                    if(ptr[offset4] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset2] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        if(ptr[offset2] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              if(ptr[offset7] < c_b)
                                if(ptr[offset1] < c_b)
                                  if(ptr[offset6] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  if(ptr[offset6] < c_b)
                                    if(ptr[offset8] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto homogeneous;
                else
                  if(ptr[offset2] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset8] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    if(ptr[offset9] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              if(ptr[offset1] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset6] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
            else
            if(ptr[offset0] < c_b)
              if(ptr[offset2] > cb)
                if(ptr[offset5] > cb)
                  if(ptr[offset7] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset1] > cb)
                            goto success_structured;
                          else
                            if(ptr[offset8] > cb)
                              goto success_structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset9] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset9] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      goto structured;
                  else
                    if(ptr[offset9] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                else
                  if(ptr[offset9] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset3] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
              else
                if(ptr[offset2] < c_b)
                  if(ptr[offset9] > cb)
                    if(ptr[offset5] > cb)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset10] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset11] > cb)
                                    if(ptr[offset10] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset7] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  if(ptr[offset4] > cb)
                                    goto success_structured;
                                  else
                                    if(ptr[offset11] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  if(ptr[offset3] > cb)
                                    if(ptr[offset4] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset4] > cb)
                                if(ptr[offset3] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset3] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset5] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset1] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset9] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset6] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset4] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset4] < c_b)
                                      if(ptr[offset7] < c_b)
                                        goto success_structured;
                                      else
                                        goto structured;
                                    else
                                      goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset11] < c_b)
                              if(ptr[offset3] < c_b)
                                if(ptr[offset4] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset4] < c_b)
                                  if(ptr[offset3] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset10] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset11] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset3] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset8] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset3] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset5] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset1] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                else
                  if(ptr[offset9] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset3] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    if(ptr[offset5] > cb)
                      if(ptr[offset9] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset4] > cb)
                                if(ptr[offset3] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto homogeneous;
                    else
                      goto structured;
            else
              if(ptr[offset5] > cb)
                if(ptr[offset9] > cb)
                  if(ptr[offset6] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset8] > cb)
                            goto success_structured;
                          else
                            if(ptr[offset1] > cb)
                              if(ptr[offset2] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
                else
                  if(ptr[offset2] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
              else
                if(ptr[offset5] < c_b)
                  if(ptr[offset9] < c_b)
                    if(ptr[offset6] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset8] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset1] < c_b)
                                if(ptr[offset2] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset11] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    if(ptr[offset2] < c_b)
                      if(ptr[offset3] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                else
                  goto homogeneous;
        }
      }
      success_homogeneous:
        if(total == nExpectedCorners)
        {
            if(nExpectedCorners == 0)
            {
                nExpectedCorners = 512;
                keypoints.reserve(nExpectedCorners);
            }
            else
            {
                nExpectedCorners *= 2;
                keypoints.reserve(nExpectedCorners);
            }
        }
        keypoints.push_back(KeyPoint(Point2f((float)x, (float)y), 1.0f));
        total++;
        goto homogeneous;
      success_structured:
        if(total == nExpectedCorners)
        {
            if(nExpectedCorners == 0)
            {
                nExpectedCorners = 512;
                keypoints.reserve(nExpectedCorners);
            }
            else
            {
                nExpectedCorners *= 2;
                keypoints.reserve(nExpectedCorners);
            }
        }
        keypoints.push_back(KeyPoint(Point2f((float)x, (float)y), 1.0f));
        total++;
        goto structured;
    }
}

}

static void AGAST_7_12s(InputArray _img, std::vector& keypoints, int threshold)
{
cv::Mat img;
if(!_img.getMat().isContinuous())
img = _img.getMat().clone();
else
img = _img.getMat();

text
size_t total = 0;
int xsize = img.cols;
int ysize = img.rows;
size_t nExpectedCorners = keypoints.capacity();
int x, y;
int xsizeB=xsize - 3; //2, +1 due to faster test x>xsizeB
int ysizeB=ysize - 2;
int width;

keypoints.resize(0);

int pixel_7_12s_[16];
makeAgastOffsets(pixel_7_12s_, (int)img.step, AgastFeatureDetector::AGAST_7_12s);

short offset0 = (short) pixel_7_12s_[0];
short offset1 = (short) pixel_7_12s_[1];
short offset2 = (short) pixel_7_12s_[2];
short offset3 = (short) pixel_7_12s_[3];
short offset4 = (short) pixel_7_12s_[4];
short offset5 = (short) pixel_7_12s_[5];
short offset6 = (short) pixel_7_12s_[6];
short offset7 = (short) pixel_7_12s_[7];
short offset8 = (short) pixel_7_12s_[8];
short offset9 = (short) pixel_7_12s_[9];
short offset10 = (short) pixel_7_12s_[10];
short offset11 = (short) pixel_7_12s_[11];

width = xsize;

for(y = 2; y < ysizeB; y++)
{
    x = 1;
    while(true)
    {
      homogeneous:
      {
        x++;
        if(x > xsizeB)
            break;
        else
        {
            const unsigned char* const ptr = img.ptr() + y*width + x;
            const int cb = *ptr + threshold;
            const int c_b = *ptr - threshold;
            if(ptr[offset0] > cb)
              if(ptr[offset2] > cb)
                if(ptr[offset5] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset1] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset11] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset1] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset3] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset11] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset11] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  if(ptr[offset9] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] > cb)
                          if(ptr[offset4] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset11] < c_b)
                                    if(ptr[offset10] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset11] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  if(ptr[offset3] < c_b)
                                    if(ptr[offset4] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset1] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset1] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset4] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset7] > cb)
                            if(ptr[offset1] > cb)
                              if(ptr[offset3] > cb)
                                goto success_homogeneous;
                              else
                                if(ptr[offset8] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset8] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset1] > cb)
                              if(ptr[offset3] > cb)
                                goto success_homogeneous;
                              else
                                if(ptr[offset8] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
              else
                if(ptr[offset7] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset8] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            if(ptr[offset1] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
                else
                  if(ptr[offset7] < c_b)
                    if(ptr[offset5] < c_b)
                      if(ptr[offset2] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset8] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset9] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset9] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        if(ptr[offset9] < c_b)
                          if(ptr[offset6] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
            else
            if(ptr[offset0] < c_b)
              if(ptr[offset2] < c_b)
                if(ptr[offset9] < c_b)
                  if(ptr[offset5] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset4] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset11] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset4] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset10] < c_b)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset6] < c_b)
                          if(ptr[offset8] < c_b)
                            if(ptr[offset4] < c_b)
                              if(ptr[offset3] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset10] < c_b)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset1] < c_b)
                        if(ptr[offset11] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              goto success_homogeneous;
                            else
                              if(ptr[offset10] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset4] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset10] < c_b)
                      if(ptr[offset11] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset3] < c_b)
                              goto success_homogeneous;
                            else
                              if(ptr[offset8] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset8] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset1] < c_b)
                            if(ptr[offset3] < c_b)
                              goto success_homogeneous;
                            else
                              if(ptr[offset8] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  if(ptr[offset9] > cb)
                    if(ptr[offset5] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset3] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset11] > cb)
                                    if(ptr[offset10] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  if(ptr[offset4] > cb)
                                    goto success_structured;
                                  else
                                    if(ptr[offset11] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  if(ptr[offset3] > cb)
                                    if(ptr[offset4] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset4] > cb)
                                if(ptr[offset3] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset1] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      if(ptr[offset3] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset5] < c_b)
                            if(ptr[offset7] < c_b)
                              if(ptr[offset1] < c_b)
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset8] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset1] < c_b)
                                if(ptr[offset6] < c_b)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset11] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset1] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    if(ptr[offset3] < c_b)
                      if(ptr[offset4] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset11] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset11] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset1] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
              else
                if(ptr[offset7] > cb)
                  if(ptr[offset5] > cb)
                    if(ptr[offset2] > cb)
                      if(ptr[offset6] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset1] > cb)
                              goto success_homogeneous;
                            else
                              if(ptr[offset8] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset9] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset9] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      if(ptr[offset9] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    goto homogeneous;
                else
                  if(ptr[offset7] < c_b)
                    if(ptr[offset9] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset3] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_homogeneous;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_homogeneous;
                                  else
                                    goto homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    goto homogeneous;
            else
              if(ptr[offset5] > cb)
                if(ptr[offset7] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset8] > cb)
                            goto success_homogeneous;
                          else
                            if(ptr[offset1] > cb)
                              if(ptr[offset2] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                    else
                      goto homogeneous;
                  else
                    if(ptr[offset2] > cb)
                      if(ptr[offset3] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_homogeneous;
                            else
                              goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      goto homogeneous;
                else
                  goto homogeneous;
              else
                if(ptr[offset5] < c_b)
                  if(ptr[offset7] < c_b)
                    if(ptr[offset9] < c_b)
                      if(ptr[offset6] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset8] < c_b)
                              goto success_homogeneous;
                            else
                              if(ptr[offset1] < c_b)
                                if(ptr[offset2] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                        else
                          if(ptr[offset11] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              goto homogeneous;
                          else
                            goto homogeneous;
                      else
                        goto homogeneous;
                    else
                      if(ptr[offset2] < c_b)
                        if(ptr[offset3] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_homogeneous;
                              else
                                goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  goto success_homogeneous;
                                else
                                  goto homogeneous;
                              else
                                goto homogeneous;
                          else
                            goto homogeneous;
                        else
                          goto homogeneous;
                      else
                        goto homogeneous;
                  else
                    goto homogeneous;
                else
                  goto homogeneous;
        }
      }
      structured:
      {
        x++;
        if(x > xsizeB)
            break;
        else
        {
            const unsigned char* const ptr = img.ptr() + y*width + x;
            const int cb = *ptr + threshold;
            const int c_b = *ptr - threshold;
            if(ptr[offset0] > cb)
              if(ptr[offset2] > cb)
                if(ptr[offset5] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset1] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset11] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset1] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset10] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset3] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset11] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                else
                  if(ptr[offset7] < c_b)
                    if(ptr[offset9] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset1] > cb)
                          if(ptr[offset4] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset11] < c_b)
                                    if(ptr[offset10] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    if(ptr[offset11] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  if(ptr[offset3] < c_b)
                                    if(ptr[offset4] < c_b)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset1] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset1] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset8] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            if(ptr[offset1] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset8] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset7] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset4] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
              else
                if(ptr[offset7] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset8] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset3] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset6] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            if(ptr[offset1] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset6] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
                else
                  if(ptr[offset7] < c_b)
                    if(ptr[offset5] < c_b)
                      if(ptr[offset2] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset8] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset9] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset9] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        if(ptr[offset9] < c_b)
                          if(ptr[offset6] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
            else
            if(ptr[offset0] < c_b)
              if(ptr[offset2] < c_b)
                if(ptr[offset11] < c_b)
                  if(ptr[offset3] < c_b)
                    if(ptr[offset5] < c_b)
                      if(ptr[offset9] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset4] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset10] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset4] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset1] < c_b)
                            if(ptr[offset4] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset10] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset4] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset1] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset1] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset10] < c_b)
                        if(ptr[offset9] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset1] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset1] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset1] < c_b)
                            if(ptr[offset4] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset7] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset5] > cb)
                              if(ptr[offset4] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset8] > cb)
                                    if(ptr[offset10] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                  else
                    if(ptr[offset9] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset10] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset1] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset6] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset1] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                    else
                      if(ptr[offset5] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset6] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset3] > cb)
                                    goto success_structured;
                                  else
                                    if(ptr[offset10] > cb)
                                      goto success_structured;
                                    else
                                      goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                else
                  if(ptr[offset4] < c_b)
                    if(ptr[offset5] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset1] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset8] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset9] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset10] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        if(ptr[offset1] < c_b)
                          if(ptr[offset6] < c_b)
                            if(ptr[offset3] < c_b)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      if(ptr[offset7] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset5] > cb)
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    if(ptr[offset5] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset6] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset4] > cb)
                                  goto success_structured;
                                else
                                  if(ptr[offset11] > cb)
                                    goto success_structured;
                                  else
                                    goto homogeneous;
                              else
                                if(ptr[offset3] > cb)
                                  if(ptr[offset4] > cb)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
              else
                if(ptr[offset7] > cb)
                  if(ptr[offset5] > cb)
                    if(ptr[offset2] > cb)
                      if(ptr[offset6] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset1] > cb)
                              goto success_structured;
                            else
                              if(ptr[offset8] > cb)
                                goto success_structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset9] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset9] > cb)
                            if(ptr[offset8] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      if(ptr[offset9] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset3] > cb)
                                goto success_structured;
                              else
                                if(ptr[offset10] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    goto structured;
                else
                  if(ptr[offset7] < c_b)
                    if(ptr[offset9] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset3] < c_b)
                                  if(ptr[offset4] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  goto success_structured;
                                else
                                  if(ptr[offset10] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    goto success_structured;
                                  else
                                    goto structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset1] < c_b)
                                goto success_structured;
                              else
                                if(ptr[offset6] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                  else
                    goto structured;
            else
              if(ptr[offset5] > cb)
                if(ptr[offset7] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset3] > cb)
                          if(ptr[offset8] > cb)
                            goto success_structured;
                          else
                            if(ptr[offset1] > cb)
                              if(ptr[offset2] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        if(ptr[offset11] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset10] > cb)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                    else
                      goto structured;
                  else
                    if(ptr[offset2] > cb)
                      if(ptr[offset3] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset6] > cb)
                              goto success_structured;
                            else
                              goto structured;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset8] > cb)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                    else
                      goto structured;
                else
                  goto structured;
              else
                if(ptr[offset5] < c_b)
                  if(ptr[offset7] < c_b)
                    if(ptr[offset9] < c_b)
                      if(ptr[offset6] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset8] < c_b)
                              goto success_structured;
                            else
                              if(ptr[offset1] < c_b)
                                if(ptr[offset2] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                        else
                          if(ptr[offset11] < c_b)
                            if(ptr[offset8] < c_b)
                              if(ptr[offset10] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              goto structured;
                          else
                            goto structured;
                      else
                        goto structured;
                    else
                      if(ptr[offset2] < c_b)
                        if(ptr[offset3] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset6] < c_b)
                                goto success_structured;
                              else
                                goto structured;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset8] < c_b)
                                  goto success_structured;
                                else
                                  goto structured;
                              else
                                goto structured;
                          else
                            goto structured;
                        else
                          goto structured;
                      else
                        goto structured;
                  else
                    goto structured;
                else
                  goto homogeneous;
        }
      }
      success_homogeneous:
        if(total == nExpectedCorners)
        {
            if(nExpectedCorners == 0)
            {
                nExpectedCorners = 512;
                keypoints.reserve(nExpectedCorners);
            }
            else
            {
                nExpectedCorners *= 2;
                keypoints.reserve(nExpectedCorners);
            }
        }
        keypoints.push_back(KeyPoint(Point2f((float)x, (float)y), 1.0f));
        total++;
        goto homogeneous;
      success_structured:
        if(total == nExpectedCorners)
        {
            if(nExpectedCorners == 0)
            {
                nExpectedCorners = 512;
                keypoints.reserve(nExpectedCorners);
            }
            else
            {
                nExpectedCorners *= 2;
                keypoints.reserve(nExpectedCorners);
            }
        }
        keypoints.push_back(KeyPoint(Point2f((float)x, (float)y), 1.0f));
        total++;
        goto structured;
    }
}

}

static void OAST_9_16(InputArray _img, std::vector& keypoints, int threshold)
{
cv::Mat img;
if(!_img.getMat().isContinuous())
img = _img.getMat().clone();
else
img = _img.getMat();

text
size_t total = 0;
int xsize = img.cols;
int ysize = img.rows;
size_t nExpectedCorners = keypoints.capacity();
int x, y;
int xsizeB=xsize - 4;
int ysizeB=ysize - 3;
int width;

keypoints.resize(0);

int pixel_9_16_[16];
makeAgastOffsets(pixel_9_16_, (int)img.step, AgastFeatureDetector::OAST_9_16);

short offset0 = (short) pixel_9_16_[0];
short offset1 = (short) pixel_9_16_[1];
short offset2 = (short) pixel_9_16_[2];
short offset3 = (short) pixel_9_16_[3];
short offset4 = (short) pixel_9_16_[4];
short offset5 = (short) pixel_9_16_[5];
short offset6 = (short) pixel_9_16_[6];
short offset7 = (short) pixel_9_16_[7];
short offset8 = (short) pixel_9_16_[8];
short offset9 = (short) pixel_9_16_[9];
short offset10 = (short) pixel_9_16_[10];
short offset11 = (short) pixel_9_16_[11];
short offset12 = (short) pixel_9_16_[12];
short offset13 = (short) pixel_9_16_[13];
short offset14 = (short) pixel_9_16_[14];
short offset15 = (short) pixel_9_16_[15];

width = xsize;

for(y = 3; y < ysizeB; y++)
{
    x = 2;
    while(true)
    {
        x++;
        if(x > xsizeB)
            break;
        else
        {
            const unsigned char* const ptr = img.ptr() + y*width + x;
            const int cb = *ptr + threshold;
            const int c_b = *ptr - threshold;
            if(ptr[offset0] > cb)
              if(ptr[offset2] > cb)
                if(ptr[offset4] > cb)
                  if(ptr[offset5] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset3] > cb)
                        if(ptr[offset1] > cb)
                          if(ptr[offset6] > cb)
                            if(ptr[offset8] > cb)
                              {} // goto success_homogeneous;
                            else
                              if(ptr[offset15] > cb)
                                {} // goto success_homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset13] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset8] > cb)
                            if(ptr[offset9] > cb)
                              if(ptr[offset10] > cb)
                                if(ptr[offset6] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  if(ptr[offset11] > cb)
                                    if(ptr[offset12] > cb)
                                      if(ptr[offset13] > cb)
                                        if(ptr[offset14] > cb)
                                          if(ptr[offset15] > cb)
                                            {} // goto success_homogeneous;
                                          else
                                            continue; // goto homogeneous;
                                        else
                                          continue; // goto homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            if(ptr[offset12] > cb)
                              if(ptr[offset8] > cb)
                                if(ptr[offset9] > cb)
                                  if(ptr[offset6] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    if(ptr[offset13] > cb)
                                      if(ptr[offset14] > cb)
                                        if(ptr[offset15] > cb)
                                          {} // goto success_homogeneous;
                                        else
                                          continue; // goto homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                else
                                  if(ptr[offset1] > cb)
                                    if(ptr[offset13] > cb)
                                      if(ptr[offset14] > cb)
                                        if(ptr[offset15] > cb)
                                          {} // goto success_homogeneous;
                                        else
                                          continue; // goto homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                if(ptr[offset1] > cb)
                                  if(ptr[offset13] > cb)
                                    if(ptr[offset14] > cb)
                                      if(ptr[offset15] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                    if(ptr[offset7] < c_b)
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset6] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset13] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  if(ptr[offset12] > cb)
                                    if(ptr[offset13] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset9] > cb)
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    if(ptr[offset12] > cb)
                                      if(ptr[offset13] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                      if(ptr[offset14] < c_b)
                        if(ptr[offset8] < c_b)
                          if(ptr[offset9] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                if(ptr[offset12] < c_b)
                                  if(ptr[offset13] < c_b)
                                    if(ptr[offset6] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      if(ptr[offset15] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset6] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset13] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  if(ptr[offset12] > cb)
                                    if(ptr[offset13] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset8] > cb)
                              if(ptr[offset9] > cb)
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    if(ptr[offset12] > cb)
                                      if(ptr[offset13] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                  else
                  if(ptr[offset5] < c_b)
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset14] > cb)
                          if(ptr[offset15] > cb)
                            if(ptr[offset1] > cb)
                              if(ptr[offset3] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset8] > cb)
                                if(ptr[offset9] > cb)
                                  if(ptr[offset10] > cb)
                                    if(ptr[offset11] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset9] > cb)
                                    if(ptr[offset10] > cb)
                                      if(ptr[offset11] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                    if(ptr[offset12] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset8] < c_b)
                          if(ptr[offset9] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                if(ptr[offset13] < c_b)
                                  if(ptr[offset6] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    if(ptr[offset14] < c_b)
                                      if(ptr[offset15] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset14] > cb)
                          if(ptr[offset15] > cb)
                            if(ptr[offset1] > cb)
                              if(ptr[offset3] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  if(ptr[offset11] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset8] > cb)
                                if(ptr[offset9] > cb)
                                  if(ptr[offset10] > cb)
                                    if(ptr[offset11] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset6] > cb)
                              if(ptr[offset7] > cb)
                                if(ptr[offset8] > cb)
                                  if(ptr[offset9] > cb)
                                    if(ptr[offset10] > cb)
                                      if(ptr[offset11] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                    if(ptr[offset12] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset8] < c_b)
                          if(ptr[offset9] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                if(ptr[offset13] < c_b)
                                  if(ptr[offset14] < c_b)
                                    if(ptr[offset6] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      if(ptr[offset15] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                else
                if(ptr[offset4] < c_b)
                  if(ptr[offset11] > cb)
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset10] > cb)
                          if(ptr[offset14] > cb)
                            if(ptr[offset15] > cb)
                              if(ptr[offset1] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset8] > cb)
                                  if(ptr[offset9] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    if(ptr[offset9] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset5] > cb)
                              if(ptr[offset6] > cb)
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    if(ptr[offset9] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                  if(ptr[offset11] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset9] < c_b)
                          if(ptr[offset10] < c_b)
                            if(ptr[offset6] < c_b)
                              if(ptr[offset5] < c_b)
                                if(ptr[offset3] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  if(ptr[offset12] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                if(ptr[offset12] < c_b)
                                  if(ptr[offset13] < c_b)
                                    if(ptr[offset14] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset12] < c_b)
                                if(ptr[offset13] < c_b)
                                  if(ptr[offset14] < c_b)
                                    if(ptr[offset15] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                  if(ptr[offset11] > cb)
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset10] > cb)
                          if(ptr[offset14] > cb)
                            if(ptr[offset15] > cb)
                              if(ptr[offset1] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset8] > cb)
                                  if(ptr[offset9] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset6] > cb)
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    if(ptr[offset9] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset5] > cb)
                              if(ptr[offset6] > cb)
                                if(ptr[offset7] > cb)
                                  if(ptr[offset8] > cb)
                                    if(ptr[offset9] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                  if(ptr[offset11] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset9] < c_b)
                          if(ptr[offset10] < c_b)
                            if(ptr[offset12] < c_b)
                              if(ptr[offset13] < c_b)
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset5] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    if(ptr[offset14] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                else
                                  if(ptr[offset14] < c_b)
                                    if(ptr[offset15] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
              else
              if(ptr[offset2] < c_b)
                if(ptr[offset9] > cb)
                  if(ptr[offset10] > cb)
                    if(ptr[offset11] > cb)
                      if(ptr[offset8] > cb)
                        if(ptr[offset12] > cb)
                          if(ptr[offset13] > cb)
                            if(ptr[offset14] > cb)
                              if(ptr[offset15] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset5] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset4] > cb)
                              if(ptr[offset5] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset5] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset1] > cb)
                          if(ptr[offset12] > cb)
                            if(ptr[offset13] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                if(ptr[offset9] < c_b)
                  if(ptr[offset7] < c_b)
                    if(ptr[offset8] < c_b)
                      if(ptr[offset6] < c_b)
                        if(ptr[offset5] < c_b)
                          if(ptr[offset4] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset1] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  if(ptr[offset12] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                if(ptr[offset12] < c_b)
                                  if(ptr[offset13] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset12] < c_b)
                                if(ptr[offset13] < c_b)
                                  if(ptr[offset14] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset12] < c_b)
                              if(ptr[offset13] < c_b)
                                if(ptr[offset14] < c_b)
                                  if(ptr[offset15] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                  continue; // goto homogeneous;
              else
                if(ptr[offset9] > cb)
                  if(ptr[offset10] > cb)
                    if(ptr[offset11] > cb)
                      if(ptr[offset8] > cb)
                        if(ptr[offset12] > cb)
                          if(ptr[offset13] > cb)
                            if(ptr[offset14] > cb)
                              if(ptr[offset15] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset5] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset4] > cb)
                              if(ptr[offset5] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset3] > cb)
                            if(ptr[offset4] > cb)
                              if(ptr[offset5] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset7] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset1] > cb)
                          if(ptr[offset12] > cb)
                            if(ptr[offset13] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                if(ptr[offset9] < c_b)
                  if(ptr[offset7] < c_b)
                    if(ptr[offset8] < c_b)
                      if(ptr[offset10] < c_b)
                        if(ptr[offset11] < c_b)
                          if(ptr[offset6] < c_b)
                            if(ptr[offset5] < c_b)
                              if(ptr[offset4] < c_b)
                                if(ptr[offset3] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  if(ptr[offset12] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                if(ptr[offset12] < c_b)
                                  if(ptr[offset13] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset12] < c_b)
                                if(ptr[offset13] < c_b)
                                  if(ptr[offset14] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset12] < c_b)
                              if(ptr[offset13] < c_b)
                                if(ptr[offset14] < c_b)
                                  if(ptr[offset15] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                  continue; // goto homogeneous;
            else
            if(ptr[offset0] < c_b)
              if(ptr[offset2] > cb)
                if(ptr[offset9] > cb)
                  if(ptr[offset7] > cb)
                    if(ptr[offset8] > cb)
                      if(ptr[offset6] > cb)
                        if(ptr[offset5] > cb)
                          if(ptr[offset4] > cb)
                            if(ptr[offset3] > cb)
                              if(ptr[offset1] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  if(ptr[offset12] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                if(ptr[offset12] > cb)
                                  if(ptr[offset13] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              if(ptr[offset12] > cb)
                                if(ptr[offset13] > cb)
                                  if(ptr[offset14] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            if(ptr[offset12] > cb)
                              if(ptr[offset13] > cb)
                                if(ptr[offset14] > cb)
                                  if(ptr[offset15] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                if(ptr[offset9] < c_b)
                  if(ptr[offset10] < c_b)
                    if(ptr[offset11] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset12] < c_b)
                          if(ptr[offset13] < c_b)
                            if(ptr[offset14] < c_b)
                              if(ptr[offset15] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset5] < c_b)
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset4] < c_b)
                              if(ptr[offset5] < c_b)
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              if(ptr[offset5] < c_b)
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset1] < c_b)
                          if(ptr[offset12] < c_b)
                            if(ptr[offset13] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                  continue; // goto homogeneous;
              else
              if(ptr[offset2] < c_b)
                if(ptr[offset4] > cb)
                  if(ptr[offset11] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset8] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset6] > cb)
                              if(ptr[offset5] > cb)
                                if(ptr[offset3] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  if(ptr[offset12] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                if(ptr[offset12] > cb)
                                  if(ptr[offset13] > cb)
                                    if(ptr[offset14] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset12] > cb)
                                if(ptr[offset13] > cb)
                                  if(ptr[offset14] > cb)
                                    if(ptr[offset15] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                  if(ptr[offset11] < c_b)
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset10] < c_b)
                          if(ptr[offset14] < c_b)
                            if(ptr[offset15] < c_b)
                              if(ptr[offset1] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset9] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    if(ptr[offset9] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset5] < c_b)
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    if(ptr[offset9] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset1] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                if(ptr[offset4] < c_b)
                  if(ptr[offset5] > cb)
                    if(ptr[offset12] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                if(ptr[offset13] > cb)
                                  if(ptr[offset6] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    if(ptr[offset14] > cb)
                                      if(ptr[offset15] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset14] < c_b)
                          if(ptr[offset15] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset3] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset8] < c_b)
                                if(ptr[offset9] < c_b)
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset11] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset7] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset9] < c_b)
                                    if(ptr[offset10] < c_b)
                                      if(ptr[offset11] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                  if(ptr[offset5] < c_b)
                    if(ptr[offset7] > cb)
                      if(ptr[offset14] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                if(ptr[offset12] > cb)
                                  if(ptr[offset13] > cb)
                                    if(ptr[offset6] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      if(ptr[offset15] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset6] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset13] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  if(ptr[offset12] < c_b)
                                    if(ptr[offset13] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset9] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    if(ptr[offset12] < c_b)
                                      if(ptr[offset13] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                    if(ptr[offset7] < c_b)
                      if(ptr[offset3] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset6] < c_b)
                            if(ptr[offset8] < c_b)
                              {} // goto success_homogeneous;
                            else
                              if(ptr[offset15] < c_b)
                                {} // goto success_homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset13] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset8] < c_b)
                            if(ptr[offset9] < c_b)
                              if(ptr[offset10] < c_b)
                                if(ptr[offset6] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  if(ptr[offset11] < c_b)
                                    if(ptr[offset12] < c_b)
                                      if(ptr[offset13] < c_b)
                                        if(ptr[offset14] < c_b)
                                          if(ptr[offset15] < c_b)
                                            {} // goto success_homogeneous;
                                          else
                                            continue; // goto homogeneous;
                                        else
                                          continue; // goto homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset12] < c_b)
                              if(ptr[offset8] < c_b)
                                if(ptr[offset9] < c_b)
                                  if(ptr[offset6] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    if(ptr[offset13] < c_b)
                                      if(ptr[offset14] < c_b)
                                        if(ptr[offset15] < c_b)
                                          {} // goto success_homogeneous;
                                        else
                                          continue; // goto homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                else
                                  if(ptr[offset1] < c_b)
                                    if(ptr[offset13] < c_b)
                                      if(ptr[offset14] < c_b)
                                        if(ptr[offset15] < c_b)
                                          {} // goto success_homogeneous;
                                        else
                                          continue; // goto homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                if(ptr[offset1] < c_b)
                                  if(ptr[offset13] < c_b)
                                    if(ptr[offset14] < c_b)
                                      if(ptr[offset15] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          if(ptr[offset1] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset6] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset13] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  if(ptr[offset12] < c_b)
                                    if(ptr[offset13] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset8] < c_b)
                              if(ptr[offset9] < c_b)
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    if(ptr[offset12] < c_b)
                                      if(ptr[offset13] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                  else
                    if(ptr[offset12] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                if(ptr[offset13] > cb)
                                  if(ptr[offset14] > cb)
                                    if(ptr[offset6] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      if(ptr[offset15] > cb)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset14] < c_b)
                          if(ptr[offset15] < c_b)
                            if(ptr[offset1] < c_b)
                              if(ptr[offset3] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  if(ptr[offset11] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset8] < c_b)
                                if(ptr[offset9] < c_b)
                                  if(ptr[offset10] < c_b)
                                    if(ptr[offset11] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset6] < c_b)
                              if(ptr[offset7] < c_b)
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset9] < c_b)
                                    if(ptr[offset10] < c_b)
                                      if(ptr[offset11] < c_b)
                                        {} // goto success_homogeneous;
                                      else
                                        continue; // goto homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                else
                  if(ptr[offset11] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset8] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset12] > cb)
                              if(ptr[offset13] > cb)
                                if(ptr[offset6] > cb)
                                  if(ptr[offset5] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    if(ptr[offset14] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                else
                                  if(ptr[offset14] > cb)
                                    if(ptr[offset15] > cb)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                  if(ptr[offset11] < c_b)
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset10] < c_b)
                          if(ptr[offset14] < c_b)
                            if(ptr[offset15] < c_b)
                              if(ptr[offset1] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset8] < c_b)
                                  if(ptr[offset9] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    if(ptr[offset9] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset5] < c_b)
                              if(ptr[offset6] < c_b)
                                if(ptr[offset7] < c_b)
                                  if(ptr[offset8] < c_b)
                                    if(ptr[offset9] < c_b)
                                      {} // goto success_homogeneous;
                                    else
                                      continue; // goto homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset1] < c_b)
                            if(ptr[offset3] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
              else
                if(ptr[offset9] > cb)
                  if(ptr[offset7] > cb)
                    if(ptr[offset8] > cb)
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset6] > cb)
                            if(ptr[offset5] > cb)
                              if(ptr[offset4] > cb)
                                if(ptr[offset3] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  if(ptr[offset12] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                              else
                                if(ptr[offset12] > cb)
                                  if(ptr[offset13] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset12] > cb)
                                if(ptr[offset13] > cb)
                                  if(ptr[offset14] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset12] > cb)
                              if(ptr[offset13] > cb)
                                if(ptr[offset14] > cb)
                                  if(ptr[offset15] > cb)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                if(ptr[offset9] < c_b)
                  if(ptr[offset10] < c_b)
                    if(ptr[offset11] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset12] < c_b)
                          if(ptr[offset13] < c_b)
                            if(ptr[offset14] < c_b)
                              if(ptr[offset15] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset5] < c_b)
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset4] < c_b)
                              if(ptr[offset5] < c_b)
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              if(ptr[offset5] < c_b)
                                if(ptr[offset6] < c_b)
                                  if(ptr[offset7] < c_b)
                                    {} // goto success_homogeneous;
                                  else
                                    continue; // goto homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset1] < c_b)
                          if(ptr[offset12] < c_b)
                            if(ptr[offset13] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                  continue; // goto homogeneous;
            else
              if(ptr[offset7] > cb)
                if(ptr[offset8] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset4] > cb)
                          if(ptr[offset3] > cb)
                            if(ptr[offset2] > cb)
                              if(ptr[offset1] > cb)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] > cb)
                                if(ptr[offset11] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                if(ptr[offset12] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              if(ptr[offset12] > cb)
                                if(ptr[offset13] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            if(ptr[offset12] > cb)
                              if(ptr[offset13] > cb)
                                if(ptr[offset14] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset12] > cb)
                            if(ptr[offset13] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                  continue; // goto homogeneous;
              else
              if(ptr[offset7] < c_b)
                if(ptr[offset8] < c_b)
                  if(ptr[offset9] < c_b)
                    if(ptr[offset6] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset2] < c_b)
                              if(ptr[offset1] < c_b)
                                {} // goto success_homogeneous;
                              else
                                if(ptr[offset10] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                            else
                              if(ptr[offset10] < c_b)
                                if(ptr[offset11] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                          else
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                if(ptr[offset12] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset12] < c_b)
                                if(ptr[offset13] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset12] < c_b)
                              if(ptr[offset13] < c_b)
                                if(ptr[offset14] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                    else
                      if(ptr[offset10] < c_b)
                        if(ptr[offset11] < c_b)
                          if(ptr[offset12] < c_b)
                            if(ptr[offset13] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  {} // goto success_homogeneous;
                                else
                                  continue; // goto homogeneous;
                              else
                                continue; // goto homogeneous;
                            else
                              continue; // goto homogeneous;
                          else
                            continue; // goto homogeneous;
                        else
                          continue; // goto homogeneous;
                      else
                        continue; // goto homogeneous;
                  else
                    continue; // goto homogeneous;
                else
                  continue; // goto homogeneous;
              else
                continue; // goto homogeneous;
        }
        if(total == nExpectedCorners)
        {
            if(nExpectedCorners == 0)
            {
                nExpectedCorners = 512;
                keypoints.reserve(nExpectedCorners);
            }
            else
            {
                nExpectedCorners *= 2;
                keypoints.reserve(nExpectedCorners);
            }
        }
        keypoints.push_back(KeyPoint(Point2f((float)x, (float)y), 1.0f));
        total++;
    }
}

}

void AGAST(InputArray _img, std::vector& keypoints, int threshold, bool nonmax_suppression)
{
AGAST(_img, keypoints, threshold, nonmax_suppression, AgastFeatureDetector::OAST_9_16);
}

class AgastFeatureDetector_Impl : public AgastFeatureDetector
{
public:
AgastFeatureDetector_Impl( int _threshold, bool _nonmaxSuppression, int _type )
: threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type((short)_type)
{}

text
void detect( InputArray _image, std::vector<KeyPoint>& keypoints, InputArray _mask )
{
    Mat mask = _mask.getMat(), grayImage;
    UMat ugrayImage;
    _InputArray gray = _image;
    if( _image.type() != CV_8U )
    {
        _OutputArray ogray = _image.isUMat() ? _OutputArray(ugrayImage) : _OutputArray(grayImage);
        cvtColor( _image, ogray, COLOR_BGR2GRAY );
        gray = ogray;
    }
    AGAST( gray, keypoints, threshold, nonmaxSuppression, type );
    KeyPointsFilter::runByPixelsMask( keypoints, mask );
}

void set(int prop, double value)
{
    if(prop == THRESHOLD)
        threshold = cvRound(value);
    else if(prop == NONMAX_SUPPRESSION)
        nonmaxSuppression = value != 0;
    else
        CV_Error(Error::StsBadArg, "");
}

double get(int prop) const
{
    if(prop == THRESHOLD)
        return threshold;
    if(prop == NONMAX_SUPPRESSION)
        return nonmaxSuppression;
    CV_Error(Error::StsBadArg, "");
    return 0;
}

void setThreshold(int threshold_) { threshold = threshold_; }
int getThreshold() const { return threshold; }

void setNonmaxSuppression(bool f) { nonmaxSuppression = f; }
bool getNonmaxSuppression() const { return nonmaxSuppression; }

void setType(int type_) { type = type_; }
int getType() const { return type; }

int threshold;
bool nonmaxSuppression;
int type;

};

Ptr AgastFeatureDetector::create( int threshold, bool nonmaxSuppression, int type )
{
return makePtr(threshold, nonmaxSuppression, type);
}

void AGAST(InputArray _img, std::vector& keypoints, int threshold, bool nonmax_suppression, int type)
{

text
std::vector<KeyPoint> kpts;

// detect
switch(type) {
  case AgastFeatureDetector::AGAST_5_8:
    AGAST_5_8(_img, kpts, threshold);
    break;
  case AgastFeatureDetector::AGAST_7_12d:
    AGAST_7_12d(_img, kpts, threshold);
    break;
  case AgastFeatureDetector::AGAST_7_12s:
    AGAST_7_12s(_img, kpts, threshold);
    break;
  case AgastFeatureDetector::OAST_9_16:
    OAST_9_16(_img, kpts, threshold);
    break;
}

cv::Mat img = _img.getMat();

// score
int pixel_[16];
makeAgastOffsets(pixel_, (int)img.step, type);

std::vector<KeyPoint>::iterator kpt;
for(kpt = kpts.begin(); kpt != kpts.end(); kpt++)
{
    switch(type) {
      case AgastFeatureDetector::AGAST_5_8:
        kpt->response = (float)agast_cornerScore<AgastFeatureDetector::AGAST_5_8>
            (&img.at((int)kpt->pt.y, (int)kpt->pt.x), pixel_, threshold);
        break;
      case AgastFeatureDetector::AGAST_7_12d:
        kpt->response = (float)agast_cornerScore<AgastFeatureDetector::AGAST_7_12d>
            (&img.at((int)kpt->pt.y, (int)kpt->pt.x), pixel_, threshold);
        break;
      case AgastFeatureDetector::AGAST_7_12s:
        kpt->response = (float)agast_cornerScore<AgastFeatureDetector::AGAST_7_12s>
            (&img.at((int)kpt->pt.y, (int)kpt->pt.x), pixel_, threshold);
        break;
      case AgastFeatureDetector::OAST_9_16:
        kpt->response = (float)agast_cornerScore<AgastFeatureDetector::OAST_9_16>
            (&img.at((int)kpt->pt.y, (int)kpt->pt.x), pixel_, threshold);
        break;
    }
}

// suppression
if(nonmax_suppression)
{
    size_t j;
    size_t curr_idx;
    size_t lastRow = 0, next_lastRow = 0;
    size_t num_Corners = kpts.size();
    size_t lastRowCorner_ind = 0, next_lastRowCorner_ind = 0;

    std::vector nmsFlags;
    std::vector<KeyPoint>::iterator currCorner_nms;
    std::vector<KeyPoint>::const_iterator currCorner;

    currCorner = kpts.begin();

    nmsFlags.resize((int)num_Corners);

    // set all flags to MAXIMUM
    for(j = 0; j < num_Corners; j++)
        nmsFlags[j] = -1;

    for(curr_idx = 0; curr_idx < num_Corners; curr_idx++)
    {
        int t;
        // check above
        if(lastRow + 1 < currCorner->pt.y)
        {
            lastRow = next_lastRow;
            lastRowCorner_ind = next_lastRowCorner_ind;
        }
        if(next_lastRow != currCorner->pt.y)
        {
            next_lastRow = (size_t) currCorner->pt.y;
            next_lastRowCorner_ind = curr_idx;
        }
        if(lastRow + 1 == currCorner->pt.y)
        {
            // find the corner above the current one
            while( (kpts[lastRowCorner_ind].pt.x < currCorner->pt.x)
                && (kpts[lastRowCorner_ind].pt.y == lastRow) )
                lastRowCorner_ind++;

                if( (kpts[lastRowCorner_ind].pt.x == currCorner->pt.x)
                 && (lastRowCorner_ind != curr_idx) )
                {
                    size_t w = lastRowCorner_ind;
                    // find the maximum in this block
                    while(nmsFlags[w] != -1)
                        w = nmsFlags[w];

                    if(kpts[curr_idx].response < kpts[w].response)
                        nmsFlags[curr_idx] = (int)w;
                    else
                        nmsFlags[w] = (int)curr_idx;
                }
        }

        // check left
        t = (int)curr_idx - 1;
        if( (curr_idx != 0) && (kpts[t].pt.y == currCorner->pt.y)
         && (kpts[t].pt.x + 1 == currCorner->pt.x) )
        {
            int currCornerMaxAbove_ind = nmsFlags[curr_idx];
            // find the maximum in that area
            while(nmsFlags[t] != -1)
                t = nmsFlags[t];
            // no maximum above
            if(currCornerMaxAbove_ind == -1)
            {
                if((size_t)t != curr_idx)
                {
                    if ( kpts[curr_idx].response < kpts[t].response )
                        nmsFlags[curr_idx] = t;
                    else
                        nmsFlags[t] = (int)curr_idx;
                }
            }
            else // maximum above
            {
                if(t != currCornerMaxAbove_ind)
                {
                    if(kpts[currCornerMaxAbove_ind].response < kpts[t].response)
                    {
                        nmsFlags[currCornerMaxAbove_ind] = t;
                        nmsFlags[curr_idx] = t;
                    }
                    else
                    {
                        nmsFlags[t] = currCornerMaxAbove_ind;
                        nmsFlags[curr_idx] = currCornerMaxAbove_ind;
                    }
                }
            }
        }
        currCorner++;
    }

    // collecting maximum corners
    for(curr_idx = 0; curr_idx < num_Corners; curr_idx++)
    {
        if (nmsFlags[curr_idx] == -1)
            keypoints.push_back(kpts[curr_idx]);
    }
} else
{
  keypoints = kpts;
}

}

} // END NAMESPACE CV


Modules Xfeatures2d Doc Agast Score (`modules/xfeatures2d/doc/agast_score.txt`)

/* This is AGAST and OAST, an optimal and accelerated corner detector
based on the accelerated segment tests
Below is the original copyright and the references */

/*
Copyright (C) 2010 Elmar Mair
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

text
*Redistributions of source code must retain the above copyright
 notice, this list of conditions and the following disclaimer.

*Redistributions in binary form must reproduce the above copyright
 notice, this list of conditions and the following disclaimer in the
 documentation and/or other materials provided with the distribution.

*Neither the name of the University of Cambridge nor the names of
 its contributors may be used to endorse or promote products derived
 from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
The references are:

  • Adaptive and Generic Corner Detection Based on the Accelerated Segment Test,
    Elmar Mair and Gregory D. Hager and Darius Burschka
    and Michael Suppa and Gerhard Hirzinger ECCV 2010
    URL: http://www6.in.tum.de/Main/ResearchAgast
    */

#include "agast_score.hpp"

#ifdef _MSC_VER
#pragma warning( disable : 4127 )
#endif

namespace cv
{

void makeAgastOffsets(int pixel[16], int rowStride, int type)
{
static const int offsets16[][2] =
{
{-3, 0}, {-3, -1}, {-2, -2}, {-1, -3}, {0, -3}, { 1, -3}, { 2, -2}, { 3, -1},
{ 3, 0}, { 3, 1}, { 2, 2}, { 1, 3}, {0, 3}, {-1, 3}, {-2, 2}, {-3, 1}
};

text
static const int offsets12d[][2] =
{
    {-3,  0}, {-2, -1}, {-1, -2}, {0, -3}, { 1, -2}, { 2, -1},
    { 3,  0}, { 2,  1}, { 1,  2}, {0,  3}, {-1,  2}, {-2,  1}
};

static const int offsets12s[][2] =
{
    {-2,  0}, {-2, -1}, {-1, -2}, {0, -2}, { 1, -2}, { 2, -1},
    { 2,  0}, { 2,  1}, { 1,  2}, {0,  2}, {-1,  2}, {-2,  1}
};

static const int offsets8[][2] =
{
    {-1,  0}, {-1, -1}, {0, -1}, { 1, -1},
    { 1,  0}, { 1,  1}, {0,  1}, {-1,  1}
};

const int (*offsets)[2] = type == AgastFeatureDetector::OAST_9_16 ? offsets16 :
                          type == AgastFeatureDetector::AGAST_7_12d ? offsets12d :
                          type == AgastFeatureDetector::AGAST_7_12s ? offsets12s :
                          type == AgastFeatureDetector::AGAST_5_8 ? offsets8  : 0;

CV_Assert(pixel && offsets);

int k = 0;
for( ; k < 16; k++ )
    pixel[k] = offsets[k][0] + offsets[k][1] * rowStride;

}

// 16 pixel mask
template<>
int agast_cornerScoreAgastFeatureDetector::OAST_9_16(const uchar* ptr, const int pixel[], int threshold)
{
int bmin = threshold;
int bmax = 255;
int b_test = (bmax + bmin) / 2;

text
short offset0 = (short) pixel[0];
short offset1 = (short) pixel[1];
short offset2 = (short) pixel[2];
short offset3 = (short) pixel[3];
short offset4 = (short) pixel[4];
short offset5 = (short) pixel[5];
short offset6 = (short) pixel[6];
short offset7 = (short) pixel[7];
short offset8 = (short) pixel[8];
short offset9 = (short) pixel[9];
short offset10 = (short) pixel[10];
short offset11 = (short) pixel[11];
short offset12 = (short) pixel[12];
short offset13 = (short) pixel[13];
short offset14 = (short) pixel[14];
short offset15 = (short) pixel[15];

while(true)
{
    const int cb = *ptr + b_test;
    const int c_b = *ptr - b_test;
    if(ptr[offset0] > cb)
      if(ptr[offset2] > cb)
        if(ptr[offset4] > cb)
          if(ptr[offset5] > cb)
            if(ptr[offset7] > cb)
              if(ptr[offset3] > cb)
                if(ptr[offset1] > cb)
                  if(ptr[offset6] > cb)
                    if(ptr[offset8] > cb)
                      goto is_a_corner;
                    else
                      if(ptr[offset15] > cb)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset13] > cb)
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset8] > cb)
                    if(ptr[offset9] > cb)
                      if(ptr[offset10] > cb)
                        if(ptr[offset6] > cb)
                          goto is_a_corner;
                        else
                          if(ptr[offset11] > cb)
                            if(ptr[offset12] > cb)
                              if(ptr[offset13] > cb)
                                if(ptr[offset14] > cb)
                                  if(ptr[offset15] > cb)
                                    goto is_a_corner;
                                  else
                                    goto is_not_a_corner;
                                else
                                  goto is_not_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset10] > cb)
                  if(ptr[offset11] > cb)
                    if(ptr[offset12] > cb)
                      if(ptr[offset8] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset6] > cb)
                            goto is_a_corner;
                          else
                            if(ptr[offset13] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  goto is_a_corner;
                                else
                                  goto is_not_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          if(ptr[offset1] > cb)
                            if(ptr[offset13] > cb)
                              if(ptr[offset14] > cb)
                                if(ptr[offset15] > cb)
                                  goto is_a_corner;
                                else
                                  goto is_not_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset1] > cb)
                          if(ptr[offset13] > cb)
                            if(ptr[offset14] > cb)
                              if(ptr[offset15] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
            if(ptr[offset7] < c_b)
              if(ptr[offset14] > cb)
                if(ptr[offset15] > cb)
                  if(ptr[offset1] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset6] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset13] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset12] > cb)
                            if(ptr[offset13] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset8] > cb)
                      if(ptr[offset9] > cb)
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            if(ptr[offset12] > cb)
                              if(ptr[offset13] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
              if(ptr[offset14] < c_b)
                if(ptr[offset8] < c_b)
                  if(ptr[offset9] < c_b)
                    if(ptr[offset10] < c_b)
                      if(ptr[offset11] < c_b)
                        if(ptr[offset12] < c_b)
                          if(ptr[offset13] < c_b)
                            if(ptr[offset6] < c_b)
                              goto is_a_corner;
                            else
                              if(ptr[offset15] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              if(ptr[offset14] > cb)
                if(ptr[offset15] > cb)
                  if(ptr[offset1] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset6] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset13] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset12] > cb)
                            if(ptr[offset13] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset8] > cb)
                      if(ptr[offset9] > cb)
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            if(ptr[offset12] > cb)
                              if(ptr[offset13] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
          else
          if(ptr[offset5] < c_b)
            if(ptr[offset12] > cb)
              if(ptr[offset13] > cb)
                if(ptr[offset14] > cb)
                  if(ptr[offset15] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset3] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset8] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
            if(ptr[offset12] < c_b)
              if(ptr[offset7] < c_b)
                if(ptr[offset8] < c_b)
                  if(ptr[offset9] < c_b)
                    if(ptr[offset10] < c_b)
                      if(ptr[offset11] < c_b)
                        if(ptr[offset13] < c_b)
                          if(ptr[offset6] < c_b)
                            goto is_a_corner;
                          else
                            if(ptr[offset14] < c_b)
                              if(ptr[offset15] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            if(ptr[offset12] > cb)
              if(ptr[offset13] > cb)
                if(ptr[offset14] > cb)
                  if(ptr[offset15] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset3] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] > cb)
                          if(ptr[offset11] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset8] > cb)
                        if(ptr[offset9] > cb)
                          if(ptr[offset10] > cb)
                            if(ptr[offset11] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset9] > cb)
                            if(ptr[offset10] > cb)
                              if(ptr[offset11] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
            if(ptr[offset12] < c_b)
              if(ptr[offset7] < c_b)
                if(ptr[offset8] < c_b)
                  if(ptr[offset9] < c_b)
                    if(ptr[offset10] < c_b)
                      if(ptr[offset11] < c_b)
                        if(ptr[offset13] < c_b)
                          if(ptr[offset14] < c_b)
                            if(ptr[offset6] < c_b)
                              goto is_a_corner;
                            else
                              if(ptr[offset15] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
        else
        if(ptr[offset4] < c_b)
          if(ptr[offset11] > cb)
            if(ptr[offset12] > cb)
              if(ptr[offset13] > cb)
                if(ptr[offset10] > cb)
                  if(ptr[offset14] > cb)
                    if(ptr[offset15] > cb)
                      if(ptr[offset1] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset8] > cb)
                          if(ptr[offset9] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset6] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset9] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset5] > cb)
                      if(ptr[offset6] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset9] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset1] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
          if(ptr[offset11] < c_b)
            if(ptr[offset7] < c_b)
              if(ptr[offset8] < c_b)
                if(ptr[offset9] < c_b)
                  if(ptr[offset10] < c_b)
                    if(ptr[offset6] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset3] < c_b)
                          goto is_a_corner;
                        else
                          if(ptr[offset12] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset12] < c_b)
                          if(ptr[offset13] < c_b)
                            if(ptr[offset14] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset12] < c_b)
                        if(ptr[offset13] < c_b)
                          if(ptr[offset14] < c_b)
                            if(ptr[offset15] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
          if(ptr[offset11] > cb)
            if(ptr[offset12] > cb)
              if(ptr[offset13] > cb)
                if(ptr[offset10] > cb)
                  if(ptr[offset14] > cb)
                    if(ptr[offset15] > cb)
                      if(ptr[offset1] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset8] > cb)
                          if(ptr[offset9] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset6] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset9] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset5] > cb)
                      if(ptr[offset6] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            if(ptr[offset9] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset1] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
          if(ptr[offset11] < c_b)
            if(ptr[offset7] < c_b)
              if(ptr[offset8] < c_b)
                if(ptr[offset9] < c_b)
                  if(ptr[offset10] < c_b)
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset5] < c_b)
                            goto is_a_corner;
                          else
                            if(ptr[offset14] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          if(ptr[offset14] < c_b)
                            if(ptr[offset15] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
      else
      if(ptr[offset2] < c_b)
        if(ptr[offset9] > cb)
          if(ptr[offset10] > cb)
            if(ptr[offset11] > cb)
              if(ptr[offset8] > cb)
                if(ptr[offset12] > cb)
                  if(ptr[offset13] > cb)
                    if(ptr[offset14] > cb)
                      if(ptr[offset15] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset5] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset4] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset3] > cb)
                    if(ptr[offset4] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset1] > cb)
                  if(ptr[offset12] > cb)
                    if(ptr[offset13] > cb)
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
        if(ptr[offset9] < c_b)
          if(ptr[offset7] < c_b)
            if(ptr[offset8] < c_b)
              if(ptr[offset6] < c_b)
                if(ptr[offset5] < c_b)
                  if(ptr[offset4] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset1] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] < c_b)
                        if(ptr[offset11] < c_b)
                          if(ptr[offset12] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset10] < c_b)
                      if(ptr[offset11] < c_b)
                        if(ptr[offset12] < c_b)
                          if(ptr[offset13] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset10] < c_b)
                    if(ptr[offset11] < c_b)
                      if(ptr[offset12] < c_b)
                        if(ptr[offset13] < c_b)
                          if(ptr[offset14] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset10] < c_b)
                  if(ptr[offset11] < c_b)
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset14] < c_b)
                          if(ptr[offset15] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
          goto is_not_a_corner;
      else
        if(ptr[offset9] > cb)
          if(ptr[offset10] > cb)
            if(ptr[offset11] > cb)
              if(ptr[offset8] > cb)
                if(ptr[offset12] > cb)
                  if(ptr[offset13] > cb)
                    if(ptr[offset14] > cb)
                      if(ptr[offset15] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset5] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset4] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset3] > cb)
                    if(ptr[offset4] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset1] > cb)
                  if(ptr[offset12] > cb)
                    if(ptr[offset13] > cb)
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
        if(ptr[offset9] < c_b)
          if(ptr[offset7] < c_b)
            if(ptr[offset8] < c_b)
              if(ptr[offset10] < c_b)
                if(ptr[offset11] < c_b)
                  if(ptr[offset6] < c_b)
                    if(ptr[offset5] < c_b)
                      if(ptr[offset4] < c_b)
                        if(ptr[offset3] < c_b)
                          goto is_a_corner;
                        else
                          if(ptr[offset12] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset12] < c_b)
                          if(ptr[offset13] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset12] < c_b)
                        if(ptr[offset13] < c_b)
                          if(ptr[offset14] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset14] < c_b)
                          if(ptr[offset15] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
          goto is_not_a_corner;
    else
    if(ptr[offset0] < c_b)
      if(ptr[offset2] > cb)
        if(ptr[offset9] > cb)
          if(ptr[offset7] > cb)
            if(ptr[offset8] > cb)
              if(ptr[offset6] > cb)
                if(ptr[offset5] > cb)
                  if(ptr[offset4] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset1] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          if(ptr[offset12] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset12] > cb)
                          if(ptr[offset13] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset10] > cb)
                    if(ptr[offset11] > cb)
                      if(ptr[offset12] > cb)
                        if(ptr[offset13] > cb)
                          if(ptr[offset14] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset10] > cb)
                  if(ptr[offset11] > cb)
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset14] > cb)
                          if(ptr[offset15] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
        if(ptr[offset9] < c_b)
          if(ptr[offset10] < c_b)
            if(ptr[offset11] < c_b)
              if(ptr[offset8] < c_b)
                if(ptr[offset12] < c_b)
                  if(ptr[offset13] < c_b)
                    if(ptr[offset14] < c_b)
                      if(ptr[offset15] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset5] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset4] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset3] < c_b)
                    if(ptr[offset4] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset1] < c_b)
                  if(ptr[offset12] < c_b)
                    if(ptr[offset13] < c_b)
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
          goto is_not_a_corner;
      else
      if(ptr[offset2] < c_b)
        if(ptr[offset4] > cb)
          if(ptr[offset11] > cb)
            if(ptr[offset7] > cb)
              if(ptr[offset8] > cb)
                if(ptr[offset9] > cb)
                  if(ptr[offset10] > cb)
                    if(ptr[offset6] > cb)
                      if(ptr[offset5] > cb)
                        if(ptr[offset3] > cb)
                          goto is_a_corner;
                        else
                          if(ptr[offset12] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset12] > cb)
                          if(ptr[offset13] > cb)
                            if(ptr[offset14] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset12] > cb)
                        if(ptr[offset13] > cb)
                          if(ptr[offset14] > cb)
                            if(ptr[offset15] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
          if(ptr[offset11] < c_b)
            if(ptr[offset12] < c_b)
              if(ptr[offset13] < c_b)
                if(ptr[offset10] < c_b)
                  if(ptr[offset14] < c_b)
                    if(ptr[offset15] < c_b)
                      if(ptr[offset1] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset8] < c_b)
                          if(ptr[offset9] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset6] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset8] < c_b)
                            if(ptr[offset9] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset5] < c_b)
                      if(ptr[offset6] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset8] < c_b)
                            if(ptr[offset9] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset1] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
        if(ptr[offset4] < c_b)
          if(ptr[offset5] > cb)
            if(ptr[offset12] > cb)
              if(ptr[offset7] > cb)
                if(ptr[offset8] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset13] > cb)
                          if(ptr[offset6] > cb)
                            goto is_a_corner;
                          else
                            if(ptr[offset14] > cb)
                              if(ptr[offset15] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
            if(ptr[offset12] < c_b)
              if(ptr[offset13] < c_b)
                if(ptr[offset14] < c_b)
                  if(ptr[offset15] < c_b)
                    if(ptr[offset1] < c_b)
                      if(ptr[offset3] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset8] < c_b)
                        if(ptr[offset9] < c_b)
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset8] < c_b)
                          if(ptr[offset9] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
          if(ptr[offset5] < c_b)
            if(ptr[offset7] > cb)
              if(ptr[offset14] > cb)
                if(ptr[offset8] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset12] > cb)
                          if(ptr[offset13] > cb)
                            if(ptr[offset6] > cb)
                              goto is_a_corner;
                            else
                              if(ptr[offset15] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
              if(ptr[offset14] < c_b)
                if(ptr[offset15] < c_b)
                  if(ptr[offset1] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset6] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset13] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] < c_b)
                        if(ptr[offset11] < c_b)
                          if(ptr[offset12] < c_b)
                            if(ptr[offset13] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset8] < c_b)
                      if(ptr[offset9] < c_b)
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset12] < c_b)
                              if(ptr[offset13] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
            if(ptr[offset7] < c_b)
              if(ptr[offset3] < c_b)
                if(ptr[offset1] < c_b)
                  if(ptr[offset6] < c_b)
                    if(ptr[offset8] < c_b)
                      goto is_a_corner;
                    else
                      if(ptr[offset15] < c_b)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset13] < c_b)
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset8] < c_b)
                    if(ptr[offset9] < c_b)
                      if(ptr[offset10] < c_b)
                        if(ptr[offset6] < c_b)
                          goto is_a_corner;
                        else
                          if(ptr[offset11] < c_b)
                            if(ptr[offset12] < c_b)
                              if(ptr[offset13] < c_b)
                                if(ptr[offset14] < c_b)
                                  if(ptr[offset15] < c_b)
                                    goto is_a_corner;
                                  else
                                    goto is_not_a_corner;
                                else
                                  goto is_not_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset10] < c_b)
                  if(ptr[offset11] < c_b)
                    if(ptr[offset12] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset9] < c_b)
                          if(ptr[offset6] < c_b)
                            goto is_a_corner;
                          else
                            if(ptr[offset13] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  goto is_a_corner;
                                else
                                  goto is_not_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          if(ptr[offset1] < c_b)
                            if(ptr[offset13] < c_b)
                              if(ptr[offset14] < c_b)
                                if(ptr[offset15] < c_b)
                                  goto is_a_corner;
                                else
                                  goto is_not_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset1] < c_b)
                          if(ptr[offset13] < c_b)
                            if(ptr[offset14] < c_b)
                              if(ptr[offset15] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              if(ptr[offset14] < c_b)
                if(ptr[offset15] < c_b)
                  if(ptr[offset1] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset6] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset13] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] < c_b)
                        if(ptr[offset11] < c_b)
                          if(ptr[offset12] < c_b)
                            if(ptr[offset13] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset8] < c_b)
                      if(ptr[offset9] < c_b)
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            if(ptr[offset12] < c_b)
                              if(ptr[offset13] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
          else
            if(ptr[offset12] > cb)
              if(ptr[offset7] > cb)
                if(ptr[offset8] > cb)
                  if(ptr[offset9] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset13] > cb)
                          if(ptr[offset14] > cb)
                            if(ptr[offset6] > cb)
                              goto is_a_corner;
                            else
                              if(ptr[offset15] > cb)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
            if(ptr[offset12] < c_b)
              if(ptr[offset13] < c_b)
                if(ptr[offset14] < c_b)
                  if(ptr[offset15] < c_b)
                    if(ptr[offset1] < c_b)
                      if(ptr[offset3] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset8] < c_b)
                        if(ptr[offset9] < c_b)
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset8] < c_b)
                          if(ptr[offset9] < c_b)
                            if(ptr[offset10] < c_b)
                              if(ptr[offset11] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
        else
          if(ptr[offset11] > cb)
            if(ptr[offset7] > cb)
              if(ptr[offset8] > cb)
                if(ptr[offset9] > cb)
                  if(ptr[offset10] > cb)
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset6] > cb)
                          if(ptr[offset5] > cb)
                            goto is_a_corner;
                          else
                            if(ptr[offset14] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          if(ptr[offset14] > cb)
                            if(ptr[offset15] > cb)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
          if(ptr[offset11] < c_b)
            if(ptr[offset12] < c_b)
              if(ptr[offset13] < c_b)
                if(ptr[offset10] < c_b)
                  if(ptr[offset14] < c_b)
                    if(ptr[offset15] < c_b)
                      if(ptr[offset1] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset8] < c_b)
                          if(ptr[offset9] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset6] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset8] < c_b)
                            if(ptr[offset9] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset5] < c_b)
                      if(ptr[offset6] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset8] < c_b)
                            if(ptr[offset9] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset1] < c_b)
                    if(ptr[offset3] < c_b)
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
      else
        if(ptr[offset9] > cb)
          if(ptr[offset7] > cb)
            if(ptr[offset8] > cb)
              if(ptr[offset10] > cb)
                if(ptr[offset11] > cb)
                  if(ptr[offset6] > cb)
                    if(ptr[offset5] > cb)
                      if(ptr[offset4] > cb)
                        if(ptr[offset3] > cb)
                          goto is_a_corner;
                        else
                          if(ptr[offset12] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset12] > cb)
                          if(ptr[offset13] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset12] > cb)
                        if(ptr[offset13] > cb)
                          if(ptr[offset14] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset14] > cb)
                          if(ptr[offset15] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
        if(ptr[offset9] < c_b)
          if(ptr[offset10] < c_b)
            if(ptr[offset11] < c_b)
              if(ptr[offset8] < c_b)
                if(ptr[offset12] < c_b)
                  if(ptr[offset13] < c_b)
                    if(ptr[offset14] < c_b)
                      if(ptr[offset15] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset5] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset4] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset3] < c_b)
                    if(ptr[offset4] < c_b)
                      if(ptr[offset5] < c_b)
                        if(ptr[offset6] < c_b)
                          if(ptr[offset7] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset1] < c_b)
                  if(ptr[offset12] < c_b)
                    if(ptr[offset13] < c_b)
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
          goto is_not_a_corner;
    else
      if(ptr[offset7] > cb)
        if(ptr[offset8] > cb)
          if(ptr[offset9] > cb)
            if(ptr[offset6] > cb)
              if(ptr[offset5] > cb)
                if(ptr[offset4] > cb)
                  if(ptr[offset3] > cb)
                    if(ptr[offset2] > cb)
                      if(ptr[offset1] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        if(ptr[offset12] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset10] > cb)
                    if(ptr[offset11] > cb)
                      if(ptr[offset12] > cb)
                        if(ptr[offset13] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset10] > cb)
                  if(ptr[offset11] > cb)
                    if(ptr[offset12] > cb)
                      if(ptr[offset13] > cb)
                        if(ptr[offset14] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              if(ptr[offset10] > cb)
                if(ptr[offset11] > cb)
                  if(ptr[offset12] > cb)
                    if(ptr[offset13] > cb)
                      if(ptr[offset14] > cb)
                        if(ptr[offset15] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
          goto is_not_a_corner;
      else
      if(ptr[offset7] < c_b)
        if(ptr[offset8] < c_b)
          if(ptr[offset9] < c_b)
            if(ptr[offset6] < c_b)
              if(ptr[offset5] < c_b)
                if(ptr[offset4] < c_b)
                  if(ptr[offset3] < c_b)
                    if(ptr[offset2] < c_b)
                      if(ptr[offset1] < c_b)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] < c_b)
                        if(ptr[offset11] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset10] < c_b)
                      if(ptr[offset11] < c_b)
                        if(ptr[offset12] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset10] < c_b)
                    if(ptr[offset11] < c_b)
                      if(ptr[offset12] < c_b)
                        if(ptr[offset13] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset10] < c_b)
                  if(ptr[offset11] < c_b)
                    if(ptr[offset12] < c_b)
                      if(ptr[offset13] < c_b)
                        if(ptr[offset14] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              if(ptr[offset10] < c_b)
                if(ptr[offset11] < c_b)
                  if(ptr[offset12] < c_b)
                    if(ptr[offset13] < c_b)
                      if(ptr[offset14] < c_b)
                        if(ptr[offset15] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
          else
            goto is_not_a_corner;
        else
          goto is_not_a_corner;
      else
        goto is_not_a_corner;

    is_a_corner:
        bmin = b_test;
        goto end;

    is_not_a_corner:
        bmax = b_test;
        goto end;

    end:

    if(bmin == bmax - 1 || bmin == bmax)
        return bmin;
    b_test = (bmin + bmax) / 2;
}

}

// 12 pixel mask in diamond format
template<>
int agast_cornerScoreAgastFeatureDetector::AGAST_7_12d(const uchar* ptr, const int pixel[], int threshold)
{
int bmin = threshold;
int bmax = 255;
int b_test = (bmax + bmin)/2;

text
short offset0 = (short) pixel[0];
short offset1 = (short) pixel[1];
short offset2 = (short) pixel[2];
short offset3 = (short) pixel[3];
short offset4 = (short) pixel[4];
short offset5 = (short) pixel[5];
short offset6 = (short) pixel[6];
short offset7 = (short) pixel[7];
short offset8 = (short) pixel[8];
short offset9 = (short) pixel[9];
short offset10 = (short) pixel[10];
short offset11 = (short) pixel[11];

while(true)
{
    const int cb = *ptr + b_test;
    const int c_b = *ptr - b_test;
    if(ptr[offset0] > cb)
      if(ptr[offset5] > cb)
        if(ptr[offset2] > cb)
          if(ptr[offset9] > cb)
            if(ptr[offset1] > cb)
              if(ptr[offset6] > cb)
                if(ptr[offset3] > cb)
                  if(ptr[offset4] > cb)
                    goto is_a_corner;
                  else
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset8] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset11] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset4] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset11] > cb)
                  if(ptr[offset3] > cb)
                    if(ptr[offset4] > cb)
                      goto is_a_corner;
                    else
                      if(ptr[offset10] > cb)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset8] > cb)
                      if(ptr[offset10] > cb)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              if(ptr[offset6] > cb)
                if(ptr[offset7] > cb)
                  if(ptr[offset8] > cb)
                    if(ptr[offset4] > cb)
                      if(ptr[offset3] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
          else
            if(ptr[offset3] > cb)
              if(ptr[offset4] > cb)
                if(ptr[offset1] > cb)
                  if(ptr[offset6] > cb)
                    goto is_a_corner;
                  else
                    if(ptr[offset11] > cb)
                      goto is_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset6] > cb)
                    if(ptr[offset7] > cb)
                      if(ptr[offset8] > cb)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
        else
          if(ptr[offset9] > cb)
            if(ptr[offset7] > cb)
              if(ptr[offset8] > cb)
                if(ptr[offset1] > cb)
                  if(ptr[offset10] > cb)
                    if(ptr[offset11] > cb)
                      goto is_a_corner;
                    else
                      if(ptr[offset6] > cb)
                        if(ptr[offset4] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] > cb)
                      if(ptr[offset3] > cb)
                        if(ptr[offset4] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset6] > cb)
                    if(ptr[offset4] > cb)
                      if(ptr[offset3] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset10] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            goto is_not_a_corner;
      else
        if(ptr[offset5] < c_b)
          if(ptr[offset9] > cb)
            if(ptr[offset3] < c_b)
              if(ptr[offset4] < c_b)
                if(ptr[offset11] > cb)
                  if(ptr[offset1] > cb)
                    if(ptr[offset8] > cb)
                      if(ptr[offset10] > cb)
                        if(ptr[offset2] > cb)
                          goto is_a_corner;
                        else
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      if(ptr[offset6] < c_b)
                        if(ptr[offset2] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset8] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          if(ptr[offset10] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      if(ptr[offset6] < c_b)
                        if(ptr[offset2] < c_b)
                          if(ptr[offset7] < c_b)
                            if(ptr[offset1] < c_b)
                              goto is_a_corner;
                            else
                              if(ptr[offset8] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                else
                  if(ptr[offset2] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset1] < c_b)
                        if(ptr[offset6] < c_b)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        if(ptr[offset6] < c_b)
                          if(ptr[offset8] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset11] > cb)
                  if(ptr[offset8] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset1] > cb)
                        if(ptr[offset2] > cb)
                          goto is_a_corner;
                        else
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              if(ptr[offset11] > cb)
                if(ptr[offset10] > cb)
                  if(ptr[offset3] > cb)
                    if(ptr[offset1] > cb)
                      if(ptr[offset2] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset6] > cb)
                        if(ptr[offset7] > cb)
                          if(ptr[offset8] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset8] > cb)
                      if(ptr[offset1] > cb)
                        if(ptr[offset2] > cb)
                          goto is_a_corner;
                        else
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset6] > cb)
                          if(ptr[offset7] > cb)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                goto is_not_a_corner;
          else
            if(ptr[offset9] < c_b)
              if(ptr[offset2] > cb)
                if(ptr[offset1] > cb)
                  if(ptr[offset4] > cb)
                    if(ptr[offset10] > cb)
                      if(ptr[offset3] > cb)
                        if(ptr[offset11] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      if(ptr[offset6] < c_b)
                        if(ptr[offset7] < c_b)
                          if(ptr[offset8] < c_b)
                            if(ptr[offset11] < c_b)
                              if(ptr[offset10] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset8] < c_b)
                          if(ptr[offset10] < c_b)
                            if(ptr[offset4] < c_b)
                              goto is_a_corner;
                            else
                              if(ptr[offset11] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                          else
                            if(ptr[offset3] < c_b)
                              if(ptr[offset4] < c_b)
                                goto is_a_corner;
                              else
                                goto is_not_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset6] < c_b)
                    if(ptr[offset7] < c_b)
                      if(ptr[offset8] < c_b)
                        if(ptr[offset4] < c_b)
                          if(ptr[offset3] < c_b)
                            goto is_a_corner;
                          else
                            if(ptr[offset10] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                        else
                          if(ptr[offset10] < c_b)
                            if(ptr[offset11] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                if(ptr[offset6] < c_b)
                  if(ptr[offset7] < c_b)
                    if(ptr[offset8] < c_b)
                      if(ptr[offset4] < c_b)
                        if(ptr[offset3] < c_b)
                          goto is_a_corner;
                        else
                          if(ptr[offset10] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        if(ptr[offset10] < c_b)
                          if(ptr[offset11] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      if(ptr[offset2] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset3] < c_b)
                            if(ptr[offset4] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
            else
              if(ptr[offset2] > cb)
                if(ptr[offset1] > cb)
                  if(ptr[offset3] > cb)
                    if(ptr[offset4] > cb)
                      if(ptr[offset10] > cb)
                        if(ptr[offset11] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
              else
                if(ptr[offset2] < c_b)
                  if(ptr[offset3] < c_b)
                    if(ptr[offset4] < c_b)
                      if(ptr[offset7] < c_b)
                        if(ptr[offset1] < c_b)
                          if(ptr[offset6] < c_b)
                            goto is_a_corner;
                          else
                            goto is_not_a_corner;
                        else
                          if(ptr[offset6] < c_b)
                            if(ptr[offset8] < c_b)
                              goto is_a_corner;
                            else
                              goto is_not_a_corner;
                          else
                            goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
                else
                  goto is_not_a_corner;
        else
          if(ptr[offset2] > cb)
            if(ptr[offset10] > cb)
              if(ptr[offset11] > cb)
                if(ptr[offset9] > cb)
                  if(ptr[offset1] > cb)
                    if(ptr[offset3] > cb)
                      goto is_a_corner;
                    else
                      if(ptr[offset8] > cb)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                  else
                    if(ptr[offset6] > cb)
                      if(ptr[offset7] > cb)
                        if(ptr[offset8] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                else
                  if(ptr[offset1] > cb)
                    if(ptr[offset3] > cb)
                      if(ptr[offset4] > cb)
                        goto is_a_corner;
                      else
                        goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  else
                    goto is_not_a_corner;
              else
                goto is_not_a_corner;
            else
              goto is_not_a_corner;
          else
            if(ptr[offset9] > cb)
              if(ptr[offset7] > cb)
                if(ptr[offset8] > cb)
                  if(ptr[offset10] > cb)
                    if(ptr[offset11] > cb)
                      if(ptr[offset1] > cb)
                        goto is_a_corner;
                      else
                        if(ptr[offset6] > cb)
                          goto is_a_corner;
                        else
                          goto is_not_a_corner;
                    else
                      goto is_not_a_corner;
                  els