// Generated by Futhark 0.22.0
// git: e8b7244 (Wed Jan 12 23:26:03 2022 +0100)

// We need to define _GNU_SOURCE before
// _any_ headers files are imported to get
// the usage statistics of a thread (i.e. have RUSAGE_THREAD) on GNU/Linux
// https://manpages.courier-mta.org/htmlman2/getrusage.2.html
#ifndef _GNU_SOURCE // Avoid possible double-definition warning.
#define _GNU_SOURCE
#endif

#ifdef __clang__
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wparentheses"
#pragma clang diagnostic ignored "-Wunused-label"
#elif __GNUC__
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif

// Headers\n")
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdio.h>
#include <float.h>

#define CL_TARGET_OPENCL_VERSION 120
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#ifdef __APPLE__
#define CL_SILENCE_DEPRECATION
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

// Initialisation
struct futhark_context_config;
struct futhark_context_config *futhark_context_config_new(void);
void futhark_context_config_free(struct futhark_context_config *cfg);
void futhark_context_config_add_build_option(struct futhark_context_config *cfg,
                                             const char *opt);
void futhark_context_config_set_debugging(struct futhark_context_config *cfg,
                                          int flag);
void futhark_context_config_set_profiling(struct futhark_context_config *cfg,
                                          int flag);
void futhark_context_config_set_logging(struct futhark_context_config *cfg,
                                        int flag);
void futhark_context_config_set_device(struct futhark_context_config *cfg, const
                                       char *s);
void futhark_context_config_set_platform(struct futhark_context_config *cfg,
                                         const char *s);
void
futhark_context_config_select_device_interactively(struct futhark_context_config *cfg);
void futhark_context_config_list_devices(struct futhark_context_config *cfg);
void futhark_context_config_dump_program_to(struct futhark_context_config *cfg,
                                            const char *path);
void
futhark_context_config_load_program_from(struct futhark_context_config *cfg,
                                         const char *path);
void futhark_context_config_dump_binary_to(struct futhark_context_config *cfg,
                                           const char *path);
void futhark_context_config_load_binary_from(struct futhark_context_config *cfg,
                                             const char *path);
void
futhark_context_config_set_default_group_size(struct futhark_context_config *cfg,
                                              int size);
void
futhark_context_config_set_default_num_groups(struct futhark_context_config *cfg,
                                              int num);
void
futhark_context_config_set_default_tile_size(struct futhark_context_config *cfg,
                                             int num);
void
futhark_context_config_set_default_reg_tile_size(struct futhark_context_config *cfg,
                                                 int num);
void
futhark_context_config_set_default_threshold(struct futhark_context_config *cfg,
                                             int num);
int futhark_context_config_set_tuning_param(struct futhark_context_config *cfg,
                                            const char *param_name,
                                            size_t new_value);
struct futhark_context;
struct futhark_context *futhark_context_new(struct futhark_context_config *cfg);
struct futhark_context
*futhark_context_new_with_command_queue(struct futhark_context_config *cfg,
                                        cl_command_queue queue);
void futhark_context_free(struct futhark_context *ctx);
cl_command_queue futhark_context_get_command_queue(struct futhark_context *ctx);
int futhark_get_tuning_param_count(void);
const char *futhark_get_tuning_param_name(int);
const char *futhark_get_tuning_param_class(int);

// Arrays
struct futhark_f64_2d;
struct futhark_f64_2d *futhark_new_f64_2d(struct futhark_context *ctx, const
                                          double *data, int64_t dim0,
                                          int64_t dim1);
struct futhark_f64_2d *futhark_new_raw_f64_2d(struct futhark_context *ctx, const
                                              cl_mem data, int64_t offset,
                                              int64_t dim0, int64_t dim1);
int futhark_free_f64_2d(struct futhark_context *ctx,
                        struct futhark_f64_2d *arr);
int futhark_values_f64_2d(struct futhark_context *ctx,
                          struct futhark_f64_2d *arr, double *data);
cl_mem futhark_values_raw_f64_2d(struct futhark_context *ctx,
                                 struct futhark_f64_2d *arr);
const int64_t *futhark_shape_f64_2d(struct futhark_context *ctx,
                                    struct futhark_f64_2d *arr);

// Opaque values


// Entry points
int futhark_entry_main(struct futhark_context *ctx,
                       struct futhark_f64_2d **out0, const
                       struct futhark_f64_2d *in0, const int64_t in1, const
                       int64_t in2, const int64_t in3, const int64_t in4, const
                       int64_t in5);

// Miscellaneous
int futhark_context_sync(struct futhark_context *ctx);
char *futhark_context_report(struct futhark_context *ctx);
char *futhark_context_get_error(struct futhark_context *ctx);
void futhark_context_set_logging_file(struct futhark_context *ctx, FILE *f);
void futhark_context_pause_profiling(struct futhark_context *ctx);
void futhark_context_unpause_profiling(struct futhark_context *ctx);
int futhark_context_clear_caches(struct futhark_context *ctx);
#define FUTHARK_BACKEND_opencl

#ifdef __cplusplus
}
#endif

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <stdint.h>
// If NDEBUG is set, the assert() macro will do nothing. Since Futhark
// (unfortunately) makes use of assert() for error detection (and even some
// side effects), we want to avoid that.
#undef NDEBUG
#include <assert.h>
#include <stdarg.h>
// Start of util.h.
//
// Various helper functions that are useful in all generated C code.

#include <errno.h>
#include <string.h>

static const char *fut_progname = "(embedded Futhark)";

static void futhark_panic(int eval, const char *fmt, ...) __attribute__((noreturn));
static char* msgprintf(const char *s, ...);
static void* slurp_file(const char *filename, size_t *size);
static int dump_file(const char *file, const void *buf, size_t n);
struct str_builder;
static void str_builder_init(struct str_builder *b);
static void str_builder(struct str_builder *b, const char *s, ...);

static void futhark_panic(int eval, const char *fmt, ...) {
  va_list ap;
  va_start(ap, fmt);
  fprintf(stderr, "%s: ", fut_progname);
  vfprintf(stderr, fmt, ap);
  va_end(ap);
  exit(eval);
}

// For generating arbitrary-sized error messages.  It is the callers
// responsibility to free the buffer at some point.
static char* msgprintf(const char *s, ...) {
  va_list vl;
  va_start(vl, s);
  size_t needed = 1 + (size_t)vsnprintf(NULL, 0, s, vl);
  char *buffer = (char*) malloc(needed);
  va_start(vl, s); // Must re-init.
  vsnprintf(buffer, needed, s, vl);
  return buffer;
}

static inline void check_err(int errval, int sets_errno, const char *fun, int line,
                            const char *msg, ...) {
  if (errval) {
    char errnum[10];

    va_list vl;
    va_start(vl, msg);

    fprintf(stderr, "ERROR: ");
    vfprintf(stderr, msg, vl);
    fprintf(stderr, " in %s() at line %d with error code %s\n",
            fun, line,
            sets_errno ? strerror(errno) : errnum);
    exit(errval);
  }
}

#define CHECK_ERR(err, ...) check_err(err, 0, __func__, __LINE__, __VA_ARGS__)
#define CHECK_ERRNO(err, ...) check_err(err, 1, __func__, __LINE__, __VA_ARGS__)

// Read the rest of an open file into a NUL-terminated string; returns
// NULL on error.
static void* fslurp_file(FILE *f, size_t *size) {
  long start = ftell(f);
  fseek(f, 0, SEEK_END);
  long src_size = ftell(f)-start;
  fseek(f, start, SEEK_SET);
  unsigned char *s = (unsigned char*) malloc((size_t)src_size + 1);
  if (fread(s, 1, (size_t)src_size, f) != (size_t)src_size) {
    free(s);
    s = NULL;
  } else {
    s[src_size] = '\0';
  }

  if (size) {
    *size = (size_t)src_size;
  }

  return s;
}

// Read a file into a NUL-terminated string; returns NULL on error.
static void* slurp_file(const char *filename, size_t *size) {
  FILE *f = fopen(filename, "rb"); // To avoid Windows messing with linebreaks.
  if (f == NULL) return NULL;
  unsigned char *s = fslurp_file(f, size);
  fclose(f);
  return s;
}

// Dump 'n' bytes from 'buf' into the file at the designated location.
// Returns 0 on success.
static int dump_file(const char *file, const void *buf, size_t n) {
  FILE *f = fopen(file, "w");

  if (f == NULL) {
    return 1;
  }

  if (fwrite(buf, sizeof(char), n, f) != n) {
    return 1;
  }

  if (fclose(f) != 0) {
    return 1;
  }

  return 0;
}

struct str_builder {
  char *str;
  size_t capacity; // Size of buffer.
  size_t used; // Bytes used, *not* including final zero.
};

static void str_builder_init(struct str_builder *b) {
  b->capacity = 10;
  b->used = 0;
  b->str = malloc(b->capacity);
  b->str[0] = 0;
}

static void str_builder(struct str_builder *b, const char *s, ...) {
  va_list vl;
  va_start(vl, s);
  size_t needed = (size_t)vsnprintf(NULL, 0, s, vl);

  while (b->capacity < b->used + needed + 1) {
    b->capacity *= 2;
    b->str = realloc(b->str, b->capacity);
  }

  va_start(vl, s); // Must re-init.
  vsnprintf(b->str+b->used, b->capacity-b->used, s, vl);
  b->used += needed;
}

// End of util.h.
// Start of half.h.

// Conversion functions are from http://half.sourceforge.net/, but
// translated to C.
//
// Copyright (c) 2012-2021 Christian Rau
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#ifndef __OPENCL_VERSION__
#define __constant
#endif

__constant static const uint16_t base_table[512] = {
  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100,
  0x0200, 0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x2400, 0x2800, 0x2C00, 0x3000, 0x3400, 0x3800, 0x3C00,
  0x4000, 0x4400, 0x4800, 0x4C00, 0x5000, 0x5400, 0x5800, 0x5C00, 0x6000, 0x6400, 0x6800, 0x6C00, 0x7000, 0x7400, 0x7800, 0x7C00,
  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,
  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,
  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,
  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,
  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,
  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,
  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,
  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8001, 0x8002, 0x8004, 0x8008, 0x8010, 0x8020, 0x8040, 0x8080, 0x8100,
  0x8200, 0x8400, 0x8800, 0x8C00, 0x9000, 0x9400, 0x9800, 0x9C00, 0xA000, 0xA400, 0xA800, 0xAC00, 0xB000, 0xB400, 0xB800, 0xBC00,
  0xC000, 0xC400, 0xC800, 0xCC00, 0xD000, 0xD400, 0xD800, 0xDC00, 0xE000, 0xE400, 0xE800, 0xEC00, 0xF000, 0xF400, 0xF800, 0xFC00,
  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,
  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,
  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,
  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,
  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,
  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,
  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00 };

__constant static const unsigned char shift_table[512] = {
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 13,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 13 };

__constant static const uint32_t mantissa_table[2048] = {
  0x00000000, 0x33800000, 0x34000000, 0x34400000, 0x34800000, 0x34A00000, 0x34C00000, 0x34E00000, 0x35000000, 0x35100000, 0x35200000, 0x35300000, 0x35400000, 0x35500000, 0x35600000, 0x35700000,
  0x35800000, 0x35880000, 0x35900000, 0x35980000, 0x35A00000, 0x35A80000, 0x35B00000, 0x35B80000, 0x35C00000, 0x35C80000, 0x35D00000, 0x35D80000, 0x35E00000, 0x35E80000, 0x35F00000, 0x35F80000,
  0x36000000, 0x36040000, 0x36080000, 0x360C0000, 0x36100000, 0x36140000, 0x36180000, 0x361C0000, 0x36200000, 0x36240000, 0x36280000, 0x362C0000, 0x36300000, 0x36340000, 0x36380000, 0x363C0000,
  0x36400000, 0x36440000, 0x36480000, 0x364C0000, 0x36500000, 0x36540000, 0x36580000, 0x365C0000, 0x36600000, 0x36640000, 0x36680000, 0x366C0000, 0x36700000, 0x36740000, 0x36780000, 0x367C0000,
  0x36800000, 0x36820000, 0x36840000, 0x36860000, 0x36880000, 0x368A0000, 0x368C0000, 0x368E0000, 0x36900000, 0x36920000, 0x36940000, 0x36960000, 0x36980000, 0x369A0000, 0x369C0000, 0x369E0000,
  0x36A00000, 0x36A20000, 0x36A40000, 0x36A60000, 0x36A80000, 0x36AA0000, 0x36AC0000, 0x36AE0000, 0x36B00000, 0x36B20000, 0x36B40000, 0x36B60000, 0x36B80000, 0x36BA0000, 0x36BC0000, 0x36BE0000,
  0x36C00000, 0x36C20000, 0x36C40000, 0x36C60000, 0x36C80000, 0x36CA0000, 0x36CC0000, 0x36CE0000, 0x36D00000, 0x36D20000, 0x36D40000, 0x36D60000, 0x36D80000, 0x36DA0000, 0x36DC0000, 0x36DE0000,
  0x36E00000, 0x36E20000, 0x36E40000, 0x36E60000, 0x36E80000, 0x36EA0000, 0x36EC0000, 0x36EE0000, 0x36F00000, 0x36F20000, 0x36F40000, 0x36F60000, 0x36F80000, 0x36FA0000, 0x36FC0000, 0x36FE0000,
  0x37000000, 0x37010000, 0x37020000, 0x37030000, 0x37040000, 0x37050000, 0x37060000, 0x37070000, 0x37080000, 0x37090000, 0x370A0000, 0x370B0000, 0x370C0000, 0x370D0000, 0x370E0000, 0x370F0000,
  0x37100000, 0x37110000, 0x37120000, 0x37130000, 0x37140000, 0x37150000, 0x37160000, 0x37170000, 0x37180000, 0x37190000, 0x371A0000, 0x371B0000, 0x371C0000, 0x371D0000, 0x371E0000, 0x371F0000,
  0x37200000, 0x37210000, 0x37220000, 0x37230000, 0x37240000, 0x37250000, 0x37260000, 0x37270000, 0x37280000, 0x37290000, 0x372A0000, 0x372B0000, 0x372C0000, 0x372D0000, 0x372E0000, 0x372F0000,
  0x37300000, 0x37310000, 0x37320000, 0x37330000, 0x37340000, 0x37350000, 0x37360000, 0x37370000, 0x37380000, 0x37390000, 0x373A0000, 0x373B0000, 0x373C0000, 0x373D0000, 0x373E0000, 0x373F0000,
  0x37400000, 0x37410000, 0x37420000, 0x37430000, 0x37440000, 0x37450000, 0x37460000, 0x37470000, 0x37480000, 0x37490000, 0x374A0000, 0x374B0000, 0x374C0000, 0x374D0000, 0x374E0000, 0x374F0000,
  0x37500000, 0x37510000, 0x37520000, 0x37530000, 0x37540000, 0x37550000, 0x37560000, 0x37570000, 0x37580000, 0x37590000, 0x375A0000, 0x375B0000, 0x375C0000, 0x375D0000, 0x375E0000, 0x375F0000,
  0x37600000, 0x37610000, 0x37620000, 0x37630000, 0x37640000, 0x37650000, 0x37660000, 0x37670000, 0x37680000, 0x37690000, 0x376A0000, 0x376B0000, 0x376C0000, 0x376D0000, 0x376E0000, 0x376F0000,
  0x37700000, 0x37710000, 0x37720000, 0x37730000, 0x37740000, 0x37750000, 0x37760000, 0x37770000, 0x37780000, 0x37790000, 0x377A0000, 0x377B0000, 0x377C0000, 0x377D0000, 0x377E0000, 0x377F0000,
  0x37800000, 0x37808000, 0x37810000, 0x37818000, 0x37820000, 0x37828000, 0x37830000, 0x37838000, 0x37840000, 0x37848000, 0x37850000, 0x37858000, 0x37860000, 0x37868000, 0x37870000, 0x37878000,
  0x37880000, 0x37888000, 0x37890000, 0x37898000, 0x378A0000, 0x378A8000, 0x378B0000, 0x378B8000, 0x378C0000, 0x378C8000, 0x378D0000, 0x378D8000, 0x378E0000, 0x378E8000, 0x378F0000, 0x378F8000,
  0x37900000, 0x37908000, 0x37910000, 0x37918000, 0x37920000, 0x37928000, 0x37930000, 0x37938000, 0x37940000, 0x37948000, 0x37950000, 0x37958000, 0x37960000, 0x37968000, 0x37970000, 0x37978000,
  0x37980000, 0x37988000, 0x37990000, 0x37998000, 0x379A0000, 0x379A8000, 0x379B0000, 0x379B8000, 0x379C0000, 0x379C8000, 0x379D0000, 0x379D8000, 0x379E0000, 0x379E8000, 0x379F0000, 0x379F8000,
  0x37A00000, 0x37A08000, 0x37A10000, 0x37A18000, 0x37A20000, 0x37A28000, 0x37A30000, 0x37A38000, 0x37A40000, 0x37A48000, 0x37A50000, 0x37A58000, 0x37A60000, 0x37A68000, 0x37A70000, 0x37A78000,
  0x37A80000, 0x37A88000, 0x37A90000, 0x37A98000, 0x37AA0000, 0x37AA8000, 0x37AB0000, 0x37AB8000, 0x37AC0000, 0x37AC8000, 0x37AD0000, 0x37AD8000, 0x37AE0000, 0x37AE8000, 0x37AF0000, 0x37AF8000,
  0x37B00000, 0x37B08000, 0x37B10000, 0x37B18000, 0x37B20000, 0x37B28000, 0x37B30000, 0x37B38000, 0x37B40000, 0x37B48000, 0x37B50000, 0x37B58000, 0x37B60000, 0x37B68000, 0x37B70000, 0x37B78000,
  0x37B80000, 0x37B88000, 0x37B90000, 0x37B98000, 0x37BA0000, 0x37BA8000, 0x37BB0000, 0x37BB8000, 0x37BC0000, 0x37BC8000, 0x37BD0000, 0x37BD8000, 0x37BE0000, 0x37BE8000, 0x37BF0000, 0x37BF8000,
  0x37C00000, 0x37C08000, 0x37C10000, 0x37C18000, 0x37C20000, 0x37C28000, 0x37C30000, 0x37C38000, 0x37C40000, 0x37C48000, 0x37C50000, 0x37C58000, 0x37C60000, 0x37C68000, 0x37C70000, 0x37C78000,
  0x37C80000, 0x37C88000, 0x37C90000, 0x37C98000, 0x37CA0000, 0x37CA8000, 0x37CB0000, 0x37CB8000, 0x37CC0000, 0x37CC8000, 0x37CD0000, 0x37CD8000, 0x37CE0000, 0x37CE8000, 0x37CF0000, 0x37CF8000,
  0x37D00000, 0x37D08000, 0x37D10000, 0x37D18000, 0x37D20000, 0x37D28000, 0x37D30000, 0x37D38000, 0x37D40000, 0x37D48000, 0x37D50000, 0x37D58000, 0x37D60000, 0x37D68000, 0x37D70000, 0x37D78000,
  0x37D80000, 0x37D88000, 0x37D90000, 0x37D98000, 0x37DA0000, 0x37DA8000, 0x37DB0000, 0x37DB8000, 0x37DC0000, 0x37DC8000, 0x37DD0000, 0x37DD8000, 0x37DE0000, 0x37DE8000, 0x37DF0000, 0x37DF8000,
  0x37E00000, 0x37E08000, 0x37E10000, 0x37E18000, 0x37E20000, 0x37E28000, 0x37E30000, 0x37E38000, 0x37E40000, 0x37E48000, 0x37E50000, 0x37E58000, 0x37E60000, 0x37E68000, 0x37E70000, 0x37E78000,
  0x37E80000, 0x37E88000, 0x37E90000, 0x37E98000, 0x37EA0000, 0x37EA8000, 0x37EB0000, 0x37EB8000, 0x37EC0000, 0x37EC8000, 0x37ED0000, 0x37ED8000, 0x37EE0000, 0x37EE8000, 0x37EF0000, 0x37EF8000,
  0x37F00000, 0x37F08000, 0x37F10000, 0x37F18000, 0x37F20000, 0x37F28000, 0x37F30000, 0x37F38000, 0x37F40000, 0x37F48000, 0x37F50000, 0x37F58000, 0x37F60000, 0x37F68000, 0x37F70000, 0x37F78000,
  0x37F80000, 0x37F88000, 0x37F90000, 0x37F98000, 0x37FA0000, 0x37FA8000, 0x37FB0000, 0x37FB8000, 0x37FC0000, 0x37FC8000, 0x37FD0000, 0x37FD8000, 0x37FE0000, 0x37FE8000, 0x37FF0000, 0x37FF8000,
  0x38000000, 0x38004000, 0x38008000, 0x3800C000, 0x38010000, 0x38014000, 0x38018000, 0x3801C000, 0x38020000, 0x38024000, 0x38028000, 0x3802C000, 0x38030000, 0x38034000, 0x38038000, 0x3803C000,
  0x38040000, 0x38044000, 0x38048000, 0x3804C000, 0x38050000, 0x38054000, 0x38058000, 0x3805C000, 0x38060000, 0x38064000, 0x38068000, 0x3806C000, 0x38070000, 0x38074000, 0x38078000, 0x3807C000,
  0x38080000, 0x38084000, 0x38088000, 0x3808C000, 0x38090000, 0x38094000, 0x38098000, 0x3809C000, 0x380A0000, 0x380A4000, 0x380A8000, 0x380AC000, 0x380B0000, 0x380B4000, 0x380B8000, 0x380BC000,
  0x380C0000, 0x380C4000, 0x380C8000, 0x380CC000, 0x380D0000, 0x380D4000, 0x380D8000, 0x380DC000, 0x380E0000, 0x380E4000, 0x380E8000, 0x380EC000, 0x380F0000, 0x380F4000, 0x380F8000, 0x380FC000,
  0x38100000, 0x38104000, 0x38108000, 0x3810C000, 0x38110000, 0x38114000, 0x38118000, 0x3811C000, 0x38120000, 0x38124000, 0x38128000, 0x3812C000, 0x38130000, 0x38134000, 0x38138000, 0x3813C000,
  0x38140000, 0x38144000, 0x38148000, 0x3814C000, 0x38150000, 0x38154000, 0x38158000, 0x3815C000, 0x38160000, 0x38164000, 0x38168000, 0x3816C000, 0x38170000, 0x38174000, 0x38178000, 0x3817C000,
  0x38180000, 0x38184000, 0x38188000, 0x3818C000, 0x38190000, 0x38194000, 0x38198000, 0x3819C000, 0x381A0000, 0x381A4000, 0x381A8000, 0x381AC000, 0x381B0000, 0x381B4000, 0x381B8000, 0x381BC000,
  0x381C0000, 0x381C4000, 0x381C8000, 0x381CC000, 0x381D0000, 0x381D4000, 0x381D8000, 0x381DC000, 0x381E0000, 0x381E4000, 0x381E8000, 0x381EC000, 0x381F0000, 0x381F4000, 0x381F8000, 0x381FC000,
  0x38200000, 0x38204000, 0x38208000, 0x3820C000, 0x38210000, 0x38214000, 0x38218000, 0x3821C000, 0x38220000, 0x38224000, 0x38228000, 0x3822C000, 0x38230000, 0x38234000, 0x38238000, 0x3823C000,
  0x38240000, 0x38244000, 0x38248000, 0x3824C000, 0x38250000, 0x38254000, 0x38258000, 0x3825C000, 0x38260000, 0x38264000, 0x38268000, 0x3826C000, 0x38270000, 0x38274000, 0x38278000, 0x3827C000,
  0x38280000, 0x38284000, 0x38288000, 0x3828C000, 0x38290000, 0x38294000, 0x38298000, 0x3829C000, 0x382A0000, 0x382A4000, 0x382A8000, 0x382AC000, 0x382B0000, 0x382B4000, 0x382B8000, 0x382BC000,
  0x382C0000, 0x382C4000, 0x382C8000, 0x382CC000, 0x382D0000, 0x382D4000, 0x382D8000, 0x382DC000, 0x382E0000, 0x382E4000, 0x382E8000, 0x382EC000, 0x382F0000, 0x382F4000, 0x382F8000, 0x382FC000,
  0x38300000, 0x38304000, 0x38308000, 0x3830C000, 0x38310000, 0x38314000, 0x38318000, 0x3831C000, 0x38320000, 0x38324000, 0x38328000, 0x3832C000, 0x38330000, 0x38334000, 0x38338000, 0x3833C000,
  0x38340000, 0x38344000, 0x38348000, 0x3834C000, 0x38350000, 0x38354000, 0x38358000, 0x3835C000, 0x38360000, 0x38364000, 0x38368000, 0x3836C000, 0x38370000, 0x38374000, 0x38378000, 0x3837C000,
  0x38380000, 0x38384000, 0x38388000, 0x3838C000, 0x38390000, 0x38394000, 0x38398000, 0x3839C000, 0x383A0000, 0x383A4000, 0x383A8000, 0x383AC000, 0x383B0000, 0x383B4000, 0x383B8000, 0x383BC000,
  0x383C0000, 0x383C4000, 0x383C8000, 0x383CC000, 0x383D0000, 0x383D4000, 0x383D8000, 0x383DC000, 0x383E0000, 0x383E4000, 0x383E8000, 0x383EC000, 0x383F0000, 0x383F4000, 0x383F8000, 0x383FC000,
  0x38400000, 0x38404000, 0x38408000, 0x3840C000, 0x38410000, 0x38414000, 0x38418000, 0x3841C000, 0x38420000, 0x38424000, 0x38428000, 0x3842C000, 0x38430000, 0x38434000, 0x38438000, 0x3843C000,
  0x38440000, 0x38444000, 0x38448000, 0x3844C000, 0x38450000, 0x38454000, 0x38458000, 0x3845C000, 0x38460000, 0x38464000, 0x38468000, 0x3846C000, 0x38470000, 0x38474000, 0x38478000, 0x3847C000,
  0x38480000, 0x38484000, 0x38488000, 0x3848C000, 0x38490000, 0x38494000, 0x38498000, 0x3849C000, 0x384A0000, 0x384A4000, 0x384A8000, 0x384AC000, 0x384B0000, 0x384B4000, 0x384B8000, 0x384BC000,
  0x384C0000, 0x384C4000, 0x384C8000, 0x384CC000, 0x384D0000, 0x384D4000, 0x384D8000, 0x384DC000, 0x384E0000, 0x384E4000, 0x384E8000, 0x384EC000, 0x384F0000, 0x384F4000, 0x384F8000, 0x384FC000,
  0x38500000, 0x38504000, 0x38508000, 0x3850C000, 0x38510000, 0x38514000, 0x38518000, 0x3851C000, 0x38520000, 0x38524000, 0x38528000, 0x3852C000, 0x38530000, 0x38534000, 0x38538000, 0x3853C000,
  0x38540000, 0x38544000, 0x38548000, 0x3854C000, 0x38550000, 0x38554000, 0x38558000, 0x3855C000, 0x38560000, 0x38564000, 0x38568000, 0x3856C000, 0x38570000, 0x38574000, 0x38578000, 0x3857C000,
  0x38580000, 0x38584000, 0x38588000, 0x3858C000, 0x38590000, 0x38594000, 0x38598000, 0x3859C000, 0x385A0000, 0x385A4000, 0x385A8000, 0x385AC000, 0x385B0000, 0x385B4000, 0x385B8000, 0x385BC000,
  0x385C0000, 0x385C4000, 0x385C8000, 0x385CC000, 0x385D0000, 0x385D4000, 0x385D8000, 0x385DC000, 0x385E0000, 0x385E4000, 0x385E8000, 0x385EC000, 0x385F0000, 0x385F4000, 0x385F8000, 0x385FC000,
  0x38600000, 0x38604000, 0x38608000, 0x3860C000, 0x38610000, 0x38614000, 0x38618000, 0x3861C000, 0x38620000, 0x38624000, 0x38628000, 0x3862C000, 0x38630000, 0x38634000, 0x38638000, 0x3863C000,
  0x38640000, 0x38644000, 0x38648000, 0x3864C000, 0x38650000, 0x38654000, 0x38658000, 0x3865C000, 0x38660000, 0x38664000, 0x38668000, 0x3866C000, 0x38670000, 0x38674000, 0x38678000, 0x3867C000,
  0x38680000, 0x38684000, 0x38688000, 0x3868C000, 0x38690000, 0x38694000, 0x38698000, 0x3869C000, 0x386A0000, 0x386A4000, 0x386A8000, 0x386AC000, 0x386B0000, 0x386B4000, 0x386B8000, 0x386BC000,
  0x386C0000, 0x386C4000, 0x386C8000, 0x386CC000, 0x386D0000, 0x386D4000, 0x386D8000, 0x386DC000, 0x386E0000, 0x386E4000, 0x386E8000, 0x386EC000, 0x386F0000, 0x386F4000, 0x386F8000, 0x386FC000,
  0x38700000, 0x38704000, 0x38708000, 0x3870C000, 0x38710000, 0x38714000, 0x38718000, 0x3871C000, 0x38720000, 0x38724000, 0x38728000, 0x3872C000, 0x38730000, 0x38734000, 0x38738000, 0x3873C000,
  0x38740000, 0x38744000, 0x38748000, 0x3874C000, 0x38750000, 0x38754000, 0x38758000, 0x3875C000, 0x38760000, 0x38764000, 0x38768000, 0x3876C000, 0x38770000, 0x38774000, 0x38778000, 0x3877C000,
  0x38780000, 0x38784000, 0x38788000, 0x3878C000, 0x38790000, 0x38794000, 0x38798000, 0x3879C000, 0x387A0000, 0x387A4000, 0x387A8000, 0x387AC000, 0x387B0000, 0x387B4000, 0x387B8000, 0x387BC000,
  0x387C0000, 0x387C4000, 0x387C8000, 0x387CC000, 0x387D0000, 0x387D4000, 0x387D8000, 0x387DC000, 0x387E0000, 0x387E4000, 0x387E8000, 0x387EC000, 0x387F0000, 0x387F4000, 0x387F8000, 0x387FC000,
  0x38000000, 0x38002000, 0x38004000, 0x38006000, 0x38008000, 0x3800A000, 0x3800C000, 0x3800E000, 0x38010000, 0x38012000, 0x38014000, 0x38016000, 0x38018000, 0x3801A000, 0x3801C000, 0x3801E000,
  0x38020000, 0x38022000, 0x38024000, 0x38026000, 0x38028000, 0x3802A000, 0x3802C000, 0x3802E000, 0x38030000, 0x38032000, 0x38034000, 0x38036000, 0x38038000, 0x3803A000, 0x3803C000, 0x3803E000,
  0x38040000, 0x38042000, 0x38044000, 0x38046000, 0x38048000, 0x3804A000, 0x3804C000, 0x3804E000, 0x38050000, 0x38052000, 0x38054000, 0x38056000, 0x38058000, 0x3805A000, 0x3805C000, 0x3805E000,
  0x38060000, 0x38062000, 0x38064000, 0x38066000, 0x38068000, 0x3806A000, 0x3806C000, 0x3806E000, 0x38070000, 0x38072000, 0x38074000, 0x38076000, 0x38078000, 0x3807A000, 0x3807C000, 0x3807E000,
  0x38080000, 0x38082000, 0x38084000, 0x38086000, 0x38088000, 0x3808A000, 0x3808C000, 0x3808E000, 0x38090000, 0x38092000, 0x38094000, 0x38096000, 0x38098000, 0x3809A000, 0x3809C000, 0x3809E000,
  0x380A0000, 0x380A2000, 0x380A4000, 0x380A6000, 0x380A8000, 0x380AA000, 0x380AC000, 0x380AE000, 0x380B0000, 0x380B2000, 0x380B4000, 0x380B6000, 0x380B8000, 0x380BA000, 0x380BC000, 0x380BE000,
  0x380C0000, 0x380C2000, 0x380C4000, 0x380C6000, 0x380C8000, 0x380CA000, 0x380CC000, 0x380CE000, 0x380D0000, 0x380D2000, 0x380D4000, 0x380D6000, 0x380D8000, 0x380DA000, 0x380DC000, 0x380DE000,
  0x380E0000, 0x380E2000, 0x380E4000, 0x380E6000, 0x380E8000, 0x380EA000, 0x380EC000, 0x380EE000, 0x380F0000, 0x380F2000, 0x380F4000, 0x380F6000, 0x380F8000, 0x380FA000, 0x380FC000, 0x380FE000,
  0x38100000, 0x38102000, 0x38104000, 0x38106000, 0x38108000, 0x3810A000, 0x3810C000, 0x3810E000, 0x38110000, 0x38112000, 0x38114000, 0x38116000, 0x38118000, 0x3811A000, 0x3811C000, 0x3811E000,
  0x38120000, 0x38122000, 0x38124000, 0x38126000, 0x38128000, 0x3812A000, 0x3812C000, 0x3812E000, 0x38130000, 0x38132000, 0x38134000, 0x38136000, 0x38138000, 0x3813A000, 0x3813C000, 0x3813E000,
  0x38140000, 0x38142000, 0x38144000, 0x38146000, 0x38148000, 0x3814A000, 0x3814C000, 0x3814E000, 0x38150000, 0x38152000, 0x38154000, 0x38156000, 0x38158000, 0x3815A000, 0x3815C000, 0x3815E000,
  0x38160000, 0x38162000, 0x38164000, 0x38166000, 0x38168000, 0x3816A000, 0x3816C000, 0x3816E000, 0x38170000, 0x38172000, 0x38174000, 0x38176000, 0x38178000, 0x3817A000, 0x3817C000, 0x3817E000,
  0x38180000, 0x38182000, 0x38184000, 0x38186000, 0x38188000, 0x3818A000, 0x3818C000, 0x3818E000, 0x38190000, 0x38192000, 0x38194000, 0x38196000, 0x38198000, 0x3819A000, 0x3819C000, 0x3819E000,
  0x381A0000, 0x381A2000, 0x381A4000, 0x381A6000, 0x381A8000, 0x381AA000, 0x381AC000, 0x381AE000, 0x381B0000, 0x381B2000, 0x381B4000, 0x381B6000, 0x381B8000, 0x381BA000, 0x381BC000, 0x381BE000,
  0x381C0000, 0x381C2000, 0x381C4000, 0x381C6000, 0x381C8000, 0x381CA000, 0x381CC000, 0x381CE000, 0x381D0000, 0x381D2000, 0x381D4000, 0x381D6000, 0x381D8000, 0x381DA000, 0x381DC000, 0x381DE000,
  0x381E0000, 0x381E2000, 0x381E4000, 0x381E6000, 0x381E8000, 0x381EA000, 0x381EC000, 0x381EE000, 0x381F0000, 0x381F2000, 0x381F4000, 0x381F6000, 0x381F8000, 0x381FA000, 0x381FC000, 0x381FE000,
  0x38200000, 0x38202000, 0x38204000, 0x38206000, 0x38208000, 0x3820A000, 0x3820C000, 0x3820E000, 0x38210000, 0x38212000, 0x38214000, 0x38216000, 0x38218000, 0x3821A000, 0x3821C000, 0x3821E000,
  0x38220000, 0x38222000, 0x38224000, 0x38226000, 0x38228000, 0x3822A000, 0x3822C000, 0x3822E000, 0x38230000, 0x38232000, 0x38234000, 0x38236000, 0x38238000, 0x3823A000, 0x3823C000, 0x3823E000,
  0x38240000, 0x38242000, 0x38244000, 0x38246000, 0x38248000, 0x3824A000, 0x3824C000, 0x3824E000, 0x38250000, 0x38252000, 0x38254000, 0x38256000, 0x38258000, 0x3825A000, 0x3825C000, 0x3825E000,
  0x38260000, 0x38262000, 0x38264000, 0x38266000, 0x38268000, 0x3826A000, 0x3826C000, 0x3826E000, 0x38270000, 0x38272000, 0x38274000, 0x38276000, 0x38278000, 0x3827A000, 0x3827C000, 0x3827E000,
  0x38280000, 0x38282000, 0x38284000, 0x38286000, 0x38288000, 0x3828A000, 0x3828C000, 0x3828E000, 0x38290000, 0x38292000, 0x38294000, 0x38296000, 0x38298000, 0x3829A000, 0x3829C000, 0x3829E000,
  0x382A0000, 0x382A2000, 0x382A4000, 0x382A6000, 0x382A8000, 0x382AA000, 0x382AC000, 0x382AE000, 0x382B0000, 0x382B2000, 0x382B4000, 0x382B6000, 0x382B8000, 0x382BA000, 0x382BC000, 0x382BE000,
  0x382C0000, 0x382C2000, 0x382C4000, 0x382C6000, 0x382C8000, 0x382CA000, 0x382CC000, 0x382CE000, 0x382D0000, 0x382D2000, 0x382D4000, 0x382D6000, 0x382D8000, 0x382DA000, 0x382DC000, 0x382DE000,
  0x382E0000, 0x382E2000, 0x382E4000, 0x382E6000, 0x382E8000, 0x382EA000, 0x382EC000, 0x382EE000, 0x382F0000, 0x382F2000, 0x382F4000, 0x382F6000, 0x382F8000, 0x382FA000, 0x382FC000, 0x382FE000,
  0x38300000, 0x38302000, 0x38304000, 0x38306000, 0x38308000, 0x3830A000, 0x3830C000, 0x3830E000, 0x38310000, 0x38312000, 0x38314000, 0x38316000, 0x38318000, 0x3831A000, 0x3831C000, 0x3831E000,
  0x38320000, 0x38322000, 0x38324000, 0x38326000, 0x38328000, 0x3832A000, 0x3832C000, 0x3832E000, 0x38330000, 0x38332000, 0x38334000, 0x38336000, 0x38338000, 0x3833A000, 0x3833C000, 0x3833E000,
  0x38340000, 0x38342000, 0x38344000, 0x38346000, 0x38348000, 0x3834A000, 0x3834C000, 0x3834E000, 0x38350000, 0x38352000, 0x38354000, 0x38356000, 0x38358000, 0x3835A000, 0x3835C000, 0x3835E000,
  0x38360000, 0x38362000, 0x38364000, 0x38366000, 0x38368000, 0x3836A000, 0x3836C000, 0x3836E000, 0x38370000, 0x38372000, 0x38374000, 0x38376000, 0x38378000, 0x3837A000, 0x3837C000, 0x3837E000,
  0x38380000, 0x38382000, 0x38384000, 0x38386000, 0x38388000, 0x3838A000, 0x3838C000, 0x3838E000, 0x38390000, 0x38392000, 0x38394000, 0x38396000, 0x38398000, 0x3839A000, 0x3839C000, 0x3839E000,
  0x383A0000, 0x383A2000, 0x383A4000, 0x383A6000, 0x383A8000, 0x383AA000, 0x383AC000, 0x383AE000, 0x383B0000, 0x383B2000, 0x383B4000, 0x383B6000, 0x383B8000, 0x383BA000, 0x383BC000, 0x383BE000,
  0x383C0000, 0x383C2000, 0x383C4000, 0x383C6000, 0x383C8000, 0x383CA000, 0x383CC000, 0x383CE000, 0x383D0000, 0x383D2000, 0x383D4000, 0x383D6000, 0x383D8000, 0x383DA000, 0x383DC000, 0x383DE000,
  0x383E0000, 0x383E2000, 0x383E4000, 0x383E6000, 0x383E8000, 0x383EA000, 0x383EC000, 0x383EE000, 0x383F0000, 0x383F2000, 0x383F4000, 0x383F6000, 0x383F8000, 0x383FA000, 0x383FC000, 0x383FE000,
  0x38400000, 0x38402000, 0x38404000, 0x38406000, 0x38408000, 0x3840A000, 0x3840C000, 0x3840E000, 0x38410000, 0x38412000, 0x38414000, 0x38416000, 0x38418000, 0x3841A000, 0x3841C000, 0x3841E000,
  0x38420000, 0x38422000, 0x38424000, 0x38426000, 0x38428000, 0x3842A000, 0x3842C000, 0x3842E000, 0x38430000, 0x38432000, 0x38434000, 0x38436000, 0x38438000, 0x3843A000, 0x3843C000, 0x3843E000,
  0x38440000, 0x38442000, 0x38444000, 0x38446000, 0x38448000, 0x3844A000, 0x3844C000, 0x3844E000, 0x38450000, 0x38452000, 0x38454000, 0x38456000, 0x38458000, 0x3845A000, 0x3845C000, 0x3845E000,
  0x38460000, 0x38462000, 0x38464000, 0x38466000, 0x38468000, 0x3846A000, 0x3846C000, 0x3846E000, 0x38470000, 0x38472000, 0x38474000, 0x38476000, 0x38478000, 0x3847A000, 0x3847C000, 0x3847E000,
  0x38480000, 0x38482000, 0x38484000, 0x38486000, 0x38488000, 0x3848A000, 0x3848C000, 0x3848E000, 0x38490000, 0x38492000, 0x38494000, 0x38496000, 0x38498000, 0x3849A000, 0x3849C000, 0x3849E000,
  0x384A0000, 0x384A2000, 0x384A4000, 0x384A6000, 0x384A8000, 0x384AA000, 0x384AC000, 0x384AE000, 0x384B0000, 0x384B2000, 0x384B4000, 0x384B6000, 0x384B8000, 0x384BA000, 0x384BC000, 0x384BE000,
  0x384C0000, 0x384C2000, 0x384C4000, 0x384C6000, 0x384C8000, 0x384CA000, 0x384CC000, 0x384CE000, 0x384D0000, 0x384D2000, 0x384D4000, 0x384D6000, 0x384D8000, 0x384DA000, 0x384DC000, 0x384DE000,
  0x384E0000, 0x384E2000, 0x384E4000, 0x384E6000, 0x384E8000, 0x384EA000, 0x384EC000, 0x384EE000, 0x384F0000, 0x384F2000, 0x384F4000, 0x384F6000, 0x384F8000, 0x384FA000, 0x384FC000, 0x384FE000,
  0x38500000, 0x38502000, 0x38504000, 0x38506000, 0x38508000, 0x3850A000, 0x3850C000, 0x3850E000, 0x38510000, 0x38512000, 0x38514000, 0x38516000, 0x38518000, 0x3851A000, 0x3851C000, 0x3851E000,
  0x38520000, 0x38522000, 0x38524000, 0x38526000, 0x38528000, 0x3852A000, 0x3852C000, 0x3852E000, 0x38530000, 0x38532000, 0x38534000, 0x38536000, 0x38538000, 0x3853A000, 0x3853C000, 0x3853E000,
  0x38540000, 0x38542000, 0x38544000, 0x38546000, 0x38548000, 0x3854A000, 0x3854C000, 0x3854E000, 0x38550000, 0x38552000, 0x38554000, 0x38556000, 0x38558000, 0x3855A000, 0x3855C000, 0x3855E000,
  0x38560000, 0x38562000, 0x38564000, 0x38566000, 0x38568000, 0x3856A000, 0x3856C000, 0x3856E000, 0x38570000, 0x38572000, 0x38574000, 0x38576000, 0x38578000, 0x3857A000, 0x3857C000, 0x3857E000,
  0x38580000, 0x38582000, 0x38584000, 0x38586000, 0x38588000, 0x3858A000, 0x3858C000, 0x3858E000, 0x38590000, 0x38592000, 0x38594000, 0x38596000, 0x38598000, 0x3859A000, 0x3859C000, 0x3859E000,
  0x385A0000, 0x385A2000, 0x385A4000, 0x385A6000, 0x385A8000, 0x385AA000, 0x385AC000, 0x385AE000, 0x385B0000, 0x385B2000, 0x385B4000, 0x385B6000, 0x385B8000, 0x385BA000, 0x385BC000, 0x385BE000,
  0x385C0000, 0x385C2000, 0x385C4000, 0x385C6000, 0x385C8000, 0x385CA000, 0x385CC000, 0x385CE000, 0x385D0000, 0x385D2000, 0x385D4000, 0x385D6000, 0x385D8000, 0x385DA000, 0x385DC000, 0x385DE000,
  0x385E0000, 0x385E2000, 0x385E4000, 0x385E6000, 0x385E8000, 0x385EA000, 0x385EC000, 0x385EE000, 0x385F0000, 0x385F2000, 0x385F4000, 0x385F6000, 0x385F8000, 0x385FA000, 0x385FC000, 0x385FE000,
  0x38600000, 0x38602000, 0x38604000, 0x38606000, 0x38608000, 0x3860A000, 0x3860C000, 0x3860E000, 0x38610000, 0x38612000, 0x38614000, 0x38616000, 0x38618000, 0x3861A000, 0x3861C000, 0x3861E000,
  0x38620000, 0x38622000, 0x38624000, 0x38626000, 0x38628000, 0x3862A000, 0x3862C000, 0x3862E000, 0x38630000, 0x38632000, 0x38634000, 0x38636000, 0x38638000, 0x3863A000, 0x3863C000, 0x3863E000,
  0x38640000, 0x38642000, 0x38644000, 0x38646000, 0x38648000, 0x3864A000, 0x3864C000, 0x3864E000, 0x38650000, 0x38652000, 0x38654000, 0x38656000, 0x38658000, 0x3865A000, 0x3865C000, 0x3865E000,
  0x38660000, 0x38662000, 0x38664000, 0x38666000, 0x38668000, 0x3866A000, 0x3866C000, 0x3866E000, 0x38670000, 0x38672000, 0x38674000, 0x38676000, 0x38678000, 0x3867A000, 0x3867C000, 0x3867E000,
  0x38680000, 0x38682000, 0x38684000, 0x38686000, 0x38688000, 0x3868A000, 0x3868C000, 0x3868E000, 0x38690000, 0x38692000, 0x38694000, 0x38696000, 0x38698000, 0x3869A000, 0x3869C000, 0x3869E000,
  0x386A0000, 0x386A2000, 0x386A4000, 0x386A6000, 0x386A8000, 0x386AA000, 0x386AC000, 0x386AE000, 0x386B0000, 0x386B2000, 0x386B4000, 0x386B6000, 0x386B8000, 0x386BA000, 0x386BC000, 0x386BE000,
  0x386C0000, 0x386C2000, 0x386C4000, 0x386C6000, 0x386C8000, 0x386CA000, 0x386CC000, 0x386CE000, 0x386D0000, 0x386D2000, 0x386D4000, 0x386D6000, 0x386D8000, 0x386DA000, 0x386DC000, 0x386DE000,
  0x386E0000, 0x386E2000, 0x386E4000, 0x386E6000, 0x386E8000, 0x386EA000, 0x386EC000, 0x386EE000, 0x386F0000, 0x386F2000, 0x386F4000, 0x386F6000, 0x386F8000, 0x386FA000, 0x386FC000, 0x386FE000,
  0x38700000, 0x38702000, 0x38704000, 0x38706000, 0x38708000, 0x3870A000, 0x3870C000, 0x3870E000, 0x38710000, 0x38712000, 0x38714000, 0x38716000, 0x38718000, 0x3871A000, 0x3871C000, 0x3871E000,
  0x38720000, 0x38722000, 0x38724000, 0x38726000, 0x38728000, 0x3872A000, 0x3872C000, 0x3872E000, 0x38730000, 0x38732000, 0x38734000, 0x38736000, 0x38738000, 0x3873A000, 0x3873C000, 0x3873E000,
  0x38740000, 0x38742000, 0x38744000, 0x38746000, 0x38748000, 0x3874A000, 0x3874C000, 0x3874E000, 0x38750000, 0x38752000, 0x38754000, 0x38756000, 0x38758000, 0x3875A000, 0x3875C000, 0x3875E000,
  0x38760000, 0x38762000, 0x38764000, 0x38766000, 0x38768000, 0x3876A000, 0x3876C000, 0x3876E000, 0x38770000, 0x38772000, 0x38774000, 0x38776000, 0x38778000, 0x3877A000, 0x3877C000, 0x3877E000,
  0x38780000, 0x38782000, 0x38784000, 0x38786000, 0x38788000, 0x3878A000, 0x3878C000, 0x3878E000, 0x38790000, 0x38792000, 0x38794000, 0x38796000, 0x38798000, 0x3879A000, 0x3879C000, 0x3879E000,
  0x387A0000, 0x387A2000, 0x387A4000, 0x387A6000, 0x387A8000, 0x387AA000, 0x387AC000, 0x387AE000, 0x387B0000, 0x387B2000, 0x387B4000, 0x387B6000, 0x387B8000, 0x387BA000, 0x387BC000, 0x387BE000,
  0x387C0000, 0x387C2000, 0x387C4000, 0x387C6000, 0x387C8000, 0x387CA000, 0x387CC000, 0x387CE000, 0x387D0000, 0x387D2000, 0x387D4000, 0x387D6000, 0x387D8000, 0x387DA000, 0x387DC000, 0x387DE000,
  0x387E0000, 0x387E2000, 0x387E4000, 0x387E6000, 0x387E8000, 0x387EA000, 0x387EC000, 0x387EE000, 0x387F0000, 0x387F2000, 0x387F4000, 0x387F6000, 0x387F8000, 0x387FA000, 0x387FC000, 0x387FE000 };
__constant static const uint32_t exponent_table[64] = {
  0x00000000, 0x00800000, 0x01000000, 0x01800000, 0x02000000, 0x02800000, 0x03000000, 0x03800000, 0x04000000, 0x04800000, 0x05000000, 0x05800000, 0x06000000, 0x06800000, 0x07000000, 0x07800000,
  0x08000000, 0x08800000, 0x09000000, 0x09800000, 0x0A000000, 0x0A800000, 0x0B000000, 0x0B800000, 0x0C000000, 0x0C800000, 0x0D000000, 0x0D800000, 0x0E000000, 0x0E800000, 0x0F000000, 0x47800000,
  0x80000000, 0x80800000, 0x81000000, 0x81800000, 0x82000000, 0x82800000, 0x83000000, 0x83800000, 0x84000000, 0x84800000, 0x85000000, 0x85800000, 0x86000000, 0x86800000, 0x87000000, 0x87800000,
  0x88000000, 0x88800000, 0x89000000, 0x89800000, 0x8A000000, 0x8A800000, 0x8B000000, 0x8B800000, 0x8C000000, 0x8C800000, 0x8D000000, 0x8D800000, 0x8E000000, 0x8E800000, 0x8F000000, 0xC7800000 };
__constant static const unsigned short offset_table[64] = {
  0, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,
  0, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 };

static uint16_t float2halfbits(float value) {
  union { float x; uint32_t y; } u;
  u.x = value;
  uint32_t bits = u.y;

  uint16_t hbits = base_table[bits>>23] + (uint16_t)((bits&0x7FFFFF)>>shift_table[bits>>23]);;

  return hbits;
}

static float halfbits2float(uint16_t value) {
  uint32_t bits = mantissa_table[offset_table[value>>10]+(value&0x3FF)] + exponent_table[value>>10];

  union { uint32_t x; float y; } u;
  u.x = bits;
  return u.y;
}

// End of half.h.
// Start of timing.h.

// The function get_wall_time() returns the wall time in microseconds
// (with an unspecified offset).

#ifdef _WIN32

#include <windows.h>

static int64_t get_wall_time(void) {
  LARGE_INTEGER time,freq;
  assert(QueryPerformanceFrequency(&freq));
  assert(QueryPerformanceCounter(&time));
  return ((double)time.QuadPart / freq.QuadPart) * 1000000;
}

#else
// Assuming POSIX

#include <time.h>
#include <sys/time.h>

static int64_t get_wall_time(void) {
  struct timeval time;
  assert(gettimeofday(&time,NULL) == 0);
  return time.tv_sec * 1000000 + time.tv_usec;
}

static int64_t get_wall_time_ns(void) {
  struct timespec time;
  assert(clock_gettime(CLOCK_REALTIME, &time) == 0);
  return time.tv_sec * 1000000000 + time.tv_nsec;
}

#endif

// End of timing.h.

#ifdef _MSC_VER
#define inline __inline
#endif
#include <string.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>


#define CL_TARGET_OPENCL_VERSION 120
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#ifdef __APPLE__
#define CL_SILENCE_DEPRECATION
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif


// Start of lock.h.

// A very simple cross-platform implementation of locks.  Uses
// pthreads on Unix and some Windows thing there.  Futhark's
// host-level code is not multithreaded, but user code may be, so we
// need some mechanism for ensuring atomic access to API functions.
// This is that mechanism.  It is not exposed to user code at all, so
// we do not have to worry about name collisions.

#ifdef _WIN32

typedef HANDLE lock_t;

static void create_lock(lock_t *lock) {
  *lock = CreateMutex(NULL,  // Default security attributes.
                      FALSE, // Initially unlocked.
                      NULL); // Unnamed.
}

static void lock_lock(lock_t *lock) {
  assert(WaitForSingleObject(*lock, INFINITE) == WAIT_OBJECT_0);
}

static void lock_unlock(lock_t *lock) {
  assert(ReleaseMutex(*lock));
}

static void free_lock(lock_t *lock) {
  CloseHandle(*lock);
}

#else
// Assuming POSIX

#include <pthread.h>

typedef pthread_mutex_t lock_t;

static void create_lock(lock_t *lock) {
  int r = pthread_mutex_init(lock, NULL);
  assert(r == 0);
}

static void lock_lock(lock_t *lock) {
  int r = pthread_mutex_lock(lock);
  assert(r == 0);
}

static void lock_unlock(lock_t *lock) {
  int r = pthread_mutex_unlock(lock);
  assert(r == 0);
}

static void free_lock(lock_t *lock) {
  // Nothing to do for pthreads.
  (void)lock;
}

#endif

// End of lock.h.

#define FUTHARK_F64_ENABLED

// Start of scalar.h.

// Implementation of the primitive scalar operations.  Very
// repetitive.  This code is inserted directly into both CUDA and
// OpenCL programs, as well as the CPU code, so it has some #ifdefs to
// work everywhere.  Some operations are defined as macros because
// this allows us to use them as constant expressions in things like
// array sizes and static initialisers.

// Some of the #ifdefs are because OpenCL uses type-generic functions
// for some operations (e.g. sqrt), while C and CUDA sensibly use
// distinct functions for different precisions (e.g. sqrtf() and
// sqrt()).  This is quite annoying.  Due to C's unfortunate casting
// rules, it is also really easy to accidentally implement
// floating-point functions in the wrong precision, so be careful.

// Double-precision definitions are only included if the preprocessor
// macro FUTHARK_F64_ENABLED is set.

static inline uint8_t add8(uint8_t x, uint8_t y) {
  return x + y;
}

static inline uint16_t add16(uint16_t x, uint16_t y) {
  return x + y;
}

static inline uint32_t add32(uint32_t x, uint32_t y) {
  return x + y;
}

static inline uint64_t add64(uint64_t x, uint64_t y) {
  return x + y;
}

static inline uint8_t sub8(uint8_t x, uint8_t y) {
  return x - y;
}

static inline uint16_t sub16(uint16_t x, uint16_t y) {
  return x - y;
}

static inline uint32_t sub32(uint32_t x, uint32_t y) {
  return x - y;
}

static inline uint64_t sub64(uint64_t x, uint64_t y) {
  return x - y;
}

static inline uint8_t mul8(uint8_t x, uint8_t y) {
  return x * y;
}

static inline uint16_t mul16(uint16_t x, uint16_t y) {
  return x * y;
}

static inline uint32_t mul32(uint32_t x, uint32_t y) {
  return x * y;
}

static inline uint64_t mul64(uint64_t x, uint64_t y) {
  return x * y;
}

static inline uint8_t udiv8(uint8_t x, uint8_t y) {
  return x / y;
}

static inline uint16_t udiv16(uint16_t x, uint16_t y) {
  return x / y;
}

static inline uint32_t udiv32(uint32_t x, uint32_t y) {
  return x / y;
}

static inline uint64_t udiv64(uint64_t x, uint64_t y) {
  return x / y;
}

static inline uint8_t udiv_up8(uint8_t x, uint8_t y) {
  return (x + y - 1) / y;
}

static inline uint16_t udiv_up16(uint16_t x, uint16_t y) {
  return (x + y - 1) / y;
}

static inline uint32_t udiv_up32(uint32_t x, uint32_t y) {
  return (x + y - 1) / y;
}

static inline uint64_t udiv_up64(uint64_t x, uint64_t y) {
  return (x + y - 1) / y;
}

static inline uint8_t umod8(uint8_t x, uint8_t y) {
  return x % y;
}

static inline uint16_t umod16(uint16_t x, uint16_t y) {
  return x % y;
}

static inline uint32_t umod32(uint32_t x, uint32_t y) {
  return x % y;
}

static inline uint64_t umod64(uint64_t x, uint64_t y) {
  return x % y;
}

static inline uint8_t udiv_safe8(uint8_t x, uint8_t y) {
  return y == 0 ? 0 : x / y;
}

static inline uint16_t udiv_safe16(uint16_t x, uint16_t y) {
  return y == 0 ? 0 : x / y;
}

static inline uint32_t udiv_safe32(uint32_t x, uint32_t y) {
  return y == 0 ? 0 : x / y;
}

static inline uint64_t udiv_safe64(uint64_t x, uint64_t y) {
  return y == 0 ? 0 : x / y;
}

static inline uint8_t udiv_up_safe8(uint8_t x, uint8_t y) {
  return y == 0 ? 0 : (x + y - 1) / y;
}

static inline uint16_t udiv_up_safe16(uint16_t x, uint16_t y) {
  return y == 0 ? 0 : (x + y - 1) / y;
}

static inline uint32_t udiv_up_safe32(uint32_t x, uint32_t y) {
  return y == 0 ? 0 : (x + y - 1) / y;
}

static inline uint64_t udiv_up_safe64(uint64_t x, uint64_t y) {
  return y == 0 ? 0 : (x + y - 1) / y;
}

static inline uint8_t umod_safe8(uint8_t x, uint8_t y) {
  return y == 0 ? 0 : x % y;
}

static inline uint16_t umod_safe16(uint16_t x, uint16_t y) {
  return y == 0 ? 0 : x % y;
}

static inline uint32_t umod_safe32(uint32_t x, uint32_t y) {
  return y == 0 ? 0 : x % y;
}

static inline uint64_t umod_safe64(uint64_t x, uint64_t y) {
  return y == 0 ? 0 : x % y;
}

static inline int8_t sdiv8(int8_t x, int8_t y) {
  int8_t q = x / y;
  int8_t r = x % y;

  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);
}

static inline int16_t sdiv16(int16_t x, int16_t y) {
  int16_t q = x / y;
  int16_t r = x % y;

  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);
}

static inline int32_t sdiv32(int32_t x, int32_t y) {
  int32_t q = x / y;
  int32_t r = x % y;

  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);
}

static inline int64_t sdiv64(int64_t x, int64_t y) {
  int64_t q = x / y;
  int64_t r = x % y;

  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);
}

static inline int8_t sdiv_up8(int8_t x, int8_t y) {
  return sdiv8(x + y - 1, y);
}

static inline int16_t sdiv_up16(int16_t x, int16_t y) {
  return sdiv16(x + y - 1, y);
}

static inline int32_t sdiv_up32(int32_t x, int32_t y) {
  return sdiv32(x + y - 1, y);
}

static inline int64_t sdiv_up64(int64_t x, int64_t y) {
  return sdiv64(x + y - 1, y);
}

static inline int8_t smod8(int8_t x, int8_t y) {
  int8_t r = x % y;

  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);
}

static inline int16_t smod16(int16_t x, int16_t y) {
  int16_t r = x % y;

  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);
}

static inline int32_t smod32(int32_t x, int32_t y) {
  int32_t r = x % y;

  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);
}

static inline int64_t smod64(int64_t x, int64_t y) {
  int64_t r = x % y;

  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);
}

static inline int8_t sdiv_safe8(int8_t x, int8_t y) {
  return y == 0 ? 0 : sdiv8(x, y);
}

static inline int16_t sdiv_safe16(int16_t x, int16_t y) {
  return y == 0 ? 0 : sdiv16(x, y);
}

static inline int32_t sdiv_safe32(int32_t x, int32_t y) {
  return y == 0 ? 0 : sdiv32(x, y);
}

static inline int64_t sdiv_safe64(int64_t x, int64_t y) {
  return y == 0 ? 0 : sdiv64(x, y);
}

static inline int8_t sdiv_up_safe8(int8_t x, int8_t y) {
  return sdiv_safe8(x + y - 1, y);
}

static inline int16_t sdiv_up_safe16(int16_t x, int16_t y) {
  return sdiv_safe16(x + y - 1, y);
}

static inline int32_t sdiv_up_safe32(int32_t x, int32_t y) {
  return sdiv_safe32(x + y - 1, y);
}

static inline int64_t sdiv_up_safe64(int64_t x, int64_t y) {
  return sdiv_safe64(x + y - 1, y);
}

static inline int8_t smod_safe8(int8_t x, int8_t y) {
  return y == 0 ? 0 : smod8(x, y);
}

static inline int16_t smod_safe16(int16_t x, int16_t y) {
  return y == 0 ? 0 : smod16(x, y);
}

static inline int32_t smod_safe32(int32_t x, int32_t y) {
  return y == 0 ? 0 : smod32(x, y);
}

static inline int64_t smod_safe64(int64_t x, int64_t y) {
  return y == 0 ? 0 : smod64(x, y);
}

static inline int8_t squot8(int8_t x, int8_t y) {
  return x / y;
}

static inline int16_t squot16(int16_t x, int16_t y) {
  return x / y;
}

static inline int32_t squot32(int32_t x, int32_t y) {
  return x / y;
}

static inline int64_t squot64(int64_t x, int64_t y) {
  return x / y;
}

static inline int8_t srem8(int8_t x, int8_t y) {
  return x % y;
}

static inline int16_t srem16(int16_t x, int16_t y) {
  return x % y;
}

static inline int32_t srem32(int32_t x, int32_t y) {
  return x % y;
}

static inline int64_t srem64(int64_t x, int64_t y) {
  return x % y;
}

static inline int8_t squot_safe8(int8_t x, int8_t y) {
  return y == 0 ? 0 : x / y;
}

static inline int16_t squot_safe16(int16_t x, int16_t y) {
  return y == 0 ? 0 : x / y;
}

static inline int32_t squot_safe32(int32_t x, int32_t y) {
  return y == 0 ? 0 : x / y;
}

static inline int64_t squot_safe64(int64_t x, int64_t y) {
  return y == 0 ? 0 : x / y;
}

static inline int8_t srem_safe8(int8_t x, int8_t y) {
  return y == 0 ? 0 : x % y;
}

static inline int16_t srem_safe16(int16_t x, int16_t y) {
  return y == 0 ? 0 : x % y;
}

static inline int32_t srem_safe32(int32_t x, int32_t y) {
  return y == 0 ? 0 : x % y;
}

static inline int64_t srem_safe64(int64_t x, int64_t y) {
  return y == 0 ? 0 : x % y;
}

static inline int8_t smin8(int8_t x, int8_t y) {
  return x < y ? x : y;
}

static inline int16_t smin16(int16_t x, int16_t y) {
  return x < y ? x : y;
}

static inline int32_t smin32(int32_t x, int32_t y) {
  return x < y ? x : y;
}

static inline int64_t smin64(int64_t x, int64_t y) {
  return x < y ? x : y;
}

static inline uint8_t umin8(uint8_t x, uint8_t y) {
  return x < y ? x : y;
}

static inline uint16_t umin16(uint16_t x, uint16_t y) {
  return x < y ? x : y;
}

static inline uint32_t umin32(uint32_t x, uint32_t y) {
  return x < y ? x : y;
}

static inline uint64_t umin64(uint64_t x, uint64_t y) {
  return x < y ? x : y;
}

static inline int8_t smax8(int8_t x, int8_t y) {
  return x < y ? y : x;
}

static inline int16_t smax16(int16_t x, int16_t y) {
  return x < y ? y : x;
}

static inline int32_t smax32(int32_t x, int32_t y) {
  return x < y ? y : x;
}

static inline int64_t smax64(int64_t x, int64_t y) {
  return x < y ? y : x;
}

static inline uint8_t umax8(uint8_t x, uint8_t y) {
  return x < y ? y : x;
}

static inline uint16_t umax16(uint16_t x, uint16_t y) {
  return x < y ? y : x;
}

static inline uint32_t umax32(uint32_t x, uint32_t y) {
  return x < y ? y : x;
}

static inline uint64_t umax64(uint64_t x, uint64_t y) {
  return x < y ? y : x;
}

static inline uint8_t shl8(uint8_t x, uint8_t y) {
  return (uint8_t)(x << y);
}

static inline uint16_t shl16(uint16_t x, uint16_t y) {
  return (uint16_t)(x << y);
}

static inline uint32_t shl32(uint32_t x, uint32_t y) {
  return x << y;
}

static inline uint64_t shl64(uint64_t x, uint64_t y) {
  return x << y;
}

static inline uint8_t lshr8(uint8_t x, uint8_t y) {
  return x >> y;
}

static inline uint16_t lshr16(uint16_t x, uint16_t y) {
  return x >> y;
}

static inline uint32_t lshr32(uint32_t x, uint32_t y) {
  return x >> y;
}

static inline uint64_t lshr64(uint64_t x, uint64_t y) {
  return x >> y;
}

static inline int8_t ashr8(int8_t x, int8_t y) {
  return x >> y;
}

static inline int16_t ashr16(int16_t x, int16_t y) {
  return x >> y;
}

static inline int32_t ashr32(int32_t x, int32_t y) {
  return x >> y;
}

static inline int64_t ashr64(int64_t x, int64_t y) {
  return x >> y;
}

static inline uint8_t and8(uint8_t x, uint8_t y) {
  return x & y;
}

static inline uint16_t and16(uint16_t x, uint16_t y) {
  return x & y;
}

static inline uint32_t and32(uint32_t x, uint32_t y) {
  return x & y;
}

static inline uint64_t and64(uint64_t x, uint64_t y) {
  return x & y;
}

static inline uint8_t or8(uint8_t x, uint8_t y) {
  return x | y;
}

static inline uint16_t or16(uint16_t x, uint16_t y) {
  return x | y;
}

static inline uint32_t or32(uint32_t x, uint32_t y) {
  return x | y;
}

static inline uint64_t or64(uint64_t x, uint64_t y) {
  return x | y;
}

static inline uint8_t xor8(uint8_t x, uint8_t y) {
  return x ^ y;
}

static inline uint16_t xor16(uint16_t x, uint16_t y) {
  return x ^ y;
}

static inline uint32_t xor32(uint32_t x, uint32_t y) {
  return x ^ y;
}

static inline uint64_t xor64(uint64_t x, uint64_t y) {
  return x ^ y;
}

static inline bool ult8(uint8_t x, uint8_t y) {
  return x < y;
}

static inline bool ult16(uint16_t x, uint16_t y) {
  return x < y;
}

static inline bool ult32(uint32_t x, uint32_t y) {
  return x < y;
}

static inline bool ult64(uint64_t x, uint64_t y) {
  return x < y;
}

static inline bool ule8(uint8_t x, uint8_t y) {
  return x <= y;
}

static inline bool ule16(uint16_t x, uint16_t y) {
  return x <= y;
}

static inline bool ule32(uint32_t x, uint32_t y) {
  return x <= y;
}

static inline bool ule64(uint64_t x, uint64_t y) {
  return x <= y;
}

static inline bool slt8(int8_t x, int8_t y) {
  return x < y;
}

static inline bool slt16(int16_t x, int16_t y) {
  return x < y;
}

static inline bool slt32(int32_t x, int32_t y) {
  return x < y;
}

static inline bool slt64(int64_t x, int64_t y) {
  return x < y;
}

static inline bool sle8(int8_t x, int8_t y) {
  return x <= y;
}

static inline bool sle16(int16_t x, int16_t y) {
  return x <= y;
}

static inline bool sle32(int32_t x, int32_t y) {
  return x <= y;
}

static inline bool sle64(int64_t x, int64_t y) {
  return x <= y;
}

static inline uint8_t pow8(uint8_t x, uint8_t y) {
  uint8_t res = 1, rem = y;

  while (rem != 0) {
    if (rem & 1)
      res *= x;
    rem >>= 1;
    x *= x;
  }
  return res;
}

static inline uint16_t pow16(uint16_t x, uint16_t y) {
  uint16_t res = 1, rem = y;

  while (rem != 0) {
    if (rem & 1)
      res *= x;
    rem >>= 1;
    x *= x;
  }
  return res;
}

static inline uint32_t pow32(uint32_t x, uint32_t y) {
  uint32_t res = 1, rem = y;

  while (rem != 0) {
    if (rem & 1)
      res *= x;
    rem >>= 1;
    x *= x;
  }
  return res;
}

static inline uint64_t pow64(uint64_t x, uint64_t y) {
  uint64_t res = 1, rem = y;

  while (rem != 0) {
    if (rem & 1)
      res *= x;
    rem >>= 1;
    x *= x;
  }
  return res;
}

static inline bool itob_i8_bool(int8_t x) {
  return x;
}

static inline bool itob_i16_bool(int16_t x) {
  return x;
}

static inline bool itob_i32_bool(int32_t x) {
  return x;
}

static inline bool itob_i64_bool(int64_t x) {
  return x;
}

static inline int8_t btoi_bool_i8(bool x) {
  return x;
}

static inline int16_t btoi_bool_i16(bool x) {
  return x;
}

static inline int32_t btoi_bool_i32(bool x) {
  return x;
}

static inline int64_t btoi_bool_i64(bool x) {
  return x;
}

#define sext_i8_i8(x) ((int8_t) (int8_t) (x))
#define sext_i8_i16(x) ((int16_t) (int8_t) (x))
#define sext_i8_i32(x) ((int32_t) (int8_t) (x))
#define sext_i8_i64(x) ((int64_t) (int8_t) (x))
#define sext_i16_i8(x) ((int8_t) (int16_t) (x))
#define sext_i16_i16(x) ((int16_t) (int16_t) (x))
#define sext_i16_i32(x) ((int32_t) (int16_t) (x))
#define sext_i16_i64(x) ((int64_t) (int16_t) (x))
#define sext_i32_i8(x) ((int8_t) (int32_t) (x))
#define sext_i32_i16(x) ((int16_t) (int32_t) (x))
#define sext_i32_i32(x) ((int32_t) (int32_t) (x))
#define sext_i32_i64(x) ((int64_t) (int32_t) (x))
#define sext_i64_i8(x) ((int8_t) (int64_t) (x))
#define sext_i64_i16(x) ((int16_t) (int64_t) (x))
#define sext_i64_i32(x) ((int32_t) (int64_t) (x))
#define sext_i64_i64(x) ((int64_t) (int64_t) (x))
#define zext_i8_i8(x) ((int8_t) (uint8_t) (x))
#define zext_i8_i16(x) ((int16_t) (uint8_t) (x))
#define zext_i8_i32(x) ((int32_t) (uint8_t) (x))
#define zext_i8_i64(x) ((int64_t) (uint8_t) (x))
#define zext_i16_i8(x) ((int8_t) (uint16_t) (x))
#define zext_i16_i16(x) ((int16_t) (uint16_t) (x))
#define zext_i16_i32(x) ((int32_t) (uint16_t) (x))
#define zext_i16_i64(x) ((int64_t) (uint16_t) (x))
#define zext_i32_i8(x) ((int8_t) (uint32_t) (x))
#define zext_i32_i16(x) ((int16_t) (uint32_t) (x))
#define zext_i32_i32(x) ((int32_t) (uint32_t) (x))
#define zext_i32_i64(x) ((int64_t) (uint32_t) (x))
#define zext_i64_i8(x) ((int8_t) (uint64_t) (x))
#define zext_i64_i16(x) ((int16_t) (uint64_t) (x))
#define zext_i64_i32(x) ((int32_t) (uint64_t) (x))
#define zext_i64_i64(x) ((int64_t) (uint64_t) (x))

static int8_t abs8(int8_t x) {
  return (int8_t)abs(x);
}

static int16_t abs16(int16_t x) {
  return (int16_t)abs(x);
}

static int32_t abs32(int32_t x) {
  return abs(x);
}

static int64_t abs64(int64_t x) {
#if defined(__OPENCL_VERSION__)
  return abs(x);
#else
  return llabs(x);
#endif
}

#if defined(__OPENCL_VERSION__)
static int32_t futrts_popc8(int8_t x) {
  return popcount(x);
}

static int32_t futrts_popc16(int16_t x) {
  return popcount(x);
}

static int32_t futrts_popc32(int32_t x) {
  return popcount(x);
}

static int32_t futrts_popc64(int64_t x) {
  return popcount(x);
}
#elif defined(__CUDA_ARCH__)

static int32_t futrts_popc8(int8_t x) {
  return __popc(zext_i8_i32(x));
}

static int32_t futrts_popc16(int16_t x) {
  return __popc(zext_i16_i32(x));
}

static int32_t futrts_popc32(int32_t x) {
  return __popc(x);
}

static int32_t futrts_popc64(int64_t x) {
  return __popcll(x);
}

#else // Not OpenCL or CUDA, but plain C.

static int32_t futrts_popc8(uint8_t x) {
  int c = 0;
  for (; x; ++c) { x &= x - 1; }
  return c;
}

static int32_t futrts_popc16(uint16_t x) {
  int c = 0;
  for (; x; ++c) { x &= x - 1; }
  return c;
}

static int32_t futrts_popc32(uint32_t x) {
  int c = 0;
  for (; x; ++c) { x &= x - 1; }
  return c;
}

static int32_t futrts_popc64(uint64_t x) {
  int c = 0;
  for (; x; ++c) { x &= x - 1; }
  return c;
}
#endif

#if defined(__OPENCL_VERSION__)
static uint8_t futrts_mul_hi8(uint8_t a, uint8_t b) {
  return mul_hi(a, b);
}

static uint16_t futrts_mul_hi16(uint16_t a, uint16_t b) {
  return mul_hi(a, b);
}

static uint32_t futrts_mul_hi32(uint32_t a, uint32_t b) {
  return mul_hi(a, b);
}

static uint64_t futrts_mul_hi64(uint64_t a, uint64_t b) {
  return mul_hi(a, b);
}

#elif defined(__CUDA_ARCH__)

static uint8_t futrts_mul_hi8(uint8_t a, uint8_t b) {
  uint16_t aa = a;
  uint16_t bb = b;

  return aa * bb >> 8;
}

static uint16_t futrts_mul_hi16(uint16_t a, uint16_t b) {
  uint32_t aa = a;
  uint32_t bb = b;

  return aa * bb >> 16;
}

static uint32_t futrts_mul_hi32(uint32_t a, uint32_t b) {
  return mulhi(a, b);
}

static uint64_t futrts_mul_hi64(uint64_t a, uint64_t b) {
  return mul64hi(a, b);
}

#else // Not OpenCL or CUDA, but plain C.

static uint8_t futrts_mul_hi8(uint8_t a, uint8_t b) {
  uint16_t aa = a;
  uint16_t bb = b;

  return aa * bb >> 8;
}

static uint16_t futrts_mul_hi16(uint16_t a, uint16_t b) {
  uint32_t aa = a;
  uint32_t bb = b;

  return aa * bb >> 16;
}

static uint32_t futrts_mul_hi32(uint32_t a, uint32_t b) {
  uint64_t aa = a;
  uint64_t bb = b;

  return aa * bb >> 32;
}

static uint64_t futrts_mul_hi64(uint64_t a, uint64_t b) {
  __uint128_t aa = a;
  __uint128_t bb = b;

  return aa * bb >> 64;
}
#endif

#if defined(__OPENCL_VERSION__)
static uint8_t futrts_mad_hi8(uint8_t a, uint8_t b, uint8_t c) {
  return mad_hi(a, b, c);
}

static uint16_t futrts_mad_hi16(uint16_t a, uint16_t b, uint16_t c) {
  return mad_hi(a, b, c);
}

static uint32_t futrts_mad_hi32(uint32_t a, uint32_t b, uint32_t c) {
  return mad_hi(a, b, c);
}

static uint64_t futrts_mad_hi64(uint64_t a, uint64_t b, uint64_t c) {
  return mad_hi(a, b, c);
}

#else // Not OpenCL

static uint8_t futrts_mad_hi8(uint8_t a, uint8_t b, uint8_t c) {
  return futrts_mul_hi8(a, b) + c;
}

static uint16_t futrts_mad_hi16(uint16_t a, uint16_t b, uint16_t c) {
  return futrts_mul_hi16(a, b) + c;
}

static uint32_t futrts_mad_hi32(uint32_t a, uint32_t b, uint32_t c) {
  return futrts_mul_hi32(a, b) + c;
}

static uint64_t futrts_mad_hi64(uint64_t a, uint64_t b, uint64_t c) {
  return futrts_mul_hi64(a, b) + c;
}
#endif

#if defined(__OPENCL_VERSION__)
static int32_t futrts_clzz8(int8_t x) {
  return clz(x);
}

static int32_t futrts_clzz16(int16_t x) {
  return clz(x);
}

static int32_t futrts_clzz32(int32_t x) {
  return clz(x);
}

static int32_t futrts_clzz64(int64_t x) {
  return clz(x);
}

#elif defined(__CUDA_ARCH__)

static int32_t futrts_clzz8(int8_t x) {
  return __clz(zext_i8_i32(x)) - 24;
}

static int32_t futrts_clzz16(int16_t x) {
  return __clz(zext_i16_i32(x)) - 16;
}

static int32_t futrts_clzz32(int32_t x) {
  return __clz(x);
}

static int32_t futrts_clzz64(int64_t x) {
  return __clzll(x);
}

#else // Not OpenCL or CUDA, but plain C.

static int32_t futrts_clzz8(int8_t x) {
  return x == 0 ? 8 : __builtin_clz((uint32_t)zext_i8_i32(x)) - 24;
}

static int32_t futrts_clzz16(int16_t x) {
  return x == 0 ? 16 : __builtin_clz((uint32_t)zext_i16_i32(x)) - 16;
}

static int32_t futrts_clzz32(int32_t x) {
  return x == 0 ? 32 : __builtin_clz((uint32_t)x);
}

static int32_t futrts_clzz64(int64_t x) {
  return x == 0 ? 64 : __builtin_clzll((uint64_t)x);
}
#endif

#if defined(__OPENCL_VERSION__)
static int32_t futrts_ctzz8(int8_t x) {
  int i = 0;
  for (; i < 8 && (x & 1) == 0; i++, x >>= 1)
    ;
  return i;
}

static int32_t futrts_ctzz16(int16_t x) {
  int i = 0;
  for (; i < 16 && (x & 1) == 0; i++, x >>= 1)
    ;
  return i;
}

static int32_t futrts_ctzz32(int32_t x) {
  int i = 0;
  for (; i < 32 && (x & 1) == 0; i++, x >>= 1)
    ;
  return i;
}

static int32_t futrts_ctzz64(int64_t x) {
  int i = 0;
  for (; i < 64 && (x & 1) == 0; i++, x >>= 1)
    ;
  return i;
}

#elif defined(__CUDA_ARCH__)

static int32_t futrts_ctzz8(int8_t x) {
  int y = __ffs(x);
  return y == 0 ? 8 : y - 1;
}

static int32_t futrts_ctzz16(int16_t x) {
  int y = __ffs(x);
  return y == 0 ? 16 : y - 1;
}

static int32_t futrts_ctzz32(int32_t x) {
  int y = __ffs(x);
  return y == 0 ? 32 : y - 1;
}

static int32_t futrts_ctzz64(int64_t x) {
  int y = __ffsll(x);
  return y == 0 ? 64 : y - 1;
}

#else // Not OpenCL or CUDA, but plain C.

static int32_t futrts_ctzz8(int8_t x) {
  return x == 0 ? 8 : __builtin_ctz((uint32_t)x);
}

static int32_t futrts_ctzz16(int16_t x) {
  return x == 0 ? 16 : __builtin_ctz((uint32_t)x);
}

static int32_t futrts_ctzz32(int32_t x) {
  return x == 0 ? 32 : __builtin_ctz((uint32_t)x);
}

static int32_t futrts_ctzz64(int64_t x) {
  return x == 0 ? 64 : __builtin_ctzll((uint64_t)x);
}
#endif

static inline float fdiv32(float x, float y) {
  return x / y;
}

static inline float fadd32(float x, float y) {
  return x + y;
}

static inline float fsub32(float x, float y) {
  return x - y;
}

static inline float fmul32(float x, float y) {
  return x * y;
}

static inline bool cmplt32(float x, float y) {
  return x < y;
}

static inline bool cmple32(float x, float y) {
  return x <= y;
}

static inline float sitofp_i8_f32(int8_t x) {
  return (float) x;
}

static inline float sitofp_i16_f32(int16_t x) {
  return (float) x;
}

static inline float sitofp_i32_f32(int32_t x) {
  return (float) x;
}

static inline float sitofp_i64_f32(int64_t x) {
  return (float) x;
}

static inline float uitofp_i8_f32(uint8_t x) {
  return (float) x;
}

static inline float uitofp_i16_f32(uint16_t x) {
  return (float) x;
}

static inline float uitofp_i32_f32(uint32_t x) {
  return (float) x;
}

static inline float uitofp_i64_f32(uint64_t x) {
  return (float) x;
}

static inline int8_t fptosi_f32_i8(float x) {
  return (int8_t) x;
}

static inline int16_t fptosi_f32_i16(float x) {
  return (int16_t) x;
}

static inline int32_t fptosi_f32_i32(float x) {
  return (int32_t) x;
}

static inline int64_t fptosi_f32_i64(float x) {
  return (int64_t) x;
}

static inline uint8_t fptoui_f32_i8(float x) {
  return (uint8_t) x;
}

static inline uint16_t fptoui_f32_i16(float x) {
  return (uint16_t) x;
}

static inline uint32_t fptoui_f32_i32(float x) {
  return (uint32_t) x;
}

static inline uint64_t fptoui_f32_i64(float x) {
  return (uint64_t) x;
}

#ifdef __OPENCL_VERSION__
static inline float fabs32(float x) {
  return fabs(x);
}

static inline float fmax32(float x, float y) {
  return fmax(x, y);
}

static inline float fmin32(float x, float y) {
  return fmin(x, y);
}

static inline float fpow32(float x, float y) {
  return pow(x, y);
}

#else // Not OpenCL, but CUDA or plain C.

static inline float fabs32(float x) {
  return fabsf(x);
}

static inline float fmax32(float x, float y) {
  return fmaxf(x, y);
}

static inline float fmin32(float x, float y) {
  return fminf(x, y);
}

static inline float fpow32(float x, float y) {
  return powf(x, y);
}
#endif

static inline bool futrts_isnan32(float x) {
  return isnan(x);
}

static inline bool futrts_isinf32(float x) {
  return isinf(x);
}

#ifdef __OPENCL_VERSION__
static inline float futrts_log32(float x) {
  return log(x);
}

static inline float futrts_log2_32(float x) {
  return log2(x);
}

static inline float futrts_log10_32(float x) {
  return log10(x);
}

static inline float futrts_sqrt32(float x) {
  return sqrt(x);
}

static inline float futrts_exp32(float x) {
  return exp(x);
}

static inline float futrts_cos32(float x) {
  return cos(x);
}

static inline float futrts_sin32(float x) {
  return sin(x);
}

static inline float futrts_tan32(float x) {
  return tan(x);
}

static inline float futrts_acos32(float x) {
  return acos(x);
}

static inline float futrts_asin32(float x) {
  return asin(x);
}

static inline float futrts_atan32(float x) {
  return atan(x);
}

static inline float futrts_cosh32(float x) {
  return cosh(x);
}

static inline float futrts_sinh32(float x) {
  return sinh(x);
}

static inline float futrts_tanh32(float x) {
  return tanh(x);
}

static inline float futrts_acosh32(float x) {
  return acosh(x);
}

static inline float futrts_asinh32(float x) {
  return asinh(x);
}

static inline float futrts_atanh32(float x) {
  return atanh(x);
}

static inline float futrts_atan2_32(float x, float y) {
  return atan2(x, y);
}

static inline float futrts_hypot32(float x, float y) {
  return hypot(x, y);
}

static inline float futrts_gamma32(float x) {
  return tgamma(x);
}

static inline float futrts_lgamma32(float x) {
  return lgamma(x);
}

static inline float fmod32(float x, float y) {
  return fmod(x, y);
}

static inline float futrts_round32(float x) {
  return rint(x);
}

static inline float futrts_floor32(float x) {
  return floor(x);
}

static inline float futrts_ceil32(float x) {
  return ceil(x);
}

static inline float futrts_lerp32(float v0, float v1, float t) {
  return mix(v0, v1, t);
}

static inline float futrts_mad32(float a, float b, float c) {
  return mad(a, b, c);
}

static inline float futrts_fma32(float a, float b, float c) {
  return fma(a, b, c);
}

#else // Not OpenCL, but CUDA or plain C.

static inline float futrts_log32(float x) {
  return logf(x);
}

static inline float futrts_log2_32(float x) {
  return log2f(x);
}

static inline float futrts_log10_32(float x) {
  return log10f(x);
}

static inline float futrts_sqrt32(float x) {
  return sqrtf(x);
}

static inline float futrts_exp32(float x) {
  return expf(x);
}

static inline float futrts_cos32(float x) {
  return cosf(x);
}

static inline float futrts_sin32(float x) {
  return sinf(x);
}

static inline float futrts_tan32(float x) {
  return tanf(x);
}

static inline float futrts_acos32(float x) {
  return acosf(x);
}

static inline float futrts_asin32(float x) {
  return asinf(x);
}

static inline float futrts_atan32(float x) {
  return atanf(x);
}

static inline float futrts_cosh32(float x) {
  return coshf(x);
}

static inline float futrts_sinh32(float x) {
  return sinhf(x);
}

static inline float futrts_tanh32(float x) {
  return tanhf(x);
}

static inline float futrts_acosh32(float x) {
  return acoshf(x);
}

static inline float futrts_asinh32(float x) {
  return asinhf(x);
}

static inline float futrts_atanh32(float x) {
  return atanhf(x);
}

static inline float futrts_atan2_32(float x, float y) {
  return atan2f(x, y);
}

static inline float futrts_hypot32(float x, float y) {
  return hypotf(x, y);
}

static inline float futrts_gamma32(float x) {
  return tgammaf(x);
}

static inline float futrts_lgamma32(float x) {
  return lgammaf(x);
}

static inline float fmod32(float x, float y) {
  return fmodf(x, y);
}

static inline float futrts_round32(float x) {
  return rintf(x);
}

static inline float futrts_floor32(float x) {
  return floorf(x);
}

static inline float futrts_ceil32(float x) {
  return ceilf(x);
}

static inline float futrts_lerp32(float v0, float v1, float t) {
  return v0 + (v1 - v0) * t;
}

static inline float futrts_mad32(float a, float b, float c) {
  return a * b + c;
}

static inline float futrts_fma32(float a, float b, float c) {
  return fmaf(a, b, c);
}
#endif

static inline int32_t futrts_to_bits32(float x) {
  union {
    float f;
    int32_t t;
  } p;

  p.f = x;
  return p.t;
}

static inline float futrts_from_bits32(int32_t x) {
  union {
    int32_t f;
    float t;
  } p;

  p.f = x;
  return p.t;
}

static inline float fsignum32(float x) {
  return futrts_isnan32(x) ? x : (x > 0) - (x < 0);
}

#ifdef FUTHARK_F64_ENABLED

static inline double fdiv64(double x, double y) {
  return x / y;
}

static inline double fadd64(double x, double y) {
  return x + y;
}

static inline double fsub64(double x, double y) {
  return x - y;
}

static inline double fmul64(double x, double y) {
  return x * y;
}

static inline bool cmplt64(double x, double y) {
  return x < y;
}

static inline bool cmple64(double x, double y) {
  return x <= y;
}

static inline double sitofp_i8_f64(int8_t x) {
  return (double) x;
}

static inline double sitofp_i16_f64(int16_t x) {
  return (double) x;
}

static inline double sitofp_i32_f64(int32_t x) {
  return (double) x;
}

static inline double sitofp_i64_f64(int64_t x) {
  return (double) x;
}

static inline double uitofp_i8_f64(uint8_t x) {
  return (double) x;
}

static inline double uitofp_i16_f64(uint16_t x) {
  return (double) x;
}

static inline double uitofp_i32_f64(uint32_t x) {
  return (double) x;
}

static inline double uitofp_i64_f64(uint64_t x) {
  return (double) x;
}

static inline int8_t fptosi_f64_i8(double x) {
  return (int8_t) x;
}

static inline int16_t fptosi_f64_i16(double x) {
  return (int16_t) x;
}

static inline int32_t fptosi_f64_i32(double x) {
  return (int32_t) x;
}

static inline int64_t fptosi_f64_i64(double x) {
  return (int64_t) x;
}

static inline uint8_t fptoui_f64_i8(double x) {
  return (uint8_t) x;
}

static inline uint16_t fptoui_f64_i16(double x) {
  return (uint16_t) x;
}

static inline uint32_t fptoui_f64_i32(double x) {
  return (uint32_t) x;
}

static inline uint64_t fptoui_f64_i64(double x) {
  return (uint64_t) x;
}

static inline double fabs64(double x) {
  return fabs(x);
}

static inline double fmax64(double x, double y) {
  return fmax(x, y);
}

static inline double fmin64(double x, double y) {
  return fmin(x, y);
}

static inline double fpow64(double x, double y) {
  return pow(x, y);
}

static inline double futrts_log64(double x) {
  return log(x);
}

static inline double futrts_log2_64(double x) {
  return log2(x);
}

static inline double futrts_log10_64(double x) {
  return log10(x);
}

static inline double futrts_sqrt64(double x) {
  return sqrt(x);
}

static inline double futrts_exp64(double x) {
  return exp(x);
}

static inline double futrts_cos64(double x) {
  return cos(x);
}

static inline double futrts_sin64(double x) {
  return sin(x);
}

static inline double futrts_tan64(double x) {
  return tan(x);
}

static inline double futrts_acos64(double x) {
  return acos(x);
}

static inline double futrts_asin64(double x) {
  return asin(x);
}

static inline double futrts_atan64(double x) {
  return atan(x);
}

static inline double futrts_cosh64(double x) {
  return cosh(x);
}

static inline double futrts_sinh64(double x) {
  return sinh(x);
}

static inline double futrts_tanh64(double x) {
  return tanh(x);
}

static inline double futrts_acosh64(double x) {
  return acosh(x);
}

static inline double futrts_asinh64(double x) {
  return asinh(x);
}

static inline double futrts_atanh64(double x) {
  return atanh(x);
}

static inline double futrts_atan2_64(double x, double y) {
  return atan2(x, y);
}

static inline double futrts_hypot64(double x, double y) {
  return hypot(x, y);
}

static inline double futrts_gamma64(double x) {
  return tgamma(x);
}

static inline double futrts_lgamma64(double x) {
  return lgamma(x);
}

static inline double futrts_fma64(double a, double b, double c) {
  return fma(a, b, c);
}

static inline double futrts_round64(double x) {
  return rint(x);
}

static inline double futrts_ceil64(double x) {
  return ceil(x);
}

static inline double futrts_floor64(double x) {
  return floor(x);
}

static inline bool futrts_isnan64(double x) {
  return isnan(x);
}

static inline bool futrts_isinf64(double x) {
  return isinf(x);
}

static inline int64_t futrts_to_bits64(double x) {
  union {
    double f;
    int64_t t;
  } p;

  p.f = x;
  return p.t;
}

static inline double futrts_from_bits64(int64_t x) {
  union {
    int64_t f;
    double t;
  } p;

  p.f = x;
  return p.t;
}

static inline double fmod64(double x, double y) {
  return fmod(x, y);
}

static inline double fsignum64(double x) {
  return futrts_isnan64(x) ? x : (x > 0) - (x < 0);
}

static inline double futrts_lerp64(double v0, double v1, double t) {
#ifdef __OPENCL_VERSION__
  return mix(v0, v1, t);
#else
  return v0 + (v1 - v0) * t;
#endif
}

static inline double futrts_mad64(double a, double b, double c) {
#ifdef __OPENCL_VERSION__
  return mad(a, b, c);
#else
  return a * b + c;
#endif
}

static inline float fpconv_f32_f32(float x) {
  return (float) x;
}

static inline double fpconv_f32_f64(float x) {
  return (double) x;
}

static inline float fpconv_f64_f32(double x) {
  return (float) x;
}

static inline double fpconv_f64_f64(double x) {
  return (double) x;
}

#endif

// End of scalar.h.
// Start of scalar_f16.h.

// Half-precision is emulated if needed (e.g. in straight C) with the
// native type used if possible.  The emulation works by typedef'ing
// 'float' to 'f16', and then implementing all operations on single
// precision.  To cut down on duplication, we use the same code for
// those Futhark functions that require just operators or casts.  The
// in-memory representation for arrays will still be 16 bits even
// under emulation, so the compiler will have to be careful when
// generating reads or writes.

#if !defined(cl_khr_fp16) && !(defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 600)
#define EMULATE_F16
#endif

#if !defined(EMULATE_F16) && defined(__OPENCL_VERSION__)
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
#endif

#ifdef EMULATE_F16

// Note that the half-precision storage format is still 16 bits - the
// compiler will have to be real careful!
typedef float f16;

#else

#ifdef __CUDA_ARCH__
#include <cuda_fp16.h>
#endif

typedef half f16;

#endif

// Some of these functions convert to single precision because half
// precision versions are not available.

static inline f16 fadd16(f16 x, f16 y) {
  return x + y;
}

static inline f16 fsub16(f16 x, f16 y) {
  return x - y;
}

static inline f16 fmul16(f16 x, f16 y) {
  return x * y;
}

static inline bool cmplt16(f16 x, f16 y) {
  return x < y;
}

static inline bool cmple16(f16 x, f16 y) {
  return x <= y;
}

static inline f16 sitofp_i8_f16(int8_t x) {
  return (f16) x;
}

static inline f16 sitofp_i16_f16(int16_t x) {
  return (f16) x;
}

static inline f16 sitofp_i32_f16(int32_t x) {
  return (f16) x;
}

static inline f16 sitofp_i64_f16(int64_t x) {
  return (f16) x;
}

static inline f16 uitofp_i8_f16(uint8_t x) {
  return (f16) x;
}

static inline f16 uitofp_i16_f16(uint16_t x) {
  return (f16) x;
}

static inline f16 uitofp_i32_f16(uint32_t x) {
  return (f16) x;
}

static inline f16 uitofp_i64_f16(uint64_t x) {
  return (f16) x;
}

static inline int8_t fptosi_f16_i8(f16 x) {
  return (int8_t) (float) x;
}

static inline int16_t fptosi_f16_i16(f16 x) {
  return (int16_t) x;
}

static inline int32_t fptosi_f16_i32(f16 x) {
  return (int32_t) x;
}

static inline int64_t fptosi_f16_i64(f16 x) {
  return (int64_t) x;
}

static inline uint8_t fptoui_f16_i8(f16 x) {
  return (uint8_t) (float) x;
}

static inline uint16_t fptoui_f16_i16(f16 x) {
  return (uint16_t) x;
}

static inline uint32_t fptoui_f16_i32(f16 x) {
  return (uint32_t) x;
}

static inline uint64_t fptoui_f16_i64(f16 x) {
  return (uint64_t) x;
}

#ifndef EMULATE_F16

#ifdef __OPENCL_VERSION__
static inline f16 fabs16(f16 x) {
  return fabs(x);
}

static inline f16 fmax16(f16 x, f16 y) {
  return fmax(x, y);
}

static inline f16 fmin16(f16 x, f16 y) {
  return fmin(x, y);
}

static inline f16 fpow16(f16 x, f16 y) {
  return pow(x, y);
}

#else // Assuming CUDA.

static inline f16 fabs16(f16 x) {
  return fabsf(x);
}

static inline f16 fmax16(f16 x, f16 y) {
  return fmaxf(x, y);
}

static inline f16 fmin16(f16 x, f16 y) {
  return fminf(x, y);
}

static inline f16 fpow16(f16 x, f16 y) {
  return powf(x, y);
}
#endif

static inline bool futrts_isnan16(f16 x) {
  return isnan((float)x);
}

static inline bool futrts_isinf16(f16 x) {
  return isinf((float)x);
}

#ifdef __OPENCL_VERSION__
static inline f16 futrts_log16(f16 x) {
  return log(x);
}

static inline f16 futrts_log2_16(f16 x) {
  return log2(x);
}

static inline f16 futrts_log10_16(f16 x) {
  return log10(x);
}

static inline f16 futrts_sqrt16(f16 x) {
  return sqrt(x);
}

static inline f16 futrts_exp16(f16 x) {
  return exp(x);
}

static inline f16 futrts_cos16(f16 x) {
  return cos(x);
}

static inline f16 futrts_sin16(f16 x) {
  return sin(x);
}

static inline f16 futrts_tan16(f16 x) {
  return tan(x);
}

static inline f16 futrts_acos16(f16 x) {
  return acos(x);
}

static inline f16 futrts_asin16(f16 x) {
  return asin(x);
}

static inline f16 futrts_atan16(f16 x) {
  return atan(x);
}

static inline f16 futrts_cosh16(f16 x) {
  return cosh(x);
}

static inline f16 futrts_sinh16(f16 x) {
  return sinh(x);
}

static inline f16 futrts_tanh16(f16 x) {
  return tanh(x);
}

static inline f16 futrts_acosh16(f16 x) {
  return acosh(x);
}

static inline f16 futrts_asinh16(f16 x) {
  return asinh(x);
}

static inline f16 futrts_atanh16(f16 x) {
  return atanh(x);
}

static inline f16 futrts_atan2_16(f16 x, f16 y) {
  return atan2(x, y);
}

static inline f16 futrts_hypot16(f16 x, f16 y) {
  return hypot(x, y);
}

static inline f16 futrts_gamma16(f16 x) {
  return tgamma(x);
}

static inline f16 futrts_lgamma16(f16 x) {
  return lgamma(x);
}

static inline f16 fmod16(f16 x, f16 y) {
  return fmod(x, y);
}

static inline f16 futrts_round16(f16 x) {
  return rint(x);
}

static inline f16 futrts_floor16(f16 x) {
  return floor(x);
}

static inline f16 futrts_ceil16(f16 x) {
  return ceil(x);
}

static inline f16 futrts_lerp16(f16 v0, f16 v1, f16 t) {
  return mix(v0, v1, t);
}

static inline f16 futrts_mad16(f16 a, f16 b, f16 c) {
  return mad(a, b, c);
}

static inline f16 futrts_fma16(f16 a, f16 b, f16 c) {
  return fma(a, b, c);
}

#else // Assume CUDA.

static inline f16 futrts_log16(f16 x) {
  return hlog(x);
}

static inline f16 futrts_log2_16(f16 x) {
  return hlog2(x);
}

static inline f16 futrts_log10_16(f16 x) {
  return hlog10(x);
}

static inline f16 futrts_sqrt16(f16 x) {
  return hsqrt(x);
}

static inline f16 futrts_exp16(f16 x) {
  return hexp(x);
}

static inline f16 futrts_cos16(f16 x) {
  return hcos(x);
}

static inline f16 futrts_sin16(f16 x) {
  return hsin(x);
}

static inline f16 futrts_tan16(f16 x) {
  return tanf(x);
}

static inline f16 futrts_acos16(f16 x) {
  return acosf(x);
}

static inline f16 futrts_asin16(f16 x) {
  return asinf(x);
}

static inline f16 futrts_atan16(f16 x) {
  return atanf(x);
}

static inline f16 futrts_cosh16(f16 x) {
  return coshf(x);
}

static inline f16 futrts_sinh16(f16 x) {
  return sinhf(x);
}

static inline f16 futrts_tanh16(f16 x) {
  return tanhf(x);
}

static inline f16 futrts_acosh16(f16 x) {
  return acoshf(x);
}

static inline f16 futrts_asinh16(f16 x) {
  return asinhf(x);
}

static inline f16 futrts_atanh16(f16 x) {
  return atanhf(x);
}

static inline f16 futrts_atan2_16(f16 x, f16 y) {
  return atan2f(x, y);
}

static inline f16 futrts_hypot16(f16 x, f16 y) {
  return hypotf(x, y);
}

static inline f16 futrts_gamma16(f16 x) {
  return tgammaf(x);
}

static inline f16 futrts_lgamma16(f16 x) {
  return lgammaf(x);
}

static inline f16 fmod16(f16 x, f16 y) {
  return fmodf(x, y);
}

static inline f16 futrts_round16(f16 x) {
  return rintf(x);
}

static inline f16 futrts_floor16(f16 x) {
  return hfloor(x);
}

static inline f16 futrts_ceil16(f16 x) {
  return hceil(x);
}

static inline f16 futrts_lerp16(f16 v0, f16 v1, f16 t) {
  return v0 + (v1 - v0) * t;
}

static inline f16 futrts_mad16(f16 a, f16 b, f16 c) {
  return a * b + c;
}

static inline f16 futrts_fma16(f16 a, f16 b, f16 c) {
  return fmaf(a, b, c);
}

#endif

// The CUDA __half type cannot be put in unions for some reason, so we
// use bespoke conversion functions instead.
#ifdef __CUDA_ARCH__
static inline int16_t futrts_to_bits16(f16 x) {
  return __half_as_ushort(x);
}
static inline f16 futrts_from_bits16(int16_t x) {
  return __ushort_as_half(x);
}
#else
static inline int16_t futrts_to_bits16(f16 x) {
  union {
    f16 f;
    int16_t t;
  } p;

  p.f = x;
  return p.t;
}

static inline f16 futrts_from_bits16(int16_t x) {
  union {
    int16_t f;
    f16 t;
  } p;

  p.f = x;
  return p.t;
}
#endif

#else // No native f16 - emulate.

static inline f16 fabs16(f16 x) {
  return fabs32(x);
}

static inline f16 fmax16(f16 x, f16 y) {
  return fmax32(x, y);
}

static inline f16 fmin16(f16 x, f16 y) {
  return fmin32(x, y);
}

static inline f16 fpow16(f16 x, f16 y) {
  return fpow32(x, y);
}

static inline bool futrts_isnan16(f16 x) {
  return futrts_isnan32(x);
}

static inline bool futrts_isinf16(f16 x) {
  return futrts_isinf32(x);
}

static inline f16 futrts_log16(f16 x) {
  return futrts_log32(x);
}

static inline f16 futrts_log2_16(f16 x) {
  return futrts_log2_32(x);
}

static inline f16 futrts_log10_16(f16 x) {
  return futrts_log10_32(x);
}

static inline f16 futrts_sqrt16(f16 x) {
  return futrts_sqrt32(x);
}

static inline f16 futrts_exp16(f16 x) {
  return futrts_exp32(x);
}

static inline f16 futrts_cos16(f16 x) {
  return futrts_cos32(x);
}

static inline f16 futrts_sin16(f16 x) {
  return futrts_sin32(x);
}

static inline f16 futrts_tan16(f16 x) {
  return futrts_tan32(x);
}

static inline f16 futrts_acos16(f16 x) {
  return futrts_acos32(x);
}

static inline f16 futrts_asin16(f16 x) {
  return futrts_asin32(x);
}

static inline f16 futrts_atan16(f16 x) {
  return futrts_atan32(x);
}

static inline f16 futrts_cosh16(f16 x) {
  return futrts_cosh32(x);
}

static inline f16 futrts_sinh16(f16 x) {
  return futrts_sinh32(x);
}

static inline f16 futrts_tanh16(f16 x) {
  return futrts_tanh32(x);
}

static inline f16 futrts_acosh16(f16 x) {
  return futrts_acosh32(x);
}

static inline f16 futrts_asinh16(f16 x) {
  return futrts_asinh32(x);
}

static inline f16 futrts_atanh16(f16 x) {
  return futrts_atanh32(x);
}

static inline f16 futrts_atan2_16(f16 x, f16 y) {
  return futrts_atan2_32(x, y);
}

static inline f16 futrts_hypot16(f16 x, f16 y) {
  return futrts_hypot32(x, y);
}

static inline f16 futrts_gamma16(f16 x) {
  return futrts_gamma32(x);
}

static inline f16 futrts_lgamma16(f16 x) {
  return futrts_lgamma32(x);
}

static inline f16 fmod16(f16 x, f16 y) {
  return fmod32(x, y);
}

static inline f16 futrts_round16(f16 x) {
  return futrts_round32(x);
}

static inline f16 futrts_floor16(f16 x) {
  return futrts_floor32(x);
}

static inline f16 futrts_ceil16(f16 x) {
  return futrts_ceil32(x);
}

static inline f16 futrts_lerp16(f16 v0, f16 v1, f16 t) {
  return futrts_lerp32(v0, v1, t);
}

static inline f16 futrts_mad16(f16 a, f16 b, f16 c) {
  return futrts_mad32(a, b, c);
}

static inline f16 futrts_fma16(f16 a, f16 b, f16 c) {
  return futrts_fma32(a, b, c);
}

// Even when we are using an OpenCL that does not support cl_khr_fp16,
// it must still support vload_half for actually creating a
// half-precision number, which can then be efficiently converted to a
// float.  Similarly for vstore_half.
#ifdef __OPENCL_VERSION__

static inline int16_t futrts_to_bits16(f16 x) {
  int16_t y;
  // Violating strict aliasing here.
  vstore_half((float)x, 0, (half*)&y);
  return y;
}

static inline f16 futrts_from_bits16(int16_t x) {
  return (f16)vload_half(0, (half*)&x);
}

#else

static inline int16_t futrts_to_bits16(f16 x) {
  return (int16_t)float2halfbits(x);
}

static inline f16 futrts_from_bits16(int16_t x) {
  return halfbits2float((uint16_t)x);
}

static inline f16 fsignum16(f16 x) {
  return futrts_isnan16(x) ? x : (x > 0) - (x < 0);
}

#endif

#endif

static inline float fpconv_f16_f16(f16 x) {
  return x;
}

static inline float fpconv_f16_f32(f16 x) {
  return x;
}

static inline f16 fpconv_f32_f16(float x) {
  return x;
}

#ifdef FUTHARK_F64_ENABLED

static inline double fpconv_f16_f64(f16 x) {
  return (double) x;
}

static inline f16 fpconv_f64_f16(double x) {
  return (f16) x;
}

#endif


// End of scalar_f16.h.

static int init_constants(struct futhark_context *);
static int free_constants(struct futhark_context *);
static int32_t mainzicounter_mem_realtype_80060[10240];
static int32_t mainzicounter_mem_realtype_80076[10240];
static int32_t mainzicounter_mem_realtype_80137[10240];
static int32_t mainzicounter_mem_realtype_80153[10240];
static int32_t mainzicounter_mem_realtype_80214[10240];
static int32_t mainzicounter_mem_realtype_80230[10240];
struct memblock_device {
    int *references;
    cl_mem mem;
    int64_t size;
    const char *desc;
};
struct memblock {
    int *references;
    unsigned char *mem;
    int64_t size;
    const char *desc;
};
typedef cl_mem fl_mem_t;
// Start of free_list.h.

// An entry in the free list.  May be invalid, to avoid having to
// deallocate entries as soon as they are removed.  There is also a
// tag, to help with memory reuse.
struct free_list_entry {
  size_t size;
  fl_mem_t mem;
  const char *tag;
  unsigned char valid;
};

struct free_list {
  struct free_list_entry *entries;        // Pointer to entries.
  int capacity;                           // Number of entries.
  int used;                               // Number of valid entries.
};

static void free_list_init(struct free_list *l) {
  l->capacity = 30; // Picked arbitrarily.
  l->used = 0;
  l->entries = (struct free_list_entry*) malloc(sizeof(struct free_list_entry) * l->capacity);
  for (int i = 0; i < l->capacity; i++) {
    l->entries[i].valid = 0;
  }
}

// Remove invalid entries from the free list.
static void free_list_pack(struct free_list *l) {
  int p = 0;
  for (int i = 0; i < l->capacity; i++) {
    if (l->entries[i].valid) {
      l->entries[p] = l->entries[i];
      if (i > p) {
        l->entries[i].valid = 0;
      }
      p++;
    }
  }

  // Now p is the number of used elements.  We don't want it to go
  // less than the default capacity (although in practice it's OK as
  // long as it doesn't become 1).
  if (p < 30) {
    p = 30;
  }
  l->entries = realloc(l->entries, p * sizeof(struct free_list_entry));
  l->capacity = p;
}

static void free_list_destroy(struct free_list *l) {
  assert(l->used == 0);
  free(l->entries);
}

static int free_list_find_invalid(struct free_list *l) {
  int i;
  for (i = 0; i < l->capacity; i++) {
    if (!l->entries[i].valid) {
      break;
    }
  }
  return i;
}

static void free_list_insert(struct free_list *l, size_t size, fl_mem_t mem, const char *tag) {
  int i = free_list_find_invalid(l);

  if (i == l->capacity) {
    // List is full; so we have to grow it.
    int new_capacity = l->capacity * 2 * sizeof(struct free_list_entry);
    l->entries = realloc(l->entries, new_capacity);
    for (int j = 0; j < l->capacity; j++) {
      l->entries[j+l->capacity].valid = 0;
    }
    l->capacity *= 2;
  }

  // Now 'i' points to the first invalid entry.
  l->entries[i].valid = 1;
  l->entries[i].size = size;
  l->entries[i].mem = mem;
  l->entries[i].tag = tag;

  l->used++;
}

// Find and remove a memory block of the indicated tag, or if that
// does not exist, another memory block with exactly the desired size.
// Returns 0 on success.
static int free_list_find(struct free_list *l, size_t size,
                          size_t *size_out, fl_mem_t *mem_out) {
  int size_match = -1;
  int i;
  for (i = 0; i < l->capacity; i++) {
    if (l->entries[i].valid &&
        size <= l->entries[i].size &&
        (size_match < 0 || l->entries[i].size < l->entries[size_match].size)) {
      // If this entry is valid, has sufficient size, and is smaller than the
      // best entry found so far, use this entry.
      size_match = i;
    }
  }

  if (size_match >= 0) {
    l->entries[size_match].valid = 0;
    *size_out = l->entries[size_match].size;
    *mem_out = l->entries[size_match].mem;
    l->used--;
    return 0;
  } else {
    return 1;
  }
}

// Remove the first block in the free list.  Returns 0 if a block was
// removed, and nonzero if the free list was already empty.
static int free_list_first(struct free_list *l, fl_mem_t *mem_out) {
  for (int i = 0; i < l->capacity; i++) {
    if (l->entries[i].valid) {
      l->entries[i].valid = 0;
      *mem_out = l->entries[i].mem;
      l->used--;
      return 0;
    }
  }

  return 1;
}

// End of free_list.h.

// Start of opencl.h.

#define OPENCL_SUCCEED_FATAL(e) opencl_succeed_fatal(e, #e, __FILE__, __LINE__)
#define OPENCL_SUCCEED_NONFATAL(e) opencl_succeed_nonfatal(e, #e, __FILE__, __LINE__)
// Take care not to override an existing error.
#define OPENCL_SUCCEED_OR_RETURN(e) {             \
    char *serror = OPENCL_SUCCEED_NONFATAL(e);    \
    if (serror) {                                 \
      if (!ctx->error) {                          \
        ctx->error = serror;                      \
        return bad;                               \
      } else {                                    \
        free(serror);                             \
      }                                           \
    }                                             \
  }

// OPENCL_SUCCEED_OR_RETURN returns the value of the variable 'bad' in
// scope.  By default, it will be this one.  Create a local variable
// of some other type if needed.  This is a bit of a hack, but it
// saves effort in the code generator.
static const int bad = 1;

struct opencl_config {
  int debugging;
  int profiling;
  int logging;
  int preferred_device_num;
  const char *preferred_platform;
  const char *preferred_device;
  int ignore_blacklist;

  const char* dump_program_to;
  const char* load_program_from;
  const char* dump_binary_to;
  const char* load_binary_from;

  size_t default_group_size;
  size_t default_num_groups;
  size_t default_tile_size;
  size_t default_reg_tile_size;
  size_t default_threshold;

  int default_group_size_changed;
  int default_tile_size_changed;

  int num_sizes;
  const char **size_names;
  const char **size_vars;
  int64_t *size_values;
  const char **size_classes;
};

static void opencl_config_init(struct opencl_config *cfg,
                               int num_sizes,
                               const char *size_names[],
                               const char *size_vars[],
                               int64_t *size_values,
                               const char *size_classes[]) {
  cfg->debugging = 0;
  cfg->logging = 0;
  cfg->profiling = 0;
  cfg->preferred_device_num = 0;
  cfg->preferred_platform = "";
  cfg->preferred_device = "";
  cfg->ignore_blacklist = 0;
  cfg->dump_program_to = NULL;
  cfg->load_program_from = NULL;
  cfg->dump_binary_to = NULL;
  cfg->load_binary_from = NULL;

  // The following are dummy sizes that mean the concrete defaults
  // will be set during initialisation via hardware-inspection-based
  // heuristics.
  cfg->default_group_size = 0;
  cfg->default_num_groups = 0;
  cfg->default_tile_size = 0;
  cfg->default_reg_tile_size = 0;
  cfg->default_threshold = 0;

  cfg->default_group_size_changed = 0;
  cfg->default_tile_size_changed = 0;

  cfg->num_sizes = num_sizes;
  cfg->size_names = size_names;
  cfg->size_vars = size_vars;
  cfg->size_values = size_values;
  cfg->size_classes = size_classes;
}

// A record of something that happened.
struct profiling_record {
  cl_event *event;
  int *runs;
  int64_t *runtime;
};

struct opencl_context {
  cl_device_id device;
  cl_context ctx;
  cl_command_queue queue;

  struct opencl_config cfg;

  struct free_list free_list;

  size_t max_group_size;
  size_t max_num_groups;
  size_t max_tile_size;
  size_t max_threshold;
  size_t max_local_memory;

  size_t lockstep_width;

  struct profiling_record *profiling_records;
  int profiling_records_capacity;
  int profiling_records_used;
};

struct opencl_device_option {
  cl_platform_id platform;
  cl_device_id device;
  cl_device_type device_type;
  char *platform_name;
  char *device_name;
};

// This function must be defined by the user.  It is invoked by
// setup_opencl() after the platform and device has been found, but
// before the program is loaded.  Its intended use is to tune
// constants based on the selected platform and device.
static void post_opencl_setup(struct opencl_context*, struct opencl_device_option*);

static char *strclone(const char *str) {
  size_t size = strlen(str) + 1;
  char *copy = (char*) malloc(size);
  if (copy == NULL) {
    return NULL;
  }

  memcpy(copy, str, size);
  return copy;
}

static const char* opencl_error_string(cl_int err)
{
    switch (err) {
        case CL_SUCCESS:                            return "Success!";
        case CL_DEVICE_NOT_FOUND:                   return "Device not found.";
        case CL_DEVICE_NOT_AVAILABLE:               return "Device not available";
        case CL_COMPILER_NOT_AVAILABLE:             return "Compiler not available";
        case CL_MEM_OBJECT_ALLOCATION_FAILURE:      return "Memory object allocation failure";
        case CL_OUT_OF_RESOURCES:                   return "Out of resources";
        case CL_OUT_OF_HOST_MEMORY:                 return "Out of host memory";
        case CL_PROFILING_INFO_NOT_AVAILABLE:       return "Profiling information not available";
        case CL_MEM_COPY_OVERLAP:                   return "Memory copy overlap";
        case CL_IMAGE_FORMAT_MISMATCH:              return "Image format mismatch";
        case CL_IMAGE_FORMAT_NOT_SUPPORTED:         return "Image format not supported";
        case CL_BUILD_PROGRAM_FAILURE:              return "Program build failure";
        case CL_MAP_FAILURE:                        return "Map failure";
        case CL_INVALID_VALUE:                      return "Invalid value";
        case CL_INVALID_DEVICE_TYPE:                return "Invalid device type";
        case CL_INVALID_PLATFORM:                   return "Invalid platform";
        case CL_INVALID_DEVICE:                     return "Invalid device";
        case CL_INVALID_CONTEXT:                    return "Invalid context";
        case CL_INVALID_QUEUE_PROPERTIES:           return "Invalid queue properties";
        case CL_INVALID_COMMAND_QUEUE:              return "Invalid command queue";
        case CL_INVALID_HOST_PTR:                   return "Invalid host pointer";
        case CL_INVALID_MEM_OBJECT:                 return "Invalid memory object";
        case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR:    return "Invalid image format descriptor";
        case CL_INVALID_IMAGE_SIZE:                 return "Invalid image size";
        case CL_INVALID_SAMPLER:                    return "Invalid sampler";
        case CL_INVALID_BINARY:                     return "Invalid binary";
        case CL_INVALID_BUILD_OPTIONS:              return "Invalid build options";
        case CL_INVALID_PROGRAM:                    return "Invalid program";
        case CL_INVALID_PROGRAM_EXECUTABLE:         return "Invalid program executable";
        case CL_INVALID_KERNEL_NAME:                return "Invalid kernel name";
        case CL_INVALID_KERNEL_DEFINITION:          return "Invalid kernel definition";
        case CL_INVALID_KERNEL:                     return "Invalid kernel";
        case CL_INVALID_ARG_INDEX:                  return "Invalid argument index";
        case CL_INVALID_ARG_VALUE:                  return "Invalid argument value";
        case CL_INVALID_ARG_SIZE:                   return "Invalid argument size";
        case CL_INVALID_KERNEL_ARGS:                return "Invalid kernel arguments";
        case CL_INVALID_WORK_DIMENSION:             return "Invalid work dimension";
        case CL_INVALID_WORK_GROUP_SIZE:            return "Invalid work group size";
        case CL_INVALID_WORK_ITEM_SIZE:             return "Invalid work item size";
        case CL_INVALID_GLOBAL_OFFSET:              return "Invalid global offset";
        case CL_INVALID_EVENT_WAIT_LIST:            return "Invalid event wait list";
        case CL_INVALID_EVENT:                      return "Invalid event";
        case CL_INVALID_OPERATION:                  return "Invalid operation";
        case CL_INVALID_GL_OBJECT:                  return "Invalid OpenGL object";
        case CL_INVALID_BUFFER_SIZE:                return "Invalid buffer size";
        case CL_INVALID_MIP_LEVEL:                  return "Invalid mip-map level";
        default:                                    return "Unknown";
    }
}

static void opencl_succeed_fatal(cl_int ret,
                                 const char *call,
                                 const char *file,
                                 int line) {
  if (ret != CL_SUCCESS) {
    futhark_panic(-1, "%s:%d: OpenCL call\n  %s\nfailed with error code %d (%s)\n",
          file, line, call, ret, opencl_error_string(ret));
  }
}

static char* opencl_succeed_nonfatal(cl_int ret,
                                     const char *call,
                                     const char *file,
                                     int line) {
  if (ret != CL_SUCCESS) {
    return msgprintf("%s:%d: OpenCL call\n  %s\nfailed with error code %d (%s)\n",
                     file, line, call, ret, opencl_error_string(ret));
  } else {
    return NULL;
  }
}

static void set_preferred_platform(struct opencl_config *cfg, const char *s) {
  cfg->preferred_platform = s;
  cfg->ignore_blacklist = 1;
}

static void set_preferred_device(struct opencl_config *cfg, const char *s) {
  int x = 0;
  if (*s == '#') {
    s++;
    while (isdigit(*s)) {
      x = x * 10 + (*s++)-'0';
    }
    // Skip trailing spaces.
    while (isspace(*s)) {
      s++;
    }
  }
  cfg->preferred_device = s;
  cfg->preferred_device_num = x;
  cfg->ignore_blacklist = 1;
}

static char* opencl_platform_info(cl_platform_id platform,
                                  cl_platform_info param) {
  size_t req_bytes;
  char *info;

  OPENCL_SUCCEED_FATAL(clGetPlatformInfo(platform, param, 0, NULL, &req_bytes));

  info = (char*) malloc(req_bytes);

  OPENCL_SUCCEED_FATAL(clGetPlatformInfo(platform, param, req_bytes, info, NULL));

  return info;
}

static char* opencl_device_info(cl_device_id device,
                                cl_device_info param) {
  size_t req_bytes;
  char *info;

  OPENCL_SUCCEED_FATAL(clGetDeviceInfo(device, param, 0, NULL, &req_bytes));

  info = (char*) malloc(req_bytes);

  OPENCL_SUCCEED_FATAL(clGetDeviceInfo(device, param, req_bytes, info, NULL));

  return info;
}

static void opencl_all_device_options(struct opencl_device_option **devices_out,
                                      size_t *num_devices_out) {
  size_t num_devices = 0, num_devices_added = 0;

  cl_platform_id *all_platforms;
  cl_uint *platform_num_devices;

  cl_uint num_platforms;

  // Find the number of platforms.
  OPENCL_SUCCEED_FATAL(clGetPlatformIDs(0, NULL, &num_platforms));

  // Make room for them.
  all_platforms = calloc(num_platforms, sizeof(cl_platform_id));
  platform_num_devices = calloc(num_platforms, sizeof(cl_uint));

  // Fetch all the platforms.
  OPENCL_SUCCEED_FATAL(clGetPlatformIDs(num_platforms, all_platforms, NULL));

  // Count the number of devices for each platform, as well as the
  // total number of devices.
  for (cl_uint i = 0; i < num_platforms; i++) {
    if (clGetDeviceIDs(all_platforms[i], CL_DEVICE_TYPE_ALL,
                       0, NULL, &platform_num_devices[i]) == CL_SUCCESS) {
      num_devices += platform_num_devices[i];
    } else {
      platform_num_devices[i] = 0;
    }
  }

  // Make room for all the device options.
  struct opencl_device_option *devices =
    calloc(num_devices, sizeof(struct opencl_device_option));

  // Loop through the platforms, getting information about their devices.
  for (cl_uint i = 0; i < num_platforms; i++) {
    cl_platform_id platform = all_platforms[i];
    cl_uint num_platform_devices = platform_num_devices[i];

    if (num_platform_devices == 0) {
      continue;
    }

    char *platform_name = opencl_platform_info(platform, CL_PLATFORM_NAME);
    cl_device_id *platform_devices =
      calloc(num_platform_devices, sizeof(cl_device_id));

    // Fetch all the devices.
    OPENCL_SUCCEED_FATAL(clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL,
                                  num_platform_devices, platform_devices, NULL));

    // Loop through the devices, adding them to the devices array.
    for (cl_uint i = 0; i < num_platform_devices; i++) {
      char *device_name = opencl_device_info(platform_devices[i], CL_DEVICE_NAME);
      devices[num_devices_added].platform = platform;
      devices[num_devices_added].device = platform_devices[i];
      OPENCL_SUCCEED_FATAL(clGetDeviceInfo(platform_devices[i], CL_DEVICE_TYPE,
                                     sizeof(cl_device_type),
                                     &devices[num_devices_added].device_type,
                                     NULL));
      // We don't want the structs to share memory, so copy the platform name.
      // Each device name is already unique.
      devices[num_devices_added].platform_name = strclone(platform_name);
      devices[num_devices_added].device_name = device_name;
      num_devices_added++;
    }
    free(platform_devices);
    free(platform_name);
  }
  free(all_platforms);
  free(platform_num_devices);

  *devices_out = devices;
  *num_devices_out = num_devices;
}

// Returns 0 on success.
static int list_devices(void) {
  struct opencl_device_option *devices;
  size_t num_devices;

  opencl_all_device_options(&devices, &num_devices);

  const char *cur_platform = "";
  for (size_t i = 0; i < num_devices; i++) {
    struct opencl_device_option device = devices[i];
    if (strcmp(cur_platform, device.platform_name) != 0) {
      printf("Platform: %s\n", device.platform_name);
      cur_platform = device.platform_name;
    }
    printf("[%d]: %s\n", (int)i, device.device_name);
  }

  // Free all the platform and device names.
  for (size_t j = 0; j < num_devices; j++) {
    free(devices[j].platform_name);
    free(devices[j].device_name);
  }
  free(devices);

  return 0;
}

// Returns 0 on success.
static int select_device_interactively(struct opencl_config *cfg) {
  struct opencl_device_option *devices;
  size_t num_devices;
  int ret = 1;

  opencl_all_device_options(&devices, &num_devices);

  printf("Choose OpenCL device:\n");
  const char *cur_platform = "";
  for (size_t i = 0; i < num_devices; i++) {
    struct opencl_device_option device = devices[i];
    if (strcmp(cur_platform, device.platform_name) != 0) {
      printf("Platform: %s\n", device.platform_name);
      cur_platform = device.platform_name;
    }
    printf("[%d] %s\n", (int)i, device.device_name);
  }

  int selection;
  printf("Choice: ");
  if (scanf("%d", &selection) == 1) {
    ret = 0;
    cfg->preferred_platform = "";
    cfg->preferred_device = "";
    cfg->preferred_device_num = selection;
    cfg->ignore_blacklist = 1;
  }

  // Free all the platform and device names.
  for (size_t j = 0; j < num_devices; j++) {
    free(devices[j].platform_name);
    free(devices[j].device_name);
  }
  free(devices);

  return ret;
}

static int is_blacklisted(const char *platform_name, const char *device_name,
                          const struct opencl_config *cfg) {
  if (strcmp(cfg->preferred_platform, "") != 0 ||
      strcmp(cfg->preferred_device, "") != 0) {
    return 0;
  } else if (strstr(platform_name, "Apple") != NULL &&
             strstr(device_name, "Intel(R) Core(TM)") != NULL) {
    return 1;
  } else {
    return 0;
  }
}

static struct opencl_device_option get_preferred_device(const struct opencl_config *cfg) {
  struct opencl_device_option *devices;
  size_t num_devices;

  opencl_all_device_options(&devices, &num_devices);

  int num_device_matches = 0;

  for (size_t i = 0; i < num_devices; i++) {
    struct opencl_device_option device = devices[i];
    if (strstr(device.platform_name, cfg->preferred_platform) != NULL &&
        strstr(device.device_name, cfg->preferred_device) != NULL &&
        (cfg->ignore_blacklist ||
         !is_blacklisted(device.platform_name, device.device_name, cfg)) &&
        num_device_matches++ == cfg->preferred_device_num) {
      // Free all the platform and device names, except the ones we have chosen.
      for (size_t j = 0; j < num_devices; j++) {
        if (j != i) {
          free(devices[j].platform_name);
          free(devices[j].device_name);
        }
      }
      free(devices);
      return device;
    }
  }

  futhark_panic(1, "Could not find acceptable OpenCL device.\n");
  exit(1); // Never reached
}

static void describe_device_option(struct opencl_device_option device) {
  fprintf(stderr, "Using platform: %s\n", device.platform_name);
  fprintf(stderr, "Using device: %s\n", device.device_name);
}

static cl_build_status build_opencl_program(cl_program program, cl_device_id device, const char* options) {
  cl_int clBuildProgram_error = clBuildProgram(program, 1, &device, options, NULL, NULL);

  // Avoid termination due to CL_BUILD_PROGRAM_FAILURE
  if (clBuildProgram_error != CL_SUCCESS &&
      clBuildProgram_error != CL_BUILD_PROGRAM_FAILURE) {
    OPENCL_SUCCEED_FATAL(clBuildProgram_error);
  }

  cl_build_status build_status;
  OPENCL_SUCCEED_FATAL(clGetProgramBuildInfo(program,
                                             device,
                                             CL_PROGRAM_BUILD_STATUS,
                                             sizeof(cl_build_status),
                                             &build_status,
                                             NULL));

  if (build_status != CL_SUCCESS) {
    char *build_log;
    size_t ret_val_size;
    OPENCL_SUCCEED_FATAL(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size));

    build_log = (char*) malloc(ret_val_size+1);
    OPENCL_SUCCEED_FATAL(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL));

    // The spec technically does not say whether the build log is zero-terminated, so let's be careful.
    build_log[ret_val_size] = '\0';

    fprintf(stderr, "Build log:\n%s\n", build_log);

    free(build_log);
  }

  return build_status;
}

// Fields in a bitmask indicating which types we must be sure are
// available.
enum opencl_required_type { OPENCL_F64 = 1 };

// We take as input several strings representing the program, because
// C does not guarantee that the compiler supports particularly large
// literals.  Notably, Visual C has a limit of 2048 characters.  The
// array must be NULL-terminated.
static cl_program setup_opencl_with_command_queue(struct opencl_context *ctx,
                                                  cl_command_queue queue,
                                                  const char *srcs[],
                                                  int required_types,
                                                  const char *extra_build_opts[]) {
  int error;

  free_list_init(&ctx->free_list);
  ctx->queue = queue;

  OPENCL_SUCCEED_FATAL(clGetCommandQueueInfo(ctx->queue, CL_QUEUE_CONTEXT, sizeof(cl_context), &ctx->ctx, NULL));

  // Fill out the device info.  This is redundant work if we are
  // called from setup_opencl() (which is the common case), but I
  // doubt it matters much.
  struct opencl_device_option device_option;
  OPENCL_SUCCEED_FATAL(clGetCommandQueueInfo(ctx->queue, CL_QUEUE_DEVICE,
                                       sizeof(cl_device_id),
                                       &device_option.device,
                                       NULL));
  OPENCL_SUCCEED_FATAL(clGetDeviceInfo(device_option.device, CL_DEVICE_PLATFORM,
                                 sizeof(cl_platform_id),
                                 &device_option.platform,
                                 NULL));
  OPENCL_SUCCEED_FATAL(clGetDeviceInfo(device_option.device, CL_DEVICE_TYPE,
                                 sizeof(cl_device_type),
                                 &device_option.device_type,
                                 NULL));
  device_option.platform_name = opencl_platform_info(device_option.platform, CL_PLATFORM_NAME);
  device_option.device_name = opencl_device_info(device_option.device, CL_DEVICE_NAME);

  ctx->device = device_option.device;

  if (required_types & OPENCL_F64) {
    cl_uint supported;
    OPENCL_SUCCEED_FATAL(clGetDeviceInfo(device_option.device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
                                   sizeof(cl_uint), &supported, NULL));
    if (!supported) {
      futhark_panic(1, "Program uses double-precision floats, but this is not supported on the chosen device: %s\n",
            device_option.device_name);
    }
  }

  size_t max_group_size;
  OPENCL_SUCCEED_FATAL(clGetDeviceInfo(device_option.device, CL_DEVICE_MAX_WORK_GROUP_SIZE,
                                 sizeof(size_t), &max_group_size, NULL));

  size_t max_tile_size = sqrt(max_group_size);

  cl_ulong max_local_memory;
  OPENCL_SUCCEED_FATAL(clGetDeviceInfo(device_option.device, CL_DEVICE_LOCAL_MEM_SIZE,
                                       sizeof(size_t), &max_local_memory, NULL));

  // Futhark reserves 4 bytes for bookkeeping information.
  max_local_memory -= 4;

  // The OpenCL implementation may reserve some local memory bytes for
  // various purposes.  In principle, we should use
  // clGetKernelWorkGroupInfo() to figure out for each kernel how much
  // is actually available, but our current code generator design
  // makes this infeasible.  Instead, we have this nasty hack where we
  // arbitrarily subtract some bytes, based on empirical measurements
  // (but which might be arbitrarily wrong).  Fortunately, we rarely
  // try to really push the local memory usage.
  if (strstr(device_option.platform_name, "NVIDIA CUDA") != NULL) {
    max_local_memory -= 12;
  } else if (strstr(device_option.platform_name, "AMD") != NULL) {
    max_local_memory -= 16;
  }

  // Make sure this function is defined.
  post_opencl_setup(ctx, &device_option);

  if (max_group_size < ctx->cfg.default_group_size) {
    if (ctx->cfg.default_group_size_changed) {
      fprintf(stderr, "Note: Device limits default group size to %zu (down from %zu).\n",
              max_group_size, ctx->cfg.default_group_size);
    }
    ctx->cfg.default_group_size = max_group_size;
  }

  if (max_tile_size < ctx->cfg.default_tile_size) {
    if (ctx->cfg.default_tile_size_changed) {
      fprintf(stderr, "Note: Device limits default tile size to %zu (down from %zu).\n",
              max_tile_size, ctx->cfg.default_tile_size);
    }
    ctx->cfg.default_tile_size = max_tile_size;
  }

  ctx->max_group_size = max_group_size;
  ctx->max_tile_size = max_tile_size; // No limit.
  ctx->max_threshold = ctx->max_num_groups = 0; // No limit.
  ctx->max_local_memory = max_local_memory;

  // Now we go through all the sizes, clamp them to the valid range,
  // or set them to the default.
  for (int i = 0; i < ctx->cfg.num_sizes; i++) {
    const char *size_class = ctx->cfg.size_classes[i];
    int64_t *size_value = &ctx->cfg.size_values[i];
    const char* size_name = ctx->cfg.size_names[i];
    int64_t max_value = 0, default_value = 0;

    if (strstr(size_class, "group_size") == size_class) {
      max_value = max_group_size;
      default_value = ctx->cfg.default_group_size;
    } else if (strstr(size_class, "num_groups") == size_class) {
      max_value = max_group_size; // Futhark assumes this constraint.
      default_value = ctx->cfg.default_num_groups;
      // XXX: as a quick and dirty hack, use twice as many threads for
      // histograms by default.  We really should just be smarter
      // about sizes somehow.
      if (strstr(size_name, ".seghist_") != NULL) {
        default_value *= 2;
      }
    } else if (strstr(size_class, "tile_size") == size_class) {
      max_value = sqrt(max_group_size);
      default_value = ctx->cfg.default_tile_size;
    } else if (strstr(size_class, "reg_tile_size") == size_class) {
      max_value = 0; // No limit.
      default_value = ctx->cfg.default_reg_tile_size;
    } else if (strstr(size_class, "threshold") == size_class) {
      // Threshold can be as large as it takes.
      default_value = ctx->cfg.default_threshold;
    } else {
      // Bespoke sizes have no limit or default.
    }
    if (*size_value == 0) {
      *size_value = default_value;
    } else if (max_value > 0 && *size_value > max_value) {
      fprintf(stderr, "Note: Device limits %s to %d (down from %d)\n",
              size_name, (int)max_value, (int)*size_value);
      *size_value = max_value;
    }
  }

  if (ctx->lockstep_width == 0) {
    ctx->lockstep_width = 1;
  }

  if (ctx->cfg.logging) {
    fprintf(stderr, "Lockstep width: %d\n", (int)ctx->lockstep_width);
    fprintf(stderr, "Default group size: %d\n", (int)ctx->cfg.default_group_size);
    fprintf(stderr, "Default number of groups: %d\n", (int)ctx->cfg.default_num_groups);
  }

  char *fut_opencl_src = NULL;
  cl_program prog;
  error = CL_SUCCESS;

  if (ctx->cfg.load_binary_from == NULL) {
    size_t src_size = 0;

    // Maybe we have to read OpenCL source from somewhere else (used for debugging).
    if (ctx->cfg.load_program_from != NULL) {
      fut_opencl_src = slurp_file(ctx->cfg.load_program_from, NULL);
      assert(fut_opencl_src != NULL);
    } else {
      // Construct the OpenCL source concatenating all the fragments.
      for (const char **src = srcs; src && *src; src++) {
        src_size += strlen(*src);
      }

      fut_opencl_src = (char*) malloc(src_size + 1);

      size_t n, i;
      for (i = 0, n = 0; srcs && srcs[i]; i++) {
        strncpy(fut_opencl_src+n, srcs[i], src_size-n);
        n += strlen(srcs[i]);
      }
      fut_opencl_src[src_size] = 0;
    }

    if (ctx->cfg.dump_program_to != NULL) {
      if (ctx->cfg.debugging) {
        fprintf(stderr, "Dumping OpenCL source to %s...\n", ctx->cfg.dump_program_to);
      }

      dump_file(ctx->cfg.dump_program_to, fut_opencl_src, strlen(fut_opencl_src));
    }

    if (ctx->cfg.debugging) {
      fprintf(stderr, "Creating OpenCL program...\n");
    }

    const char* src_ptr[] = {fut_opencl_src};
    prog = clCreateProgramWithSource(ctx->ctx, 1, src_ptr, &src_size, &error);
    OPENCL_SUCCEED_FATAL(error);
  } else {
    if (ctx->cfg.debugging) {
      fprintf(stderr, "Loading OpenCL binary from %s...\n", ctx->cfg.load_binary_from);
    }
    size_t binary_size;
    unsigned char *fut_opencl_bin =
      (unsigned char*) slurp_file(ctx->cfg.load_binary_from, &binary_size);
    assert(fut_opencl_bin != NULL);
    const unsigned char *binaries[1] = { fut_opencl_bin };
    cl_int status = 0;

    prog = clCreateProgramWithBinary(ctx->ctx, 1, &device_option.device,
                                     &binary_size, binaries,
                                     &status, &error);

    OPENCL_SUCCEED_FATAL(status);
    OPENCL_SUCCEED_FATAL(error);
  }

  int compile_opts_size = 1024;

  for (int i = 0; i < ctx->cfg.num_sizes; i++) {
    compile_opts_size += strlen(ctx->cfg.size_names[i]) + 20;
  }

  for (int i = 0; extra_build_opts[i] != NULL; i++) {
    compile_opts_size += strlen(extra_build_opts[i] + 1);
  }

  char *compile_opts = (char*) malloc(compile_opts_size);

  int w = snprintf(compile_opts, compile_opts_size,
                   "-DLOCKSTEP_WIDTH=%d ",
                   (int)ctx->lockstep_width);

  for (int i = 0; i < ctx->cfg.num_sizes; i++) {
    w += snprintf(compile_opts+w, compile_opts_size-w,
                  "-D%s=%d ",
                  ctx->cfg.size_vars[i],
                  (int)ctx->cfg.size_values[i]);
  }

  for (int i = 0; extra_build_opts[i] != NULL; i++) {
    w += snprintf(compile_opts+w, compile_opts_size-w,
                  "%s ", extra_build_opts[i]);
  }

  // Oclgrind claims to support cl_khr_fp16, but this is not actually
  // the case.
  if (strcmp(device_option.platform_name, "Oclgrind") == 0) {
    w += snprintf(compile_opts+w, compile_opts_size-w, "-DEMULATE_F16 ");
  }

  if (ctx->cfg.debugging) {
    fprintf(stderr, "OpenCL compiler options: %s\n", compile_opts);
    fprintf(stderr, "Building OpenCL program...\n");
  }
  OPENCL_SUCCEED_FATAL(build_opencl_program(prog, device_option.device, compile_opts));

  free(compile_opts);
  free(fut_opencl_src);

  if (ctx->cfg.dump_binary_to != NULL) {
    if (ctx->cfg.debugging) {
      fprintf(stderr, "Dumping OpenCL binary to %s...\n", ctx->cfg.dump_binary_to);
    }

    size_t binary_size;
    OPENCL_SUCCEED_FATAL(clGetProgramInfo(prog, CL_PROGRAM_BINARY_SIZES,
                                          sizeof(size_t), &binary_size, NULL));
    unsigned char *binary = (unsigned char*) malloc(binary_size);
    unsigned char *binaries[1] = { binary };
    OPENCL_SUCCEED_FATAL(clGetProgramInfo(prog, CL_PROGRAM_BINARIES,
                                          sizeof(unsigned char*), binaries, NULL));

    dump_file(ctx->cfg.dump_binary_to, binary, binary_size);
  }

  return prog;
}

static cl_program setup_opencl(struct opencl_context *ctx,
                               const char *srcs[],
                               int required_types,
                               const char *extra_build_opts[]) {

  ctx->lockstep_width = 0; // Real value set later.

  struct opencl_device_option device_option = get_preferred_device(&ctx->cfg);

  if (ctx->cfg.logging) {
    describe_device_option(device_option);
  }

  // Note that NVIDIA's OpenCL requires the platform property
  cl_context_properties properties[] = {
    CL_CONTEXT_PLATFORM,
    (cl_context_properties)device_option.platform,
    0
  };

  cl_int clCreateContext_error;
  ctx->ctx = clCreateContext(properties, 1, &device_option.device, NULL, NULL, &clCreateContext_error);
  OPENCL_SUCCEED_FATAL(clCreateContext_error);

  cl_int clCreateCommandQueue_error;
  cl_command_queue queue =
    clCreateCommandQueue(ctx->ctx,
                         device_option.device,
                         ctx->cfg.profiling ? CL_QUEUE_PROFILING_ENABLE : 0,
                         &clCreateCommandQueue_error);
  OPENCL_SUCCEED_FATAL(clCreateCommandQueue_error);

  return setup_opencl_with_command_queue(ctx, queue, srcs, required_types, extra_build_opts);
}

// Count up the runtime all the profiling_records that occured during execution.
// Also clears the buffer of profiling_records.
static cl_int opencl_tally_profiling_records(struct opencl_context *ctx) {
  cl_int err;
  for (int i = 0; i < ctx->profiling_records_used; i++) {
    struct profiling_record record = ctx->profiling_records[i];

    cl_ulong start_t, end_t;

    if ((err = clGetEventProfilingInfo(*record.event,
                                       CL_PROFILING_COMMAND_START,
                                       sizeof(start_t),
                                       &start_t,
                                       NULL)) != CL_SUCCESS) {
      return err;
    }

    if ((err = clGetEventProfilingInfo(*record.event,
                                       CL_PROFILING_COMMAND_END,
                                       sizeof(end_t),
                                       &end_t,
                                       NULL)) != CL_SUCCESS) {
      return err;
    }

    // OpenCL provides nanosecond resolution, but we want
    // microseconds.
    *record.runs += 1;
    *record.runtime += (end_t - start_t)/1000;

    if ((err = clReleaseEvent(*record.event)) != CL_SUCCESS) {
      return err;
    }
    free(record.event);
  }

  ctx->profiling_records_used = 0;

  return CL_SUCCESS;
}

// If profiling, produce an event associated with a profiling record.
static cl_event* opencl_get_event(struct opencl_context *ctx, int *runs, int64_t *runtime) {
    if (ctx->profiling_records_used == ctx->profiling_records_capacity) {
      ctx->profiling_records_capacity *= 2;
      ctx->profiling_records =
        realloc(ctx->profiling_records,
                ctx->profiling_records_capacity *
                sizeof(struct profiling_record));
    }
    cl_event *event = malloc(sizeof(cl_event));
    ctx->profiling_records[ctx->profiling_records_used].event = event;
    ctx->profiling_records[ctx->profiling_records_used].runs = runs;
    ctx->profiling_records[ctx->profiling_records_used].runtime = runtime;
    ctx->profiling_records_used++;
    return event;
}

// Allocate memory from driver. The problem is that OpenCL may perform
// lazy allocation, so we cannot know whether an allocation succeeded
// until the first time we try to use it.  Hence we immediately
// perform a write to see if the allocation succeeded.  This is slow,
// but the assumption is that this operation will be rare (most things
// will go through the free list).
static int opencl_alloc_actual(struct opencl_context *ctx, size_t size, cl_mem *mem_out) {
  int error;
  *mem_out = clCreateBuffer(ctx->ctx, CL_MEM_READ_WRITE, size, NULL, &error);

  if (error != CL_SUCCESS) {
    return error;
  }

  int x = 2;
  error = clEnqueueWriteBuffer(ctx->queue, *mem_out,
                               CL_TRUE,
                               0, sizeof(x), &x,
                               0, NULL, NULL);

  // No need to wait for completion here. clWaitForEvents() cannot
  // return mem object allocation failures. This implies that the
  // buffer is faulted onto the device on enqueue. (Observation by
  // Andreas Kloeckner.)

  return error;
}

static int opencl_alloc(struct opencl_context *ctx, size_t min_size, const char *tag, cl_mem *mem_out) {
  (void)tag;
  if (min_size < sizeof(int)) {
    min_size = sizeof(int);
  }

  size_t size;

  if (free_list_find(&ctx->free_list, min_size, &size, mem_out) == 0) {
    // Successfully found a free block.  Is it big enough?
    //
    // FIXME: we might also want to check whether the block is *too
    // big*, to avoid internal fragmentation.  However, this can
    // sharply impact performance on programs where arrays change size
    // frequently.  Fortunately, such allocations are usually fairly
    // short-lived, as they are necessarily within a loop, so the risk
    // of internal fragmentation resulting in an OOM situation is
    // limited.  However, it would be preferable if we could go back
    // and *shrink* oversize allocations when we encounter an OOM
    // condition.  That is technically feasible, since we do not
    // expose OpenCL pointer values directly to the application, but
    // instead rely on a level of indirection.
    if (size >= min_size) {
      if (ctx->cfg.debugging) {
        fprintf(stderr, "No need to allocate: Found a block in the free list.\n");
      }

      return CL_SUCCESS;
    } else {
      if (ctx->cfg.debugging) {
        fprintf(stderr, "Found a free block, but it was too small.\n");
      }

      // Not just right - free it.
      int error = clReleaseMemObject(*mem_out);
      if (error != CL_SUCCESS) {
        return error;
      }
    }
  }

  // We have to allocate a new block from the driver.  If the
  // allocation does not succeed, then we might be in an out-of-memory
  // situation.  We now start freeing things from the free list until
  // we think we have freed enough that the allocation will succeed.
  // Since we don't know how far the allocation is from fitting, we
  // have to check after every deallocation.  This might be pretty
  // expensive.  Let's hope that this case is hit rarely.

  if (ctx->cfg.debugging) {
    fprintf(stderr, "Actually allocating the desired block.\n");
  }

  int error = opencl_alloc_actual(ctx, min_size, mem_out);

  while (error == CL_MEM_OBJECT_ALLOCATION_FAILURE) {
    if (ctx->cfg.debugging) {
      fprintf(stderr, "Out of OpenCL memory: releasing entry from the free list...\n");
    }
    cl_mem mem;
    if (free_list_first(&ctx->free_list, &mem) == 0) {
      error = clReleaseMemObject(mem);
      if (error != CL_SUCCESS) {
        return error;
      }
    } else {
      break;
    }
    error = opencl_alloc_actual(ctx, min_size, mem_out);
  }

  return error;
}

static int opencl_free(struct opencl_context *ctx, cl_mem mem, const char *tag) {
  size_t size;
  cl_mem existing_mem;

  // If there is already a block with this tag, then remove it.
  if (free_list_find(&ctx->free_list, -1, &size, &existing_mem) == 0) {
    int error = clReleaseMemObject(existing_mem);
    if (error != CL_SUCCESS) {
      return error;
    }
  }

  int error = clGetMemObjectInfo(mem, CL_MEM_SIZE, sizeof(size_t), &size, NULL);

  if (error == CL_SUCCESS) {
    free_list_insert(&ctx->free_list, size, mem, tag);
  }

  return error;
}

static int opencl_free_all(struct opencl_context *ctx) {
  cl_mem mem;
  free_list_pack(&ctx->free_list);
  while (free_list_first(&ctx->free_list, &mem) == 0) {
    int error = clReleaseMemObject(mem);
    if (error != CL_SUCCESS) {
      return error;
    }
  }

  return CL_SUCCESS;
}

// Free everything that belongs to 'ctx', but do not free 'ctx'
// itself.
static void teardown_opencl(struct opencl_context *ctx) {
  (void)opencl_tally_profiling_records(ctx);
  free(ctx->profiling_records);
  (void)opencl_free_all(ctx);
  (void)clReleaseCommandQueue(ctx->queue);
  (void)clReleaseContext(ctx->ctx);
}

// End of opencl.h.

static const char *opencl_program[] =
                  {"\n// Clang-based OpenCL implementations need this for 'static' to work.\n#ifdef cl_clang_storage_class_specifiers\n#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable\n#endif\n#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable\n\n#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n#define FUTHARK_F64_ENABLED\n\n// Some OpenCL programs dislike empty progams, or programs with no kernels.\n// Declare a dummy kernel to ensure they remain our friends.\n__kernel void dummy_kernel(__global unsigned char *dummy, int n)\n{\n    const int thread_gid = get_global_id(0);\n    if (thread_gid >= n) return;\n}\n\n#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : enable\n#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics : enable\n\ntypedef char int8_t;\ntypedef short int16_t;\ntypedef int int32_t;\ntypedef long int64_t;\n\ntypedef uchar uint8_t;\ntypedef ushort uint16_t;\ntypedef uint uint32_t;\ntypedef ulong uint64_t;\n\n// NVIDIAs OpenCL does not create device-wide memory fences (see #734), so we\n// use inline assembly if we detect we are on an NVIDIA GPU.\n#ifdef cl_nv_pragma_unroll\nstatic inline void mem_fence_global() {\n  asm(\"membar.gl;\");\n}\n#else\nstatic inline void mem_fence_global() {\n  mem_fence(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE);\n}\n#endif\nstatic inline void mem_fence_local() {\n  mem_fence(CLK_LOCAL_MEM_FENCE);\n}\n// Start of half.h.\n\n// Conversion functions are from http://half.sourceforge.net/, but\n// translated to C.\n//\n// Copyright (c) 2012-2021 Christian Rau\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission noti",
                   "ce shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#ifndef __OPENCL_VERSION__\n#define __constant\n#endif\n\n__constant static const uint16_t base_table[512] = {\n  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\n  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\n  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\n  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\n  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\n  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\n  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100,\n  0x0200, 0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x2400, 0x2800, 0x2C00, 0x3000, 0x3400, 0x3800, 0x3C00,\n  0x4000, 0x4400, 0x4800, 0x4C00, 0x5000, 0x5400, 0x5800, 0x5C00, 0x6000, 0x6400, 0x6800, 0x6C00, 0x7000, 0x7400, 0x7800, 0x7C00,\n  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,\n  0x7C00, 0x7C00, 0x7C00, 0x",
                   "7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,\n  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,\n  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,\n  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,\n  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,\n  0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00, 0x7C00,\n  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,\n  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,\n  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,\n  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,\n  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,\n  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,\n  0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8001, 0x8002, 0x8004, 0x8008, 0x8010, 0x8020, 0x8040, 0x8080, 0x8100,\n  0x8200, 0x8400, 0x8800, 0x8C00, 0x9000, 0x9400, 0x9800, 0x9C00, 0xA000, 0xA400, 0xA800, 0xAC00, 0xB000, 0xB400, 0xB800, 0xBC00,\n  0xC000, 0xC400, 0xC800, 0xCC00, 0xD000, 0xD400, 0xD800, 0xDC00, 0xE000, 0xE400, 0xE800, 0xEC00, 0xF000, 0xF400, 0xF800, 0xFC00,\n  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC",
                   "00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,\n  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,\n  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,\n  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,\n  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,\n  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00,\n  0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00 };\n\n__constant static const unsigned char shift_table[512] = {\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,\n  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 13,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, ",
                   "24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,\n  13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\n  24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 13 };\n\n__constant static const uint32_t mantissa_table[2048] = {\n  0x00000000, 0x33800000, 0x34000000, 0x34400000, 0x34800000, 0x34A00000, 0x34C00000, 0x34E00000, 0x35000000, 0x35100000, 0x35200000, 0x35300000, 0x35400000, 0x35500000, 0x35600000, 0x35700000,\n  0x35800000, 0x35880000, 0x35900000, 0x35980000, 0x35A00000, 0x35A80000, 0x35B00000, 0x35B80000, 0x35C00000, 0x35C80000, 0x35D00000, 0x35D80000, 0x35E00000, 0x35E80000, 0x35F00000, 0x35F80000,\n  0x36000000, 0x36040000, 0x36080000, 0x360C0000, 0x36100000, 0x36140000, 0x36180000, 0x361C0000, 0x36200000, 0x36240000, 0x36280000, 0x362C0000, 0x36300000, 0x36340000, 0x36380000, 0x363C0000,\n  0x36400000, 0x36440000, 0x36480000, 0x364C0000, 0x36500000, 0x36540000, 0x36580000, 0x365C0000, 0x36600000, 0x36640000, 0x36680000, 0x366C0000, 0x36700000, 0x36740000, 0x36780000, 0x367C0000,\n  0x36800000, 0x36820000, 0x36840000, 0x36860000, 0x36880000, 0x368A0000, 0x368C0000, 0x368E0000, 0x36900000, 0x36920000, 0x36940000, 0x36960000, 0x36980000, 0x369A0000, 0x369C0000, 0x369E0",
                   "000,\n  0x36A00000, 0x36A20000, 0x36A40000, 0x36A60000, 0x36A80000, 0x36AA0000, 0x36AC0000, 0x36AE0000, 0x36B00000, 0x36B20000, 0x36B40000, 0x36B60000, 0x36B80000, 0x36BA0000, 0x36BC0000, 0x36BE0000,\n  0x36C00000, 0x36C20000, 0x36C40000, 0x36C60000, 0x36C80000, 0x36CA0000, 0x36CC0000, 0x36CE0000, 0x36D00000, 0x36D20000, 0x36D40000, 0x36D60000, 0x36D80000, 0x36DA0000, 0x36DC0000, 0x36DE0000,\n  0x36E00000, 0x36E20000, 0x36E40000, 0x36E60000, 0x36E80000, 0x36EA0000, 0x36EC0000, 0x36EE0000, 0x36F00000, 0x36F20000, 0x36F40000, 0x36F60000, 0x36F80000, 0x36FA0000, 0x36FC0000, 0x36FE0000,\n  0x37000000, 0x37010000, 0x37020000, 0x37030000, 0x37040000, 0x37050000, 0x37060000, 0x37070000, 0x37080000, 0x37090000, 0x370A0000, 0x370B0000, 0x370C0000, 0x370D0000, 0x370E0000, 0x370F0000,\n  0x37100000, 0x37110000, 0x37120000, 0x37130000, 0x37140000, 0x37150000, 0x37160000, 0x37170000, 0x37180000, 0x37190000, 0x371A0000, 0x371B0000, 0x371C0000, 0x371D0000, 0x371E0000, 0x371F0000,\n  0x37200000, 0x37210000, 0x37220000, 0x37230000, 0x37240000, 0x37250000, 0x37260000, 0x37270000, 0x37280000, 0x37290000, 0x372A0000, 0x372B0000, 0x372C0000, 0x372D0000, 0x372E0000, 0x372F0000,\n  0x37300000, 0x37310000, 0x37320000, 0x37330000, 0x37340000, 0x37350000, 0x37360000, 0x37370000, 0x37380000, 0x37390000, 0x373A0000, 0x373B0000, 0x373C0000, 0x373D0000, 0x373E0000, 0x373F0000,\n  0x37400000, 0x37410000, 0x37420000, 0x37430000, 0x37440000, 0x37450000, 0x37460000, 0x37470000, 0x37480000, 0x37490000, 0x374A0000, 0x374B0000, 0x374C0000, 0x374D0000, 0x374E0000, 0x374F0000,\n  0x37500000, 0x37510000, 0x37520000, 0x37530000, 0x37540000, 0x37550000, 0x37560000, 0x37570000, 0x37580000, 0x37590000, 0x375A0000, 0x375B0000, 0x375C0000, 0x375D0000, 0x375E0000, 0x375F0000,\n  0x37600000, 0x37610000, 0x37620000, 0x37630000, 0x37640000, 0x37650000, 0x37660000, 0x37670000, 0x37680000, 0x37690000, 0x376A0000, 0x376B0000, 0x376C0000, 0x376D0000, 0x376E0000, 0x376F0000,\n  0x37700000, 0x37710000, 0x37720000, 0x37730000, 0x377",
                   "40000, 0x37750000, 0x37760000, 0x37770000, 0x37780000, 0x37790000, 0x377A0000, 0x377B0000, 0x377C0000, 0x377D0000, 0x377E0000, 0x377F0000,\n  0x37800000, 0x37808000, 0x37810000, 0x37818000, 0x37820000, 0x37828000, 0x37830000, 0x37838000, 0x37840000, 0x37848000, 0x37850000, 0x37858000, 0x37860000, 0x37868000, 0x37870000, 0x37878000,\n  0x37880000, 0x37888000, 0x37890000, 0x37898000, 0x378A0000, 0x378A8000, 0x378B0000, 0x378B8000, 0x378C0000, 0x378C8000, 0x378D0000, 0x378D8000, 0x378E0000, 0x378E8000, 0x378F0000, 0x378F8000,\n  0x37900000, 0x37908000, 0x37910000, 0x37918000, 0x37920000, 0x37928000, 0x37930000, 0x37938000, 0x37940000, 0x37948000, 0x37950000, 0x37958000, 0x37960000, 0x37968000, 0x37970000, 0x37978000,\n  0x37980000, 0x37988000, 0x37990000, 0x37998000, 0x379A0000, 0x379A8000, 0x379B0000, 0x379B8000, 0x379C0000, 0x379C8000, 0x379D0000, 0x379D8000, 0x379E0000, 0x379E8000, 0x379F0000, 0x379F8000,\n  0x37A00000, 0x37A08000, 0x37A10000, 0x37A18000, 0x37A20000, 0x37A28000, 0x37A30000, 0x37A38000, 0x37A40000, 0x37A48000, 0x37A50000, 0x37A58000, 0x37A60000, 0x37A68000, 0x37A70000, 0x37A78000,\n  0x37A80000, 0x37A88000, 0x37A90000, 0x37A98000, 0x37AA0000, 0x37AA8000, 0x37AB0000, 0x37AB8000, 0x37AC0000, 0x37AC8000, 0x37AD0000, 0x37AD8000, 0x37AE0000, 0x37AE8000, 0x37AF0000, 0x37AF8000,\n  0x37B00000, 0x37B08000, 0x37B10000, 0x37B18000, 0x37B20000, 0x37B28000, 0x37B30000, 0x37B38000, 0x37B40000, 0x37B48000, 0x37B50000, 0x37B58000, 0x37B60000, 0x37B68000, 0x37B70000, 0x37B78000,\n  0x37B80000, 0x37B88000, 0x37B90000, 0x37B98000, 0x37BA0000, 0x37BA8000, 0x37BB0000, 0x37BB8000, 0x37BC0000, 0x37BC8000, 0x37BD0000, 0x37BD8000, 0x37BE0000, 0x37BE8000, 0x37BF0000, 0x37BF8000,\n  0x37C00000, 0x37C08000, 0x37C10000, 0x37C18000, 0x37C20000, 0x37C28000, 0x37C30000, 0x37C38000, 0x37C40000, 0x37C48000, 0x37C50000, 0x37C58000, 0x37C60000, 0x37C68000, 0x37C70000, 0x37C78000,\n  0x37C80000, 0x37C88000, 0x37C90000, 0x37C98000, 0x37CA0000, 0x37CA8000, 0x37CB0000, 0x37CB8000, 0x37CC0000, 0x37C",
                   "C8000, 0x37CD0000, 0x37CD8000, 0x37CE0000, 0x37CE8000, 0x37CF0000, 0x37CF8000,\n  0x37D00000, 0x37D08000, 0x37D10000, 0x37D18000, 0x37D20000, 0x37D28000, 0x37D30000, 0x37D38000, 0x37D40000, 0x37D48000, 0x37D50000, 0x37D58000, 0x37D60000, 0x37D68000, 0x37D70000, 0x37D78000,\n  0x37D80000, 0x37D88000, 0x37D90000, 0x37D98000, 0x37DA0000, 0x37DA8000, 0x37DB0000, 0x37DB8000, 0x37DC0000, 0x37DC8000, 0x37DD0000, 0x37DD8000, 0x37DE0000, 0x37DE8000, 0x37DF0000, 0x37DF8000,\n  0x37E00000, 0x37E08000, 0x37E10000, 0x37E18000, 0x37E20000, 0x37E28000, 0x37E30000, 0x37E38000, 0x37E40000, 0x37E48000, 0x37E50000, 0x37E58000, 0x37E60000, 0x37E68000, 0x37E70000, 0x37E78000,\n  0x37E80000, 0x37E88000, 0x37E90000, 0x37E98000, 0x37EA0000, 0x37EA8000, 0x37EB0000, 0x37EB8000, 0x37EC0000, 0x37EC8000, 0x37ED0000, 0x37ED8000, 0x37EE0000, 0x37EE8000, 0x37EF0000, 0x37EF8000,\n  0x37F00000, 0x37F08000, 0x37F10000, 0x37F18000, 0x37F20000, 0x37F28000, 0x37F30000, 0x37F38000, 0x37F40000, 0x37F48000, 0x37F50000, 0x37F58000, 0x37F60000, 0x37F68000, 0x37F70000, 0x37F78000,\n  0x37F80000, 0x37F88000, 0x37F90000, 0x37F98000, 0x37FA0000, 0x37FA8000, 0x37FB0000, 0x37FB8000, 0x37FC0000, 0x37FC8000, 0x37FD0000, 0x37FD8000, 0x37FE0000, 0x37FE8000, 0x37FF0000, 0x37FF8000,\n  0x38000000, 0x38004000, 0x38008000, 0x3800C000, 0x38010000, 0x38014000, 0x38018000, 0x3801C000, 0x38020000, 0x38024000, 0x38028000, 0x3802C000, 0x38030000, 0x38034000, 0x38038000, 0x3803C000,\n  0x38040000, 0x38044000, 0x38048000, 0x3804C000, 0x38050000, 0x38054000, 0x38058000, 0x3805C000, 0x38060000, 0x38064000, 0x38068000, 0x3806C000, 0x38070000, 0x38074000, 0x38078000, 0x3807C000,\n  0x38080000, 0x38084000, 0x38088000, 0x3808C000, 0x38090000, 0x38094000, 0x38098000, 0x3809C000, 0x380A0000, 0x380A4000, 0x380A8000, 0x380AC000, 0x380B0000, 0x380B4000, 0x380B8000, 0x380BC000,\n  0x380C0000, 0x380C4000, 0x380C8000, 0x380CC000, 0x380D0000, 0x380D4000, 0x380D8000, 0x380DC000, 0x380E0000, 0x380E4000, 0x380E8000, 0x380EC000, 0x380F0000, 0x380F4000, 0x380",
                   "F8000, 0x380FC000,\n  0x38100000, 0x38104000, 0x38108000, 0x3810C000, 0x38110000, 0x38114000, 0x38118000, 0x3811C000, 0x38120000, 0x38124000, 0x38128000, 0x3812C000, 0x38130000, 0x38134000, 0x38138000, 0x3813C000,\n  0x38140000, 0x38144000, 0x38148000, 0x3814C000, 0x38150000, 0x38154000, 0x38158000, 0x3815C000, 0x38160000, 0x38164000, 0x38168000, 0x3816C000, 0x38170000, 0x38174000, 0x38178000, 0x3817C000,\n  0x38180000, 0x38184000, 0x38188000, 0x3818C000, 0x38190000, 0x38194000, 0x38198000, 0x3819C000, 0x381A0000, 0x381A4000, 0x381A8000, 0x381AC000, 0x381B0000, 0x381B4000, 0x381B8000, 0x381BC000,\n  0x381C0000, 0x381C4000, 0x381C8000, 0x381CC000, 0x381D0000, 0x381D4000, 0x381D8000, 0x381DC000, 0x381E0000, 0x381E4000, 0x381E8000, 0x381EC000, 0x381F0000, 0x381F4000, 0x381F8000, 0x381FC000,\n  0x38200000, 0x38204000, 0x38208000, 0x3820C000, 0x38210000, 0x38214000, 0x38218000, 0x3821C000, 0x38220000, 0x38224000, 0x38228000, 0x3822C000, 0x38230000, 0x38234000, 0x38238000, 0x3823C000,\n  0x38240000, 0x38244000, 0x38248000, 0x3824C000, 0x38250000, 0x38254000, 0x38258000, 0x3825C000, 0x38260000, 0x38264000, 0x38268000, 0x3826C000, 0x38270000, 0x38274000, 0x38278000, 0x3827C000,\n  0x38280000, 0x38284000, 0x38288000, 0x3828C000, 0x38290000, 0x38294000, 0x38298000, 0x3829C000, 0x382A0000, 0x382A4000, 0x382A8000, 0x382AC000, 0x382B0000, 0x382B4000, 0x382B8000, 0x382BC000,\n  0x382C0000, 0x382C4000, 0x382C8000, 0x382CC000, 0x382D0000, 0x382D4000, 0x382D8000, 0x382DC000, 0x382E0000, 0x382E4000, 0x382E8000, 0x382EC000, 0x382F0000, 0x382F4000, 0x382F8000, 0x382FC000,\n  0x38300000, 0x38304000, 0x38308000, 0x3830C000, 0x38310000, 0x38314000, 0x38318000, 0x3831C000, 0x38320000, 0x38324000, 0x38328000, 0x3832C000, 0x38330000, 0x38334000, 0x38338000, 0x3833C000,\n  0x38340000, 0x38344000, 0x38348000, 0x3834C000, 0x38350000, 0x38354000, 0x38358000, 0x3835C000, 0x38360000, 0x38364000, 0x38368000, 0x3836C000, 0x38370000, 0x38374000, 0x38378000, 0x3837C000,\n  0x38380000, 0x38384000, 0x38388000, 0x3",
                   "838C000, 0x38390000, 0x38394000, 0x38398000, 0x3839C000, 0x383A0000, 0x383A4000, 0x383A8000, 0x383AC000, 0x383B0000, 0x383B4000, 0x383B8000, 0x383BC000,\n  0x383C0000, 0x383C4000, 0x383C8000, 0x383CC000, 0x383D0000, 0x383D4000, 0x383D8000, 0x383DC000, 0x383E0000, 0x383E4000, 0x383E8000, 0x383EC000, 0x383F0000, 0x383F4000, 0x383F8000, 0x383FC000,\n  0x38400000, 0x38404000, 0x38408000, 0x3840C000, 0x38410000, 0x38414000, 0x38418000, 0x3841C000, 0x38420000, 0x38424000, 0x38428000, 0x3842C000, 0x38430000, 0x38434000, 0x38438000, 0x3843C000,\n  0x38440000, 0x38444000, 0x38448000, 0x3844C000, 0x38450000, 0x38454000, 0x38458000, 0x3845C000, 0x38460000, 0x38464000, 0x38468000, 0x3846C000, 0x38470000, 0x38474000, 0x38478000, 0x3847C000,\n  0x38480000, 0x38484000, 0x38488000, 0x3848C000, 0x38490000, 0x38494000, 0x38498000, 0x3849C000, 0x384A0000, 0x384A4000, 0x384A8000, 0x384AC000, 0x384B0000, 0x384B4000, 0x384B8000, 0x384BC000,\n  0x384C0000, 0x384C4000, 0x384C8000, 0x384CC000, 0x384D0000, 0x384D4000, 0x384D8000, 0x384DC000, 0x384E0000, 0x384E4000, 0x384E8000, 0x384EC000, 0x384F0000, 0x384F4000, 0x384F8000, 0x384FC000,\n  0x38500000, 0x38504000, 0x38508000, 0x3850C000, 0x38510000, 0x38514000, 0x38518000, 0x3851C000, 0x38520000, 0x38524000, 0x38528000, 0x3852C000, 0x38530000, 0x38534000, 0x38538000, 0x3853C000,\n  0x38540000, 0x38544000, 0x38548000, 0x3854C000, 0x38550000, 0x38554000, 0x38558000, 0x3855C000, 0x38560000, 0x38564000, 0x38568000, 0x3856C000, 0x38570000, 0x38574000, 0x38578000, 0x3857C000,\n  0x38580000, 0x38584000, 0x38588000, 0x3858C000, 0x38590000, 0x38594000, 0x38598000, 0x3859C000, 0x385A0000, 0x385A4000, 0x385A8000, 0x385AC000, 0x385B0000, 0x385B4000, 0x385B8000, 0x385BC000,\n  0x385C0000, 0x385C4000, 0x385C8000, 0x385CC000, 0x385D0000, 0x385D4000, 0x385D8000, 0x385DC000, 0x385E0000, 0x385E4000, 0x385E8000, 0x385EC000, 0x385F0000, 0x385F4000, 0x385F8000, 0x385FC000,\n  0x38600000, 0x38604000, 0x38608000, 0x3860C000, 0x38610000, 0x38614000, 0x38618000, 0x3861C000, 0x3",
                   "8620000, 0x38624000, 0x38628000, 0x3862C000, 0x38630000, 0x38634000, 0x38638000, 0x3863C000,\n  0x38640000, 0x38644000, 0x38648000, 0x3864C000, 0x38650000, 0x38654000, 0x38658000, 0x3865C000, 0x38660000, 0x38664000, 0x38668000, 0x3866C000, 0x38670000, 0x38674000, 0x38678000, 0x3867C000,\n  0x38680000, 0x38684000, 0x38688000, 0x3868C000, 0x38690000, 0x38694000, 0x38698000, 0x3869C000, 0x386A0000, 0x386A4000, 0x386A8000, 0x386AC000, 0x386B0000, 0x386B4000, 0x386B8000, 0x386BC000,\n  0x386C0000, 0x386C4000, 0x386C8000, 0x386CC000, 0x386D0000, 0x386D4000, 0x386D8000, 0x386DC000, 0x386E0000, 0x386E4000, 0x386E8000, 0x386EC000, 0x386F0000, 0x386F4000, 0x386F8000, 0x386FC000,\n  0x38700000, 0x38704000, 0x38708000, 0x3870C000, 0x38710000, 0x38714000, 0x38718000, 0x3871C000, 0x38720000, 0x38724000, 0x38728000, 0x3872C000, 0x38730000, 0x38734000, 0x38738000, 0x3873C000,\n  0x38740000, 0x38744000, 0x38748000, 0x3874C000, 0x38750000, 0x38754000, 0x38758000, 0x3875C000, 0x38760000, 0x38764000, 0x38768000, 0x3876C000, 0x38770000, 0x38774000, 0x38778000, 0x3877C000,\n  0x38780000, 0x38784000, 0x38788000, 0x3878C000, 0x38790000, 0x38794000, 0x38798000, 0x3879C000, 0x387A0000, 0x387A4000, 0x387A8000, 0x387AC000, 0x387B0000, 0x387B4000, 0x387B8000, 0x387BC000,\n  0x387C0000, 0x387C4000, 0x387C8000, 0x387CC000, 0x387D0000, 0x387D4000, 0x387D8000, 0x387DC000, 0x387E0000, 0x387E4000, 0x387E8000, 0x387EC000, 0x387F0000, 0x387F4000, 0x387F8000, 0x387FC000,\n  0x38000000, 0x38002000, 0x38004000, 0x38006000, 0x38008000, 0x3800A000, 0x3800C000, 0x3800E000, 0x38010000, 0x38012000, 0x38014000, 0x38016000, 0x38018000, 0x3801A000, 0x3801C000, 0x3801E000,\n  0x38020000, 0x38022000, 0x38024000, 0x38026000, 0x38028000, 0x3802A000, 0x3802C000, 0x3802E000, 0x38030000, 0x38032000, 0x38034000, 0x38036000, 0x38038000, 0x3803A000, 0x3803C000, 0x3803E000,\n  0x38040000, 0x38042000, 0x38044000, 0x38046000, 0x38048000, 0x3804A000, 0x3804C000, 0x3804E000, 0x38050000, 0x38052000, 0x38054000, 0x38056000, 0x38058000, 0x3",
                   "805A000, 0x3805C000, 0x3805E000,\n  0x38060000, 0x38062000, 0x38064000, 0x38066000, 0x38068000, 0x3806A000, 0x3806C000, 0x3806E000, 0x38070000, 0x38072000, 0x38074000, 0x38076000, 0x38078000, 0x3807A000, 0x3807C000, 0x3807E000,\n  0x38080000, 0x38082000, 0x38084000, 0x38086000, 0x38088000, 0x3808A000, 0x3808C000, 0x3808E000, 0x38090000, 0x38092000, 0x38094000, 0x38096000, 0x38098000, 0x3809A000, 0x3809C000, 0x3809E000,\n  0x380A0000, 0x380A2000, 0x380A4000, 0x380A6000, 0x380A8000, 0x380AA000, 0x380AC000, 0x380AE000, 0x380B0000, 0x380B2000, 0x380B4000, 0x380B6000, 0x380B8000, 0x380BA000, 0x380BC000, 0x380BE000,\n  0x380C0000, 0x380C2000, 0x380C4000, 0x380C6000, 0x380C8000, 0x380CA000, 0x380CC000, 0x380CE000, 0x380D0000, 0x380D2000, 0x380D4000, 0x380D6000, 0x380D8000, 0x380DA000, 0x380DC000, 0x380DE000,\n  0x380E0000, 0x380E2000, 0x380E4000, 0x380E6000, 0x380E8000, 0x380EA000, 0x380EC000, 0x380EE000, 0x380F0000, 0x380F2000, 0x380F4000, 0x380F6000, 0x380F8000, 0x380FA000, 0x380FC000, 0x380FE000,\n  0x38100000, 0x38102000, 0x38104000, 0x38106000, 0x38108000, 0x3810A000, 0x3810C000, 0x3810E000, 0x38110000, 0x38112000, 0x38114000, 0x38116000, 0x38118000, 0x3811A000, 0x3811C000, 0x3811E000,\n  0x38120000, 0x38122000, 0x38124000, 0x38126000, 0x38128000, 0x3812A000, 0x3812C000, 0x3812E000, 0x38130000, 0x38132000, 0x38134000, 0x38136000, 0x38138000, 0x3813A000, 0x3813C000, 0x3813E000,\n  0x38140000, 0x38142000, 0x38144000, 0x38146000, 0x38148000, 0x3814A000, 0x3814C000, 0x3814E000, 0x38150000, 0x38152000, 0x38154000, 0x38156000, 0x38158000, 0x3815A000, 0x3815C000, 0x3815E000,\n  0x38160000, 0x38162000, 0x38164000, 0x38166000, 0x38168000, 0x3816A000, 0x3816C000, 0x3816E000, 0x38170000, 0x38172000, 0x38174000, 0x38176000, 0x38178000, 0x3817A000, 0x3817C000, 0x3817E000,\n  0x38180000, 0x38182000, 0x38184000, 0x38186000, 0x38188000, 0x3818A000, 0x3818C000, 0x3818E000, 0x38190000, 0x38192000, 0x38194000, 0x38196000, 0x38198000, 0x3819A000, 0x3819C000, 0x3819E000,\n  0x381A0000, 0x381A2000, 0",
                   "x381A4000, 0x381A6000, 0x381A8000, 0x381AA000, 0x381AC000, 0x381AE000, 0x381B0000, 0x381B2000, 0x381B4000, 0x381B6000, 0x381B8000, 0x381BA000, 0x381BC000, 0x381BE000,\n  0x381C0000, 0x381C2000, 0x381C4000, 0x381C6000, 0x381C8000, 0x381CA000, 0x381CC000, 0x381CE000, 0x381D0000, 0x381D2000, 0x381D4000, 0x381D6000, 0x381D8000, 0x381DA000, 0x381DC000, 0x381DE000,\n  0x381E0000, 0x381E2000, 0x381E4000, 0x381E6000, 0x381E8000, 0x381EA000, 0x381EC000, 0x381EE000, 0x381F0000, 0x381F2000, 0x381F4000, 0x381F6000, 0x381F8000, 0x381FA000, 0x381FC000, 0x381FE000,\n  0x38200000, 0x38202000, 0x38204000, 0x38206000, 0x38208000, 0x3820A000, 0x3820C000, 0x3820E000, 0x38210000, 0x38212000, 0x38214000, 0x38216000, 0x38218000, 0x3821A000, 0x3821C000, 0x3821E000,\n  0x38220000, 0x38222000, 0x38224000, 0x38226000, 0x38228000, 0x3822A000, 0x3822C000, 0x3822E000, 0x38230000, 0x38232000, 0x38234000, 0x38236000, 0x38238000, 0x3823A000, 0x3823C000, 0x3823E000,\n  0x38240000, 0x38242000, 0x38244000, 0x38246000, 0x38248000, 0x3824A000, 0x3824C000, 0x3824E000, 0x38250000, 0x38252000, 0x38254000, 0x38256000, 0x38258000, 0x3825A000, 0x3825C000, 0x3825E000,\n  0x38260000, 0x38262000, 0x38264000, 0x38266000, 0x38268000, 0x3826A000, 0x3826C000, 0x3826E000, 0x38270000, 0x38272000, 0x38274000, 0x38276000, 0x38278000, 0x3827A000, 0x3827C000, 0x3827E000,\n  0x38280000, 0x38282000, 0x38284000, 0x38286000, 0x38288000, 0x3828A000, 0x3828C000, 0x3828E000, 0x38290000, 0x38292000, 0x38294000, 0x38296000, 0x38298000, 0x3829A000, 0x3829C000, 0x3829E000,\n  0x382A0000, 0x382A2000, 0x382A4000, 0x382A6000, 0x382A8000, 0x382AA000, 0x382AC000, 0x382AE000, 0x382B0000, 0x382B2000, 0x382B4000, 0x382B6000, 0x382B8000, 0x382BA000, 0x382BC000, 0x382BE000,\n  0x382C0000, 0x382C2000, 0x382C4000, 0x382C6000, 0x382C8000, 0x382CA000, 0x382CC000, 0x382CE000, 0x382D0000, 0x382D2000, 0x382D4000, 0x382D6000, 0x382D8000, 0x382DA000, 0x382DC000, 0x382DE000,\n  0x382E0000, 0x382E2000, 0x382E4000, 0x382E6000, 0x382E8000, 0x382EA000, 0x382EC000, 0",
                   "x382EE000, 0x382F0000, 0x382F2000, 0x382F4000, 0x382F6000, 0x382F8000, 0x382FA000, 0x382FC000, 0x382FE000,\n  0x38300000, 0x38302000, 0x38304000, 0x38306000, 0x38308000, 0x3830A000, 0x3830C000, 0x3830E000, 0x38310000, 0x38312000, 0x38314000, 0x38316000, 0x38318000, 0x3831A000, 0x3831C000, 0x3831E000,\n  0x38320000, 0x38322000, 0x38324000, 0x38326000, 0x38328000, 0x3832A000, 0x3832C000, 0x3832E000, 0x38330000, 0x38332000, 0x38334000, 0x38336000, 0x38338000, 0x3833A000, 0x3833C000, 0x3833E000,\n  0x38340000, 0x38342000, 0x38344000, 0x38346000, 0x38348000, 0x3834A000, 0x3834C000, 0x3834E000, 0x38350000, 0x38352000, 0x38354000, 0x38356000, 0x38358000, 0x3835A000, 0x3835C000, 0x3835E000,\n  0x38360000, 0x38362000, 0x38364000, 0x38366000, 0x38368000, 0x3836A000, 0x3836C000, 0x3836E000, 0x38370000, 0x38372000, 0x38374000, 0x38376000, 0x38378000, 0x3837A000, 0x3837C000, 0x3837E000,\n  0x38380000, 0x38382000, 0x38384000, 0x38386000, 0x38388000, 0x3838A000, 0x3838C000, 0x3838E000, 0x38390000, 0x38392000, 0x38394000, 0x38396000, 0x38398000, 0x3839A000, 0x3839C000, 0x3839E000,\n  0x383A0000, 0x383A2000, 0x383A4000, 0x383A6000, 0x383A8000, 0x383AA000, 0x383AC000, 0x383AE000, 0x383B0000, 0x383B2000, 0x383B4000, 0x383B6000, 0x383B8000, 0x383BA000, 0x383BC000, 0x383BE000,\n  0x383C0000, 0x383C2000, 0x383C4000, 0x383C6000, 0x383C8000, 0x383CA000, 0x383CC000, 0x383CE000, 0x383D0000, 0x383D2000, 0x383D4000, 0x383D6000, 0x383D8000, 0x383DA000, 0x383DC000, 0x383DE000,\n  0x383E0000, 0x383E2000, 0x383E4000, 0x383E6000, 0x383E8000, 0x383EA000, 0x383EC000, 0x383EE000, 0x383F0000, 0x383F2000, 0x383F4000, 0x383F6000, 0x383F8000, 0x383FA000, 0x383FC000, 0x383FE000,\n  0x38400000, 0x38402000, 0x38404000, 0x38406000, 0x38408000, 0x3840A000, 0x3840C000, 0x3840E000, 0x38410000, 0x38412000, 0x38414000, 0x38416000, 0x38418000, 0x3841A000, 0x3841C000, 0x3841E000,\n  0x38420000, 0x38422000, 0x38424000, 0x38426000, 0x38428000, 0x3842A000, 0x3842C000, 0x3842E000, 0x38430000, 0x38432000, 0x38434000, 0x38436000, 0",
                   "x38438000, 0x3843A000, 0x3843C000, 0x3843E000,\n  0x38440000, 0x38442000, 0x38444000, 0x38446000, 0x38448000, 0x3844A000, 0x3844C000, 0x3844E000, 0x38450000, 0x38452000, 0x38454000, 0x38456000, 0x38458000, 0x3845A000, 0x3845C000, 0x3845E000,\n  0x38460000, 0x38462000, 0x38464000, 0x38466000, 0x38468000, 0x3846A000, 0x3846C000, 0x3846E000, 0x38470000, 0x38472000, 0x38474000, 0x38476000, 0x38478000, 0x3847A000, 0x3847C000, 0x3847E000,\n  0x38480000, 0x38482000, 0x38484000, 0x38486000, 0x38488000, 0x3848A000, 0x3848C000, 0x3848E000, 0x38490000, 0x38492000, 0x38494000, 0x38496000, 0x38498000, 0x3849A000, 0x3849C000, 0x3849E000,\n  0x384A0000, 0x384A2000, 0x384A4000, 0x384A6000, 0x384A8000, 0x384AA000, 0x384AC000, 0x384AE000, 0x384B0000, 0x384B2000, 0x384B4000, 0x384B6000, 0x384B8000, 0x384BA000, 0x384BC000, 0x384BE000,\n  0x384C0000, 0x384C2000, 0x384C4000, 0x384C6000, 0x384C8000, 0x384CA000, 0x384CC000, 0x384CE000, 0x384D0000, 0x384D2000, 0x384D4000, 0x384D6000, 0x384D8000, 0x384DA000, 0x384DC000, 0x384DE000,\n  0x384E0000, 0x384E2000, 0x384E4000, 0x384E6000, 0x384E8000, 0x384EA000, 0x384EC000, 0x384EE000, 0x384F0000, 0x384F2000, 0x384F4000, 0x384F6000, 0x384F8000, 0x384FA000, 0x384FC000, 0x384FE000,\n  0x38500000, 0x38502000, 0x38504000, 0x38506000, 0x38508000, 0x3850A000, 0x3850C000, 0x3850E000, 0x38510000, 0x38512000, 0x38514000, 0x38516000, 0x38518000, 0x3851A000, 0x3851C000, 0x3851E000,\n  0x38520000, 0x38522000, 0x38524000, 0x38526000, 0x38528000, 0x3852A000, 0x3852C000, 0x3852E000, 0x38530000, 0x38532000, 0x38534000, 0x38536000, 0x38538000, 0x3853A000, 0x3853C000, 0x3853E000,\n  0x38540000, 0x38542000, 0x38544000, 0x38546000, 0x38548000, 0x3854A000, 0x3854C000, 0x3854E000, 0x38550000, 0x38552000, 0x38554000, 0x38556000, 0x38558000, 0x3855A000, 0x3855C000, 0x3855E000,\n  0x38560000, 0x38562000, 0x38564000, 0x38566000, 0x38568000, 0x3856A000, 0x3856C000, 0x3856E000, 0x38570000, 0x38572000, 0x38574000, 0x38576000, 0x38578000, 0x3857A000, 0x3857C000, 0x3857E000,\n  0x38580000,",
                   " 0x38582000, 0x38584000, 0x38586000, 0x38588000, 0x3858A000, 0x3858C000, 0x3858E000, 0x38590000, 0x38592000, 0x38594000, 0x38596000, 0x38598000, 0x3859A000, 0x3859C000, 0x3859E000,\n  0x385A0000, 0x385A2000, 0x385A4000, 0x385A6000, 0x385A8000, 0x385AA000, 0x385AC000, 0x385AE000, 0x385B0000, 0x385B2000, 0x385B4000, 0x385B6000, 0x385B8000, 0x385BA000, 0x385BC000, 0x385BE000,\n  0x385C0000, 0x385C2000, 0x385C4000, 0x385C6000, 0x385C8000, 0x385CA000, 0x385CC000, 0x385CE000, 0x385D0000, 0x385D2000, 0x385D4000, 0x385D6000, 0x385D8000, 0x385DA000, 0x385DC000, 0x385DE000,\n  0x385E0000, 0x385E2000, 0x385E4000, 0x385E6000, 0x385E8000, 0x385EA000, 0x385EC000, 0x385EE000, 0x385F0000, 0x385F2000, 0x385F4000, 0x385F6000, 0x385F8000, 0x385FA000, 0x385FC000, 0x385FE000,\n  0x38600000, 0x38602000, 0x38604000, 0x38606000, 0x38608000, 0x3860A000, 0x3860C000, 0x3860E000, 0x38610000, 0x38612000, 0x38614000, 0x38616000, 0x38618000, 0x3861A000, 0x3861C000, 0x3861E000,\n  0x38620000, 0x38622000, 0x38624000, 0x38626000, 0x38628000, 0x3862A000, 0x3862C000, 0x3862E000, 0x38630000, 0x38632000, 0x38634000, 0x38636000, 0x38638000, 0x3863A000, 0x3863C000, 0x3863E000,\n  0x38640000, 0x38642000, 0x38644000, 0x38646000, 0x38648000, 0x3864A000, 0x3864C000, 0x3864E000, 0x38650000, 0x38652000, 0x38654000, 0x38656000, 0x38658000, 0x3865A000, 0x3865C000, 0x3865E000,\n  0x38660000, 0x38662000, 0x38664000, 0x38666000, 0x38668000, 0x3866A000, 0x3866C000, 0x3866E000, 0x38670000, 0x38672000, 0x38674000, 0x38676000, 0x38678000, 0x3867A000, 0x3867C000, 0x3867E000,\n  0x38680000, 0x38682000, 0x38684000, 0x38686000, 0x38688000, 0x3868A000, 0x3868C000, 0x3868E000, 0x38690000, 0x38692000, 0x38694000, 0x38696000, 0x38698000, 0x3869A000, 0x3869C000, 0x3869E000,\n  0x386A0000, 0x386A2000, 0x386A4000, 0x386A6000, 0x386A8000, 0x386AA000, 0x386AC000, 0x386AE000, 0x386B0000, 0x386B2000, 0x386B4000, 0x386B6000, 0x386B8000, 0x386BA000, 0x386BC000, 0x386BE000,\n  0x386C0000, 0x386C2000, 0x386C4000, 0x386C6000, 0x386C8000, 0x386CA000,",
                   " 0x386CC000, 0x386CE000, 0x386D0000, 0x386D2000, 0x386D4000, 0x386D6000, 0x386D8000, 0x386DA000, 0x386DC000, 0x386DE000,\n  0x386E0000, 0x386E2000, 0x386E4000, 0x386E6000, 0x386E8000, 0x386EA000, 0x386EC000, 0x386EE000, 0x386F0000, 0x386F2000, 0x386F4000, 0x386F6000, 0x386F8000, 0x386FA000, 0x386FC000, 0x386FE000,\n  0x38700000, 0x38702000, 0x38704000, 0x38706000, 0x38708000, 0x3870A000, 0x3870C000, 0x3870E000, 0x38710000, 0x38712000, 0x38714000, 0x38716000, 0x38718000, 0x3871A000, 0x3871C000, 0x3871E000,\n  0x38720000, 0x38722000, 0x38724000, 0x38726000, 0x38728000, 0x3872A000, 0x3872C000, 0x3872E000, 0x38730000, 0x38732000, 0x38734000, 0x38736000, 0x38738000, 0x3873A000, 0x3873C000, 0x3873E000,\n  0x38740000, 0x38742000, 0x38744000, 0x38746000, 0x38748000, 0x3874A000, 0x3874C000, 0x3874E000, 0x38750000, 0x38752000, 0x38754000, 0x38756000, 0x38758000, 0x3875A000, 0x3875C000, 0x3875E000,\n  0x38760000, 0x38762000, 0x38764000, 0x38766000, 0x38768000, 0x3876A000, 0x3876C000, 0x3876E000, 0x38770000, 0x38772000, 0x38774000, 0x38776000, 0x38778000, 0x3877A000, 0x3877C000, 0x3877E000,\n  0x38780000, 0x38782000, 0x38784000, 0x38786000, 0x38788000, 0x3878A000, 0x3878C000, 0x3878E000, 0x38790000, 0x38792000, 0x38794000, 0x38796000, 0x38798000, 0x3879A000, 0x3879C000, 0x3879E000,\n  0x387A0000, 0x387A2000, 0x387A4000, 0x387A6000, 0x387A8000, 0x387AA000, 0x387AC000, 0x387AE000, 0x387B0000, 0x387B2000, 0x387B4000, 0x387B6000, 0x387B8000, 0x387BA000, 0x387BC000, 0x387BE000,\n  0x387C0000, 0x387C2000, 0x387C4000, 0x387C6000, 0x387C8000, 0x387CA000, 0x387CC000, 0x387CE000, 0x387D0000, 0x387D2000, 0x387D4000, 0x387D6000, 0x387D8000, 0x387DA000, 0x387DC000, 0x387DE000,\n  0x387E0000, 0x387E2000, 0x387E4000, 0x387E6000, 0x387E8000, 0x387EA000, 0x387EC000, 0x387EE000, 0x387F0000, 0x387F2000, 0x387F4000, 0x387F6000, 0x387F8000, 0x387FA000, 0x387FC000, 0x387FE000 };\n__constant static const uint32_t exponent_table[64] = {\n  0x00000000, 0x00800000, 0x01000000, 0x01800000, 0x02000000, 0x02800000, 0",
                   "x03000000, 0x03800000, 0x04000000, 0x04800000, 0x05000000, 0x05800000, 0x06000000, 0x06800000, 0x07000000, 0x07800000,\n  0x08000000, 0x08800000, 0x09000000, 0x09800000, 0x0A000000, 0x0A800000, 0x0B000000, 0x0B800000, 0x0C000000, 0x0C800000, 0x0D000000, 0x0D800000, 0x0E000000, 0x0E800000, 0x0F000000, 0x47800000,\n  0x80000000, 0x80800000, 0x81000000, 0x81800000, 0x82000000, 0x82800000, 0x83000000, 0x83800000, 0x84000000, 0x84800000, 0x85000000, 0x85800000, 0x86000000, 0x86800000, 0x87000000, 0x87800000,\n  0x88000000, 0x88800000, 0x89000000, 0x89800000, 0x8A000000, 0x8A800000, 0x8B000000, 0x8B800000, 0x8C000000, 0x8C800000, 0x8D000000, 0x8D800000, 0x8E000000, 0x8E800000, 0x8F000000, 0xC7800000 };\n__constant static const unsigned short offset_table[64] = {\n  0, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024,\n  0, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 };\n\nstatic uint16_t float2halfbits(float value) {\n  union { float x; uint32_t y; } u;\n  u.x = value;\n  uint32_t bits = u.y;\n\n  uint16_t hbits = base_table[bits>>23] + (uint16_t)((bits&0x7FFFFF)>>shift_table[bits>>23]);;\n\n  return hbits;\n}\n\nstatic float halfbits2float(uint16_t value) {\n  uint32_t bits = mantissa_table[offset_table[value>>10]+(value&0x3FF)] + exponent_table[value>>10];\n\n  union { uint32_t x; float y; } u;\n  u.x = bits;\n  return u.y;\n}\n\n// End of half.h.\n// Start of scalar.h.\n\n// Implementation of the primitive scalar operations.  Very\n// repetitive.  This code is inserted directly into both CUDA and\n// OpenCL programs, as well as the CPU code, so it has some #ifdefs to\n// work everywhere.  Some operations are defined as macros because\n// this allows us to use them as constant expressions in things like\n// array sizes and static i",
                   "nitialisers.\n\n// Some of the #ifdefs are because OpenCL uses type-generic functions\n// for some operations (e.g. sqrt), while C and CUDA sensibly use\n// distinct functions for different precisions (e.g. sqrtf() and\n// sqrt()).  This is quite annoying.  Due to C's unfortunate casting\n// rules, it is also really easy to accidentally implement\n// floating-point functions in the wrong precision, so be careful.\n\n// Double-precision definitions are only included if the preprocessor\n// macro FUTHARK_F64_ENABLED is set.\n\nstatic inline uint8_t add8(uint8_t x, uint8_t y) {\n  return x + y;\n}\n\nstatic inline uint16_t add16(uint16_t x, uint16_t y) {\n  return x + y;\n}\n\nstatic inline uint32_t add32(uint32_t x, uint32_t y) {\n  return x + y;\n}\n\nstatic inline uint64_t add64(uint64_t x, uint64_t y) {\n  return x + y;\n}\n\nstatic inline uint8_t sub8(uint8_t x, uint8_t y) {\n  return x - y;\n}\n\nstatic inline uint16_t sub16(uint16_t x, uint16_t y) {\n  return x - y;\n}\n\nstatic inline uint32_t sub32(uint32_t x, uint32_t y) {\n  return x - y;\n}\n\nstatic inline uint64_t sub64(uint64_t x, uint64_t y) {\n  return x - y;\n}\n\nstatic inline uint8_t mul8(uint8_t x, uint8_t y) {\n  return x * y;\n}\n\nstatic inline uint16_t mul16(uint16_t x, uint16_t y) {\n  return x * y;\n}\n\nstatic inline uint32_t mul32(uint32_t x, uint32_t y) {\n  return x * y;\n}\n\nstatic inline uint64_t mul64(uint64_t x, uint64_t y) {\n  return x * y;\n}\n\nstatic inline uint8_t udiv8(uint8_t x, uint8_t y) {\n  return x / y;\n}\n\nstatic inline uint16_t udiv16(uint16_t x, uint16_t y) {\n  return x / y;\n}\n\nstatic inline uint32_t udiv32(uint32_t x, uint32_t y) {\n  return x / y;\n}\n\nstatic inline uint64_t udiv64(uint64_t x, uint64_t y) {\n  return x / y;\n}\n\nstatic inline uint8_t udiv_up8(uint8_t x, uint8_t y) {\n  return (x + y - 1) / y;\n}\n\nstatic inline uint16_t udiv_up16(uint16_t x, uint16_t y) {\n  return (x + y - 1) / y;\n}\n\nstatic inline uint32_t udiv_up32(uint32_t x, uint32_t y) {\n  return (x + y - 1) / y;\n}\n\nstatic inline uint64_t udiv_up64(uint64_t x, uint",
                   "64_t y) {\n  return (x + y - 1) / y;\n}\n\nstatic inline uint8_t umod8(uint8_t x, uint8_t y) {\n  return x % y;\n}\n\nstatic inline uint16_t umod16(uint16_t x, uint16_t y) {\n  return x % y;\n}\n\nstatic inline uint32_t umod32(uint32_t x, uint32_t y) {\n  return x % y;\n}\n\nstatic inline uint64_t umod64(uint64_t x, uint64_t y) {\n  return x % y;\n}\n\nstatic inline uint8_t udiv_safe8(uint8_t x, uint8_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline uint16_t udiv_safe16(uint16_t x, uint16_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline uint32_t udiv_safe32(uint32_t x, uint32_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline uint64_t udiv_safe64(uint64_t x, uint64_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline uint8_t udiv_up_safe8(uint8_t x, uint8_t y) {\n  return y == 0 ? 0 : (x + y - 1) / y;\n}\n\nstatic inline uint16_t udiv_up_safe16(uint16_t x, uint16_t y) {\n  return y == 0 ? 0 : (x + y - 1) / y;\n}\n\nstatic inline uint32_t udiv_up_safe32(uint32_t x, uint32_t y) {\n  return y == 0 ? 0 : (x + y - 1) / y;\n}\n\nstatic inline uint64_t udiv_up_safe64(uint64_t x, uint64_t y) {\n  return y == 0 ? 0 : (x + y - 1) / y;\n}\n\nstatic inline uint8_t umod_safe8(uint8_t x, uint8_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline uint16_t umod_safe16(uint16_t x, uint16_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline uint32_t umod_safe32(uint32_t x, uint32_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline uint64_t umod_safe64(uint64_t x, uint64_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline int8_t sdiv8(int8_t x, int8_t y) {\n  int8_t q = x / y;\n  int8_t r = x % y;\n\n  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);\n}\n\nstatic inline int16_t sdiv16(int16_t x, int16_t y) {\n  int16_t q = x / y;\n  int16_t r = x % y;\n\n  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);\n}\n\nstatic inline int32_t sdiv32(int32_t x, int32_t y) {\n  int32_t q = x / y;\n  int32_t r = x % y;\n\n  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);\n}\n\nstatic inline int64_t sdiv64(int64_t x, int64_t y) {\n  int64_t q ",
                   "= x / y;\n  int64_t r = x % y;\n\n  return q - ((r != 0 && r < 0 != y < 0) ? 1 : 0);\n}\n\nstatic inline int8_t sdiv_up8(int8_t x, int8_t y) {\n  return sdiv8(x + y - 1, y);\n}\n\nstatic inline int16_t sdiv_up16(int16_t x, int16_t y) {\n  return sdiv16(x + y - 1, y);\n}\n\nstatic inline int32_t sdiv_up32(int32_t x, int32_t y) {\n  return sdiv32(x + y - 1, y);\n}\n\nstatic inline int64_t sdiv_up64(int64_t x, int64_t y) {\n  return sdiv64(x + y - 1, y);\n}\n\nstatic inline int8_t smod8(int8_t x, int8_t y) {\n  int8_t r = x % y;\n\n  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);\n}\n\nstatic inline int16_t smod16(int16_t x, int16_t y) {\n  int16_t r = x % y;\n\n  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);\n}\n\nstatic inline int32_t smod32(int32_t x, int32_t y) {\n  int32_t r = x % y;\n\n  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);\n}\n\nstatic inline int64_t smod64(int64_t x, int64_t y) {\n  int64_t r = x % y;\n\n  return r + (r == 0 || (x > 0 && y > 0) || (x < 0 && y < 0) ? 0 : y);\n}\n\nstatic inline int8_t sdiv_safe8(int8_t x, int8_t y) {\n  return y == 0 ? 0 : sdiv8(x, y);\n}\n\nstatic inline int16_t sdiv_safe16(int16_t x, int16_t y) {\n  return y == 0 ? 0 : sdiv16(x, y);\n}\n\nstatic inline int32_t sdiv_safe32(int32_t x, int32_t y) {\n  return y == 0 ? 0 : sdiv32(x, y);\n}\n\nstatic inline int64_t sdiv_safe64(int64_t x, int64_t y) {\n  return y == 0 ? 0 : sdiv64(x, y);\n}\n\nstatic inline int8_t sdiv_up_safe8(int8_t x, int8_t y) {\n  return sdiv_safe8(x + y - 1, y);\n}\n\nstatic inline int16_t sdiv_up_safe16(int16_t x, int16_t y) {\n  return sdiv_safe16(x + y - 1, y);\n}\n\nstatic inline int32_t sdiv_up_safe32(int32_t x, int32_t y) {\n  return sdiv_safe32(x + y - 1, y);\n}\n\nstatic inline int64_t sdiv_up_safe64(int64_t x, int64_t y) {\n  return sdiv_safe64(x + y - 1, y);\n}\n\nstatic inline int8_t smod_safe8(int8_t x, int8_t y) {\n  return y == 0 ? 0 : smod8(x, y);\n}\n\nstatic inline int16_t smod_safe16(int16_t x, int16_t y) {\n  return y == 0 ? 0 : smod16(x, y);\n}\n\nst",
                   "atic inline int32_t smod_safe32(int32_t x, int32_t y) {\n  return y == 0 ? 0 : smod32(x, y);\n}\n\nstatic inline int64_t smod_safe64(int64_t x, int64_t y) {\n  return y == 0 ? 0 : smod64(x, y);\n}\n\nstatic inline int8_t squot8(int8_t x, int8_t y) {\n  return x / y;\n}\n\nstatic inline int16_t squot16(int16_t x, int16_t y) {\n  return x / y;\n}\n\nstatic inline int32_t squot32(int32_t x, int32_t y) {\n  return x / y;\n}\n\nstatic inline int64_t squot64(int64_t x, int64_t y) {\n  return x / y;\n}\n\nstatic inline int8_t srem8(int8_t x, int8_t y) {\n  return x % y;\n}\n\nstatic inline int16_t srem16(int16_t x, int16_t y) {\n  return x % y;\n}\n\nstatic inline int32_t srem32(int32_t x, int32_t y) {\n  return x % y;\n}\n\nstatic inline int64_t srem64(int64_t x, int64_t y) {\n  return x % y;\n}\n\nstatic inline int8_t squot_safe8(int8_t x, int8_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline int16_t squot_safe16(int16_t x, int16_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline int32_t squot_safe32(int32_t x, int32_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline int64_t squot_safe64(int64_t x, int64_t y) {\n  return y == 0 ? 0 : x / y;\n}\n\nstatic inline int8_t srem_safe8(int8_t x, int8_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline int16_t srem_safe16(int16_t x, int16_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline int32_t srem_safe32(int32_t x, int32_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline int64_t srem_safe64(int64_t x, int64_t y) {\n  return y == 0 ? 0 : x % y;\n}\n\nstatic inline int8_t smin8(int8_t x, int8_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline int16_t smin16(int16_t x, int16_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline int32_t smin32(int32_t x, int32_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline int64_t smin64(int64_t x, int64_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline uint8_t umin8(uint8_t x, uint8_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline uint16_t umin16(uint16_t x, uint16_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline uint32_t umin32(uint32_t x, ",
                   "uint32_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline uint64_t umin64(uint64_t x, uint64_t y) {\n  return x < y ? x : y;\n}\n\nstatic inline int8_t smax8(int8_t x, int8_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline int16_t smax16(int16_t x, int16_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline int32_t smax32(int32_t x, int32_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline int64_t smax64(int64_t x, int64_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline uint8_t umax8(uint8_t x, uint8_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline uint16_t umax16(uint16_t x, uint16_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline uint32_t umax32(uint32_t x, uint32_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline uint64_t umax64(uint64_t x, uint64_t y) {\n  return x < y ? y : x;\n}\n\nstatic inline uint8_t shl8(uint8_t x, uint8_t y) {\n  return (uint8_t)(x << y);\n}\n\nstatic inline uint16_t shl16(uint16_t x, uint16_t y) {\n  return (uint16_t)(x << y);\n}\n\nstatic inline uint32_t shl32(uint32_t x, uint32_t y) {\n  return x << y;\n}\n\nstatic inline uint64_t shl64(uint64_t x, uint64_t y) {\n  return x << y;\n}\n\nstatic inline uint8_t lshr8(uint8_t x, uint8_t y) {\n  return x >> y;\n}\n\nstatic inline uint16_t lshr16(uint16_t x, uint16_t y) {\n  return x >> y;\n}\n\nstatic inline uint32_t lshr32(uint32_t x, uint32_t y) {\n  return x >> y;\n}\n\nstatic inline uint64_t lshr64(uint64_t x, uint64_t y) {\n  return x >> y;\n}\n\nstatic inline int8_t ashr8(int8_t x, int8_t y) {\n  return x >> y;\n}\n\nstatic inline int16_t ashr16(int16_t x, int16_t y) {\n  return x >> y;\n}\n\nstatic inline int32_t ashr32(int32_t x, int32_t y) {\n  return x >> y;\n}\n\nstatic inline int64_t ashr64(int64_t x, int64_t y) {\n  return x >> y;\n}\n\nstatic inline uint8_t and8(uint8_t x, uint8_t y) {\n  return x & y;\n}\n\nstatic inline uint16_t and16(uint16_t x, uint16_t y) {\n  return x & y;\n}\n\nstatic inline uint32_t and32(uint32_t x, uint32_t y) {\n  return x & y;\n}\n\nstatic inline uint64_t and64(uint64_t x, uint64_t y) {\n  return x & y;\n}\n\nstatic inline uint8_t or8(uint8_t",
                   " x, uint8_t y) {\n  return x | y;\n}\n\nstatic inline uint16_t or16(uint16_t x, uint16_t y) {\n  return x | y;\n}\n\nstatic inline uint32_t or32(uint32_t x, uint32_t y) {\n  return x | y;\n}\n\nstatic inline uint64_t or64(uint64_t x, uint64_t y) {\n  return x | y;\n}\n\nstatic inline uint8_t xor8(uint8_t x, uint8_t y) {\n  return x ^ y;\n}\n\nstatic inline uint16_t xor16(uint16_t x, uint16_t y) {\n  return x ^ y;\n}\n\nstatic inline uint32_t xor32(uint32_t x, uint32_t y) {\n  return x ^ y;\n}\n\nstatic inline uint64_t xor64(uint64_t x, uint64_t y) {\n  return x ^ y;\n}\n\nstatic inline bool ult8(uint8_t x, uint8_t y) {\n  return x < y;\n}\n\nstatic inline bool ult16(uint16_t x, uint16_t y) {\n  return x < y;\n}\n\nstatic inline bool ult32(uint32_t x, uint32_t y) {\n  return x < y;\n}\n\nstatic inline bool ult64(uint64_t x, uint64_t y) {\n  return x < y;\n}\n\nstatic inline bool ule8(uint8_t x, uint8_t y) {\n  return x <= y;\n}\n\nstatic inline bool ule16(uint16_t x, uint16_t y) {\n  return x <= y;\n}\n\nstatic inline bool ule32(uint32_t x, uint32_t y) {\n  return x <= y;\n}\n\nstatic inline bool ule64(uint64_t x, uint64_t y) {\n  return x <= y;\n}\n\nstatic inline bool slt8(int8_t x, int8_t y) {\n  return x < y;\n}\n\nstatic inline bool slt16(int16_t x, int16_t y) {\n  return x < y;\n}\n\nstatic inline bool slt32(int32_t x, int32_t y) {\n  return x < y;\n}\n\nstatic inline bool slt64(int64_t x, int64_t y) {\n  return x < y;\n}\n\nstatic inline bool sle8(int8_t x, int8_t y) {\n  return x <= y;\n}\n\nstatic inline bool sle16(int16_t x, int16_t y) {\n  return x <= y;\n}\n\nstatic inline bool sle32(int32_t x, int32_t y) {\n  return x <= y;\n}\n\nstatic inline bool sle64(int64_t x, int64_t y) {\n  return x <= y;\n}\n\nstatic inline uint8_t pow8(uint8_t x, uint8_t y) {\n  uint8_t res = 1, rem = y;\n\n  while (rem != 0) {\n    if (rem & 1)\n      res *= x;\n    rem >>= 1;\n    x *= x;\n  }\n  return res;\n}\n\nstatic inline uint16_t pow16(uint16_t x, uint16_t y) {\n  uint16_t res = 1, rem = y;\n\n  while (rem != 0) {\n    if (rem & 1)\n      res *= x;\n    rem >>= 1;\n    x *= x;\n  }\n ",
                   " return res;\n}\n\nstatic inline uint32_t pow32(uint32_t x, uint32_t y) {\n  uint32_t res = 1, rem = y;\n\n  while (rem != 0) {\n    if (rem & 1)\n      res *= x;\n    rem >>= 1;\n    x *= x;\n  }\n  return res;\n}\n\nstatic inline uint64_t pow64(uint64_t x, uint64_t y) {\n  uint64_t res = 1, rem = y;\n\n  while (rem != 0) {\n    if (rem & 1)\n      res *= x;\n    rem >>= 1;\n    x *= x;\n  }\n  return res;\n}\n\nstatic inline bool itob_i8_bool(int8_t x) {\n  return x;\n}\n\nstatic inline bool itob_i16_bool(int16_t x) {\n  return x;\n}\n\nstatic inline bool itob_i32_bool(int32_t x) {\n  return x;\n}\n\nstatic inline bool itob_i64_bool(int64_t x) {\n  return x;\n}\n\nstatic inline int8_t btoi_bool_i8(bool x) {\n  return x;\n}\n\nstatic inline int16_t btoi_bool_i16(bool x) {\n  return x;\n}\n\nstatic inline int32_t btoi_bool_i32(bool x) {\n  return x;\n}\n\nstatic inline int64_t btoi_bool_i64(bool x) {\n  return x;\n}\n\n#define sext_i8_i8(x) ((int8_t) (int8_t) (x))\n#define sext_i8_i16(x) ((int16_t) (int8_t) (x))\n#define sext_i8_i32(x) ((int32_t) (int8_t) (x))\n#define sext_i8_i64(x) ((int64_t) (int8_t) (x))\n#define sext_i16_i8(x) ((int8_t) (int16_t) (x))\n#define sext_i16_i16(x) ((int16_t) (int16_t) (x))\n#define sext_i16_i32(x) ((int32_t) (int16_t) (x))\n#define sext_i16_i64(x) ((int64_t) (int16_t) (x))\n#define sext_i32_i8(x) ((int8_t) (int32_t) (x))\n#define sext_i32_i16(x) ((int16_t) (int32_t) (x))\n#define sext_i32_i32(x) ((int32_t) (int32_t) (x))\n#define sext_i32_i64(x) ((int64_t) (int32_t) (x))\n#define sext_i64_i8(x) ((int8_t) (int64_t) (x))\n#define sext_i64_i16(x) ((int16_t) (int64_t) (x))\n#define sext_i64_i32(x) ((int32_t) (int64_t) (x))\n#define sext_i64_i64(x) ((int64_t) (int64_t) (x))\n#define zext_i8_i8(x) ((int8_t) (uint8_t) (x))\n#define zext_i8_i16(x) ((int16_t) (uint8_t) (x))\n#define zext_i8_i32(x) ((int32_t) (uint8_t) (x))\n#define zext_i8_i64(x) ((int64_t) (uint8_t) (x))\n#define zext_i16_i8(x) ((int8_t) (uint16_t) (x))\n#define zext_i16_i16(x) ((int16_t) (uint16_t) (x))\n#define zext_i16_i32(x) ((int32_t) (uint16_t) (x",
                   "))\n#define zext_i16_i64(x) ((int64_t) (uint16_t) (x))\n#define zext_i32_i8(x) ((int8_t) (uint32_t) (x))\n#define zext_i32_i16(x) ((int16_t) (uint32_t) (x))\n#define zext_i32_i32(x) ((int32_t) (uint32_t) (x))\n#define zext_i32_i64(x) ((int64_t) (uint32_t) (x))\n#define zext_i64_i8(x) ((int8_t) (uint64_t) (x))\n#define zext_i64_i16(x) ((int16_t) (uint64_t) (x))\n#define zext_i64_i32(x) ((int32_t) (uint64_t) (x))\n#define zext_i64_i64(x) ((int64_t) (uint64_t) (x))\n\nstatic int8_t abs8(int8_t x) {\n  return (int8_t)abs(x);\n}\n\nstatic int16_t abs16(int16_t x) {\n  return (int16_t)abs(x);\n}\n\nstatic int32_t abs32(int32_t x) {\n  return abs(x);\n}\n\nstatic int64_t abs64(int64_t x) {\n#if defined(__OPENCL_VERSION__)\n  return abs(x);\n#else\n  return llabs(x);\n#endif\n}\n\n#if defined(__OPENCL_VERSION__)\nstatic int32_t futrts_popc8(int8_t x) {\n  return popcount(x);\n}\n\nstatic int32_t futrts_popc16(int16_t x) {\n  return popcount(x);\n}\n\nstatic int32_t futrts_popc32(int32_t x) {\n  return popcount(x);\n}\n\nstatic int32_t futrts_popc64(int64_t x) {\n  return popcount(x);\n}\n#elif defined(__CUDA_ARCH__)\n\nstatic int32_t futrts_popc8(int8_t x) {\n  return __popc(zext_i8_i32(x));\n}\n\nstatic int32_t futrts_popc16(int16_t x) {\n  return __popc(zext_i16_i32(x));\n}\n\nstatic int32_t futrts_popc32(int32_t x) {\n  return __popc(x);\n}\n\nstatic int32_t futrts_popc64(int64_t x) {\n  return __popcll(x);\n}\n\n#else // Not OpenCL or CUDA, but plain C.\n\nstatic int32_t futrts_popc8(uint8_t x) {\n  int c = 0;\n  for (; x; ++c) { x &= x - 1; }\n  return c;\n}\n\nstatic int32_t futrts_popc16(uint16_t x) {\n  int c = 0;\n  for (; x; ++c) { x &= x - 1; }\n  return c;\n}\n\nstatic int32_t futrts_popc32(uint32_t x) {\n  int c = 0;\n  for (; x; ++c) { x &= x - 1; }\n  return c;\n}\n\nstatic int32_t futrts_popc64(uint64_t x) {\n  int c = 0;\n  for (; x; ++c) { x &= x - 1; }\n  return c;\n}\n#endif\n\n#if defined(__OPENCL_VERSION__)\nstatic uint8_t futrts_mul_hi8(uint8_t a, uint8_t b) {\n  return mul_hi(a, b);\n}\n\nstatic uint16_t futrts_mul_hi16(uint16_t a, uint16_t b) {",
                   "\n  return mul_hi(a, b);\n}\n\nstatic uint32_t futrts_mul_hi32(uint32_t a, uint32_t b) {\n  return mul_hi(a, b);\n}\n\nstatic uint64_t futrts_mul_hi64(uint64_t a, uint64_t b) {\n  return mul_hi(a, b);\n}\n\n#elif defined(__CUDA_ARCH__)\n\nstatic uint8_t futrts_mul_hi8(uint8_t a, uint8_t b) {\n  uint16_t aa = a;\n  uint16_t bb = b;\n\n  return aa * bb >> 8;\n}\n\nstatic uint16_t futrts_mul_hi16(uint16_t a, uint16_t b) {\n  uint32_t aa = a;\n  uint32_t bb = b;\n\n  return aa * bb >> 16;\n}\n\nstatic uint32_t futrts_mul_hi32(uint32_t a, uint32_t b) {\n  return mulhi(a, b);\n}\n\nstatic uint64_t futrts_mul_hi64(uint64_t a, uint64_t b) {\n  return mul64hi(a, b);\n}\n\n#else // Not OpenCL or CUDA, but plain C.\n\nstatic uint8_t futrts_mul_hi8(uint8_t a, uint8_t b) {\n  uint16_t aa = a;\n  uint16_t bb = b;\n\n  return aa * bb >> 8;\n}\n\nstatic uint16_t futrts_mul_hi16(uint16_t a, uint16_t b) {\n  uint32_t aa = a;\n  uint32_t bb = b;\n\n  return aa * bb >> 16;\n}\n\nstatic uint32_t futrts_mul_hi32(uint32_t a, uint32_t b) {\n  uint64_t aa = a;\n  uint64_t bb = b;\n\n  return aa * bb >> 32;\n}\n\nstatic uint64_t futrts_mul_hi64(uint64_t a, uint64_t b) {\n  __uint128_t aa = a;\n  __uint128_t bb = b;\n\n  return aa * bb >> 64;\n}\n#endif\n\n#if defined(__OPENCL_VERSION__)\nstatic uint8_t futrts_mad_hi8(uint8_t a, uint8_t b, uint8_t c) {\n  return mad_hi(a, b, c);\n}\n\nstatic uint16_t futrts_mad_hi16(uint16_t a, uint16_t b, uint16_t c) {\n  return mad_hi(a, b, c);\n}\n\nstatic uint32_t futrts_mad_hi32(uint32_t a, uint32_t b, uint32_t c) {\n  return mad_hi(a, b, c);\n}\n\nstatic uint64_t futrts_mad_hi64(uint64_t a, uint64_t b, uint64_t c) {\n  return mad_hi(a, b, c);\n}\n\n#else // Not OpenCL\n\nstatic uint8_t futrts_mad_hi8(uint8_t a, uint8_t b, uint8_t c) {\n  return futrts_mul_hi8(a, b) + c;\n}\n\nstatic uint16_t futrts_mad_hi16(uint16_t a, uint16_t b, uint16_t c) {\n  return futrts_mul_hi16(a, b) + c;\n}\n\nstatic uint32_t futrts_mad_hi32(uint32_t a, uint32_t b, uint32_t c) {\n  return futrts_mul_hi32(a, b) + c;\n}\n\nstatic uint64_t futrts_mad_hi64(uint64_t a, uint64_t",
                   " b, uint64_t c) {\n  return futrts_mul_hi64(a, b) + c;\n}\n#endif\n\n#if defined(__OPENCL_VERSION__)\nstatic int32_t futrts_clzz8(int8_t x) {\n  return clz(x);\n}\n\nstatic int32_t futrts_clzz16(int16_t x) {\n  return clz(x);\n}\n\nstatic int32_t futrts_clzz32(int32_t x) {\n  return clz(x);\n}\n\nstatic int32_t futrts_clzz64(int64_t x) {\n  return clz(x);\n}\n\n#elif defined(__CUDA_ARCH__)\n\nstatic int32_t futrts_clzz8(int8_t x) {\n  return __clz(zext_i8_i32(x)) - 24;\n}\n\nstatic int32_t futrts_clzz16(int16_t x) {\n  return __clz(zext_i16_i32(x)) - 16;\n}\n\nstatic int32_t futrts_clzz32(int32_t x) {\n  return __clz(x);\n}\n\nstatic int32_t futrts_clzz64(int64_t x) {\n  return __clzll(x);\n}\n\n#else // Not OpenCL or CUDA, but plain C.\n\nstatic int32_t futrts_clzz8(int8_t x) {\n  return x == 0 ? 8 : __builtin_clz((uint32_t)zext_i8_i32(x)) - 24;\n}\n\nstatic int32_t futrts_clzz16(int16_t x) {\n  return x == 0 ? 16 : __builtin_clz((uint32_t)zext_i16_i32(x)) - 16;\n}\n\nstatic int32_t futrts_clzz32(int32_t x) {\n  return x == 0 ? 32 : __builtin_clz((uint32_t)x);\n}\n\nstatic int32_t futrts_clzz64(int64_t x) {\n  return x == 0 ? 64 : __builtin_clzll((uint64_t)x);\n}\n#endif\n\n#if defined(__OPENCL_VERSION__)\nstatic int32_t futrts_ctzz8(int8_t x) {\n  int i = 0;\n  for (; i < 8 && (x & 1) == 0; i++, x >>= 1)\n    ;\n  return i;\n}\n\nstatic int32_t futrts_ctzz16(int16_t x) {\n  int i = 0;\n  for (; i < 16 && (x & 1) == 0; i++, x >>= 1)\n    ;\n  return i;\n}\n\nstatic int32_t futrts_ctzz32(int32_t x) {\n  int i = 0;\n  for (; i < 32 && (x & 1) == 0; i++, x >>= 1)\n    ;\n  return i;\n}\n\nstatic int32_t futrts_ctzz64(int64_t x) {\n  int i = 0;\n  for (; i < 64 && (x & 1) == 0; i++, x >>= 1)\n    ;\n  return i;\n}\n\n#elif defined(__CUDA_ARCH__)\n\nstatic int32_t futrts_ctzz8(int8_t x) {\n  int y = __ffs(x);\n  return y == 0 ? 8 : y - 1;\n}\n\nstatic int32_t futrts_ctzz16(int16_t x) {\n  int y = __ffs(x);\n  return y == 0 ? 16 : y - 1;\n}\n\nstatic int32_t futrts_ctzz32(int32_t x) {\n  int y = __ffs(x);\n  return y == 0 ? 32 : y - 1;\n}\n\nstatic int32_t futrts_ctzz64(int",
                   "64_t x) {\n  int y = __ffsll(x);\n  return y == 0 ? 64 : y - 1;\n}\n\n#else // Not OpenCL or CUDA, but plain C.\n\nstatic int32_t futrts_ctzz8(int8_t x) {\n  return x == 0 ? 8 : __builtin_ctz((uint32_t)x);\n}\n\nstatic int32_t futrts_ctzz16(int16_t x) {\n  return x == 0 ? 16 : __builtin_ctz((uint32_t)x);\n}\n\nstatic int32_t futrts_ctzz32(int32_t x) {\n  return x == 0 ? 32 : __builtin_ctz((uint32_t)x);\n}\n\nstatic int32_t futrts_ctzz64(int64_t x) {\n  return x == 0 ? 64 : __builtin_ctzll((uint64_t)x);\n}\n#endif\n\nstatic inline float fdiv32(float x, float y) {\n  return x / y;\n}\n\nstatic inline float fadd32(float x, float y) {\n  return x + y;\n}\n\nstatic inline float fsub32(float x, float y) {\n  return x - y;\n}\n\nstatic inline float fmul32(float x, float y) {\n  return x * y;\n}\n\nstatic inline bool cmplt32(float x, float y) {\n  return x < y;\n}\n\nstatic inline bool cmple32(float x, float y) {\n  return x <= y;\n}\n\nstatic inline float sitofp_i8_f32(int8_t x) {\n  return (float) x;\n}\n\nstatic inline float sitofp_i16_f32(int16_t x) {\n  return (float) x;\n}\n\nstatic inline float sitofp_i32_f32(int32_t x) {\n  return (float) x;\n}\n\nstatic inline float sitofp_i64_f32(int64_t x) {\n  return (float) x;\n}\n\nstatic inline float uitofp_i8_f32(uint8_t x) {\n  return (float) x;\n}\n\nstatic inline float uitofp_i16_f32(uint16_t x) {\n  return (float) x;\n}\n\nstatic inline float uitofp_i32_f32(uint32_t x) {\n  return (float) x;\n}\n\nstatic inline float uitofp_i64_f32(uint64_t x) {\n  return (float) x;\n}\n\nstatic inline int8_t fptosi_f32_i8(float x) {\n  return (int8_t) x;\n}\n\nstatic inline int16_t fptosi_f32_i16(float x) {\n  return (int16_t) x;\n}\n\nstatic inline int32_t fptosi_f32_i32(float x) {\n  return (int32_t) x;\n}\n\nstatic inline int64_t fptosi_f32_i64(float x) {\n  return (int64_t) x;\n}\n\nstatic inline uint8_t fptoui_f32_i8(float x) {\n  return (uint8_t) x;\n}\n\nstatic inline uint16_t fptoui_f32_i16(float x) {\n  return (uint16_t) x;\n}\n\nstatic inline uint32_t fptoui_f32_i32(float x) {\n  return (uint32_t) x;\n}\n\nstatic inline uint64_t fpt",
                   "oui_f32_i64(float x) {\n  return (uint64_t) x;\n}\n\n#ifdef __OPENCL_VERSION__\nstatic inline float fabs32(float x) {\n  return fabs(x);\n}\n\nstatic inline float fmax32(float x, float y) {\n  return fmax(x, y);\n}\n\nstatic inline float fmin32(float x, float y) {\n  return fmin(x, y);\n}\n\nstatic inline float fpow32(float x, float y) {\n  return pow(x, y);\n}\n\n#else // Not OpenCL, but CUDA or plain C.\n\nstatic inline float fabs32(float x) {\n  return fabsf(x);\n}\n\nstatic inline float fmax32(float x, float y) {\n  return fmaxf(x, y);\n}\n\nstatic inline float fmin32(float x, float y) {\n  return fminf(x, y);\n}\n\nstatic inline float fpow32(float x, float y) {\n  return powf(x, y);\n}\n#endif\n\nstatic inline bool futrts_isnan32(float x) {\n  return isnan(x);\n}\n\nstatic inline bool futrts_isinf32(float x) {\n  return isinf(x);\n}\n\n#ifdef __OPENCL_VERSION__\nstatic inline float futrts_log32(float x) {\n  return log(x);\n}\n\nstatic inline float futrts_log2_32(float x) {\n  return log2(x);\n}\n\nstatic inline float futrts_log10_32(float x) {\n  return log10(x);\n}\n\nstatic inline float futrts_sqrt32(float x) {\n  return sqrt(x);\n}\n\nstatic inline float futrts_exp32(float x) {\n  return exp(x);\n}\n\nstatic inline float futrts_cos32(float x) {\n  return cos(x);\n}\n\nstatic inline float futrts_sin32(float x) {\n  return sin(x);\n}\n\nstatic inline float futrts_tan32(float x) {\n  return tan(x);\n}\n\nstatic inline float futrts_acos32(float x) {\n  return acos(x);\n}\n\nstatic inline float futrts_asin32(float x) {\n  return asin(x);\n}\n\nstatic inline float futrts_atan32(float x) {\n  return atan(x);\n}\n\nstatic inline float futrts_cosh32(float x) {\n  return cosh(x);\n}\n\nstatic inline float futrts_sinh32(float x) {\n  return sinh(x);\n}\n\nstatic inline float futrts_tanh32(float x) {\n  return tanh(x);\n}\n\nstatic inline float futrts_acosh32(float x) {\n  return acosh(x);\n}\n\nstatic inline float futrts_asinh32(float x) {\n  return asinh(x);\n}\n\nstatic inline float futrts_atanh32(float x) {\n  return atanh(x);\n}\n\nstatic inline float futrts_atan2_32(float x, fl",
                   "oat y) {\n  return atan2(x, y);\n}\n\nstatic inline float futrts_hypot32(float x, float y) {\n  return hypot(x, y);\n}\n\nstatic inline float futrts_gamma32(float x) {\n  return tgamma(x);\n}\n\nstatic inline float futrts_lgamma32(float x) {\n  return lgamma(x);\n}\n\nstatic inline float fmod32(float x, float y) {\n  return fmod(x, y);\n}\n\nstatic inline float futrts_round32(float x) {\n  return rint(x);\n}\n\nstatic inline float futrts_floor32(float x) {\n  return floor(x);\n}\n\nstatic inline float futrts_ceil32(float x) {\n  return ceil(x);\n}\n\nstatic inline float futrts_lerp32(float v0, float v1, float t) {\n  return mix(v0, v1, t);\n}\n\nstatic inline float futrts_mad32(float a, float b, float c) {\n  return mad(a, b, c);\n}\n\nstatic inline float futrts_fma32(float a, float b, float c) {\n  return fma(a, b, c);\n}\n\n#else // Not OpenCL, but CUDA or plain C.\n\nstatic inline float futrts_log32(float x) {\n  return logf(x);\n}\n\nstatic inline float futrts_log2_32(float x) {\n  return log2f(x);\n}\n\nstatic inline float futrts_log10_32(float x) {\n  return log10f(x);\n}\n\nstatic inline float futrts_sqrt32(float x) {\n  return sqrtf(x);\n}\n\nstatic inline float futrts_exp32(float x) {\n  return expf(x);\n}\n\nstatic inline float futrts_cos32(float x) {\n  return cosf(x);\n}\n\nstatic inline float futrts_sin32(float x) {\n  return sinf(x);\n}\n\nstatic inline float futrts_tan32(float x) {\n  return tanf(x);\n}\n\nstatic inline float futrts_acos32(float x) {\n  return acosf(x);\n}\n\nstatic inline float futrts_asin32(float x) {\n  return asinf(x);\n}\n\nstatic inline float futrts_atan32(float x) {\n  return atanf(x);\n}\n\nstatic inline float futrts_cosh32(float x) {\n  return coshf(x);\n}\n\nstatic inline float futrts_sinh32(float x) {\n  return sinhf(x);\n}\n\nstatic inline float futrts_tanh32(float x) {\n  return tanhf(x);\n}\n\nstatic inline float futrts_acosh32(float x) {\n  return acoshf(x);\n}\n\nstatic inline float futrts_asinh32(float x) {\n  return asinhf(x);\n}\n\nstatic inline float futrts_atanh32(float x) {\n  return atanhf(x);\n}\n\nstatic inline float futr",
                   "ts_atan2_32(float x, float y) {\n  return atan2f(x, y);\n}\n\nstatic inline float futrts_hypot32(float x, float y) {\n  return hypotf(x, y);\n}\n\nstatic inline float futrts_gamma32(float x) {\n  return tgammaf(x);\n}\n\nstatic inline float futrts_lgamma32(float x) {\n  return lgammaf(x);\n}\n\nstatic inline float fmod32(float x, float y) {\n  return fmodf(x, y);\n}\n\nstatic inline float futrts_round32(float x) {\n  return rintf(x);\n}\n\nstatic inline float futrts_floor32(float x) {\n  return floorf(x);\n}\n\nstatic inline float futrts_ceil32(float x) {\n  return ceilf(x);\n}\n\nstatic inline float futrts_lerp32(float v0, float v1, float t) {\n  return v0 + (v1 - v0) * t;\n}\n\nstatic inline float futrts_mad32(float a, float b, float c) {\n  return a * b + c;\n}\n\nstatic inline float futrts_fma32(float a, float b, float c) {\n  return fmaf(a, b, c);\n}\n#endif\n\nstatic inline int32_t futrts_to_bits32(float x) {\n  union {\n    float f;\n    int32_t t;\n  } p;\n\n  p.f = x;\n  return p.t;\n}\n\nstatic inline float futrts_from_bits32(int32_t x) {\n  union {\n    int32_t f;\n    float t;\n  } p;\n\n  p.f = x;\n  return p.t;\n}\n\nstatic inline float fsignum32(float x) {\n  return futrts_isnan32(x) ? x : (x > 0) - (x < 0);\n}\n\n#ifdef FUTHARK_F64_ENABLED\n\nstatic inline double fdiv64(double x, double y) {\n  return x / y;\n}\n\nstatic inline double fadd64(double x, double y) {\n  return x + y;\n}\n\nstatic inline double fsub64(double x, double y) {\n  return x - y;\n}\n\nstatic inline double fmul64(double x, double y) {\n  return x * y;\n}\n\nstatic inline bool cmplt64(double x, double y) {\n  return x < y;\n}\n\nstatic inline bool cmple64(double x, double y) {\n  return x <= y;\n}\n\nstatic inline double sitofp_i8_f64(int8_t x) {\n  return (double) x;\n}\n\nstatic inline double sitofp_i16_f64(int16_t x) {\n  return (double) x;\n}\n\nstatic inline double sitofp_i32_f64(int32_t x) {\n  return (double) x;\n}\n\nstatic inline double sitofp_i64_f64(int64_t x) {\n  return (double) x;\n}\n\nstatic inline double uitofp_i8_f64(uint8_t x) {\n  return (double) x;\n}\n\nstatic inline dou",
                   "ble uitofp_i16_f64(uint16_t x) {\n  return (double) x;\n}\n\nstatic inline double uitofp_i32_f64(uint32_t x) {\n  return (double) x;\n}\n\nstatic inline double uitofp_i64_f64(uint64_t x) {\n  return (double) x;\n}\n\nstatic inline int8_t fptosi_f64_i8(double x) {\n  return (int8_t) x;\n}\n\nstatic inline int16_t fptosi_f64_i16(double x) {\n  return (int16_t) x;\n}\n\nstatic inline int32_t fptosi_f64_i32(double x) {\n  return (int32_t) x;\n}\n\nstatic inline int64_t fptosi_f64_i64(double x) {\n  return (int64_t) x;\n}\n\nstatic inline uint8_t fptoui_f64_i8(double x) {\n  return (uint8_t) x;\n}\n\nstatic inline uint16_t fptoui_f64_i16(double x) {\n  return (uint16_t) x;\n}\n\nstatic inline uint32_t fptoui_f64_i32(double x) {\n  return (uint32_t) x;\n}\n\nstatic inline uint64_t fptoui_f64_i64(double x) {\n  return (uint64_t) x;\n}\n\nstatic inline double fabs64(double x) {\n  return fabs(x);\n}\n\nstatic inline double fmax64(double x, double y) {\n  return fmax(x, y);\n}\n\nstatic inline double fmin64(double x, double y) {\n  return fmin(x, y);\n}\n\nstatic inline double fpow64(double x, double y) {\n  return pow(x, y);\n}\n\nstatic inline double futrts_log64(double x) {\n  return log(x);\n}\n\nstatic inline double futrts_log2_64(double x) {\n  return log2(x);\n}\n\nstatic inline double futrts_log10_64(double x) {\n  return log10(x);\n}\n\nstatic inline double futrts_sqrt64(double x) {\n  return sqrt(x);\n}\n\nstatic inline double futrts_exp64(double x) {\n  return exp(x);\n}\n\nstatic inline double futrts_cos64(double x) {\n  return cos(x);\n}\n\nstatic inline double futrts_sin64(double x) {\n  return sin(x);\n}\n\nstatic inline double futrts_tan64(double x) {\n  return tan(x);\n}\n\nstatic inline double futrts_acos64(double x) {\n  return acos(x);\n}\n\nstatic inline double futrts_asin64(double x) {\n  return asin(x);\n}\n\nstatic inline double futrts_atan64(double x) {\n  return atan(x);\n}\n\nstatic inline double futrts_cosh64(double x) {\n  return cosh(x);\n}\n\nstatic inline double futrts_sinh64(double x) {\n  return sinh(x);\n}\n\nstatic inline double futrts_tanh64(double",
                   " x) {\n  return tanh(x);\n}\n\nstatic inline double futrts_acosh64(double x) {\n  return acosh(x);\n}\n\nstatic inline double futrts_asinh64(double x) {\n  return asinh(x);\n}\n\nstatic inline double futrts_atanh64(double x) {\n  return atanh(x);\n}\n\nstatic inline double futrts_atan2_64(double x, double y) {\n  return atan2(x, y);\n}\n\nstatic inline double futrts_hypot64(double x, double y) {\n  return hypot(x, y);\n}\n\nstatic inline double futrts_gamma64(double x) {\n  return tgamma(x);\n}\n\nstatic inline double futrts_lgamma64(double x) {\n  return lgamma(x);\n}\n\nstatic inline double futrts_fma64(double a, double b, double c) {\n  return fma(a, b, c);\n}\n\nstatic inline double futrts_round64(double x) {\n  return rint(x);\n}\n\nstatic inline double futrts_ceil64(double x) {\n  return ceil(x);\n}\n\nstatic inline double futrts_floor64(double x) {\n  return floor(x);\n}\n\nstatic inline bool futrts_isnan64(double x) {\n  return isnan(x);\n}\n\nstatic inline bool futrts_isinf64(double x) {\n  return isinf(x);\n}\n\nstatic inline int64_t futrts_to_bits64(double x) {\n  union {\n    double f;\n    int64_t t;\n  } p;\n\n  p.f = x;\n  return p.t;\n}\n\nstatic inline double futrts_from_bits64(int64_t x) {\n  union {\n    int64_t f;\n    double t;\n  } p;\n\n  p.f = x;\n  return p.t;\n}\n\nstatic inline double fmod64(double x, double y) {\n  return fmod(x, y);\n}\n\nstatic inline double fsignum64(double x) {\n  return futrts_isnan64(x) ? x : (x > 0) - (x < 0);\n}\n\nstatic inline double futrts_lerp64(double v0, double v1, double t) {\n#ifdef __OPENCL_VERSION__\n  return mix(v0, v1, t);\n#else\n  return v0 + (v1 - v0) * t;\n#endif\n}\n\nstatic inline double futrts_mad64(double a, double b, double c) {\n#ifdef __OPENCL_VERSION__\n  return mad(a, b, c);\n#else\n  return a * b + c;\n#endif\n}\n\nstatic inline float fpconv_f32_f32(float x) {\n  return (float) x;\n}\n\nstatic inline double fpconv_f32_f64(float x) {\n  return (double) x;\n}\n\nstatic inline float fpconv_f64_f32(double x) {\n  return (float) x;\n}\n\nstatic inline double fpconv_f64_f64(double x) {\n  return (double) ",
                   "x;\n}\n\n#endif\n\n// End of scalar.h.\n// Start of scalar_f16.h.\n\n// Half-precision is emulated if needed (e.g. in straight C) with the\n// native type used if possible.  The emulation works by typedef'ing\n// 'float' to 'f16', and then implementing all operations on single\n// precision.  To cut down on duplication, we use the same code for\n// those Futhark functions that require just operators or casts.  The\n// in-memory representation for arrays will still be 16 bits even\n// under emulation, so the compiler will have to be careful when\n// generating reads or writes.\n\n#if !defined(cl_khr_fp16) && !(defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 600)\n#define EMULATE_F16\n#endif\n\n#if !defined(EMULATE_F16) && defined(__OPENCL_VERSION__)\n#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n#endif\n\n#ifdef EMULATE_F16\n\n// Note that the half-precision storage format is still 16 bits - the\n// compiler will have to be real careful!\ntypedef float f16;\n\n#else\n\n#ifdef __CUDA_ARCH__\n#include <cuda_fp16.h>\n#endif\n\ntypedef half f16;\n\n#endif\n\n// Some of these functions convert to single precision because half\n// precision versions are not available.\n\nstatic inline f16 fadd16(f16 x, f16 y) {\n  return x + y;\n}\n\nstatic inline f16 fsub16(f16 x, f16 y) {\n  return x - y;\n}\n\nstatic inline f16 fmul16(f16 x, f16 y) {\n  return x * y;\n}\n\nstatic inline bool cmplt16(f16 x, f16 y) {\n  return x < y;\n}\n\nstatic inline bool cmple16(f16 x, f16 y) {\n  return x <= y;\n}\n\nstatic inline f16 sitofp_i8_f16(int8_t x) {\n  return (f16) x;\n}\n\nstatic inline f16 sitofp_i16_f16(int16_t x) {\n  return (f16) x;\n}\n\nstatic inline f16 sitofp_i32_f16(int32_t x) {\n  return (f16) x;\n}\n\nstatic inline f16 sitofp_i64_f16(int64_t x) {\n  return (f16) x;\n}\n\nstatic inline f16 uitofp_i8_f16(uint8_t x) {\n  return (f16) x;\n}\n\nstatic inline f16 uitofp_i16_f16(uint16_t x) {\n  return (f16) x;\n}\n\nstatic inline f16 uitofp_i32_f16(uint32_t x) {\n  return (f16) x;\n}\n\nstatic inline f16 uitofp_i64_f16(uint64_t x) {\n  return (f16) x;\n}\n\nstatic inline int8_t fpt",
                   "osi_f16_i8(f16 x) {\n  return (int8_t) (float) x;\n}\n\nstatic inline int16_t fptosi_f16_i16(f16 x) {\n  return (int16_t) x;\n}\n\nstatic inline int32_t fptosi_f16_i32(f16 x) {\n  return (int32_t) x;\n}\n\nstatic inline int64_t fptosi_f16_i64(f16 x) {\n  return (int64_t) x;\n}\n\nstatic inline uint8_t fptoui_f16_i8(f16 x) {\n  return (uint8_t) (float) x;\n}\n\nstatic inline uint16_t fptoui_f16_i16(f16 x) {\n  return (uint16_t) x;\n}\n\nstatic inline uint32_t fptoui_f16_i32(f16 x) {\n  return (uint32_t) x;\n}\n\nstatic inline uint64_t fptoui_f16_i64(f16 x) {\n  return (uint64_t) x;\n}\n\n#ifndef EMULATE_F16\n\n#ifdef __OPENCL_VERSION__\nstatic inline f16 fabs16(f16 x) {\n  return fabs(x);\n}\n\nstatic inline f16 fmax16(f16 x, f16 y) {\n  return fmax(x, y);\n}\n\nstatic inline f16 fmin16(f16 x, f16 y) {\n  return fmin(x, y);\n}\n\nstatic inline f16 fpow16(f16 x, f16 y) {\n  return pow(x, y);\n}\n\n#else // Assuming CUDA.\n\nstatic inline f16 fabs16(f16 x) {\n  return fabsf(x);\n}\n\nstatic inline f16 fmax16(f16 x, f16 y) {\n  return fmaxf(x, y);\n}\n\nstatic inline f16 fmin16(f16 x, f16 y) {\n  return fminf(x, y);\n}\n\nstatic inline f16 fpow16(f16 x, f16 y) {\n  return powf(x, y);\n}\n#endif\n\nstatic inline bool futrts_isnan16(f16 x) {\n  return isnan((float)x);\n}\n\nstatic inline bool futrts_isinf16(f16 x) {\n  return isinf((float)x);\n}\n\n#ifdef __OPENCL_VERSION__\nstatic inline f16 futrts_log16(f16 x) {\n  return log(x);\n}\n\nstatic inline f16 futrts_log2_16(f16 x) {\n  return log2(x);\n}\n\nstatic inline f16 futrts_log10_16(f16 x) {\n  return log10(x);\n}\n\nstatic inline f16 futrts_sqrt16(f16 x) {\n  return sqrt(x);\n}\n\nstatic inline f16 futrts_exp16(f16 x) {\n  return exp(x);\n}\n\nstatic inline f16 futrts_cos16(f16 x) {\n  return cos(x);\n}\n\nstatic inline f16 futrts_sin16(f16 x) {\n  return sin(x);\n}\n\nstatic inline f16 futrts_tan16(f16 x) {\n  return tan(x);\n}\n\nstatic inline f16 futrts_acos16(f16 x) {\n  return acos(x);\n}\n\nstatic inline f16 futrts_asin16(f16 x) {\n  return asin(x);\n}\n\nstatic inline f16 futrts_atan16(f16 x) {\n  return atan(x);\n}\n\nstatic inli",
                   "ne f16 futrts_cosh16(f16 x) {\n  return cosh(x);\n}\n\nstatic inline f16 futrts_sinh16(f16 x) {\n  return sinh(x);\n}\n\nstatic inline f16 futrts_tanh16(f16 x) {\n  return tanh(x);\n}\n\nstatic inline f16 futrts_acosh16(f16 x) {\n  return acosh(x);\n}\n\nstatic inline f16 futrts_asinh16(f16 x) {\n  return asinh(x);\n}\n\nstatic inline f16 futrts_atanh16(f16 x) {\n  return atanh(x);\n}\n\nstatic inline f16 futrts_atan2_16(f16 x, f16 y) {\n  return atan2(x, y);\n}\n\nstatic inline f16 futrts_hypot16(f16 x, f16 y) {\n  return hypot(x, y);\n}\n\nstatic inline f16 futrts_gamma16(f16 x) {\n  return tgamma(x);\n}\n\nstatic inline f16 futrts_lgamma16(f16 x) {\n  return lgamma(x);\n}\n\nstatic inline f16 fmod16(f16 x, f16 y) {\n  return fmod(x, y);\n}\n\nstatic inline f16 futrts_round16(f16 x) {\n  return rint(x);\n}\n\nstatic inline f16 futrts_floor16(f16 x) {\n  return floor(x);\n}\n\nstatic inline f16 futrts_ceil16(f16 x) {\n  return ceil(x);\n}\n\nstatic inline f16 futrts_lerp16(f16 v0, f16 v1, f16 t) {\n  return mix(v0, v1, t);\n}\n\nstatic inline f16 futrts_mad16(f16 a, f16 b, f16 c) {\n  return mad(a, b, c);\n}\n\nstatic inline f16 futrts_fma16(f16 a, f16 b, f16 c) {\n  return fma(a, b, c);\n}\n\n#else // Assume CUDA.\n\nstatic inline f16 futrts_log16(f16 x) {\n  return hlog(x);\n}\n\nstatic inline f16 futrts_log2_16(f16 x) {\n  return hlog2(x);\n}\n\nstatic inline f16 futrts_log10_16(f16 x) {\n  return hlog10(x);\n}\n\nstatic inline f16 futrts_sqrt16(f16 x) {\n  return hsqrt(x);\n}\n\nstatic inline f16 futrts_exp16(f16 x) {\n  return hexp(x);\n}\n\nstatic inline f16 futrts_cos16(f16 x) {\n  return hcos(x);\n}\n\nstatic inline f16 futrts_sin16(f16 x) {\n  return hsin(x);\n}\n\nstatic inline f16 futrts_tan16(f16 x) {\n  return tanf(x);\n}\n\nstatic inline f16 futrts_acos16(f16 x) {\n  return acosf(x);\n}\n\nstatic inline f16 futrts_asin16(f16 x) {\n  return asinf(x);\n}\n\nstatic inline f16 futrts_atan16(f16 x) {\n  return atanf(x);\n}\n\nstatic inline f16 futrts_cosh16(f16 x) {\n  return coshf(x);\n}\n\nstatic inline f16 futrts_sinh16(f16 x) {\n  return sinhf(x);\n}\n\nstatic inline f16 ",
                   "futrts_tanh16(f16 x) {\n  return tanhf(x);\n}\n\nstatic inline f16 futrts_acosh16(f16 x) {\n  return acoshf(x);\n}\n\nstatic inline f16 futrts_asinh16(f16 x) {\n  return asinhf(x);\n}\n\nstatic inline f16 futrts_atanh16(f16 x) {\n  return atanhf(x);\n}\n\nstatic inline f16 futrts_atan2_16(f16 x, f16 y) {\n  return atan2f(x, y);\n}\n\nstatic inline f16 futrts_hypot16(f16 x, f16 y) {\n  return hypotf(x, y);\n}\n\nstatic inline f16 futrts_gamma16(f16 x) {\n  return tgammaf(x);\n}\n\nstatic inline f16 futrts_lgamma16(f16 x) {\n  return lgammaf(x);\n}\n\nstatic inline f16 fmod16(f16 x, f16 y) {\n  return fmodf(x, y);\n}\n\nstatic inline f16 futrts_round16(f16 x) {\n  return rintf(x);\n}\n\nstatic inline f16 futrts_floor16(f16 x) {\n  return hfloor(x);\n}\n\nstatic inline f16 futrts_ceil16(f16 x) {\n  return hceil(x);\n}\n\nstatic inline f16 futrts_lerp16(f16 v0, f16 v1, f16 t) {\n  return v0 + (v1 - v0) * t;\n}\n\nstatic inline f16 futrts_mad16(f16 a, f16 b, f16 c) {\n  return a * b + c;\n}\n\nstatic inline f16 futrts_fma16(f16 a, f16 b, f16 c) {\n  return fmaf(a, b, c);\n}\n\n#endif\n\n// The CUDA __half type cannot be put in unions for some reason, so we\n// use bespoke conversion functions instead.\n#ifdef __CUDA_ARCH__\nstatic inline int16_t futrts_to_bits16(f16 x) {\n  return __half_as_ushort(x);\n}\nstatic inline f16 futrts_from_bits16(int16_t x) {\n  return __ushort_as_half(x);\n}\n#else\nstatic inline int16_t futrts_to_bits16(f16 x) {\n  union {\n    f16 f;\n    int16_t t;\n  } p;\n\n  p.f = x;\n  return p.t;\n}\n\nstatic inline f16 futrts_from_bits16(int16_t x) {\n  union {\n    int16_t f;\n    f16 t;\n  } p;\n\n  p.f = x;\n  return p.t;\n}\n#endif\n\n#else // No native f16 - emulate.\n\nstatic inline f16 fabs16(f16 x) {\n  return fabs32(x);\n}\n\nstatic inline f16 fmax16(f16 x, f16 y) {\n  return fmax32(x, y);\n}\n\nstatic inline f16 fmin16(f16 x, f16 y) {\n  return fmin32(x, y);\n}\n\nstatic inline f16 fpow16(f16 x, f16 y) {\n  return fpow32(x, y);\n}\n\nstatic inline bool futrts_isnan16(f16 x) {\n  return futrts_isnan32(x);\n}\n\nstatic inline bool futrts_isinf16(f16 x) {",
                   "\n  return futrts_isinf32(x);\n}\n\nstatic inline f16 futrts_log16(f16 x) {\n  return futrts_log32(x);\n}\n\nstatic inline f16 futrts_log2_16(f16 x) {\n  return futrts_log2_32(x);\n}\n\nstatic inline f16 futrts_log10_16(f16 x) {\n  return futrts_log10_32(x);\n}\n\nstatic inline f16 futrts_sqrt16(f16 x) {\n  return futrts_sqrt32(x);\n}\n\nstatic inline f16 futrts_exp16(f16 x) {\n  return futrts_exp32(x);\n}\n\nstatic inline f16 futrts_cos16(f16 x) {\n  return futrts_cos32(x);\n}\n\nstatic inline f16 futrts_sin16(f16 x) {\n  return futrts_sin32(x);\n}\n\nstatic inline f16 futrts_tan16(f16 x) {\n  return futrts_tan32(x);\n}\n\nstatic inline f16 futrts_acos16(f16 x) {\n  return futrts_acos32(x);\n}\n\nstatic inline f16 futrts_asin16(f16 x) {\n  return futrts_asin32(x);\n}\n\nstatic inline f16 futrts_atan16(f16 x) {\n  return futrts_atan32(x);\n}\n\nstatic inline f16 futrts_cosh16(f16 x) {\n  return futrts_cosh32(x);\n}\n\nstatic inline f16 futrts_sinh16(f16 x) {\n  return futrts_sinh32(x);\n}\n\nstatic inline f16 futrts_tanh16(f16 x) {\n  return futrts_tanh32(x);\n}\n\nstatic inline f16 futrts_acosh16(f16 x) {\n  return futrts_acosh32(x);\n}\n\nstatic inline f16 futrts_asinh16(f16 x) {\n  return futrts_asinh32(x);\n}\n\nstatic inline f16 futrts_atanh16(f16 x) {\n  return futrts_atanh32(x);\n}\n\nstatic inline f16 futrts_atan2_16(f16 x, f16 y) {\n  return futrts_atan2_32(x, y);\n}\n\nstatic inline f16 futrts_hypot16(f16 x, f16 y) {\n  return futrts_hypot32(x, y);\n}\n\nstatic inline f16 futrts_gamma16(f16 x) {\n  return futrts_gamma32(x);\n}\n\nstatic inline f16 futrts_lgamma16(f16 x) {\n  return futrts_lgamma32(x);\n}\n\nstatic inline f16 fmod16(f16 x, f16 y) {\n  return fmod32(x, y);\n}\n\nstatic inline f16 futrts_round16(f16 x) {\n  return futrts_round32(x);\n}\n\nstatic inline f16 futrts_floor16(f16 x) {\n  return futrts_floor32(x);\n}\n\nstatic inline f16 futrts_ceil16(f16 x) {\n  return futrts_ceil32(x);\n}\n\nstatic inline f16 futrts_lerp16(f16 v0, f16 v1, f16 t) {\n  return futrts_lerp32(v0, v1, t);\n}\n\nstatic inline f16 futrts_mad16(f16 a, f16 b, f16 c) {\n  return f",
                   "utrts_mad32(a, b, c);\n}\n\nstatic inline f16 futrts_fma16(f16 a, f16 b, f16 c) {\n  return futrts_fma32(a, b, c);\n}\n\n// Even when we are using an OpenCL that does not support cl_khr_fp16,\n// it must still support vload_half for actually creating a\n// half-precision number, which can then be efficiently converted to a\n// float.  Similarly for vstore_half.\n#ifdef __OPENCL_VERSION__\n\nstatic inline int16_t futrts_to_bits16(f16 x) {\n  int16_t y;\n  // Violating strict aliasing here.\n  vstore_half((float)x, 0, (half*)&y);\n  return y;\n}\n\nstatic inline f16 futrts_from_bits16(int16_t x) {\n  return (f16)vload_half(0, (half*)&x);\n}\n\n#else\n\nstatic inline int16_t futrts_to_bits16(f16 x) {\n  return (int16_t)float2halfbits(x);\n}\n\nstatic inline f16 futrts_from_bits16(int16_t x) {\n  return halfbits2float((uint16_t)x);\n}\n\nstatic inline f16 fsignum16(f16 x) {\n  return futrts_isnan16(x) ? x : (x > 0) - (x < 0);\n}\n\n#endif\n\n#endif\n\nstatic inline float fpconv_f16_f16(f16 x) {\n  return x;\n}\n\nstatic inline float fpconv_f16_f32(f16 x) {\n  return x;\n}\n\nstatic inline f16 fpconv_f32_f16(float x) {\n  return x;\n}\n\n#ifdef FUTHARK_F64_ENABLED\n\nstatic inline double fpconv_f16_f64(f16 x) {\n  return (double) x;\n}\n\nstatic inline f16 fpconv_f64_f16(double x) {\n  return (f16) x;\n}\n\n#endif\n\n\n// End of scalar_f16.h.\n// Start of atomics.h\n\ninline int32_t atomic_xchg_i32_global(volatile __global int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicExch((int32_t*)p, x);\n#else\n  return atomic_xor(p, x);\n#endif\n}\n\ninline int32_t atomic_xchg_i32_local(volatile __local int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicExch((int32_t*)p, x);\n#else\n  return atomic_xor(p, x);\n#endif\n}\n\ninline int32_t atomic_cmpxchg_i32_global(volatile __global int32_t *p,\n                                         int32_t cmp, int32_t val) {\n#ifdef FUTHARK_CUDA\n  return atomicCAS((int32_t*)p, cmp, val);\n#else\n  return atomic_cmpxchg(p, cmp, val);\n#endif\n}\n\ninline int32_t atomic_cmpxchg_i32_local(volatile __local int32_t *p",
                   ",\n                                        int32_t cmp, int32_t val) {\n#ifdef FUTHARK_CUDA\n  return atomicCAS((int32_t*)p, cmp, val);\n#else\n  return atomic_cmpxchg(p, cmp, val);\n#endif\n}\n\ninline int32_t atomic_add_i32_global(volatile __global int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAdd((int32_t*)p, x);\n#else\n  return atomic_add(p, x);\n#endif\n}\n\ninline int32_t atomic_add_i32_local(volatile __local int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAdd((int32_t*)p, x);\n#else\n  return atomic_add(p, x);\n#endif\n}\n\ninline float atomic_fadd_f32_global(volatile __global float *p, float x) {\n#ifdef FUTHARK_CUDA\n  return atomicAdd((float*)p, x);\n#else\n  union { int32_t i; float f; } old;\n  union { int32_t i; float f; } assumed;\n  old.f = *p;\n  do {\n    assumed.f = old.f;\n    old.f = old.f + x;\n    old.i = atomic_cmpxchg_i32_global((volatile __global int32_t*)p, assumed.i, old.i);\n  } while (assumed.i != old.i);\n  return old.f;\n#endif\n}\n\ninline float atomic_fadd_f32_local(volatile __local float *p, float x) {\n#ifdef FUTHARK_CUDA\n  return atomicAdd((float*)p, x);\n#else\n  union { int32_t i; float f; } old;\n  union { int32_t i; float f; } assumed;\n  old.f = *p;\n  do {\n    assumed.f = old.f;\n    old.f = old.f + x;\n    old.i = atomic_cmpxchg_i32_local((volatile __local int32_t*)p, assumed.i, old.i);\n  } while (assumed.i != old.i);\n  return old.f;\n#endif\n}\n\ninline int32_t atomic_smax_i32_global(volatile __global int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((int32_t*)p, x);\n#else\n  return atomic_max(p, x);\n#endif\n}\n\ninline int32_t atomic_smax_i32_local(volatile __local int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((int32_t*)p, x);\n#else\n  return atomic_max(p, x);\n#endif\n}\n\ninline int32_t atomic_smin_i32_global(volatile __global int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((int32_t*)p, x);\n#else\n  return atomic_min(p, x);\n#endif\n}\n\ninline int32_t atomic_smin_i32_local(volatile __local int32_t *p, int32",
                   "_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((int32_t*)p, x);\n#else\n  return atomic_min(p, x);\n#endif\n}\n\ninline uint32_t atomic_umax_i32_global(volatile __global uint32_t *p, uint32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((uint32_t*)p, x);\n#else\n  return atomic_max(p, x);\n#endif\n}\n\ninline uint32_t atomic_umax_i32_local(volatile __local uint32_t *p, uint32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((uint32_t*)p, x);\n#else\n  return atomic_max(p, x);\n#endif\n}\n\ninline uint32_t atomic_umin_i32_global(volatile __global uint32_t *p, uint32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((uint32_t*)p, x);\n#else\n  return atomic_min(p, x);\n#endif\n}\n\ninline uint32_t atomic_umin_i32_local(volatile __local uint32_t *p, uint32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((uint32_t*)p, x);\n#else\n  return atomic_min(p, x);\n#endif\n}\n\ninline int32_t atomic_and_i32_global(volatile __global int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAnd((int32_t*)p, x);\n#else\n  return atomic_and(p, x);\n#endif\n}\n\ninline int32_t atomic_and_i32_local(volatile __local int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAnd((int32_t*)p, x);\n#else\n  return atomic_and(p, x);\n#endif\n}\n\ninline int32_t atomic_or_i32_global(volatile __global int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicOr((int32_t*)p, x);\n#else\n  return atomic_or(p, x);\n#endif\n}\n\ninline int32_t atomic_or_i32_local(volatile __local int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicOr((int32_t*)p, x);\n#else\n  return atomic_or(p, x);\n#endif\n}\n\ninline int32_t atomic_xor_i32_global(volatile __global int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicXor((int32_t*)p, x);\n#else\n  return atomic_xor(p, x);\n#endif\n}\n\ninline int32_t atomic_xor_i32_local(volatile __local int32_t *p, int32_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicXor((int32_t*)p, x);\n#else\n  return atomic_xor(p, x);\n#endif\n}\n\n// Start of 64 bit atomics\n\ninline int64_t atomic_xchg_i64_global(volatile __global int64_t *p, int",
                   "64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicExch((uint64_t*)p, x);\n#else\n  return atom_xor(p, x);\n#endif\n}\n\ninline int64_t atomic_xchg_i64_local(volatile __local int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicExch((uint64_t*)p, x);\n#else\n  return atom_xor(p, x);\n#endif\n}\n\ninline int64_t atomic_cmpxchg_i64_global(volatile __global int64_t *p,\n                                         int64_t cmp, int64_t val) {\n#ifdef FUTHARK_CUDA\n  return atomicCAS((uint64_t*)p, cmp, val);\n#else\n  return atom_cmpxchg(p, cmp, val);\n#endif\n}\n\ninline int64_t atomic_cmpxchg_i64_local(volatile __local int64_t *p,\n                                        int64_t cmp, int64_t val) {\n#ifdef FUTHARK_CUDA\n  return atomicCAS((uint64_t*)p, cmp, val);\n#else\n  return atom_cmpxchg(p, cmp, val);\n#endif\n}\n\ninline int64_t atomic_add_i64_global(volatile __global int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAdd((uint64_t*)p, x);\n#else\n  return atom_add(p, x);\n#endif\n}\n\ninline int64_t atomic_add_i64_local(volatile __local int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAdd((uint64_t*)p, x);\n#else\n  return atom_add(p, x);\n#endif\n}\n\n#ifdef FUTHARK_F64_ENABLED\n\ninline double atomic_fadd_f64_global(volatile __global double *p, double x) {\n#if defined(FUTHARK_CUDA) && __CUDA_ARCH__ >= 600\n  return atomicAdd((double*)p, x);\n#else\n  union { int64_t i; double f; } old;\n  union { int64_t i; double f; } assumed;\n  old.f = *p;\n  do {\n    assumed.f = old.f;\n    old.f = old.f + x;\n    old.i = atomic_cmpxchg_i64_global((volatile __global int64_t*)p, assumed.i, old.i);\n  } while (assumed.i != old.i);\n  return old.f;\n#endif\n}\n\ninline double atomic_fadd_f64_local(volatile __local double *p, double x) {\n#if defined(FUTHARK_CUDA) && __CUDA_ARCH__ >= 600\n  return atomicAdd((double*)p, x);\n#else\n  union { int64_t i; double f; } old;\n  union { int64_t i; double f; } assumed;\n  old.f = *p;\n  do {\n    assumed.f = old.f;\n    old.f = old.f + x;\n    old.i = atomic_cmpxchg_i64_local((volatile",
                   " __local int64_t*)p, assumed.i, old.i);\n  } while (assumed.i != old.i);\n  return old.f;\n#endif\n}\n\n#endif\n\ninline int64_t atomic_smax_i64_global(volatile __global int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((int64_t*)p, x);\n#else\n  return atom_max(p, x);\n#endif\n}\n\ninline int64_t atomic_smax_i64_local(volatile __local int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((int64_t*)p, x);\n#else\n  return atom_max(p, x);\n#endif\n}\n\ninline int64_t atomic_smin_i64_global(volatile __global int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((int64_t*)p, x);\n#else\n  return atom_min(p, x);\n#endif\n}\n\ninline int64_t atomic_smin_i64_local(volatile __local int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((int64_t*)p, x);\n#else\n  return atom_min(p, x);\n#endif\n}\n\ninline uint64_t atomic_umax_i64_global(volatile __global uint64_t *p, uint64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((uint64_t*)p, x);\n#else\n  return atom_max(p, x);\n#endif\n}\n\ninline uint64_t atomic_umax_i64_local(volatile __local uint64_t *p, uint64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMax((uint64_t*)p, x);\n#else\n  return atom_max(p, x);\n#endif\n}\n\ninline uint64_t atomic_umin_i64_global(volatile __global uint64_t *p, uint64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((uint64_t*)p, x);\n#else\n  return atom_min(p, x);\n#endif\n}\n\ninline uint64_t atomic_umin_i64_local(volatile __local uint64_t *p, uint64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicMin((uint64_t*)p, x);\n#else\n  return atom_min(p, x);\n#endif\n}\n\ninline int64_t atomic_and_i64_global(volatile __global int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAnd((int64_t*)p, x);\n#else\n  return atom_and(p, x);\n#endif\n}\n\ninline int64_t atomic_and_i64_local(volatile __local int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicAnd((int64_t*)p, x);\n#else\n  return atom_and(p, x);\n#endif\n}\n\ninline int64_t atomic_or_i64_global(volatile __global int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return at",
                   "omicOr((int64_t*)p, x);\n#else\n  return atom_or(p, x);\n#endif\n}\n\ninline int64_t atomic_or_i64_local(volatile __local int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicOr((int64_t*)p, x);\n#else\n  return atom_or(p, x);\n#endif\n}\n\ninline int64_t atomic_xor_i64_global(volatile __global int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicXor((int64_t*)p, x);\n#else\n  return atom_xor(p, x);\n#endif\n}\n\ninline int64_t atomic_xor_i64_local(volatile __local int64_t *p, int64_t x) {\n#ifdef FUTHARK_CUDA\n  return atomicXor((int64_t*)p, x);\n#else\n  return atom_xor(p, x);\n#endif\n}\n\n// End of atomics.h\n\n\n\n__kernel void builtinzhreplicate_f64zireplicate_78312(int32_t num_elems_78309,\n                                                      double val_78310, __global\n                                                      unsigned char *mem_78308)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    int32_t replicate_gtid_78312;\n    int32_t replicate_ltid_78313;\n    int32_t replicate_gid_78314;\n    \n    replicate_gtid_78312 = get_global_id(0);\n    replicate_ltid_78313 = get_local_id(0);\n    replicate_gid_78314 = get_group_id(0);\n    \n    int64_t slice_78318 = num_elems_78309;\n    int64_t rep_i_78317 = sext_i32_i64(replicate_gtid_78312);\n    int64_t remnant_78319 = sext_i32_i64(replicate_gtid_78312) - rep_i_78317;\n    \n    if (slt64(replicate_gtid_78312, num_elems_78309)) {\n        ((__global double *) mem_78308)[rep_i_78317] = val_78310;\n    }\n    \n  error_0:\n    return;\n}\n__kernel void builtinzhreplicate_i64zireplicate_78426(int32_t num_elems_78423,\n                                                      int64_t val_78424,\n                                                      __global\n                                                      unsigned char *mem_78422)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    int32_t replicate_gtid_78426;\n    int32_t replicate_ltid_78427;\n    int32_t r",
                   "eplicate_gid_78428;\n    \n    replicate_gtid_78426 = get_global_id(0);\n    replicate_ltid_78427 = get_local_id(0);\n    replicate_gid_78428 = get_group_id(0);\n    \n    int64_t slice_78432 = num_elems_78423;\n    int64_t rep_i_78431 = sext_i32_i64(replicate_gtid_78426);\n    int64_t remnant_78433 = sext_i32_i64(replicate_gtid_78426) - rep_i_78431;\n    \n    if (slt64(replicate_gtid_78426, num_elems_78423)) {\n        ((__global int64_t *) mem_78422)[rep_i_78431] = val_78424;\n    }\n    \n  error_0:\n    return;\n}\n__kernel void gpu_map_transpose_f64(__local volatile\n                                    int64_t *block_9_backing_aligned_0,\n                                    int32_t destoffset_1, int32_t srcoffset_3,\n                                    int32_t num_arrays_4, int32_t x_elems_5,\n                                    int32_t y_elems_6, int32_t mulx_7,\n                                    int32_t muly_8, __global\n                                    unsigned char *destmem_0, __global\n                                    unsigned char *srcmem_2)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict block_9_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) block_9_backing_aligned_0;\n    __local unsigned char *block_9;\n    \n    block_9 = (__local unsigned char *) block_9_backing_0;\n    \n    int32_t get_global_id_0_37;\n    \n    get_global_id_0_37 = get_global_id(0);\n    \n    int32_t get_local_id_0_38;\n    \n    get_local_id_0_38 = get_local_id(0);\n    \n    int32_t get_local_id_1_39;\n    \n    get_local_id_1_39 = get_local_id(1);\n    \n    int32_t get_group_id_0_40;\n    \n    get_group_id_0_40 = get_group_id(0);\n    \n    int32_t get_group_id_1_41;\n    \n    get_group_id_1_41 = get_group_id(1);\n    \n    int32_t get_group_id_2_42;\n    \n    get_group_id_2_42 = get_group_id(2);\n    \n    int32_t our_array_offset_30 = get_group_id_2_42 * x_",
                   "elems_5 * y_elems_6;\n    int32_t odata_offset_33 = squot32(destoffset_1, 8) + our_array_offset_30;\n    int32_t idata_offset_34 = squot32(srcoffset_3, 8) + our_array_offset_30;\n    int32_t x_index_31 = get_global_id_0_37;\n    int32_t y_index_32 = get_group_id_1_41 * 32 + get_local_id_1_39;\n    double val_44;\n    \n    if (slt32(x_index_31, x_elems_5)) {\n        for (int32_t j_43 = 0; j_43 < 4; j_43++) {\n            int32_t index_in_35 = (y_index_32 + j_43 * 8) * x_elems_5 +\n                    x_index_31;\n            \n            if (slt32(y_index_32 + j_43 * 8, y_elems_6)) {\n                val_44 = ((__global\n                           double *) srcmem_2)[sext_i32_i64(idata_offset_34 +\n                                               index_in_35)];\n                ((__local double *) block_9)[sext_i32_i64((get_local_id_1_39 +\n                                                           j_43 * 8) * 33 +\n                                             get_local_id_0_38)] = val_44;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    x_index_31 = get_group_id_1_41 * 32 + get_local_id_0_38;\n    y_index_32 = get_group_id_0_40 * 32 + get_local_id_1_39;\n    if (slt32(x_index_31, y_elems_6)) {\n        for (int32_t j_43 = 0; j_43 < 4; j_43++) {\n            int32_t index_out_36 = (y_index_32 + j_43 * 8) * y_elems_6 +\n                    x_index_31;\n            \n            if (slt32(y_index_32 + j_43 * 8, x_elems_5)) {\n                val_44 = ((__local\n                           double *) block_9)[sext_i32_i64(get_local_id_0_38 *\n                                              33 + get_local_id_1_39 + j_43 *\n                                              8)];\n                ((__global double *) destmem_0)[sext_i32_i64(odata_offset_33 +\n                                                index_out_36)] = val_44;\n            }\n        }\n    }\n    \n  error_0:\n    return;\n}\n__kernel void gpu_map_transpose_f64_low_height(__local volatile\n                                        ",
                   "       int64_t *block_9_backing_aligned_0,\n                                               int32_t destoffset_1,\n                                               int32_t srcoffset_3,\n                                               int32_t num_arrays_4,\n                                               int32_t x_elems_5,\n                                               int32_t y_elems_6,\n                                               int32_t mulx_7, int32_t muly_8,\n                                               __global\n                                               unsigned char *destmem_0,\n                                               __global unsigned char *srcmem_2)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict block_9_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) block_9_backing_aligned_0;\n    __local unsigned char *block_9;\n    \n    block_9 = (__local unsigned char *) block_9_backing_0;\n    \n    int32_t get_global_id_0_37;\n    \n    get_global_id_0_37 = get_global_id(0);\n    \n    int32_t get_local_id_0_38;\n    \n    get_local_id_0_38 = get_local_id(0);\n    \n    int32_t get_local_id_1_39;\n    \n    get_local_id_1_39 = get_local_id(1);\n    \n    int32_t get_group_id_0_40;\n    \n    get_group_id_0_40 = get_group_id(0);\n    \n    int32_t get_group_id_1_41;\n    \n    get_group_id_1_41 = get_group_id(1);\n    \n    int32_t get_group_id_2_42;\n    \n    get_group_id_2_42 = get_group_id(2);\n    \n    int32_t our_array_offset_30 = get_group_id_2_42 * x_elems_5 * y_elems_6;\n    int32_t odata_offset_33 = squot32(destoffset_1, 8) + our_array_offset_30;\n    int32_t idata_offset_34 = squot32(srcoffset_3, 8) + our_array_offset_30;\n    int32_t x_index_31 = get_group_id_0_40 * 16 * mulx_7 + get_local_id_0_38 +\n            srem32(get_local_id_1_39, mulx_7) * 16;\n    int32_t y_index_32 = get_group_id_1_41 * 16 + squot32(get_local_id_1_39,\n",
                   "                                                          mulx_7);\n    double val_44;\n    int32_t index_in_35 = y_index_32 * x_elems_5 + x_index_31;\n    \n    if (slt32(x_index_31, x_elems_5) && slt32(y_index_32, y_elems_6)) {\n        val_44 = ((__global double *) srcmem_2)[sext_i32_i64(idata_offset_34 +\n                                                index_in_35)];\n        ((__local double *) block_9)[sext_i32_i64(get_local_id_1_39 * 17 +\n                                     get_local_id_0_38)] = val_44;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    x_index_31 = get_group_id_1_41 * 16 + squot32(get_local_id_0_38, mulx_7);\n    y_index_32 = get_group_id_0_40 * 16 * mulx_7 + get_local_id_1_39 +\n        srem32(get_local_id_0_38, mulx_7) * 16;\n    \n    int32_t index_out_36 = y_index_32 * y_elems_6 + x_index_31;\n    \n    if (slt32(x_index_31, y_elems_6) && slt32(y_index_32, x_elems_5)) {\n        val_44 = ((__local double *) block_9)[sext_i32_i64(get_local_id_0_38 *\n                                              17 + get_local_id_1_39)];\n        ((__global double *) destmem_0)[sext_i32_i64(odata_offset_33 +\n                                        index_out_36)] = val_44;\n    }\n    \n  error_0:\n    return;\n}\n__kernel void gpu_map_transpose_f64_low_width(__local volatile\n                                              int64_t *block_9_backing_aligned_0,\n                                              int32_t destoffset_1,\n                                              int32_t srcoffset_3,\n                                              int32_t num_arrays_4,\n                                              int32_t x_elems_5,\n                                              int32_t y_elems_6, int32_t mulx_7,\n                                              int32_t muly_8, __global\n                                              unsigned char *destmem_0, __global\n                                              unsigned char *srcmem_2)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    c",
                   "onst int block_dim2 = 2;\n    __local volatile unsigned char *restrict block_9_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) block_9_backing_aligned_0;\n    __local unsigned char *block_9;\n    \n    block_9 = (__local unsigned char *) block_9_backing_0;\n    \n    int32_t get_global_id_0_37;\n    \n    get_global_id_0_37 = get_global_id(0);\n    \n    int32_t get_local_id_0_38;\n    \n    get_local_id_0_38 = get_local_id(0);\n    \n    int32_t get_local_id_1_39;\n    \n    get_local_id_1_39 = get_local_id(1);\n    \n    int32_t get_group_id_0_40;\n    \n    get_group_id_0_40 = get_group_id(0);\n    \n    int32_t get_group_id_1_41;\n    \n    get_group_id_1_41 = get_group_id(1);\n    \n    int32_t get_group_id_2_42;\n    \n    get_group_id_2_42 = get_group_id(2);\n    \n    int32_t our_array_offset_30 = get_group_id_2_42 * x_elems_5 * y_elems_6;\n    int32_t odata_offset_33 = squot32(destoffset_1, 8) + our_array_offset_30;\n    int32_t idata_offset_34 = squot32(srcoffset_3, 8) + our_array_offset_30;\n    int32_t x_index_31 = get_group_id_0_40 * 16 + squot32(get_local_id_0_38,\n                                                          muly_8);\n    int32_t y_index_32 = get_group_id_1_41 * 16 * muly_8 + get_local_id_1_39 +\n            srem32(get_local_id_0_38, muly_8) * 16;\n    double val_44;\n    int32_t index_in_35 = y_index_32 * x_elems_5 + x_index_31;\n    \n    if (slt32(x_index_31, x_elems_5) && slt32(y_index_32, y_elems_6)) {\n        val_44 = ((__global double *) srcmem_2)[sext_i32_i64(idata_offset_34 +\n                                                index_in_35)];\n        ((__local double *) block_9)[sext_i32_i64(get_local_id_1_39 * 17 +\n                                     get_local_id_0_38)] = val_44;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    x_index_31 = get_group_id_1_41 * 16 * muly_8 + get_local_id_0_38 +\n        srem32(get_local_id_1_39, muly_8) * 16;\n    y_index_32 = get_group_id_0_40 * 16 + squot32(get_local_id_1_39,",
                   " muly_8);\n    \n    int32_t index_out_36 = y_index_32 * y_elems_6 + x_index_31;\n    \n    if (slt32(x_index_31, y_elems_6) && slt32(y_index_32, x_elems_5)) {\n        val_44 = ((__local double *) block_9)[sext_i32_i64(get_local_id_0_38 *\n                                              17 + get_local_id_1_39)];\n        ((__global double *) destmem_0)[sext_i32_i64(odata_offset_33 +\n                                        index_out_36)] = val_44;\n    }\n    \n  error_0:\n    return;\n}\n__kernel void gpu_map_transpose_f64_small(__local volatile\n                                          int64_t *block_9_backing_aligned_0,\n                                          int32_t destoffset_1,\n                                          int32_t srcoffset_3,\n                                          int32_t num_arrays_4,\n                                          int32_t x_elems_5, int32_t y_elems_6,\n                                          int32_t mulx_7, int32_t muly_8,\n                                          __global unsigned char *destmem_0,\n                                          __global unsigned char *srcmem_2)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict block_9_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) block_9_backing_aligned_0;\n    __local unsigned char *block_9;\n    \n    block_9 = (__local unsigned char *) block_9_backing_0;\n    \n    int32_t get_global_id_0_37;\n    \n    get_global_id_0_37 = get_global_id(0);\n    \n    int32_t get_local_id_0_38;\n    \n    get_local_id_0_38 = get_local_id(0);\n    \n    int32_t get_local_id_1_39;\n    \n    get_local_id_1_39 = get_local_id(1);\n    \n    int32_t get_group_id_0_40;\n    \n    get_group_id_0_40 = get_group_id(0);\n    \n    int32_t get_group_id_1_41;\n    \n    get_group_id_1_41 = get_group_id(1);\n    \n    int32_t get_group_id_2_42;\n    \n    get_group_id_2_42 = get_group_id(2);\n ",
                   "   \n    int32_t our_array_offset_30 = squot32(get_global_id_0_37, y_elems_6 *\n                                          x_elems_5) * (y_elems_6 * x_elems_5);\n    int32_t x_index_31 = squot32(srem32(get_global_id_0_37, y_elems_6 *\n                                        x_elems_5), y_elems_6);\n    int32_t y_index_32 = srem32(get_global_id_0_37, y_elems_6);\n    double val_44;\n    int32_t odata_offset_33 = squot32(destoffset_1, 8) + our_array_offset_30;\n    int32_t idata_offset_34 = squot32(srcoffset_3, 8) + our_array_offset_30;\n    int32_t index_in_35 = y_index_32 * x_elems_5 + x_index_31;\n    int32_t index_out_36 = x_index_31 * y_elems_6 + y_index_32;\n    \n    if (slt32(get_global_id_0_37, x_elems_5 * y_elems_6 * num_arrays_4)) {\n        val_44 = ((__global double *) srcmem_2)[sext_i32_i64(idata_offset_34 +\n                                                index_in_35)];\n        ((__global double *) destmem_0)[sext_i32_i64(odata_offset_33 +\n                                        index_out_36)] = val_44;\n    }\n    \n  error_0:\n    return;\n}\n__kernel void mainziscan_stage1_67884(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_78365_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int32_t num_threads_78359, __global\n                                      unsigned char *Y_mem_77010, __global\n                                      unsigned char *mem_77116)\n{\n    #define segscan_group_sizze_67878 (mainzisegscan_group_sizze_67858)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_78365_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_78365_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32",
                   "_t global_tid_78360;\n    int32_t local_tid_78361;\n    int64_t group_sizze_78364;\n    int32_t wave_sizze_78363;\n    int32_t group_tid_78362;\n    \n    global_tid_78360 = get_global_id(0);\n    local_tid_78361 = get_local_id(0);\n    group_sizze_78364 = get_local_size(0);\n    wave_sizze_78363 = LOCKSTEP_WIDTH;\n    group_tid_78362 = get_group_id(0);\n    \n    int32_t phys_tid_67884 = global_tid_78360;\n    __local unsigned char *scan_arr_mem_78365;\n    \n    scan_arr_mem_78365 = (__local unsigned char *) scan_arr_mem_78365_backing_0;\n    \n    int64_t x_67885;\n    int64_t x_67886;\n    \n    x_67885 = (int64_t) 0;\n    for (int64_t j_78367 = 0; j_78367 < sdiv_up64(m_65377 * n_65378,\n                                                  sext_i32_i64(num_threads_78359));\n         j_78367++) {\n        int64_t chunk_offset_78368 = segscan_group_sizze_67878 * j_78367 +\n                sext_i32_i64(group_tid_78362) * (segscan_group_sizze_67878 *\n                                                 sdiv_up64(m_65377 * n_65378,\n                                                           sext_i32_i64(num_threads_78359)));\n        int64_t flat_idx_78369 = chunk_offset_78368 +\n                sext_i32_i64(local_tid_78361);\n        int64_t gtid_67882 = squot64(flat_idx_78369, n_65378);\n        int64_t gtid_67883 = flat_idx_78369 - squot64(flat_idx_78369, n_65378) *\n                n_65378;\n        \n        // threads in bounds read input\n        {\n            if (slt64(gtid_67882, m_65377) && slt64(gtid_67883, n_65378)) {\n                double x_67889;\n                \n                x_67889 = ((__global double *) Y_mem_77010)[gtid_67882 *\n                                                            n_65378 +\n                                                            gtid_67883];\n                \n                bool isnan_res_67890;\n                \n                isnan_res_67890 = futrts_isnan64(x_67889);\n                \n                bool defunc_0_p_res_67891 = !isnan_res_67890;\n           ",
                   "     int64_t defunc_0_f_res_67892 =\n                        btoi_bool_i64(defunc_0_p_res_67891);\n                \n                // write to-scan values to parameters\n                {\n                    x_67886 = defunc_0_f_res_67892;\n                }\n                // write mapped values results to global memory\n                { }\n            }\n        }\n        // do one intra-group scan operation\n        {\n            // maybe restore some to-scan values to parameters, or read neutral\n            {\n                if (!(slt64(gtid_67882, m_65377) && slt64(gtid_67883,\n                                                          n_65378))) {\n                    x_67886 = (int64_t) 0;\n                }\n            }\n            // combine with carry and write to local memory\n            {\n                int64_t defunc_1_op_res_67887 = add64(x_67885, x_67886);\n                \n                ((__local\n                  int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)] =\n                    defunc_1_op_res_67887;\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            int64_t x_78370;\n            int64_t x_78371;\n            int64_t x_78373;\n            int64_t x_78374;\n            bool ltid_in_bounds_78376 = slt64(sext_i32_i64(local_tid_78361),\n                                              segscan_group_sizze_67878);\n            int32_t skip_threads_78377;\n            \n            // read input for in-block scan\n            {\n                if (ltid_in_bounds_78376) {\n                    x_78371 = ((volatile __local\n                                int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)];\n                    if ((local_tid_78361 - squot32(local_tid_78361, 32) * 32) ==\n                        0) {\n                        x_78370 = x_78371;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_78377 = 1;\n",
                   "                while (slt32(skip_threads_78377, 32)) {\n                    bool thread_active_78378 = sle32(skip_threads_78377,\n                                                     local_tid_78361 -\n                                                     squot32(local_tid_78361,\n                                                             32) * 32) &&\n                         ltid_in_bounds_78376;\n                    \n                    if (thread_active_78378) {\n                        // read operands\n                        {\n                            x_78370 = ((volatile __local\n                                        int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361) -\n                                                                       sext_i32_i64(skip_threads_78377)];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78379 =\n                             slt64(srem64(sext_i32_i64(local_tid_78361) +\n                                          chunk_offset_78368, n_65378),\n                                   sext_i32_i64(local_tid_78361) +\n                                   chunk_offset_78368 -\n                                   (sext_i32_i64(local_tid_78361 -\n                                    skip_threads_78377) + chunk_offset_78368));\n                        \n                        if (thread_active_78378 && inactive_78379) {\n                            x_78370 = x_78371;\n                        }\n                        if (thread_active_78378) {\n                            if (!inactive_78379) {\n                                int64_t defunc_1_op_res_78372 = add64(x_78370,\n                                                                      x_78371);\n                                \n                                x_78370 = defunc_1_op_res_78372;\n                            }\n                        }\n                    }\n                    if ",
                   "(sle32(wave_sizze_78363, skip_threads_78377)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_78378) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)] =\n                                x_78370;\n                            x_78371 = x_78370;\n                        }\n                    }\n                    if (sle32(wave_sizze_78363, skip_threads_78377)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_78377 *= 2;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // last thread of block 'i' writes its result to offset 'i'\n            {\n                if ((local_tid_78361 - squot32(local_tid_78361, 32) * 32) ==\n                    31 && ltid_in_bounds_78376) {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_78365)[sext_i32_i64(squot32(local_tid_78361,\n                                                                          32))] =\n                        x_78370;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n            {\n                int32_t skip_threads_78380;\n                \n                // read input for in-block scan\n                {\n                    if (squot32(local_tid_78361, 32) == 0 &&\n                        ltid_in_bounds_78376) {\n                        x_78374 = ((volatile __local\n                                    int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)];\n                        if ((local_tid_78361 - squot32(local_tid_78361, 32) *\n                             32) == 0) {\n                            x_78373 = x_78374;\n                        }\n",
                   "                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_78380 = 1;\n                    while (slt32(skip_threads_78380, 32)) {\n                        bool thread_active_78381 = sle32(skip_threads_78380,\n                                                         local_tid_78361 -\n                                                         squot32(local_tid_78361,\n                                                                 32) * 32) &&\n                             (squot32(local_tid_78361, 32) == 0 &&\n                              ltid_in_bounds_78376);\n                        \n                        if (thread_active_78381) {\n                            // read operands\n                            {\n                                x_78373 = ((volatile __local\n                                            int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361) -\n                                                                           sext_i32_i64(skip_threads_78380)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_78382 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78361 *\n                                              32 + 32 - 1) + chunk_offset_78368,\n                                              n_65378),\n                                       sext_i32_i64(local_tid_78361 * 32 + 32 -\n                                       1) + chunk_offset_78368 -\n                                       (sext_i32_i64((local_tid_78361 -\n                                                      skip_threads_78380) * 32 +\n                                        32 - 1) + chunk_offset_78368));\n                            \n                            if (thread_active_78381 && inactive_78382) {\n                                x_78373 = x_78374;",
                   "\n                            }\n                            if (thread_active_78381) {\n                                if (!inactive_78382) {\n                                    int64_t defunc_1_op_res_78375 =\n                                            add64(x_78373, x_78374);\n                                    \n                                    x_78373 = defunc_1_op_res_78375;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_78363, skip_threads_78380)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_78381) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)] =\n                                    x_78373;\n                                x_78374 = x_78373;\n                            }\n                        }\n                        if (sle32(wave_sizze_78363, skip_threads_78380)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_78380 *= 2;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            bool no_carry_in_78383 = squot32(local_tid_78361, 32) == 0 ||\n                 !ltid_in_bounds_78376;\n            \n            // carry-in for every block except the first\n            {\n                // read operands\n                {\n                    if (!no_carry_in_78383) {\n                        x_78371 = x_78370;\n                        x_78370 = ((__local\n                                    int64_t *) scan_arr_mem_78365)[sext_i32_i64(squot32(local_tid_78361,\n                                                                                        32)) -\n                                          ",
                   "                         (int64_t) 1];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_78384 =\n                         slt64(srem64(sext_i32_i64(local_tid_78361) +\n                                      chunk_offset_78368, n_65378),\n                               sext_i32_i64(local_tid_78361) +\n                               chunk_offset_78368 -\n                               (sext_i32_i64(squot32(local_tid_78361, 32) * 32 -\n                                1) + chunk_offset_78368));\n                    \n                    if (!no_carry_in_78383) {\n                        if (inactive_78384) {\n                            x_78370 = x_78371;\n                        }\n                    }\n                    if (!no_carry_in_78383) {\n                        if (!inactive_78384) {\n                            int64_t defunc_1_op_res_78372 = add64(x_78370,\n                                                                  x_78371);\n                            \n                            x_78370 = defunc_1_op_res_78372;\n                        }\n                    }\n                }\n                // write final result\n                {\n                    if (!no_carry_in_78383) {\n                        ((__local\n                          int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)] =\n                            x_78370;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // restore correct values for first block\n            {\n                if (squot32(local_tid_78361, 32) == 0 && ltid_in_bounds_78376) {\n                    ((__local\n                      int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)] =\n                        x_78371;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // threads in bounds write partial scan result\n            {\n                if ",
                   "(slt64(gtid_67882, m_65377) && slt64(gtid_67883, n_65378)) {\n                    int64_t tmp_78385;\n                    \n                    tmp_78385 = ((__local\n                                  int64_t *) scan_arr_mem_78365)[sext_i32_i64(local_tid_78361)];\n                    ((__global int64_t *) mem_77116)[gtid_67882 * n_65378 +\n                                                     gtid_67883] = tmp_78385;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // first thread reads last element as carry-in for next iteration\n            {\n                bool crosses_segment_78386 = slt64(srem64(chunk_offset_78368 +\n                                                          segscan_group_sizze_67878,\n                                                          n_65378),\n                                                   chunk_offset_78368 +\n                                                   segscan_group_sizze_67878 -\n                                                   (chunk_offset_78368 +\n                                                    segscan_group_sizze_67878 -\n                                                    (int64_t) 1));\n                bool should_load_carry_78387 = local_tid_78361 == 0 &&\n                     !crosses_segment_78386;\n                \n                if (should_load_carry_78387) {\n                    x_67885 = ((__local\n                                int64_t *) scan_arr_mem_78365)[segscan_group_sizze_67878 -\n                                                               (int64_t) 1];\n                }\n                if (!should_load_carry_78387) {\n                    x_67885 = (int64_t) 0;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    \n  error_1:\n    return;\n    #undef segscan_group_sizze_67878\n}\n__kernel void mainziscan_stage1_69675(__global int *global_failure,\n                                      __local volatile\n                                      in",
                   "t64_t *scan_arr_mem_78730_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int32_t num_threads_78724, __global\n                                      unsigned char *Y_mem_77010, __global\n                                      unsigned char *mem_77350)\n{\n    #define segscan_group_sizze_69669 (mainzisegscan_group_sizze_69649)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_78730_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_78730_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78725;\n    int32_t local_tid_78726;\n    int64_t group_sizze_78729;\n    int32_t wave_sizze_78728;\n    int32_t group_tid_78727;\n    \n    global_tid_78725 = get_global_id(0);\n    local_tid_78726 = get_local_id(0);\n    group_sizze_78729 = get_local_size(0);\n    wave_sizze_78728 = LOCKSTEP_WIDTH;\n    group_tid_78727 = get_group_id(0);\n    \n    int32_t phys_tid_69675 = global_tid_78725;\n    __local unsigned char *scan_arr_mem_78730;\n    \n    scan_arr_mem_78730 = (__local unsigned char *) scan_arr_mem_78730_backing_0;\n    \n    int64_t x_69676;\n    int64_t x_69677;\n    \n    x_69676 = (int64_t) 0;\n    for (int64_t j_78732 = 0; j_78732 < sdiv_up64(m_65377 * n_65378,\n                                                  sext_i32_i64(num_threads_78724));\n         j_78732++) {\n        int64_t chunk_offset_78733 = segscan_group_sizze_69669 * j_78732 +\n                sext_i32_i64(group_tid_78727) * (segscan_group_sizze_69669 *\n                                                 sdiv_up64(m_65377 * n_65378,\n                                                           sext_i32_i64(num_threads_78724)));\n        int64_t flat_idx_78734 = chunk_offset_78733 +\n                sext_i32_i64(local_tid_78726);\n      ",
                   "  int64_t gtid_69673 = squot64(flat_idx_78734, n_65378);\n        int64_t gtid_69674 = flat_idx_78734 - squot64(flat_idx_78734, n_65378) *\n                n_65378;\n        \n        // threads in bounds read input\n        {\n            if (slt64(gtid_69673, m_65377) && slt64(gtid_69674, n_65378)) {\n                double x_69680;\n                \n                x_69680 = ((__global double *) Y_mem_77010)[gtid_69673 *\n                                                            n_65378 +\n                                                            gtid_69674];\n                \n                bool isnan_res_69681;\n                \n                isnan_res_69681 = futrts_isnan64(x_69680);\n                \n                bool defunc_0_p_res_69682 = !isnan_res_69681;\n                int64_t defunc_0_f_res_69683 =\n                        btoi_bool_i64(defunc_0_p_res_69682);\n                \n                // write to-scan values to parameters\n                {\n                    x_69677 = defunc_0_f_res_69683;\n                }\n                // write mapped values results to global memory\n                { }\n            }\n        }\n        // do one intra-group scan operation\n        {\n            // maybe restore some to-scan values to parameters, or read neutral\n            {\n                if (!(slt64(gtid_69673, m_65377) && slt64(gtid_69674,\n                                                          n_65378))) {\n                    x_69677 = (int64_t) 0;\n                }\n            }\n            // combine with carry and write to local memory\n            {\n                int64_t defunc_1_op_res_69678 = add64(x_69676, x_69677);\n                \n                ((__local\n                  int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)] =\n                    defunc_1_op_res_69678;\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            int64_t x_78735;\n            int64_t x_78736;\n            int64_t x_78738;\n            int6",
                   "4_t x_78739;\n            bool ltid_in_bounds_78741 = slt64(sext_i32_i64(local_tid_78726),\n                                              segscan_group_sizze_69669);\n            int32_t skip_threads_78742;\n            \n            // read input for in-block scan\n            {\n                if (ltid_in_bounds_78741) {\n                    x_78736 = ((volatile __local\n                                int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)];\n                    if ((local_tid_78726 - squot32(local_tid_78726, 32) * 32) ==\n                        0) {\n                        x_78735 = x_78736;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_78742 = 1;\n                while (slt32(skip_threads_78742, 32)) {\n                    bool thread_active_78743 = sle32(skip_threads_78742,\n                                                     local_tid_78726 -\n                                                     squot32(local_tid_78726,\n                                                             32) * 32) &&\n                         ltid_in_bounds_78741;\n                    \n                    if (thread_active_78743) {\n                        // read operands\n                        {\n                            x_78735 = ((volatile __local\n                                        int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726) -\n                                                                       sext_i32_i64(skip_threads_78742)];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78744 =\n                             slt64(srem64(sext_i32_i64(local_tid_78726) +\n                                          chunk_offset_78733, n_65378),\n                                   sext_i32_i64(local_tid_78726) +\n                                   chunk_offse",
                   "t_78733 -\n                                   (sext_i32_i64(local_tid_78726 -\n                                    skip_threads_78742) + chunk_offset_78733));\n                        \n                        if (thread_active_78743 && inactive_78744) {\n                            x_78735 = x_78736;\n                        }\n                        if (thread_active_78743) {\n                            if (!inactive_78744) {\n                                int64_t defunc_1_op_res_78737 = add64(x_78735,\n                                                                      x_78736);\n                                \n                                x_78735 = defunc_1_op_res_78737;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_78728, skip_threads_78742)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_78743) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)] =\n                                x_78735;\n                            x_78736 = x_78735;\n                        }\n                    }\n                    if (sle32(wave_sizze_78728, skip_threads_78742)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_78742 *= 2;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // last thread of block 'i' writes its result to offset 'i'\n            {\n                if ((local_tid_78726 - squot32(local_tid_78726, 32) * 32) ==\n                    31 && ltid_in_bounds_78741) {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_78730)[sext_i32_i64(squot32(local_tid_78726,\n                                                                          32))] =\n           ",
                   "             x_78735;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n            {\n                int32_t skip_threads_78745;\n                \n                // read input for in-block scan\n                {\n                    if (squot32(local_tid_78726, 32) == 0 &&\n                        ltid_in_bounds_78741) {\n                        x_78739 = ((volatile __local\n                                    int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)];\n                        if ((local_tid_78726 - squot32(local_tid_78726, 32) *\n                             32) == 0) {\n                            x_78738 = x_78739;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_78745 = 1;\n                    while (slt32(skip_threads_78745, 32)) {\n                        bool thread_active_78746 = sle32(skip_threads_78745,\n                                                         local_tid_78726 -\n                                                         squot32(local_tid_78726,\n                                                                 32) * 32) &&\n                             (squot32(local_tid_78726, 32) == 0 &&\n                              ltid_in_bounds_78741);\n                        \n                        if (thread_active_78746) {\n                            // read operands\n                            {\n                                x_78738 = ((volatile __local\n                                            int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726) -\n                                                                           sext_i32_i64(skip_threads_78745)];\n                            }\n                        }\n                        // perform operation\n                        {\n  ",
                   "                          bool inactive_78747 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78726 *\n                                              32 + 32 - 1) + chunk_offset_78733,\n                                              n_65378),\n                                       sext_i32_i64(local_tid_78726 * 32 + 32 -\n                                       1) + chunk_offset_78733 -\n                                       (sext_i32_i64((local_tid_78726 -\n                                                      skip_threads_78745) * 32 +\n                                        32 - 1) + chunk_offset_78733));\n                            \n                            if (thread_active_78746 && inactive_78747) {\n                                x_78738 = x_78739;\n                            }\n                            if (thread_active_78746) {\n                                if (!inactive_78747) {\n                                    int64_t defunc_1_op_res_78740 =\n                                            add64(x_78738, x_78739);\n                                    \n                                    x_78738 = defunc_1_op_res_78740;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_78728, skip_threads_78745)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_78746) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)] =\n                                    x_78738;\n                                x_78739 = x_78738;\n                            }\n                        }\n                        if (sle32(wave_sizze_78728, skip_threads_78745)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        ",
                   "}\n                        skip_threads_78745 *= 2;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            bool no_carry_in_78748 = squot32(local_tid_78726, 32) == 0 ||\n                 !ltid_in_bounds_78741;\n            \n            // carry-in for every block except the first\n            {\n                // read operands\n                {\n                    if (!no_carry_in_78748) {\n                        x_78736 = x_78735;\n                        x_78735 = ((__local\n                                    int64_t *) scan_arr_mem_78730)[sext_i32_i64(squot32(local_tid_78726,\n                                                                                        32)) -\n                                                                   (int64_t) 1];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_78749 =\n                         slt64(srem64(sext_i32_i64(local_tid_78726) +\n                                      chunk_offset_78733, n_65378),\n                               sext_i32_i64(local_tid_78726) +\n                               chunk_offset_78733 -\n                               (sext_i32_i64(squot32(local_tid_78726, 32) * 32 -\n                                1) + chunk_offset_78733));\n                    \n                    if (!no_carry_in_78748) {\n                        if (inactive_78749) {\n                            x_78735 = x_78736;\n                        }\n                    }\n                    if (!no_carry_in_78748) {\n                        if (!inactive_78749) {\n                            int64_t defunc_1_op_res_78737 = add64(x_78735,\n                                                                  x_78736);\n                            \n                            x_78735 = defunc_1_op_res_78737;\n                        }\n                    }\n                }\n                // write final result\n ",
                   "               {\n                    if (!no_carry_in_78748) {\n                        ((__local\n                          int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)] =\n                            x_78735;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // restore correct values for first block\n            {\n                if (squot32(local_tid_78726, 32) == 0 && ltid_in_bounds_78741) {\n                    ((__local\n                      int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)] =\n                        x_78736;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // threads in bounds write partial scan result\n            {\n                if (slt64(gtid_69673, m_65377) && slt64(gtid_69674, n_65378)) {\n                    int64_t tmp_78750;\n                    \n                    tmp_78750 = ((__local\n                                  int64_t *) scan_arr_mem_78730)[sext_i32_i64(local_tid_78726)];\n                    ((__global int64_t *) mem_77350)[gtid_69673 * n_65378 +\n                                                     gtid_69674] = tmp_78750;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // first thread reads last element as carry-in for next iteration\n            {\n                bool crosses_segment_78751 = slt64(srem64(chunk_offset_78733 +\n                                                          segscan_group_sizze_69669,\n                                                          n_65378),\n                                                   chunk_offset_78733 +\n                                                   segscan_group_sizze_69669 -\n                                                   (chunk_offset_78733 +\n                                                    segscan_group_sizze_69669 -\n                                                    (int64_t) 1));\n                bool should_load_",
                   "carry_78752 = local_tid_78726 == 0 &&\n                     !crosses_segment_78751;\n                \n                if (should_load_carry_78752) {\n                    x_69676 = ((__local\n                                int64_t *) scan_arr_mem_78730)[segscan_group_sizze_69669 -\n                                                               (int64_t) 1];\n                }\n                if (!should_load_carry_78752) {\n                    x_69676 = (int64_t) 0;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    \n  error_1:\n    return;\n    #undef segscan_group_sizze_69669\n}\n__kernel void mainziscan_stage1_71714(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79147_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int32_t num_threads_79141, __global\n                                      unsigned char *Y_mem_77010, __global\n                                      unsigned char *mem_77642)\n{\n    #define segscan_group_sizze_71708 (mainzisegscan_group_sizze_71688)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79147_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79147_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79142;\n    int32_t local_tid_79143;\n    int64_t group_sizze_79146;\n    int32_t wave_sizze_79145;\n    int32_t group_tid_79144;\n    \n    global_tid_79142 = get_global_id(0);\n    local_tid_79143 = get_local_id(0);\n    group_sizze_79146 = get_local_size(0);\n    wave_sizze_79145 = LOCKSTEP_WIDTH;\n    group_tid_79144 = get_group_id(0);\n    \n    int32_t phys_tid_71714 = global_tid_79142;\n    __local unsigned char *scan_ar",
                   "r_mem_79147;\n    \n    scan_arr_mem_79147 = (__local unsigned char *) scan_arr_mem_79147_backing_0;\n    \n    int64_t x_71715;\n    int64_t x_71716;\n    \n    x_71715 = (int64_t) 0;\n    for (int64_t j_79149 = 0; j_79149 < sdiv_up64(m_65377 * n_65378,\n                                                  sext_i32_i64(num_threads_79141));\n         j_79149++) {\n        int64_t chunk_offset_79150 = segscan_group_sizze_71708 * j_79149 +\n                sext_i32_i64(group_tid_79144) * (segscan_group_sizze_71708 *\n                                                 sdiv_up64(m_65377 * n_65378,\n                                                           sext_i32_i64(num_threads_79141)));\n        int64_t flat_idx_79151 = chunk_offset_79150 +\n                sext_i32_i64(local_tid_79143);\n        int64_t gtid_71712 = squot64(flat_idx_79151, n_65378);\n        int64_t gtid_71713 = flat_idx_79151 - squot64(flat_idx_79151, n_65378) *\n                n_65378;\n        \n        // threads in bounds read input\n        {\n            if (slt64(gtid_71712, m_65377) && slt64(gtid_71713, n_65378)) {\n                double x_71719;\n                \n                x_71719 = ((__global double *) Y_mem_77010)[gtid_71712 *\n                                                            n_65378 +\n                                                            gtid_71713];\n                \n                bool isnan_res_71720;\n                \n                isnan_res_71720 = futrts_isnan64(x_71719);\n                \n                bool defunc_0_p_res_71721 = !isnan_res_71720;\n                int64_t defunc_0_f_res_71722 =\n                        btoi_bool_i64(defunc_0_p_res_71721);\n                \n                // write to-scan values to parameters\n                {\n                    x_71716 = defunc_0_f_res_71722;\n                }\n                // write mapped values results to global memory\n                { }\n            }\n        }\n        // do one intra-group scan operation\n        {\n            /",
                   "/ maybe restore some to-scan values to parameters, or read neutral\n            {\n                if (!(slt64(gtid_71712, m_65377) && slt64(gtid_71713,\n                                                          n_65378))) {\n                    x_71716 = (int64_t) 0;\n                }\n            }\n            // combine with carry and write to local memory\n            {\n                int64_t defunc_1_op_res_71717 = add64(x_71715, x_71716);\n                \n                ((__local\n                  int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)] =\n                    defunc_1_op_res_71717;\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            int64_t x_79152;\n            int64_t x_79153;\n            int64_t x_79155;\n            int64_t x_79156;\n            bool ltid_in_bounds_79158 = slt64(sext_i32_i64(local_tid_79143),\n                                              segscan_group_sizze_71708);\n            int32_t skip_threads_79159;\n            \n            // read input for in-block scan\n            {\n                if (ltid_in_bounds_79158) {\n                    x_79153 = ((volatile __local\n                                int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)];\n                    if ((local_tid_79143 - squot32(local_tid_79143, 32) * 32) ==\n                        0) {\n                        x_79152 = x_79153;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_79159 = 1;\n                while (slt32(skip_threads_79159, 32)) {\n                    bool thread_active_79160 = sle32(skip_threads_79159,\n                                                     local_tid_79143 -\n                                                     squot32(local_tid_79143,\n                                                             32) * 32) &&\n                         ltid_in_bounds_79158;\n                    \n            ",
                   "        if (thread_active_79160) {\n                        // read operands\n                        {\n                            x_79152 = ((volatile __local\n                                        int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143) -\n                                                                       sext_i32_i64(skip_threads_79159)];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79161 =\n                             slt64(srem64(sext_i32_i64(local_tid_79143) +\n                                          chunk_offset_79150, n_65378),\n                                   sext_i32_i64(local_tid_79143) +\n                                   chunk_offset_79150 -\n                                   (sext_i32_i64(local_tid_79143 -\n                                    skip_threads_79159) + chunk_offset_79150));\n                        \n                        if (thread_active_79160 && inactive_79161) {\n                            x_79152 = x_79153;\n                        }\n                        if (thread_active_79160) {\n                            if (!inactive_79161) {\n                                int64_t defunc_1_op_res_79154 = add64(x_79152,\n                                                                      x_79153);\n                                \n                                x_79152 = defunc_1_op_res_79154;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_79145, skip_threads_79159)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_79160) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)] =\n                                x_79152;\n             ",
                   "               x_79153 = x_79152;\n                        }\n                    }\n                    if (sle32(wave_sizze_79145, skip_threads_79159)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_79159 *= 2;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // last thread of block 'i' writes its result to offset 'i'\n            {\n                if ((local_tid_79143 - squot32(local_tid_79143, 32) * 32) ==\n                    31 && ltid_in_bounds_79158) {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79147)[sext_i32_i64(squot32(local_tid_79143,\n                                                                          32))] =\n                        x_79152;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n            {\n                int32_t skip_threads_79162;\n                \n                // read input for in-block scan\n                {\n                    if (squot32(local_tid_79143, 32) == 0 &&\n                        ltid_in_bounds_79158) {\n                        x_79156 = ((volatile __local\n                                    int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)];\n                        if ((local_tid_79143 - squot32(local_tid_79143, 32) *\n                             32) == 0) {\n                            x_79155 = x_79156;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_79162 = 1;\n                    while (slt32(skip_threads_79162, 32)) {\n                        bool thread_active_79163 = sle32(skip_threads_79162,\n                                                         local_tid_79143 -\n                                                      ",
                   "   squot32(local_tid_79143,\n                                                                 32) * 32) &&\n                             (squot32(local_tid_79143, 32) == 0 &&\n                              ltid_in_bounds_79158);\n                        \n                        if (thread_active_79163) {\n                            // read operands\n                            {\n                                x_79155 = ((volatile __local\n                                            int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143) -\n                                                                           sext_i32_i64(skip_threads_79162)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79164 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79143 *\n                                              32 + 32 - 1) + chunk_offset_79150,\n                                              n_65378),\n                                       sext_i32_i64(local_tid_79143 * 32 + 32 -\n                                       1) + chunk_offset_79150 -\n                                       (sext_i32_i64((local_tid_79143 -\n                                                      skip_threads_79162) * 32 +\n                                        32 - 1) + chunk_offset_79150));\n                            \n                            if (thread_active_79163 && inactive_79164) {\n                                x_79155 = x_79156;\n                            }\n                            if (thread_active_79163) {\n                                if (!inactive_79164) {\n                                    int64_t defunc_1_op_res_79157 =\n                                            add64(x_79155, x_79156);\n                                    \n                                    x_79155 = defunc_1_op_res_79157;\n                                }\n              ",
                   "              }\n                        }\n                        if (sle32(wave_sizze_79145, skip_threads_79162)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79163) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)] =\n                                    x_79155;\n                                x_79156 = x_79155;\n                            }\n                        }\n                        if (sle32(wave_sizze_79145, skip_threads_79162)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79162 *= 2;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            bool no_carry_in_79165 = squot32(local_tid_79143, 32) == 0 ||\n                 !ltid_in_bounds_79158;\n            \n            // carry-in for every block except the first\n            {\n                // read operands\n                {\n                    if (!no_carry_in_79165) {\n                        x_79153 = x_79152;\n                        x_79152 = ((__local\n                                    int64_t *) scan_arr_mem_79147)[sext_i32_i64(squot32(local_tid_79143,\n                                                                                        32)) -\n                                                                   (int64_t) 1];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79166 =\n                         slt64(srem64(sext_i32_i64(local_tid_79143) +\n                                      chunk_offset_79150, n_65378),\n                               sext_i32_i64(local_tid_79143) +\n                               chunk_offset_79150 -\n   ",
                   "                            (sext_i32_i64(squot32(local_tid_79143, 32) * 32 -\n                                1) + chunk_offset_79150));\n                    \n                    if (!no_carry_in_79165) {\n                        if (inactive_79166) {\n                            x_79152 = x_79153;\n                        }\n                    }\n                    if (!no_carry_in_79165) {\n                        if (!inactive_79166) {\n                            int64_t defunc_1_op_res_79154 = add64(x_79152,\n                                                                  x_79153);\n                            \n                            x_79152 = defunc_1_op_res_79154;\n                        }\n                    }\n                }\n                // write final result\n                {\n                    if (!no_carry_in_79165) {\n                        ((__local\n                          int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)] =\n                            x_79152;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // restore correct values for first block\n            {\n                if (squot32(local_tid_79143, 32) == 0 && ltid_in_bounds_79158) {\n                    ((__local\n                      int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)] =\n                        x_79153;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // threads in bounds write partial scan result\n            {\n                if (slt64(gtid_71712, m_65377) && slt64(gtid_71713, n_65378)) {\n                    int64_t tmp_79167;\n                    \n                    tmp_79167 = ((__local\n                                  int64_t *) scan_arr_mem_79147)[sext_i32_i64(local_tid_79143)];\n                    ((__global int64_t *) mem_77642)[gtid_71712 * n_65378 +\n                                                     gtid_71713] = tmp_79167;\n                }\n",
                   "            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // first thread reads last element as carry-in for next iteration\n            {\n                bool crosses_segment_79168 = slt64(srem64(chunk_offset_79150 +\n                                                          segscan_group_sizze_71708,\n                                                          n_65378),\n                                                   chunk_offset_79150 +\n                                                   segscan_group_sizze_71708 -\n                                                   (chunk_offset_79150 +\n                                                    segscan_group_sizze_71708 -\n                                                    (int64_t) 1));\n                bool should_load_carry_79169 = local_tid_79143 == 0 &&\n                     !crosses_segment_79168;\n                \n                if (should_load_carry_79169) {\n                    x_71715 = ((__local\n                                int64_t *) scan_arr_mem_79147)[segscan_group_sizze_71708 -\n                                                               (int64_t) 1];\n                }\n                if (!should_load_carry_79169) {\n                    x_71715 = (int64_t) 0;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    \n  error_1:\n    return;\n    #undef segscan_group_sizze_71708\n}\n__kernel void mainziscan_stage1_72699(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79564_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int32_t num_threads_79558, __global\n                                      unsigned char *Y_mem_77010, __global\n                                      unsigned char *mem_77867)\n{\n    #define segscan_group_sizze_72693 (mainzisegscan_group_sizze_72673)\n    \n    const int block_dim",
                   "0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79564_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79564_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79559;\n    int32_t local_tid_79560;\n    int64_t group_sizze_79563;\n    int32_t wave_sizze_79562;\n    int32_t group_tid_79561;\n    \n    global_tid_79559 = get_global_id(0);\n    local_tid_79560 = get_local_id(0);\n    group_sizze_79563 = get_local_size(0);\n    wave_sizze_79562 = LOCKSTEP_WIDTH;\n    group_tid_79561 = get_group_id(0);\n    \n    int32_t phys_tid_72699 = global_tid_79559;\n    __local unsigned char *scan_arr_mem_79564;\n    \n    scan_arr_mem_79564 = (__local unsigned char *) scan_arr_mem_79564_backing_0;\n    \n    int64_t x_72700;\n    int64_t x_72701;\n    \n    x_72700 = (int64_t) 0;\n    for (int64_t j_79566 = 0; j_79566 < sdiv_up64(m_65377 * n_65378,\n                                                  sext_i32_i64(num_threads_79558));\n         j_79566++) {\n        int64_t chunk_offset_79567 = segscan_group_sizze_72693 * j_79566 +\n                sext_i32_i64(group_tid_79561) * (segscan_group_sizze_72693 *\n                                                 sdiv_up64(m_65377 * n_65378,\n                                                           sext_i32_i64(num_threads_79558)));\n        int64_t flat_idx_79568 = chunk_offset_79567 +\n                sext_i32_i64(local_tid_79560);\n        int64_t gtid_72697 = squot64(flat_idx_79568, n_65378);\n        int64_t gtid_72698 = flat_idx_79568 - squot64(flat_idx_79568, n_65378) *\n                n_65378;\n        \n        // threads in bounds read input\n        {\n            if (slt64(gtid_72697, m_65377) && slt64(gtid_72698, n_65378)) {\n                double x_72704;\n                \n                x_72704 = ((__global double *) Y_mem_77010)[gtid_72697 *\n            ",
                   "                                                n_65378 +\n                                                            gtid_72698];\n                \n                bool isnan_res_72705;\n                \n                isnan_res_72705 = futrts_isnan64(x_72704);\n                \n                bool defunc_0_p_res_72706 = !isnan_res_72705;\n                int64_t defunc_0_f_res_72707 =\n                        btoi_bool_i64(defunc_0_p_res_72706);\n                \n                // write to-scan values to parameters\n                {\n                    x_72701 = defunc_0_f_res_72707;\n                }\n                // write mapped values results to global memory\n                { }\n            }\n        }\n        // do one intra-group scan operation\n        {\n            // maybe restore some to-scan values to parameters, or read neutral\n            {\n                if (!(slt64(gtid_72697, m_65377) && slt64(gtid_72698,\n                                                          n_65378))) {\n                    x_72701 = (int64_t) 0;\n                }\n            }\n            // combine with carry and write to local memory\n            {\n                int64_t defunc_1_op_res_72702 = add64(x_72700, x_72701);\n                \n                ((__local\n                  int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560)] =\n                    defunc_1_op_res_72702;\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            int64_t x_79569;\n            int64_t x_79570;\n            int64_t x_79572;\n            int64_t x_79573;\n            bool ltid_in_bounds_79575 = slt64(sext_i32_i64(local_tid_79560),\n                                              segscan_group_sizze_72693);\n            int32_t skip_threads_79576;\n            \n            // read input for in-block scan\n            {\n                if (ltid_in_bounds_79575) {\n                    x_79570 = ((volatile __local\n                                int64_t *) scan_arr_mem_79564)[s",
                   "ext_i32_i64(local_tid_79560)];\n                    if ((local_tid_79560 - squot32(local_tid_79560, 32) * 32) ==\n                        0) {\n                        x_79569 = x_79570;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_79576 = 1;\n                while (slt32(skip_threads_79576, 32)) {\n                    bool thread_active_79577 = sle32(skip_threads_79576,\n                                                     local_tid_79560 -\n                                                     squot32(local_tid_79560,\n                                                             32) * 32) &&\n                         ltid_in_bounds_79575;\n                    \n                    if (thread_active_79577) {\n                        // read operands\n                        {\n                            x_79569 = ((volatile __local\n                                        int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560) -\n                                                                       sext_i32_i64(skip_threads_79576)];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79578 =\n                             slt64(srem64(sext_i32_i64(local_tid_79560) +\n                                          chunk_offset_79567, n_65378),\n                                   sext_i32_i64(local_tid_79560) +\n                                   chunk_offset_79567 -\n                                   (sext_i32_i64(local_tid_79560 -\n                                    skip_threads_79576) + chunk_offset_79567));\n                        \n                        if (thread_active_79577 && inactive_79578) {\n                            x_79569 = x_79570;\n                        }\n                        if (thread_active_79577) {\n                            if (!inactive_79578) {\n      ",
                   "                          int64_t defunc_1_op_res_79571 = add64(x_79569,\n                                                                      x_79570);\n                                \n                                x_79569 = defunc_1_op_res_79571;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_79562, skip_threads_79576)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_79577) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560)] =\n                                x_79569;\n                            x_79570 = x_79569;\n                        }\n                    }\n                    if (sle32(wave_sizze_79562, skip_threads_79576)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_79576 *= 2;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // last thread of block 'i' writes its result to offset 'i'\n            {\n                if ((local_tid_79560 - squot32(local_tid_79560, 32) * 32) ==\n                    31 && ltid_in_bounds_79575) {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79564)[sext_i32_i64(squot32(local_tid_79560,\n                                                                          32))] =\n                        x_79569;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n            {\n                int32_t skip_threads_79579;\n                \n                // read input for in-block scan\n                {\n                    if (squot32(local_tid_79560, 32) == 0 &&\n                        ltid_in_bounds_7",
                   "9575) {\n                        x_79573 = ((volatile __local\n                                    int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560)];\n                        if ((local_tid_79560 - squot32(local_tid_79560, 32) *\n                             32) == 0) {\n                            x_79572 = x_79573;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_79579 = 1;\n                    while (slt32(skip_threads_79579, 32)) {\n                        bool thread_active_79580 = sle32(skip_threads_79579,\n                                                         local_tid_79560 -\n                                                         squot32(local_tid_79560,\n                                                                 32) * 32) &&\n                             (squot32(local_tid_79560, 32) == 0 &&\n                              ltid_in_bounds_79575);\n                        \n                        if (thread_active_79580) {\n                            // read operands\n                            {\n                                x_79572 = ((volatile __local\n                                            int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560) -\n                                                                           sext_i32_i64(skip_threads_79579)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79581 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79560 *\n                                              32 + 32 - 1) + chunk_offset_79567,\n                                              n_65378),\n                                       sext_i32_i64(local_tid_79560 * 32 + 32 -\n                                       1) + chunk_offset_79567 -\n                         ",
                   "              (sext_i32_i64((local_tid_79560 -\n                                                      skip_threads_79579) * 32 +\n                                        32 - 1) + chunk_offset_79567));\n                            \n                            if (thread_active_79580 && inactive_79581) {\n                                x_79572 = x_79573;\n                            }\n                            if (thread_active_79580) {\n                                if (!inactive_79581) {\n                                    int64_t defunc_1_op_res_79574 =\n                                            add64(x_79572, x_79573);\n                                    \n                                    x_79572 = defunc_1_op_res_79574;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_79562, skip_threads_79579)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79580) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560)] =\n                                    x_79572;\n                                x_79573 = x_79572;\n                            }\n                        }\n                        if (sle32(wave_sizze_79562, skip_threads_79579)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79579 *= 2;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            bool no_carry_in_79582 = squot32(local_tid_79560, 32) == 0 ||\n                 !ltid_in_bounds_79575;\n            \n            // carry-in for every block except the first\n            {\n                // read operands\n                {\n                    if ",
                   "(!no_carry_in_79582) {\n                        x_79570 = x_79569;\n                        x_79569 = ((__local\n                                    int64_t *) scan_arr_mem_79564)[sext_i32_i64(squot32(local_tid_79560,\n                                                                                        32)) -\n                                                                   (int64_t) 1];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79583 =\n                         slt64(srem64(sext_i32_i64(local_tid_79560) +\n                                      chunk_offset_79567, n_65378),\n                               sext_i32_i64(local_tid_79560) +\n                               chunk_offset_79567 -\n                               (sext_i32_i64(squot32(local_tid_79560, 32) * 32 -\n                                1) + chunk_offset_79567));\n                    \n                    if (!no_carry_in_79582) {\n                        if (inactive_79583) {\n                            x_79569 = x_79570;\n                        }\n                    }\n                    if (!no_carry_in_79582) {\n                        if (!inactive_79583) {\n                            int64_t defunc_1_op_res_79571 = add64(x_79569,\n                                                                  x_79570);\n                            \n                            x_79569 = defunc_1_op_res_79571;\n                        }\n                    }\n                }\n                // write final result\n                {\n                    if (!no_carry_in_79582) {\n                        ((__local\n                          int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560)] =\n                            x_79569;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // restore correct values for first block\n            {\n                if (squot32(local_tid_79560,",
                   " 32) == 0 && ltid_in_bounds_79575) {\n                    ((__local\n                      int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560)] =\n                        x_79570;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // threads in bounds write partial scan result\n            {\n                if (slt64(gtid_72697, m_65377) && slt64(gtid_72698, n_65378)) {\n                    int64_t tmp_79584;\n                    \n                    tmp_79584 = ((__local\n                                  int64_t *) scan_arr_mem_79564)[sext_i32_i64(local_tid_79560)];\n                    ((__global int64_t *) mem_77867)[gtid_72697 * n_65378 +\n                                                     gtid_72698] = tmp_79584;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // first thread reads last element as carry-in for next iteration\n            {\n                bool crosses_segment_79585 = slt64(srem64(chunk_offset_79567 +\n                                                          segscan_group_sizze_72693,\n                                                          n_65378),\n                                                   chunk_offset_79567 +\n                                                   segscan_group_sizze_72693 -\n                                                   (chunk_offset_79567 +\n                                                    segscan_group_sizze_72693 -\n                                                    (int64_t) 1));\n                bool should_load_carry_79586 = local_tid_79560 == 0 &&\n                     !crosses_segment_79585;\n                \n                if (should_load_carry_79586) {\n                    x_72700 = ((__local\n                                int64_t *) scan_arr_mem_79564)[segscan_group_sizze_72693 -\n                                                               (int64_t) 1];\n                }\n                if (!should_load_carry_79586) {\n           ",
                   "         x_72700 = (int64_t) 0;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    \n  error_1:\n    return;\n    #undef segscan_group_sizze_72693\n}\n__kernel void mainziscan_stage1_73366(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79695_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int32_t num_threads_79689, __global\n                                      unsigned char *Y_mem_77010, __global\n                                      unsigned char *mem_77914)\n{\n    #define segscan_group_sizze_73360 (mainzisegscan_group_sizze_73340)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79695_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79695_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79690;\n    int32_t local_tid_79691;\n    int64_t group_sizze_79694;\n    int32_t wave_sizze_79693;\n    int32_t group_tid_79692;\n    \n    global_tid_79690 = get_global_id(0);\n    local_tid_79691 = get_local_id(0);\n    group_sizze_79694 = get_local_size(0);\n    wave_sizze_79693 = LOCKSTEP_WIDTH;\n    group_tid_79692 = get_group_id(0);\n    \n    int32_t phys_tid_73366 = global_tid_79690;\n    __local unsigned char *scan_arr_mem_79695;\n    \n    scan_arr_mem_79695 = (__local unsigned char *) scan_arr_mem_79695_backing_0;\n    \n    int64_t x_73367;\n    int64_t x_73368;\n    \n    x_73367 = (int64_t) 0;\n    for (int64_t j_79697 = 0; j_79697 < sdiv_up64(m_65377 * n_65378,\n                                                  sext_i32_i64(num_threads_79689));\n         j_79697++) {\n        int64_t chunk_offset_79698 = segscan_group_sizze_73360 * j_79697 +\n    ",
                   "            sext_i32_i64(group_tid_79692) * (segscan_group_sizze_73360 *\n                                                 sdiv_up64(m_65377 * n_65378,\n                                                           sext_i32_i64(num_threads_79689)));\n        int64_t flat_idx_79699 = chunk_offset_79698 +\n                sext_i32_i64(local_tid_79691);\n        int64_t gtid_73364 = squot64(flat_idx_79699, n_65378);\n        int64_t gtid_73365 = flat_idx_79699 - squot64(flat_idx_79699, n_65378) *\n                n_65378;\n        \n        // threads in bounds read input\n        {\n            if (slt64(gtid_73364, m_65377) && slt64(gtid_73365, n_65378)) {\n                double x_73371;\n                \n                x_73371 = ((__global double *) Y_mem_77010)[gtid_73364 *\n                                                            n_65378 +\n                                                            gtid_73365];\n                \n                bool isnan_res_73372;\n                \n                isnan_res_73372 = futrts_isnan64(x_73371);\n                \n                bool defunc_0_p_res_73373 = !isnan_res_73372;\n                int64_t defunc_0_f_res_73374 =\n                        btoi_bool_i64(defunc_0_p_res_73373);\n                \n                // write to-scan values to parameters\n                {\n                    x_73368 = defunc_0_f_res_73374;\n                }\n                // write mapped values results to global memory\n                { }\n            }\n        }\n        // do one intra-group scan operation\n        {\n            // maybe restore some to-scan values to parameters, or read neutral\n            {\n                if (!(slt64(gtid_73364, m_65377) && slt64(gtid_73365,\n                                                          n_65378))) {\n                    x_73368 = (int64_t) 0;\n                }\n            }\n            // combine with carry and write to local memory\n            {\n                int64_t defunc_1_op_res_73369 = add64(x_73367",
                   ", x_73368);\n                \n                ((__local\n                  int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691)] =\n                    defunc_1_op_res_73369;\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            int64_t x_79700;\n            int64_t x_79701;\n            int64_t x_79703;\n            int64_t x_79704;\n            bool ltid_in_bounds_79706 = slt64(sext_i32_i64(local_tid_79691),\n                                              segscan_group_sizze_73360);\n            int32_t skip_threads_79707;\n            \n            // read input for in-block scan\n            {\n                if (ltid_in_bounds_79706) {\n                    x_79701 = ((volatile __local\n                                int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691)];\n                    if ((local_tid_79691 - squot32(local_tid_79691, 32) * 32) ==\n                        0) {\n                        x_79700 = x_79701;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_79707 = 1;\n                while (slt32(skip_threads_79707, 32)) {\n                    bool thread_active_79708 = sle32(skip_threads_79707,\n                                                     local_tid_79691 -\n                                                     squot32(local_tid_79691,\n                                                             32) * 32) &&\n                         ltid_in_bounds_79706;\n                    \n                    if (thread_active_79708) {\n                        // read operands\n                        {\n                            x_79700 = ((volatile __local\n                                        int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691) -\n                                                                       sext_i32_i64(skip_threads_79707)];\n                        }\n                    }\n                ",
                   "    // perform operation\n                    {\n                        bool inactive_79709 =\n                             slt64(srem64(sext_i32_i64(local_tid_79691) +\n                                          chunk_offset_79698, n_65378),\n                                   sext_i32_i64(local_tid_79691) +\n                                   chunk_offset_79698 -\n                                   (sext_i32_i64(local_tid_79691 -\n                                    skip_threads_79707) + chunk_offset_79698));\n                        \n                        if (thread_active_79708 && inactive_79709) {\n                            x_79700 = x_79701;\n                        }\n                        if (thread_active_79708) {\n                            if (!inactive_79709) {\n                                int64_t defunc_1_op_res_79702 = add64(x_79700,\n                                                                      x_79701);\n                                \n                                x_79700 = defunc_1_op_res_79702;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_79693, skip_threads_79707)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_79708) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691)] =\n                                x_79700;\n                            x_79701 = x_79700;\n                        }\n                    }\n                    if (sle32(wave_sizze_79693, skip_threads_79707)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_79707 *= 2;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // last thread of block 'i' writes its result to offset 'i'\n            ",
                   "{\n                if ((local_tid_79691 - squot32(local_tid_79691, 32) * 32) ==\n                    31 && ltid_in_bounds_79706) {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79695)[sext_i32_i64(squot32(local_tid_79691,\n                                                                          32))] =\n                        x_79700;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n            {\n                int32_t skip_threads_79710;\n                \n                // read input for in-block scan\n                {\n                    if (squot32(local_tid_79691, 32) == 0 &&\n                        ltid_in_bounds_79706) {\n                        x_79704 = ((volatile __local\n                                    int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691)];\n                        if ((local_tid_79691 - squot32(local_tid_79691, 32) *\n                             32) == 0) {\n                            x_79703 = x_79704;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_79710 = 1;\n                    while (slt32(skip_threads_79710, 32)) {\n                        bool thread_active_79711 = sle32(skip_threads_79710,\n                                                         local_tid_79691 -\n                                                         squot32(local_tid_79691,\n                                                                 32) * 32) &&\n                             (squot32(local_tid_79691, 32) == 0 &&\n                              ltid_in_bounds_79706);\n                        \n                        if (thread_active_79711) {\n                            // read operands\n                            {\n                                x_79703 = ((volatile __",
                   "local\n                                            int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691) -\n                                                                           sext_i32_i64(skip_threads_79710)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79712 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79691 *\n                                              32 + 32 - 1) + chunk_offset_79698,\n                                              n_65378),\n                                       sext_i32_i64(local_tid_79691 * 32 + 32 -\n                                       1) + chunk_offset_79698 -\n                                       (sext_i32_i64((local_tid_79691 -\n                                                      skip_threads_79710) * 32 +\n                                        32 - 1) + chunk_offset_79698));\n                            \n                            if (thread_active_79711 && inactive_79712) {\n                                x_79703 = x_79704;\n                            }\n                            if (thread_active_79711) {\n                                if (!inactive_79712) {\n                                    int64_t defunc_1_op_res_79705 =\n                                            add64(x_79703, x_79704);\n                                    \n                                    x_79703 = defunc_1_op_res_79705;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_79693, skip_threads_79710)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79711) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  int64_t *) scan_arr_m",
                   "em_79695)[sext_i32_i64(local_tid_79691)] =\n                                    x_79703;\n                                x_79704 = x_79703;\n                            }\n                        }\n                        if (sle32(wave_sizze_79693, skip_threads_79710)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79710 *= 2;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            bool no_carry_in_79713 = squot32(local_tid_79691, 32) == 0 ||\n                 !ltid_in_bounds_79706;\n            \n            // carry-in for every block except the first\n            {\n                // read operands\n                {\n                    if (!no_carry_in_79713) {\n                        x_79701 = x_79700;\n                        x_79700 = ((__local\n                                    int64_t *) scan_arr_mem_79695)[sext_i32_i64(squot32(local_tid_79691,\n                                                                                        32)) -\n                                                                   (int64_t) 1];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79714 =\n                         slt64(srem64(sext_i32_i64(local_tid_79691) +\n                                      chunk_offset_79698, n_65378),\n                               sext_i32_i64(local_tid_79691) +\n                               chunk_offset_79698 -\n                               (sext_i32_i64(squot32(local_tid_79691, 32) * 32 -\n                                1) + chunk_offset_79698));\n                    \n                    if (!no_carry_in_79713) {\n                        if (inactive_79714) {\n                            x_79700 = x_79701;\n                        }\n                    }\n                    if (!no_carry_in_79713) {\n                        if (!inactive_797",
                   "14) {\n                            int64_t defunc_1_op_res_79702 = add64(x_79700,\n                                                                  x_79701);\n                            \n                            x_79700 = defunc_1_op_res_79702;\n                        }\n                    }\n                }\n                // write final result\n                {\n                    if (!no_carry_in_79713) {\n                        ((__local\n                          int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691)] =\n                            x_79700;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // restore correct values for first block\n            {\n                if (squot32(local_tid_79691, 32) == 0 && ltid_in_bounds_79706) {\n                    ((__local\n                      int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691)] =\n                        x_79701;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // threads in bounds write partial scan result\n            {\n                if (slt64(gtid_73364, m_65377) && slt64(gtid_73365, n_65378)) {\n                    int64_t tmp_79715;\n                    \n                    tmp_79715 = ((__local\n                                  int64_t *) scan_arr_mem_79695)[sext_i32_i64(local_tid_79691)];\n                    ((__global int64_t *) mem_77914)[gtid_73364 * n_65378 +\n                                                     gtid_73365] = tmp_79715;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // first thread reads last element as carry-in for next iteration\n            {\n                bool crosses_segment_79716 = slt64(srem64(chunk_offset_79698 +\n                                                          segscan_group_sizze_73360,\n                                                          n_65378),\n                                                   c",
                   "hunk_offset_79698 +\n                                                   segscan_group_sizze_73360 -\n                                                   (chunk_offset_79698 +\n                                                    segscan_group_sizze_73360 -\n                                                    (int64_t) 1));\n                bool should_load_carry_79717 = local_tid_79691 == 0 &&\n                     !crosses_segment_79716;\n                \n                if (should_load_carry_79717) {\n                    x_73367 = ((__local\n                                int64_t *) scan_arr_mem_79695)[segscan_group_sizze_73360 -\n                                                               (int64_t) 1];\n                }\n                if (!should_load_carry_79717) {\n                    x_73367 = (int64_t) 0;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    \n  error_1:\n    return;\n    #undef segscan_group_sizze_73360\n}\n__kernel void mainziscan_stage1_74123(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79832_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int32_t num_threads_79826, __global\n                                      unsigned char *Y_mem_77010, __global\n                                      unsigned char *mem_77968)\n{\n    #define segscan_group_sizze_74117 (mainzisegscan_group_sizze_74097)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79832_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79832_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79827;\n    int32_t local_tid_79828;\n    int64_t group_sizze_79831;",
                   "\n    int32_t wave_sizze_79830;\n    int32_t group_tid_79829;\n    \n    global_tid_79827 = get_global_id(0);\n    local_tid_79828 = get_local_id(0);\n    group_sizze_79831 = get_local_size(0);\n    wave_sizze_79830 = LOCKSTEP_WIDTH;\n    group_tid_79829 = get_group_id(0);\n    \n    int32_t phys_tid_74123 = global_tid_79827;\n    __local unsigned char *scan_arr_mem_79832;\n    \n    scan_arr_mem_79832 = (__local unsigned char *) scan_arr_mem_79832_backing_0;\n    \n    int64_t x_74124;\n    int64_t x_74125;\n    \n    x_74124 = (int64_t) 0;\n    for (int64_t j_79834 = 0; j_79834 < sdiv_up64(m_65377 * n_65378,\n                                                  sext_i32_i64(num_threads_79826));\n         j_79834++) {\n        int64_t chunk_offset_79835 = segscan_group_sizze_74117 * j_79834 +\n                sext_i32_i64(group_tid_79829) * (segscan_group_sizze_74117 *\n                                                 sdiv_up64(m_65377 * n_65378,\n                                                           sext_i32_i64(num_threads_79826)));\n        int64_t flat_idx_79836 = chunk_offset_79835 +\n                sext_i32_i64(local_tid_79828);\n        int64_t gtid_74121 = squot64(flat_idx_79836, n_65378);\n        int64_t gtid_74122 = flat_idx_79836 - squot64(flat_idx_79836, n_65378) *\n                n_65378;\n        \n        // threads in bounds read input\n        {\n            if (slt64(gtid_74121, m_65377) && slt64(gtid_74122, n_65378)) {\n                double x_74128;\n                \n                x_74128 = ((__global double *) Y_mem_77010)[gtid_74121 *\n                                                            n_65378 +\n                                                            gtid_74122];\n                \n                bool isnan_res_74129;\n                \n                isnan_res_74129 = futrts_isnan64(x_74128);\n                \n                bool defunc_0_p_res_74130 = !isnan_res_74129;\n                int64_t defunc_0_f_res_74131 =\n                        btoi_bool_i64(defunc",
                   "_0_p_res_74130);\n                \n                // write to-scan values to parameters\n                {\n                    x_74125 = defunc_0_f_res_74131;\n                }\n                // write mapped values results to global memory\n                { }\n            }\n        }\n        // do one intra-group scan operation\n        {\n            // maybe restore some to-scan values to parameters, or read neutral\n            {\n                if (!(slt64(gtid_74121, m_65377) && slt64(gtid_74122,\n                                                          n_65378))) {\n                    x_74125 = (int64_t) 0;\n                }\n            }\n            // combine with carry and write to local memory\n            {\n                int64_t defunc_1_op_res_74126 = add64(x_74124, x_74125);\n                \n                ((__local\n                  int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)] =\n                    defunc_1_op_res_74126;\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            int64_t x_79837;\n            int64_t x_79838;\n            int64_t x_79840;\n            int64_t x_79841;\n            bool ltid_in_bounds_79843 = slt64(sext_i32_i64(local_tid_79828),\n                                              segscan_group_sizze_74117);\n            int32_t skip_threads_79844;\n            \n            // read input for in-block scan\n            {\n                if (ltid_in_bounds_79843) {\n                    x_79838 = ((volatile __local\n                                int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)];\n                    if ((local_tid_79828 - squot32(local_tid_79828, 32) * 32) ==\n                        0) {\n                        x_79837 = x_79838;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_79844 = 1;\n                while (slt32(skip_threads_79844, 32)) {\n                    bool",
                   " thread_active_79845 = sle32(skip_threads_79844,\n                                                     local_tid_79828 -\n                                                     squot32(local_tid_79828,\n                                                             32) * 32) &&\n                         ltid_in_bounds_79843;\n                    \n                    if (thread_active_79845) {\n                        // read operands\n                        {\n                            x_79837 = ((volatile __local\n                                        int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828) -\n                                                                       sext_i32_i64(skip_threads_79844)];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79846 =\n                             slt64(srem64(sext_i32_i64(local_tid_79828) +\n                                          chunk_offset_79835, n_65378),\n                                   sext_i32_i64(local_tid_79828) +\n                                   chunk_offset_79835 -\n                                   (sext_i32_i64(local_tid_79828 -\n                                    skip_threads_79844) + chunk_offset_79835));\n                        \n                        if (thread_active_79845 && inactive_79846) {\n                            x_79837 = x_79838;\n                        }\n                        if (thread_active_79845) {\n                            if (!inactive_79846) {\n                                int64_t defunc_1_op_res_79839 = add64(x_79837,\n                                                                      x_79838);\n                                \n                                x_79837 = defunc_1_op_res_79839;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_79830, skip_threads_79844)) {\n                        barrier(",
                   "CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_79845) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)] =\n                                x_79837;\n                            x_79838 = x_79837;\n                        }\n                    }\n                    if (sle32(wave_sizze_79830, skip_threads_79844)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_79844 *= 2;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // last thread of block 'i' writes its result to offset 'i'\n            {\n                if ((local_tid_79828 - squot32(local_tid_79828, 32) * 32) ==\n                    31 && ltid_in_bounds_79843) {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79832)[sext_i32_i64(squot32(local_tid_79828,\n                                                                          32))] =\n                        x_79837;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n            {\n                int32_t skip_threads_79847;\n                \n                // read input for in-block scan\n                {\n                    if (squot32(local_tid_79828, 32) == 0 &&\n                        ltid_in_bounds_79843) {\n                        x_79841 = ((volatile __local\n                                    int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)];\n                        if ((local_tid_79828 - squot32(local_tid_79828, 32) *\n                             32) == 0) {\n                            x_79840 = x_79841;\n                        }\n                    }\n                }\n                // in-block scan (hopefu",
                   "lly no barriers needed)\n                {\n                    skip_threads_79847 = 1;\n                    while (slt32(skip_threads_79847, 32)) {\n                        bool thread_active_79848 = sle32(skip_threads_79847,\n                                                         local_tid_79828 -\n                                                         squot32(local_tid_79828,\n                                                                 32) * 32) &&\n                             (squot32(local_tid_79828, 32) == 0 &&\n                              ltid_in_bounds_79843);\n                        \n                        if (thread_active_79848) {\n                            // read operands\n                            {\n                                x_79840 = ((volatile __local\n                                            int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828) -\n                                                                           sext_i32_i64(skip_threads_79847)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79849 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79828 *\n                                              32 + 32 - 1) + chunk_offset_79835,\n                                              n_65378),\n                                       sext_i32_i64(local_tid_79828 * 32 + 32 -\n                                       1) + chunk_offset_79835 -\n                                       (sext_i32_i64((local_tid_79828 -\n                                                      skip_threads_79847) * 32 +\n                                        32 - 1) + chunk_offset_79835));\n                            \n                            if (thread_active_79848 && inactive_79849) {\n                                x_79840 = x_79841;\n                            }\n                            if (thread_active_798",
                   "48) {\n                                if (!inactive_79849) {\n                                    int64_t defunc_1_op_res_79842 =\n                                            add64(x_79840, x_79841);\n                                    \n                                    x_79840 = defunc_1_op_res_79842;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_79830, skip_threads_79847)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79848) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)] =\n                                    x_79840;\n                                x_79841 = x_79840;\n                            }\n                        }\n                        if (sle32(wave_sizze_79830, skip_threads_79847)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79847 *= 2;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            \n            bool no_carry_in_79850 = squot32(local_tid_79828, 32) == 0 ||\n                 !ltid_in_bounds_79843;\n            \n            // carry-in for every block except the first\n            {\n                // read operands\n                {\n                    if (!no_carry_in_79850) {\n                        x_79838 = x_79837;\n                        x_79837 = ((__local\n                                    int64_t *) scan_arr_mem_79832)[sext_i32_i64(squot32(local_tid_79828,\n                                                                                        32)) -\n                                                                   (int64_t) 1];\n                    }\n                }\n ",
                   "               // perform operation\n                {\n                    bool inactive_79851 =\n                         slt64(srem64(sext_i32_i64(local_tid_79828) +\n                                      chunk_offset_79835, n_65378),\n                               sext_i32_i64(local_tid_79828) +\n                               chunk_offset_79835 -\n                               (sext_i32_i64(squot32(local_tid_79828, 32) * 32 -\n                                1) + chunk_offset_79835));\n                    \n                    if (!no_carry_in_79850) {\n                        if (inactive_79851) {\n                            x_79837 = x_79838;\n                        }\n                    }\n                    if (!no_carry_in_79850) {\n                        if (!inactive_79851) {\n                            int64_t defunc_1_op_res_79839 = add64(x_79837,\n                                                                  x_79838);\n                            \n                            x_79837 = defunc_1_op_res_79839;\n                        }\n                    }\n                }\n                // write final result\n                {\n                    if (!no_carry_in_79850) {\n                        ((__local\n                          int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)] =\n                            x_79837;\n                    }\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // restore correct values for first block\n            {\n                if (squot32(local_tid_79828, 32) == 0 && ltid_in_bounds_79843) {\n                    ((__local\n                      int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)] =\n                        x_79838;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // threads in bounds write partial scan result\n            {\n                if (slt64(gtid_74121, m_65377) && slt64(gtid_74122, n_65378)) {\n                   ",
                   " int64_t tmp_79852;\n                    \n                    tmp_79852 = ((__local\n                                  int64_t *) scan_arr_mem_79832)[sext_i32_i64(local_tid_79828)];\n                    ((__global int64_t *) mem_77968)[gtid_74121 * n_65378 +\n                                                     gtid_74122] = tmp_79852;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n            // first thread reads last element as carry-in for next iteration\n            {\n                bool crosses_segment_79853 = slt64(srem64(chunk_offset_79835 +\n                                                          segscan_group_sizze_74117,\n                                                          n_65378),\n                                                   chunk_offset_79835 +\n                                                   segscan_group_sizze_74117 -\n                                                   (chunk_offset_79835 +\n                                                    segscan_group_sizze_74117 -\n                                                    (int64_t) 1));\n                bool should_load_carry_79854 = local_tid_79828 == 0 &&\n                     !crosses_segment_79853;\n                \n                if (should_load_carry_79854) {\n                    x_74124 = ((__local\n                                int64_t *) scan_arr_mem_79832)[segscan_group_sizze_74117 -\n                                                               (int64_t) 1];\n                }\n                if (!should_load_carry_79854) {\n                    x_74124 = (int64_t) 0;\n                }\n            }\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    \n  error_1:\n    return;\n    #undef segscan_group_sizze_74117\n}\n__kernel void mainziscan_stage2_67884(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_78393_backing_aligned_0,\n                                   ",
                   "   int64_t m_65377, int64_t n_65378,\n                                      int64_t stage1_num_groups_78358,\n                                      int32_t num_threads_78359, __global\n                                      unsigned char *mem_77116)\n{\n    #define segscan_group_sizze_67878 (mainzisegscan_group_sizze_67858)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_78393_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_78393_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78388;\n    int32_t local_tid_78389;\n    int64_t group_sizze_78392;\n    int32_t wave_sizze_78391;\n    int32_t group_tid_78390;\n    \n    global_tid_78388 = get_global_id(0);\n    local_tid_78389 = get_local_id(0);\n    group_sizze_78392 = get_local_size(0);\n    wave_sizze_78391 = LOCKSTEP_WIDTH;\n    group_tid_78390 = get_group_id(0);\n    \n    int32_t phys_tid_67884 = global_tid_78388;\n    __local unsigned char *scan_arr_mem_78393;\n    \n    scan_arr_mem_78393 = (__local unsigned char *) scan_arr_mem_78393_backing_0;\n    \n    int64_t flat_idx_78395 = (sext_i32_i64(local_tid_78389) + (int64_t) 1) *\n            (segscan_group_sizze_67878 * sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_78359))) -\n            (int64_t) 1;\n    int64_t gtid_67882 = squot64(flat_idx_78395, n_65378);\n    int64_t gtid_67883 = flat_idx_78395 - squot64(flat_idx_78395, n_65378) *\n            n_65378;\n    \n    // threads in bound read carries; others get neutral element\n    {\n        if (slt64(gtid_67882, m_65377) && slt64(gtid_67883, n_65378)) {\n            int64_t tmp_78396;\n            \n            tmp_78396 = ((__global int64_t *) mem_77116)[gtid_67882 * n_65378 +\n                                                         gtid_67883];\n      ",
                   "      ((__local\n              int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)] =\n                tmp_78396;\n        } else {\n            ((__local\n              int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)] =\n                (int64_t) 0;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t x_67885;\n    int64_t x_67886;\n    int64_t x_78397;\n    int64_t x_78398;\n    bool ltid_in_bounds_78400 = slt64(sext_i32_i64(local_tid_78389),\n                                      stage1_num_groups_78358);\n    int32_t skip_threads_78401;\n    \n    // read input for in-block scan\n    {\n        if (ltid_in_bounds_78400) {\n            x_67886 = ((volatile __local\n                        int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)];\n            if ((local_tid_78389 - squot32(local_tid_78389, 32) * 32) == 0) {\n                x_67885 = x_67886;\n            }\n        }\n    }\n    // in-block scan (hopefully no barriers needed)\n    {\n        skip_threads_78401 = 1;\n        while (slt32(skip_threads_78401, 32)) {\n            bool thread_active_78402 = sle32(skip_threads_78401,\n                                             local_tid_78389 -\n                                             squot32(local_tid_78389, 32) *\n                                             32) && ltid_in_bounds_78400;\n            \n            if (thread_active_78402) {\n                // read operands\n                {\n                    x_67885 = ((volatile __local\n                                int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389) -\n                                                               sext_i32_i64(skip_threads_78401)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_78403 =\n                     slt64(srem64((sext_i32_i64(local_tid_78389) +\n                                   (int64_t) 1) * (segscan_group_sizze_67878 *\n                                                   ",
                   "sdiv_up64(m_65377 * n_65378,\n                                                             sext_i32_i64(num_threads_78359))) -\n                                  (int64_t) 1, n_65378),\n                           (sext_i32_i64(local_tid_78389) + (int64_t) 1) *\n                           (segscan_group_sizze_67878 * sdiv_up64(m_65377 *\n                                                                  n_65378,\n                                                                  sext_i32_i64(num_threads_78359))) -\n                           (int64_t) 1 - ((sext_i32_i64(local_tid_78389 -\n                                           skip_threads_78401) + (int64_t) 1) *\n                                          (segscan_group_sizze_67878 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_78359))) -\n                                          (int64_t) 1));\n                \n                if (thread_active_78402 && inactive_78403) {\n                    x_67885 = x_67886;\n                }\n                if (thread_active_78402) {\n                    if (!inactive_78403) {\n                        int64_t defunc_1_op_res_67887 = add64(x_67885, x_67886);\n                        \n                        x_67885 = defunc_1_op_res_67887;\n                    }\n                }\n            }\n            if (sle32(wave_sizze_78391, skip_threads_78401)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            if (thread_active_78402) {\n                // write result\n                {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)] =\n                        x_67885;\n                    x_67886 = x_67885;\n                }\n            }\n            if (sle32(wave_sizze_78391, skip_threads_78401)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            skip_threads_78401 *= 2;\n       ",
                   " }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // last thread of block 'i' writes its result to offset 'i'\n    {\n        if ((local_tid_78389 - squot32(local_tid_78389, 32) * 32) == 31 &&\n            ltid_in_bounds_78400) {\n            ((volatile __local\n              int64_t *) scan_arr_mem_78393)[sext_i32_i64(squot32(local_tid_78389,\n                                                                  32))] =\n                x_67885;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n    {\n        int32_t skip_threads_78404;\n        \n        // read input for in-block scan\n        {\n            if (squot32(local_tid_78389, 32) == 0 && ltid_in_bounds_78400) {\n                x_78398 = ((volatile __local\n                            int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)];\n                if ((local_tid_78389 - squot32(local_tid_78389, 32) * 32) ==\n                    0) {\n                    x_78397 = x_78398;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_78404 = 1;\n            while (slt32(skip_threads_78404, 32)) {\n                bool thread_active_78405 = sle32(skip_threads_78404,\n                                                 local_tid_78389 -\n                                                 squot32(local_tid_78389, 32) *\n                                                 32) &&\n                     (squot32(local_tid_78389, 32) == 0 &&\n                      ltid_in_bounds_78400);\n                \n                if (thread_active_78405) {\n                    // read operands\n                    {\n                        x_78397 = ((volatile __local\n                                    int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389) -\n                                                                   sext_i32_i64(skip_threads_78404)];\n                    }\n     ",
                   "           }\n                // perform operation\n                {\n                    bool inactive_78406 =\n                         slt64(srem64((sext_i32_i64(local_tid_78389 * 32 + 32 -\n                                       1) + (int64_t) 1) *\n                                      (segscan_group_sizze_67878 *\n                                       sdiv_up64(m_65377 * n_65378,\n                                                 sext_i32_i64(num_threads_78359))) -\n                                      (int64_t) 1, n_65378),\n                               (sext_i32_i64(local_tid_78389 * 32 + 32 - 1) +\n                                (int64_t) 1) * (segscan_group_sizze_67878 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_78359))) -\n                               (int64_t) 1 - ((sext_i32_i64((local_tid_78389 -\n                                                             skip_threads_78404) *\n                                               32 + 32 - 1) + (int64_t) 1) *\n                                              (segscan_group_sizze_67878 *\n                                               sdiv_up64(m_65377 * n_65378,\n                                                         sext_i32_i64(num_threads_78359))) -\n                                              (int64_t) 1));\n                    \n                    if (thread_active_78405 && inactive_78406) {\n                        x_78397 = x_78398;\n                    }\n                    if (thread_active_78405) {\n                        if (!inactive_78406) {\n                            int64_t defunc_1_op_res_78399 = add64(x_78397,\n                                                                  x_78398);\n                            \n                            x_78397 = defunc_1_op_res_78399;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_78391, skip_",
                   "threads_78404)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_78405) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)] =\n                            x_78397;\n                        x_78398 = x_78397;\n                    }\n                }\n                if (sle32(wave_sizze_78391, skip_threads_78404)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_78404 *= 2;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    bool no_carry_in_78407 = squot32(local_tid_78389, 32) == 0 ||\n         !ltid_in_bounds_78400;\n    \n    // carry-in for every block except the first\n    {\n        // read operands\n        {\n            if (!no_carry_in_78407) {\n                x_67886 = x_67885;\n                x_67885 = ((__local\n                            int64_t *) scan_arr_mem_78393)[sext_i32_i64(squot32(local_tid_78389,\n                                                                                32)) -\n                                                           (int64_t) 1];\n            }\n        }\n        // perform operation\n        {\n            bool inactive_78408 = slt64(srem64((sext_i32_i64(local_tid_78389) +\n                                                (int64_t) 1) *\n                                               (segscan_group_sizze_67878 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_78359))) -\n                                               (int64_t) 1, n_65378),\n                                        (sext_i32_i64(local_tid_78389) +\n                                         (int64_t) 1) *\n                                        (segscan_group_sizze_67878 *\n                                   ",
                   "      sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_78359))) -\n                                        (int64_t) 1 -\n                                        ((sext_i32_i64(squot32(local_tid_78389,\n                                                               32) * 32 - 1) +\n                                          (int64_t) 1) *\n                                         (segscan_group_sizze_67878 *\n                                          sdiv_up64(m_65377 * n_65378,\n                                                    sext_i32_i64(num_threads_78359))) -\n                                         (int64_t) 1));\n            \n            if (!no_carry_in_78407) {\n                if (inactive_78408) {\n                    x_67885 = x_67886;\n                }\n            }\n            if (!no_carry_in_78407) {\n                if (!inactive_78408) {\n                    int64_t defunc_1_op_res_67887 = add64(x_67885, x_67886);\n                    \n                    x_67885 = defunc_1_op_res_67887;\n                }\n            }\n        }\n        // write final result\n        {\n            if (!no_carry_in_78407) {\n                ((__local\n                  int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)] =\n                    x_67885;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // restore correct values for first block\n    {\n        if (squot32(local_tid_78389, 32) == 0 && ltid_in_bounds_78400) {\n            ((__local\n              int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)] =\n                x_67886;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // threads in bounds write scanned carries\n    {\n        if (slt64(gtid_67882, m_65377) && slt64(gtid_67883, n_65378)) {\n            int64_t tmp_78409;\n            \n            tmp_78409 = ((__local\n                          int64_t *) scan_arr_mem_78393)[sext_i32_i64(local_tid_78389)];\n            ((__global",
                   " int64_t *) mem_77116)[gtid_67882 * n_65378 +\n                                             gtid_67883] = tmp_78409;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_67878\n}\n__kernel void mainziscan_stage2_69675(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_78758_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t stage1_num_groups_78723,\n                                      int32_t num_threads_78724, __global\n                                      unsigned char *mem_77350)\n{\n    #define segscan_group_sizze_69669 (mainzisegscan_group_sizze_69649)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_78758_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_78758_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78753;\n    int32_t local_tid_78754;\n    int64_t group_sizze_78757;\n    int32_t wave_sizze_78756;\n    int32_t group_tid_78755;\n    \n    global_tid_78753 = get_global_id(0);\n    local_tid_78754 = get_local_id(0);\n    group_sizze_78757 = get_local_size(0);\n    wave_sizze_78756 = LOCKSTEP_WIDTH;\n    group_tid_78755 = get_group_id(0);\n    \n    int32_t phys_tid_69675 = global_tid_78753;\n    __local unsigned char *scan_arr_mem_78758;\n    \n    scan_arr_mem_78758 = (__local unsigned char *) scan_arr_mem_78758_backing_0;\n    \n    int64_t flat_idx_78760 = (sext_i32_i64(local_tid_78754) + (int64_t) 1) *\n            (segscan_group_sizze_69669 * sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_78724))) -\n            (int64_t) 1;\n    int64_t gtid_69673 = squot64(flat_idx_78760, n_65378);\n    ",
                   "int64_t gtid_69674 = flat_idx_78760 - squot64(flat_idx_78760, n_65378) *\n            n_65378;\n    \n    // threads in bound read carries; others get neutral element\n    {\n        if (slt64(gtid_69673, m_65377) && slt64(gtid_69674, n_65378)) {\n            int64_t tmp_78761;\n            \n            tmp_78761 = ((__global int64_t *) mem_77350)[gtid_69673 * n_65378 +\n                                                         gtid_69674];\n            ((__local\n              int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)] =\n                tmp_78761;\n        } else {\n            ((__local\n              int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)] =\n                (int64_t) 0;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t x_69676;\n    int64_t x_69677;\n    int64_t x_78762;\n    int64_t x_78763;\n    bool ltid_in_bounds_78765 = slt64(sext_i32_i64(local_tid_78754),\n                                      stage1_num_groups_78723);\n    int32_t skip_threads_78766;\n    \n    // read input for in-block scan\n    {\n        if (ltid_in_bounds_78765) {\n            x_69677 = ((volatile __local\n                        int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)];\n            if ((local_tid_78754 - squot32(local_tid_78754, 32) * 32) == 0) {\n                x_69676 = x_69677;\n            }\n        }\n    }\n    // in-block scan (hopefully no barriers needed)\n    {\n        skip_threads_78766 = 1;\n        while (slt32(skip_threads_78766, 32)) {\n            bool thread_active_78767 = sle32(skip_threads_78766,\n                                             local_tid_78754 -\n                                             squot32(local_tid_78754, 32) *\n                                             32) && ltid_in_bounds_78765;\n            \n            if (thread_active_78767) {\n                // read operands\n                {\n                    x_69676 = ((volatile __local\n                                int64_t *) scan_arr_mem_78758)[se",
                   "xt_i32_i64(local_tid_78754) -\n                                                               sext_i32_i64(skip_threads_78766)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_78768 =\n                     slt64(srem64((sext_i32_i64(local_tid_78754) +\n                                   (int64_t) 1) * (segscan_group_sizze_69669 *\n                                                   sdiv_up64(m_65377 * n_65378,\n                                                             sext_i32_i64(num_threads_78724))) -\n                                  (int64_t) 1, n_65378),\n                           (sext_i32_i64(local_tid_78754) + (int64_t) 1) *\n                           (segscan_group_sizze_69669 * sdiv_up64(m_65377 *\n                                                                  n_65378,\n                                                                  sext_i32_i64(num_threads_78724))) -\n                           (int64_t) 1 - ((sext_i32_i64(local_tid_78754 -\n                                           skip_threads_78766) + (int64_t) 1) *\n                                          (segscan_group_sizze_69669 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_78724))) -\n                                          (int64_t) 1));\n                \n                if (thread_active_78767 && inactive_78768) {\n                    x_69676 = x_69677;\n                }\n                if (thread_active_78767) {\n                    if (!inactive_78768) {\n                        int64_t defunc_1_op_res_69678 = add64(x_69676, x_69677);\n                        \n                        x_69676 = defunc_1_op_res_69678;\n                    }\n                }\n            }\n            if (sle32(wave_sizze_78756, skip_threads_78766)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            if (thread_active_78767) {\n    ",
                   "            // write result\n                {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)] =\n                        x_69676;\n                    x_69677 = x_69676;\n                }\n            }\n            if (sle32(wave_sizze_78756, skip_threads_78766)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            skip_threads_78766 *= 2;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // last thread of block 'i' writes its result to offset 'i'\n    {\n        if ((local_tid_78754 - squot32(local_tid_78754, 32) * 32) == 31 &&\n            ltid_in_bounds_78765) {\n            ((volatile __local\n              int64_t *) scan_arr_mem_78758)[sext_i32_i64(squot32(local_tid_78754,\n                                                                  32))] =\n                x_69676;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n    {\n        int32_t skip_threads_78769;\n        \n        // read input for in-block scan\n        {\n            if (squot32(local_tid_78754, 32) == 0 && ltid_in_bounds_78765) {\n                x_78763 = ((volatile __local\n                            int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)];\n                if ((local_tid_78754 - squot32(local_tid_78754, 32) * 32) ==\n                    0) {\n                    x_78762 = x_78763;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_78769 = 1;\n            while (slt32(skip_threads_78769, 32)) {\n                bool thread_active_78770 = sle32(skip_threads_78769,\n                                                 local_tid_78754 -\n                                                 squot32(local_tid_78754, 32) *\n                                                 32) &&\n                     (squot32(local_tid_78754, 32) == 0 &&\n   ",
                   "                   ltid_in_bounds_78765);\n                \n                if (thread_active_78770) {\n                    // read operands\n                    {\n                        x_78762 = ((volatile __local\n                                    int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754) -\n                                                                   sext_i32_i64(skip_threads_78769)];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_78771 =\n                         slt64(srem64((sext_i32_i64(local_tid_78754 * 32 + 32 -\n                                       1) + (int64_t) 1) *\n                                      (segscan_group_sizze_69669 *\n                                       sdiv_up64(m_65377 * n_65378,\n                                                 sext_i32_i64(num_threads_78724))) -\n                                      (int64_t) 1, n_65378),\n                               (sext_i32_i64(local_tid_78754 * 32 + 32 - 1) +\n                                (int64_t) 1) * (segscan_group_sizze_69669 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_78724))) -\n                               (int64_t) 1 - ((sext_i32_i64((local_tid_78754 -\n                                                             skip_threads_78769) *\n                                               32 + 32 - 1) + (int64_t) 1) *\n                                              (segscan_group_sizze_69669 *\n                                               sdiv_up64(m_65377 * n_65378,\n                                                         sext_i32_i64(num_threads_78724))) -\n                                              (int64_t) 1));\n                    \n                    if (thread_active_78770 && inactive_78771) {\n                        x_78762 = x_78763;\n                    }\n        ",
                   "            if (thread_active_78770) {\n                        if (!inactive_78771) {\n                            int64_t defunc_1_op_res_78764 = add64(x_78762,\n                                                                  x_78763);\n                            \n                            x_78762 = defunc_1_op_res_78764;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_78756, skip_threads_78769)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_78770) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)] =\n                            x_78762;\n                        x_78763 = x_78762;\n                    }\n                }\n                if (sle32(wave_sizze_78756, skip_threads_78769)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_78769 *= 2;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    bool no_carry_in_78772 = squot32(local_tid_78754, 32) == 0 ||\n         !ltid_in_bounds_78765;\n    \n    // carry-in for every block except the first\n    {\n        // read operands\n        {\n            if (!no_carry_in_78772) {\n                x_69677 = x_69676;\n                x_69676 = ((__local\n                            int64_t *) scan_arr_mem_78758)[sext_i32_i64(squot32(local_tid_78754,\n                                                                                32)) -\n                                                           (int64_t) 1];\n            }\n        }\n        // perform operation\n        {\n            bool inactive_78773 = slt64(srem64((sext_i32_i64(local_tid_78754) +\n                                                (int64_t) 1) *\n                                               (segscan_group_sizze_69669 *\n                                ",
                   "                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_78724))) -\n                                               (int64_t) 1, n_65378),\n                                        (sext_i32_i64(local_tid_78754) +\n                                         (int64_t) 1) *\n                                        (segscan_group_sizze_69669 *\n                                         sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_78724))) -\n                                        (int64_t) 1 -\n                                        ((sext_i32_i64(squot32(local_tid_78754,\n                                                               32) * 32 - 1) +\n                                          (int64_t) 1) *\n                                         (segscan_group_sizze_69669 *\n                                          sdiv_up64(m_65377 * n_65378,\n                                                    sext_i32_i64(num_threads_78724))) -\n                                         (int64_t) 1));\n            \n            if (!no_carry_in_78772) {\n                if (inactive_78773) {\n                    x_69676 = x_69677;\n                }\n            }\n            if (!no_carry_in_78772) {\n                if (!inactive_78773) {\n                    int64_t defunc_1_op_res_69678 = add64(x_69676, x_69677);\n                    \n                    x_69676 = defunc_1_op_res_69678;\n                }\n            }\n        }\n        // write final result\n        {\n            if (!no_carry_in_78772) {\n                ((__local\n                  int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)] =\n                    x_69676;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // restore correct values for first block\n    {\n        if (squot32(local_tid_78754, 32) == 0 && ltid_in_bounds_78765) {\n            ((__local\n              int64_t *) ",
                   "scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)] =\n                x_69677;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // threads in bounds write scanned carries\n    {\n        if (slt64(gtid_69673, m_65377) && slt64(gtid_69674, n_65378)) {\n            int64_t tmp_78774;\n            \n            tmp_78774 = ((__local\n                          int64_t *) scan_arr_mem_78758)[sext_i32_i64(local_tid_78754)];\n            ((__global int64_t *) mem_77350)[gtid_69673 * n_65378 +\n                                             gtid_69674] = tmp_78774;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_69669\n}\n__kernel void mainziscan_stage2_71714(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79175_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t stage1_num_groups_79140,\n                                      int32_t num_threads_79141, __global\n                                      unsigned char *mem_77642)\n{\n    #define segscan_group_sizze_71708 (mainzisegscan_group_sizze_71688)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79175_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79175_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79170;\n    int32_t local_tid_79171;\n    int64_t group_sizze_79174;\n    int32_t wave_sizze_79173;\n    int32_t group_tid_79172;\n    \n    global_tid_79170 = get_global_id(0);\n    local_tid_79171 = get_local_id(0);\n    group_sizze_79174 = get_local_size(0);\n    wave_sizze_79173 = LOCKSTEP_WIDTH;\n    group_tid_79172 = get_group_id(0);\n    \n    int32_t phys_tid_71714 = global_tid_79170;\n    __local unsign",
                   "ed char *scan_arr_mem_79175;\n    \n    scan_arr_mem_79175 = (__local unsigned char *) scan_arr_mem_79175_backing_0;\n    \n    int64_t flat_idx_79177 = (sext_i32_i64(local_tid_79171) + (int64_t) 1) *\n            (segscan_group_sizze_71708 * sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79141))) -\n            (int64_t) 1;\n    int64_t gtid_71712 = squot64(flat_idx_79177, n_65378);\n    int64_t gtid_71713 = flat_idx_79177 - squot64(flat_idx_79177, n_65378) *\n            n_65378;\n    \n    // threads in bound read carries; others get neutral element\n    {\n        if (slt64(gtid_71712, m_65377) && slt64(gtid_71713, n_65378)) {\n            int64_t tmp_79178;\n            \n            tmp_79178 = ((__global int64_t *) mem_77642)[gtid_71712 * n_65378 +\n                                                         gtid_71713];\n            ((__local\n              int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)] =\n                tmp_79178;\n        } else {\n            ((__local\n              int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)] =\n                (int64_t) 0;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t x_71715;\n    int64_t x_71716;\n    int64_t x_79179;\n    int64_t x_79180;\n    bool ltid_in_bounds_79182 = slt64(sext_i32_i64(local_tid_79171),\n                                      stage1_num_groups_79140);\n    int32_t skip_threads_79183;\n    \n    // read input for in-block scan\n    {\n        if (ltid_in_bounds_79182) {\n            x_71716 = ((volatile __local\n                        int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)];\n            if ((local_tid_79171 - squot32(local_tid_79171, 32) * 32) == 0) {\n                x_71715 = x_71716;\n            }\n        }\n    }\n    // in-block scan (hopefully no barriers needed)\n    {\n        skip_threads_79183 = 1;\n        while (slt32(skip_threads_79183, 32)) {\n            bool thread_active_79184 = sle32(skip_thr",
                   "eads_79183,\n                                             local_tid_79171 -\n                                             squot32(local_tid_79171, 32) *\n                                             32) && ltid_in_bounds_79182;\n            \n            if (thread_active_79184) {\n                // read operands\n                {\n                    x_71715 = ((volatile __local\n                                int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171) -\n                                                               sext_i32_i64(skip_threads_79183)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_79185 =\n                     slt64(srem64((sext_i32_i64(local_tid_79171) +\n                                   (int64_t) 1) * (segscan_group_sizze_71708 *\n                                                   sdiv_up64(m_65377 * n_65378,\n                                                             sext_i32_i64(num_threads_79141))) -\n                                  (int64_t) 1, n_65378),\n                           (sext_i32_i64(local_tid_79171) + (int64_t) 1) *\n                           (segscan_group_sizze_71708 * sdiv_up64(m_65377 *\n                                                                  n_65378,\n                                                                  sext_i32_i64(num_threads_79141))) -\n                           (int64_t) 1 - ((sext_i32_i64(local_tid_79171 -\n                                           skip_threads_79183) + (int64_t) 1) *\n                                          (segscan_group_sizze_71708 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79141))) -\n                                          (int64_t) 1));\n                \n                if (thread_active_79184 && inactive_79185) {\n                    x_71715 = x_71716;\n                }\n                if (thread_",
                   "active_79184) {\n                    if (!inactive_79185) {\n                        int64_t defunc_1_op_res_71717 = add64(x_71715, x_71716);\n                        \n                        x_71715 = defunc_1_op_res_71717;\n                    }\n                }\n            }\n            if (sle32(wave_sizze_79173, skip_threads_79183)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            if (thread_active_79184) {\n                // write result\n                {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)] =\n                        x_71715;\n                    x_71716 = x_71715;\n                }\n            }\n            if (sle32(wave_sizze_79173, skip_threads_79183)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            skip_threads_79183 *= 2;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // last thread of block 'i' writes its result to offset 'i'\n    {\n        if ((local_tid_79171 - squot32(local_tid_79171, 32) * 32) == 31 &&\n            ltid_in_bounds_79182) {\n            ((volatile __local\n              int64_t *) scan_arr_mem_79175)[sext_i32_i64(squot32(local_tid_79171,\n                                                                  32))] =\n                x_71715;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n    {\n        int32_t skip_threads_79186;\n        \n        // read input for in-block scan\n        {\n            if (squot32(local_tid_79171, 32) == 0 && ltid_in_bounds_79182) {\n                x_79180 = ((volatile __local\n                            int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)];\n                if ((local_tid_79171 - squot32(local_tid_79171, 32) * 32) ==\n                    0) {\n                    x_79179 = x_79180;\n                }\n            }\n        }\n        // in-block scan (hopefully no barrier",
                   "s needed)\n        {\n            skip_threads_79186 = 1;\n            while (slt32(skip_threads_79186, 32)) {\n                bool thread_active_79187 = sle32(skip_threads_79186,\n                                                 local_tid_79171 -\n                                                 squot32(local_tid_79171, 32) *\n                                                 32) &&\n                     (squot32(local_tid_79171, 32) == 0 &&\n                      ltid_in_bounds_79182);\n                \n                if (thread_active_79187) {\n                    // read operands\n                    {\n                        x_79179 = ((volatile __local\n                                    int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171) -\n                                                                   sext_i32_i64(skip_threads_79186)];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79188 =\n                         slt64(srem64((sext_i32_i64(local_tid_79171 * 32 + 32 -\n                                       1) + (int64_t) 1) *\n                                      (segscan_group_sizze_71708 *\n                                       sdiv_up64(m_65377 * n_65378,\n                                                 sext_i32_i64(num_threads_79141))) -\n                                      (int64_t) 1, n_65378),\n                               (sext_i32_i64(local_tid_79171 * 32 + 32 - 1) +\n                                (int64_t) 1) * (segscan_group_sizze_71708 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79141))) -\n                               (int64_t) 1 - ((sext_i32_i64((local_tid_79171 -\n                                                             skip_threads_79186) *\n                                               32 + 32 - 1) + (int64_t) 1) *\n                      ",
                   "                        (segscan_group_sizze_71708 *\n                                               sdiv_up64(m_65377 * n_65378,\n                                                         sext_i32_i64(num_threads_79141))) -\n                                              (int64_t) 1));\n                    \n                    if (thread_active_79187 && inactive_79188) {\n                        x_79179 = x_79180;\n                    }\n                    if (thread_active_79187) {\n                        if (!inactive_79188) {\n                            int64_t defunc_1_op_res_79181 = add64(x_79179,\n                                                                  x_79180);\n                            \n                            x_79179 = defunc_1_op_res_79181;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_79173, skip_threads_79186)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_79187) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)] =\n                            x_79179;\n                        x_79180 = x_79179;\n                    }\n                }\n                if (sle32(wave_sizze_79173, skip_threads_79186)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_79186 *= 2;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    bool no_carry_in_79189 = squot32(local_tid_79171, 32) == 0 ||\n         !ltid_in_bounds_79182;\n    \n    // carry-in for every block except the first\n    {\n        // read operands\n        {\n            if (!no_carry_in_79189) {\n                x_71716 = x_71715;\n                x_71715 = ((__local\n                            int64_t *) scan_arr_mem_79175)[sext_i32_i64(squot32(local_tid_79171,\n                                ",
                   "                                                32)) -\n                                                           (int64_t) 1];\n            }\n        }\n        // perform operation\n        {\n            bool inactive_79190 = slt64(srem64((sext_i32_i64(local_tid_79171) +\n                                                (int64_t) 1) *\n                                               (segscan_group_sizze_71708 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79141))) -\n                                               (int64_t) 1, n_65378),\n                                        (sext_i32_i64(local_tid_79171) +\n                                         (int64_t) 1) *\n                                        (segscan_group_sizze_71708 *\n                                         sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79141))) -\n                                        (int64_t) 1 -\n                                        ((sext_i32_i64(squot32(local_tid_79171,\n                                                               32) * 32 - 1) +\n                                          (int64_t) 1) *\n                                         (segscan_group_sizze_71708 *\n                                          sdiv_up64(m_65377 * n_65378,\n                                                    sext_i32_i64(num_threads_79141))) -\n                                         (int64_t) 1));\n            \n            if (!no_carry_in_79189) {\n                if (inactive_79190) {\n                    x_71715 = x_71716;\n                }\n            }\n            if (!no_carry_in_79189) {\n                if (!inactive_79190) {\n                    int64_t defunc_1_op_res_71717 = add64(x_71715, x_71716);\n                    \n                    x_71715 = defunc_1_op_res_71717;\n                }\n            }\n        }\n        /",
                   "/ write final result\n        {\n            if (!no_carry_in_79189) {\n                ((__local\n                  int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)] =\n                    x_71715;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // restore correct values for first block\n    {\n        if (squot32(local_tid_79171, 32) == 0 && ltid_in_bounds_79182) {\n            ((__local\n              int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)] =\n                x_71716;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // threads in bounds write scanned carries\n    {\n        if (slt64(gtid_71712, m_65377) && slt64(gtid_71713, n_65378)) {\n            int64_t tmp_79191;\n            \n            tmp_79191 = ((__local\n                          int64_t *) scan_arr_mem_79175)[sext_i32_i64(local_tid_79171)];\n            ((__global int64_t *) mem_77642)[gtid_71712 * n_65378 +\n                                             gtid_71713] = tmp_79191;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_71708\n}\n__kernel void mainziscan_stage2_72699(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79592_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t stage1_num_groups_79557,\n                                      int32_t num_threads_79558, __global\n                                      unsigned char *mem_77867)\n{\n    #define segscan_group_sizze_72693 (mainzisegscan_group_sizze_72673)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79592_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79592_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n    ",
                   "    return;\n    \n    int32_t global_tid_79587;\n    int32_t local_tid_79588;\n    int64_t group_sizze_79591;\n    int32_t wave_sizze_79590;\n    int32_t group_tid_79589;\n    \n    global_tid_79587 = get_global_id(0);\n    local_tid_79588 = get_local_id(0);\n    group_sizze_79591 = get_local_size(0);\n    wave_sizze_79590 = LOCKSTEP_WIDTH;\n    group_tid_79589 = get_group_id(0);\n    \n    int32_t phys_tid_72699 = global_tid_79587;\n    __local unsigned char *scan_arr_mem_79592;\n    \n    scan_arr_mem_79592 = (__local unsigned char *) scan_arr_mem_79592_backing_0;\n    \n    int64_t flat_idx_79594 = (sext_i32_i64(local_tid_79588) + (int64_t) 1) *\n            (segscan_group_sizze_72693 * sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79558))) -\n            (int64_t) 1;\n    int64_t gtid_72697 = squot64(flat_idx_79594, n_65378);\n    int64_t gtid_72698 = flat_idx_79594 - squot64(flat_idx_79594, n_65378) *\n            n_65378;\n    \n    // threads in bound read carries; others get neutral element\n    {\n        if (slt64(gtid_72697, m_65377) && slt64(gtid_72698, n_65378)) {\n            int64_t tmp_79595;\n            \n            tmp_79595 = ((__global int64_t *) mem_77867)[gtid_72697 * n_65378 +\n                                                         gtid_72698];\n            ((__local\n              int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)] =\n                tmp_79595;\n        } else {\n            ((__local\n              int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)] =\n                (int64_t) 0;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t x_72700;\n    int64_t x_72701;\n    int64_t x_79596;\n    int64_t x_79597;\n    bool ltid_in_bounds_79599 = slt64(sext_i32_i64(local_tid_79588),\n                                      stage1_num_groups_79557);\n    int32_t skip_threads_79600;\n    \n    // read input for in-block scan\n    {\n        if (ltid_in_bounds_79599) {\n            x_72701 ",
                   "= ((volatile __local\n                        int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)];\n            if ((local_tid_79588 - squot32(local_tid_79588, 32) * 32) == 0) {\n                x_72700 = x_72701;\n            }\n        }\n    }\n    // in-block scan (hopefully no barriers needed)\n    {\n        skip_threads_79600 = 1;\n        while (slt32(skip_threads_79600, 32)) {\n            bool thread_active_79601 = sle32(skip_threads_79600,\n                                             local_tid_79588 -\n                                             squot32(local_tid_79588, 32) *\n                                             32) && ltid_in_bounds_79599;\n            \n            if (thread_active_79601) {\n                // read operands\n                {\n                    x_72700 = ((volatile __local\n                                int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588) -\n                                                               sext_i32_i64(skip_threads_79600)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_79602 =\n                     slt64(srem64((sext_i32_i64(local_tid_79588) +\n                                   (int64_t) 1) * (segscan_group_sizze_72693 *\n                                                   sdiv_up64(m_65377 * n_65378,\n                                                             sext_i32_i64(num_threads_79558))) -\n                                  (int64_t) 1, n_65378),\n                           (sext_i32_i64(local_tid_79588) + (int64_t) 1) *\n                           (segscan_group_sizze_72693 * sdiv_up64(m_65377 *\n                                                                  n_65378,\n                                                                  sext_i32_i64(num_threads_79558))) -\n                           (int64_t) 1 - ((sext_i32_i64(local_tid_79588 -\n                                           skip_threads_79600) + (int64_t) 1) *\n         ",
                   "                                 (segscan_group_sizze_72693 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79558))) -\n                                          (int64_t) 1));\n                \n                if (thread_active_79601 && inactive_79602) {\n                    x_72700 = x_72701;\n                }\n                if (thread_active_79601) {\n                    if (!inactive_79602) {\n                        int64_t defunc_1_op_res_72702 = add64(x_72700, x_72701);\n                        \n                        x_72700 = defunc_1_op_res_72702;\n                    }\n                }\n            }\n            if (sle32(wave_sizze_79590, skip_threads_79600)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            if (thread_active_79601) {\n                // write result\n                {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)] =\n                        x_72700;\n                    x_72701 = x_72700;\n                }\n            }\n            if (sle32(wave_sizze_79590, skip_threads_79600)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            skip_threads_79600 *= 2;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // last thread of block 'i' writes its result to offset 'i'\n    {\n        if ((local_tid_79588 - squot32(local_tid_79588, 32) * 32) == 31 &&\n            ltid_in_bounds_79599) {\n            ((volatile __local\n              int64_t *) scan_arr_mem_79592)[sext_i32_i64(squot32(local_tid_79588,\n                                                                  32))] =\n                x_72700;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n    {\n        int32_t skip_threads_79603;\n        \n        // read input for in-block scan\n        {\n",
                   "            if (squot32(local_tid_79588, 32) == 0 && ltid_in_bounds_79599) {\n                x_79597 = ((volatile __local\n                            int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)];\n                if ((local_tid_79588 - squot32(local_tid_79588, 32) * 32) ==\n                    0) {\n                    x_79596 = x_79597;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_79603 = 1;\n            while (slt32(skip_threads_79603, 32)) {\n                bool thread_active_79604 = sle32(skip_threads_79603,\n                                                 local_tid_79588 -\n                                                 squot32(local_tid_79588, 32) *\n                                                 32) &&\n                     (squot32(local_tid_79588, 32) == 0 &&\n                      ltid_in_bounds_79599);\n                \n                if (thread_active_79604) {\n                    // read operands\n                    {\n                        x_79596 = ((volatile __local\n                                    int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588) -\n                                                                   sext_i32_i64(skip_threads_79603)];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79605 =\n                         slt64(srem64((sext_i32_i64(local_tid_79588 * 32 + 32 -\n                                       1) + (int64_t) 1) *\n                                      (segscan_group_sizze_72693 *\n                                       sdiv_up64(m_65377 * n_65378,\n                                                 sext_i32_i64(num_threads_79558))) -\n                                      (int64_t) 1, n_65378),\n                               (sext_i32_i64(local_tid_79588 * 32 + 32 - 1) +\n                                (int64_t) 1) * (segscan_group_sizz",
                   "e_72693 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79558))) -\n                               (int64_t) 1 - ((sext_i32_i64((local_tid_79588 -\n                                                             skip_threads_79603) *\n                                               32 + 32 - 1) + (int64_t) 1) *\n                                              (segscan_group_sizze_72693 *\n                                               sdiv_up64(m_65377 * n_65378,\n                                                         sext_i32_i64(num_threads_79558))) -\n                                              (int64_t) 1));\n                    \n                    if (thread_active_79604 && inactive_79605) {\n                        x_79596 = x_79597;\n                    }\n                    if (thread_active_79604) {\n                        if (!inactive_79605) {\n                            int64_t defunc_1_op_res_79598 = add64(x_79596,\n                                                                  x_79597);\n                            \n                            x_79596 = defunc_1_op_res_79598;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_79590, skip_threads_79603)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_79604) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)] =\n                            x_79596;\n                        x_79597 = x_79596;\n                    }\n                }\n                if (sle32(wave_sizze_79590, skip_threads_79603)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_79603 *= 2;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FE",
                   "NCE);\n    \n    bool no_carry_in_79606 = squot32(local_tid_79588, 32) == 0 ||\n         !ltid_in_bounds_79599;\n    \n    // carry-in for every block except the first\n    {\n        // read operands\n        {\n            if (!no_carry_in_79606) {\n                x_72701 = x_72700;\n                x_72700 = ((__local\n                            int64_t *) scan_arr_mem_79592)[sext_i32_i64(squot32(local_tid_79588,\n                                                                                32)) -\n                                                           (int64_t) 1];\n            }\n        }\n        // perform operation\n        {\n            bool inactive_79607 = slt64(srem64((sext_i32_i64(local_tid_79588) +\n                                                (int64_t) 1) *\n                                               (segscan_group_sizze_72693 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79558))) -\n                                               (int64_t) 1, n_65378),\n                                        (sext_i32_i64(local_tid_79588) +\n                                         (int64_t) 1) *\n                                        (segscan_group_sizze_72693 *\n                                         sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79558))) -\n                                        (int64_t) 1 -\n                                        ((sext_i32_i64(squot32(local_tid_79588,\n                                                               32) * 32 - 1) +\n                                          (int64_t) 1) *\n                                         (segscan_group_sizze_72693 *\n                                          sdiv_up64(m_65377 * n_65378,\n                                                    sext_i32_i64(num_threads_79558))) -\n                                         (int64_t) 1)",
                   ");\n            \n            if (!no_carry_in_79606) {\n                if (inactive_79607) {\n                    x_72700 = x_72701;\n                }\n            }\n            if (!no_carry_in_79606) {\n                if (!inactive_79607) {\n                    int64_t defunc_1_op_res_72702 = add64(x_72700, x_72701);\n                    \n                    x_72700 = defunc_1_op_res_72702;\n                }\n            }\n        }\n        // write final result\n        {\n            if (!no_carry_in_79606) {\n                ((__local\n                  int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)] =\n                    x_72700;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // restore correct values for first block\n    {\n        if (squot32(local_tid_79588, 32) == 0 && ltid_in_bounds_79599) {\n            ((__local\n              int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)] =\n                x_72701;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // threads in bounds write scanned carries\n    {\n        if (slt64(gtid_72697, m_65377) && slt64(gtid_72698, n_65378)) {\n            int64_t tmp_79608;\n            \n            tmp_79608 = ((__local\n                          int64_t *) scan_arr_mem_79592)[sext_i32_i64(local_tid_79588)];\n            ((__global int64_t *) mem_77867)[gtid_72697 * n_65378 +\n                                             gtid_72698] = tmp_79608;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_72693\n}\n__kernel void mainziscan_stage2_73366(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79723_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t stage1_num_groups_79688,\n                                      int32_t num_threads_79689, __global\n                                      unsigned cha",
                   "r *mem_77914)\n{\n    #define segscan_group_sizze_73360 (mainzisegscan_group_sizze_73340)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79723_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79723_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79718;\n    int32_t local_tid_79719;\n    int64_t group_sizze_79722;\n    int32_t wave_sizze_79721;\n    int32_t group_tid_79720;\n    \n    global_tid_79718 = get_global_id(0);\n    local_tid_79719 = get_local_id(0);\n    group_sizze_79722 = get_local_size(0);\n    wave_sizze_79721 = LOCKSTEP_WIDTH;\n    group_tid_79720 = get_group_id(0);\n    \n    int32_t phys_tid_73366 = global_tid_79718;\n    __local unsigned char *scan_arr_mem_79723;\n    \n    scan_arr_mem_79723 = (__local unsigned char *) scan_arr_mem_79723_backing_0;\n    \n    int64_t flat_idx_79725 = (sext_i32_i64(local_tid_79719) + (int64_t) 1) *\n            (segscan_group_sizze_73360 * sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79689))) -\n            (int64_t) 1;\n    int64_t gtid_73364 = squot64(flat_idx_79725, n_65378);\n    int64_t gtid_73365 = flat_idx_79725 - squot64(flat_idx_79725, n_65378) *\n            n_65378;\n    \n    // threads in bound read carries; others get neutral element\n    {\n        if (slt64(gtid_73364, m_65377) && slt64(gtid_73365, n_65378)) {\n            int64_t tmp_79726;\n            \n            tmp_79726 = ((__global int64_t *) mem_77914)[gtid_73364 * n_65378 +\n                                                         gtid_73365];\n            ((__local\n              int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)] =\n                tmp_79726;\n        } else {\n            ((__local\n              int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_7971",
                   "9)] =\n                (int64_t) 0;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t x_73367;\n    int64_t x_73368;\n    int64_t x_79727;\n    int64_t x_79728;\n    bool ltid_in_bounds_79730 = slt64(sext_i32_i64(local_tid_79719),\n                                      stage1_num_groups_79688);\n    int32_t skip_threads_79731;\n    \n    // read input for in-block scan\n    {\n        if (ltid_in_bounds_79730) {\n            x_73368 = ((volatile __local\n                        int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)];\n            if ((local_tid_79719 - squot32(local_tid_79719, 32) * 32) == 0) {\n                x_73367 = x_73368;\n            }\n        }\n    }\n    // in-block scan (hopefully no barriers needed)\n    {\n        skip_threads_79731 = 1;\n        while (slt32(skip_threads_79731, 32)) {\n            bool thread_active_79732 = sle32(skip_threads_79731,\n                                             local_tid_79719 -\n                                             squot32(local_tid_79719, 32) *\n                                             32) && ltid_in_bounds_79730;\n            \n            if (thread_active_79732) {\n                // read operands\n                {\n                    x_73367 = ((volatile __local\n                                int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719) -\n                                                               sext_i32_i64(skip_threads_79731)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_79733 =\n                     slt64(srem64((sext_i32_i64(local_tid_79719) +\n                                   (int64_t) 1) * (segscan_group_sizze_73360 *\n                                                   sdiv_up64(m_65377 * n_65378,\n                                                             sext_i32_i64(num_threads_79689))) -\n                                  (int64_t) 1, n_65378),\n                           (sext_i32_i64(local_ti",
                   "d_79719) + (int64_t) 1) *\n                           (segscan_group_sizze_73360 * sdiv_up64(m_65377 *\n                                                                  n_65378,\n                                                                  sext_i32_i64(num_threads_79689))) -\n                           (int64_t) 1 - ((sext_i32_i64(local_tid_79719 -\n                                           skip_threads_79731) + (int64_t) 1) *\n                                          (segscan_group_sizze_73360 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79689))) -\n                                          (int64_t) 1));\n                \n                if (thread_active_79732 && inactive_79733) {\n                    x_73367 = x_73368;\n                }\n                if (thread_active_79732) {\n                    if (!inactive_79733) {\n                        int64_t defunc_1_op_res_73369 = add64(x_73367, x_73368);\n                        \n                        x_73367 = defunc_1_op_res_73369;\n                    }\n                }\n            }\n            if (sle32(wave_sizze_79721, skip_threads_79731)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            if (thread_active_79732) {\n                // write result\n                {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)] =\n                        x_73367;\n                    x_73368 = x_73367;\n                }\n            }\n            if (sle32(wave_sizze_79721, skip_threads_79731)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            skip_threads_79731 *= 2;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // last thread of block 'i' writes its result to offset 'i'\n    {\n        if ((local_tid_79719 - squot32(local_tid_79719, 32) * 32) == 31 &&\n            ltid_in_bounds_79730) {\n        ",
                   "    ((volatile __local\n              int64_t *) scan_arr_mem_79723)[sext_i32_i64(squot32(local_tid_79719,\n                                                                  32))] =\n                x_73367;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n    {\n        int32_t skip_threads_79734;\n        \n        // read input for in-block scan\n        {\n            if (squot32(local_tid_79719, 32) == 0 && ltid_in_bounds_79730) {\n                x_79728 = ((volatile __local\n                            int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)];\n                if ((local_tid_79719 - squot32(local_tid_79719, 32) * 32) ==\n                    0) {\n                    x_79727 = x_79728;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_79734 = 1;\n            while (slt32(skip_threads_79734, 32)) {\n                bool thread_active_79735 = sle32(skip_threads_79734,\n                                                 local_tid_79719 -\n                                                 squot32(local_tid_79719, 32) *\n                                                 32) &&\n                     (squot32(local_tid_79719, 32) == 0 &&\n                      ltid_in_bounds_79730);\n                \n                if (thread_active_79735) {\n                    // read operands\n                    {\n                        x_79727 = ((volatile __local\n                                    int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719) -\n                                                                   sext_i32_i64(skip_threads_79734)];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79736 =\n                         slt64(srem64((sext_i32_i64(local_tid_79719 * 32 + 32 -\n                                       1) ",
                   "+ (int64_t) 1) *\n                                      (segscan_group_sizze_73360 *\n                                       sdiv_up64(m_65377 * n_65378,\n                                                 sext_i32_i64(num_threads_79689))) -\n                                      (int64_t) 1, n_65378),\n                               (sext_i32_i64(local_tid_79719 * 32 + 32 - 1) +\n                                (int64_t) 1) * (segscan_group_sizze_73360 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79689))) -\n                               (int64_t) 1 - ((sext_i32_i64((local_tid_79719 -\n                                                             skip_threads_79734) *\n                                               32 + 32 - 1) + (int64_t) 1) *\n                                              (segscan_group_sizze_73360 *\n                                               sdiv_up64(m_65377 * n_65378,\n                                                         sext_i32_i64(num_threads_79689))) -\n                                              (int64_t) 1));\n                    \n                    if (thread_active_79735 && inactive_79736) {\n                        x_79727 = x_79728;\n                    }\n                    if (thread_active_79735) {\n                        if (!inactive_79736) {\n                            int64_t defunc_1_op_res_79729 = add64(x_79727,\n                                                                  x_79728);\n                            \n                            x_79727 = defunc_1_op_res_79729;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_79721, skip_threads_79734)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_79735) {\n                    // write result\n                    {\n                        ((volatile __local\n  ",
                   "                        int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)] =\n                            x_79727;\n                        x_79728 = x_79727;\n                    }\n                }\n                if (sle32(wave_sizze_79721, skip_threads_79734)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_79734 *= 2;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    bool no_carry_in_79737 = squot32(local_tid_79719, 32) == 0 ||\n         !ltid_in_bounds_79730;\n    \n    // carry-in for every block except the first\n    {\n        // read operands\n        {\n            if (!no_carry_in_79737) {\n                x_73368 = x_73367;\n                x_73367 = ((__local\n                            int64_t *) scan_arr_mem_79723)[sext_i32_i64(squot32(local_tid_79719,\n                                                                                32)) -\n                                                           (int64_t) 1];\n            }\n        }\n        // perform operation\n        {\n            bool inactive_79738 = slt64(srem64((sext_i32_i64(local_tid_79719) +\n                                                (int64_t) 1) *\n                                               (segscan_group_sizze_73360 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79689))) -\n                                               (int64_t) 1, n_65378),\n                                        (sext_i32_i64(local_tid_79719) +\n                                         (int64_t) 1) *\n                                        (segscan_group_sizze_73360 *\n                                         sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79689))) -\n                                        (int64_t) 1 -\n                                        ((sext_i32_i64(s",
                   "quot32(local_tid_79719,\n                                                               32) * 32 - 1) +\n                                          (int64_t) 1) *\n                                         (segscan_group_sizze_73360 *\n                                          sdiv_up64(m_65377 * n_65378,\n                                                    sext_i32_i64(num_threads_79689))) -\n                                         (int64_t) 1));\n            \n            if (!no_carry_in_79737) {\n                if (inactive_79738) {\n                    x_73367 = x_73368;\n                }\n            }\n            if (!no_carry_in_79737) {\n                if (!inactive_79738) {\n                    int64_t defunc_1_op_res_73369 = add64(x_73367, x_73368);\n                    \n                    x_73367 = defunc_1_op_res_73369;\n                }\n            }\n        }\n        // write final result\n        {\n            if (!no_carry_in_79737) {\n                ((__local\n                  int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)] =\n                    x_73367;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // restore correct values for first block\n    {\n        if (squot32(local_tid_79719, 32) == 0 && ltid_in_bounds_79730) {\n            ((__local\n              int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)] =\n                x_73368;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // threads in bounds write scanned carries\n    {\n        if (slt64(gtid_73364, m_65377) && slt64(gtid_73365, n_65378)) {\n            int64_t tmp_79739;\n            \n            tmp_79739 = ((__local\n                          int64_t *) scan_arr_mem_79723)[sext_i32_i64(local_tid_79719)];\n            ((__global int64_t *) mem_77914)[gtid_73364 * n_65378 +\n                                             gtid_73365] = tmp_79739;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_73360\n}\n__kernel void mainziscan_stage2_7",
                   "4123(__global int *global_failure,\n                                      __local volatile\n                                      int64_t *scan_arr_mem_79860_backing_aligned_0,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t stage1_num_groups_79825,\n                                      int32_t num_threads_79826, __global\n                                      unsigned char *mem_77968)\n{\n    #define segscan_group_sizze_74117 (mainzisegscan_group_sizze_74097)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict scan_arr_mem_79860_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) scan_arr_mem_79860_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79855;\n    int32_t local_tid_79856;\n    int64_t group_sizze_79859;\n    int32_t wave_sizze_79858;\n    int32_t group_tid_79857;\n    \n    global_tid_79855 = get_global_id(0);\n    local_tid_79856 = get_local_id(0);\n    group_sizze_79859 = get_local_size(0);\n    wave_sizze_79858 = LOCKSTEP_WIDTH;\n    group_tid_79857 = get_group_id(0);\n    \n    int32_t phys_tid_74123 = global_tid_79855;\n    __local unsigned char *scan_arr_mem_79860;\n    \n    scan_arr_mem_79860 = (__local unsigned char *) scan_arr_mem_79860_backing_0;\n    \n    int64_t flat_idx_79862 = (sext_i32_i64(local_tid_79856) + (int64_t) 1) *\n            (segscan_group_sizze_74117 * sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79826))) -\n            (int64_t) 1;\n    int64_t gtid_74121 = squot64(flat_idx_79862, n_65378);\n    int64_t gtid_74122 = flat_idx_79862 - squot64(flat_idx_79862, n_65378) *\n            n_65378;\n    \n    // threads in bound read carries; others get neutral element\n    {\n        if (slt64(gtid_74121, m_65377) && slt64(gtid_74122, n_",
                   "65378)) {\n            int64_t tmp_79863;\n            \n            tmp_79863 = ((__global int64_t *) mem_77968)[gtid_74121 * n_65378 +\n                                                         gtid_74122];\n            ((__local\n              int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)] =\n                tmp_79863;\n        } else {\n            ((__local\n              int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)] =\n                (int64_t) 0;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t x_74124;\n    int64_t x_74125;\n    int64_t x_79864;\n    int64_t x_79865;\n    bool ltid_in_bounds_79867 = slt64(sext_i32_i64(local_tid_79856),\n                                      stage1_num_groups_79825);\n    int32_t skip_threads_79868;\n    \n    // read input for in-block scan\n    {\n        if (ltid_in_bounds_79867) {\n            x_74125 = ((volatile __local\n                        int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)];\n            if ((local_tid_79856 - squot32(local_tid_79856, 32) * 32) == 0) {\n                x_74124 = x_74125;\n            }\n        }\n    }\n    // in-block scan (hopefully no barriers needed)\n    {\n        skip_threads_79868 = 1;\n        while (slt32(skip_threads_79868, 32)) {\n            bool thread_active_79869 = sle32(skip_threads_79868,\n                                             local_tid_79856 -\n                                             squot32(local_tid_79856, 32) *\n                                             32) && ltid_in_bounds_79867;\n            \n            if (thread_active_79869) {\n                // read operands\n                {\n                    x_74124 = ((volatile __local\n                                int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856) -\n                                                               sext_i32_i64(skip_threads_79868)];\n                }\n            }\n            // perform operation\n            {\n                bool inac",
                   "tive_79870 =\n                     slt64(srem64((sext_i32_i64(local_tid_79856) +\n                                   (int64_t) 1) * (segscan_group_sizze_74117 *\n                                                   sdiv_up64(m_65377 * n_65378,\n                                                             sext_i32_i64(num_threads_79826))) -\n                                  (int64_t) 1, n_65378),\n                           (sext_i32_i64(local_tid_79856) + (int64_t) 1) *\n                           (segscan_group_sizze_74117 * sdiv_up64(m_65377 *\n                                                                  n_65378,\n                                                                  sext_i32_i64(num_threads_79826))) -\n                           (int64_t) 1 - ((sext_i32_i64(local_tid_79856 -\n                                           skip_threads_79868) + (int64_t) 1) *\n                                          (segscan_group_sizze_74117 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79826))) -\n                                          (int64_t) 1));\n                \n                if (thread_active_79869 && inactive_79870) {\n                    x_74124 = x_74125;\n                }\n                if (thread_active_79869) {\n                    if (!inactive_79870) {\n                        int64_t defunc_1_op_res_74126 = add64(x_74124, x_74125);\n                        \n                        x_74124 = defunc_1_op_res_74126;\n                    }\n                }\n            }\n            if (sle32(wave_sizze_79858, skip_threads_79868)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            if (thread_active_79869) {\n                // write result\n                {\n                    ((volatile __local\n                      int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)] =\n                        x_74124;\n                    x_74125 ",
                   "= x_74124;\n                }\n            }\n            if (sle32(wave_sizze_79858, skip_threads_79868)) {\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n            skip_threads_79868 *= 2;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // last thread of block 'i' writes its result to offset 'i'\n    {\n        if ((local_tid_79856 - squot32(local_tid_79856, 32) * 32) == 31 &&\n            ltid_in_bounds_79867) {\n            ((volatile __local\n              int64_t *) scan_arr_mem_79860)[sext_i32_i64(squot32(local_tid_79856,\n                                                                  32))] =\n                x_74124;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n    {\n        int32_t skip_threads_79871;\n        \n        // read input for in-block scan\n        {\n            if (squot32(local_tid_79856, 32) == 0 && ltid_in_bounds_79867) {\n                x_79865 = ((volatile __local\n                            int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)];\n                if ((local_tid_79856 - squot32(local_tid_79856, 32) * 32) ==\n                    0) {\n                    x_79864 = x_79865;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_79871 = 1;\n            while (slt32(skip_threads_79871, 32)) {\n                bool thread_active_79872 = sle32(skip_threads_79871,\n                                                 local_tid_79856 -\n                                                 squot32(local_tid_79856, 32) *\n                                                 32) &&\n                     (squot32(local_tid_79856, 32) == 0 &&\n                      ltid_in_bounds_79867);\n                \n                if (thread_active_79872) {\n                    // read operands\n                    {\n                        x_79864 = ((volatile __local\n                  ",
                   "                  int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856) -\n                                                                   sext_i32_i64(skip_threads_79871)];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79873 =\n                         slt64(srem64((sext_i32_i64(local_tid_79856 * 32 + 32 -\n                                       1) + (int64_t) 1) *\n                                      (segscan_group_sizze_74117 *\n                                       sdiv_up64(m_65377 * n_65378,\n                                                 sext_i32_i64(num_threads_79826))) -\n                                      (int64_t) 1, n_65378),\n                               (sext_i32_i64(local_tid_79856 * 32 + 32 - 1) +\n                                (int64_t) 1) * (segscan_group_sizze_74117 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79826))) -\n                               (int64_t) 1 - ((sext_i32_i64((local_tid_79856 -\n                                                             skip_threads_79871) *\n                                               32 + 32 - 1) + (int64_t) 1) *\n                                              (segscan_group_sizze_74117 *\n                                               sdiv_up64(m_65377 * n_65378,\n                                                         sext_i32_i64(num_threads_79826))) -\n                                              (int64_t) 1));\n                    \n                    if (thread_active_79872 && inactive_79873) {\n                        x_79864 = x_79865;\n                    }\n                    if (thread_active_79872) {\n                        if (!inactive_79873) {\n                            int64_t defunc_1_op_res_79866 = add64(x_79864,\n                                                                  x_798",
                   "65);\n                            \n                            x_79864 = defunc_1_op_res_79866;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_79858, skip_threads_79871)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_79872) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)] =\n                            x_79864;\n                        x_79865 = x_79864;\n                    }\n                }\n                if (sle32(wave_sizze_79858, skip_threads_79871)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_79871 *= 2;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    bool no_carry_in_79874 = squot32(local_tid_79856, 32) == 0 ||\n         !ltid_in_bounds_79867;\n    \n    // carry-in for every block except the first\n    {\n        // read operands\n        {\n            if (!no_carry_in_79874) {\n                x_74125 = x_74124;\n                x_74124 = ((__local\n                            int64_t *) scan_arr_mem_79860)[sext_i32_i64(squot32(local_tid_79856,\n                                                                                32)) -\n                                                           (int64_t) 1];\n            }\n        }\n        // perform operation\n        {\n            bool inactive_79875 = slt64(srem64((sext_i32_i64(local_tid_79856) +\n                                                (int64_t) 1) *\n                                               (segscan_group_sizze_74117 *\n                                                sdiv_up64(m_65377 * n_65378,\n                                                          sext_i32_i64(num_threads_79826))) -\n                                               (int64_t) 1, n_65378),\n                       ",
                   "                 (sext_i32_i64(local_tid_79856) +\n                                         (int64_t) 1) *\n                                        (segscan_group_sizze_74117 *\n                                         sdiv_up64(m_65377 * n_65378,\n                                                   sext_i32_i64(num_threads_79826))) -\n                                        (int64_t) 1 -\n                                        ((sext_i32_i64(squot32(local_tid_79856,\n                                                               32) * 32 - 1) +\n                                          (int64_t) 1) *\n                                         (segscan_group_sizze_74117 *\n                                          sdiv_up64(m_65377 * n_65378,\n                                                    sext_i32_i64(num_threads_79826))) -\n                                         (int64_t) 1));\n            \n            if (!no_carry_in_79874) {\n                if (inactive_79875) {\n                    x_74124 = x_74125;\n                }\n            }\n            if (!no_carry_in_79874) {\n                if (!inactive_79875) {\n                    int64_t defunc_1_op_res_74126 = add64(x_74124, x_74125);\n                    \n                    x_74124 = defunc_1_op_res_74126;\n                }\n            }\n        }\n        // write final result\n        {\n            if (!no_carry_in_79874) {\n                ((__local\n                  int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)] =\n                    x_74124;\n            }\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // restore correct values for first block\n    {\n        if (squot32(local_tid_79856, 32) == 0 && ltid_in_bounds_79867) {\n            ((__local\n              int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)] =\n                x_74125;\n        }\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    // threads in bounds write scanned carries\n    {\n        if (slt64(gtid_74121, m_65377) && slt64(gti",
                   "d_74122, n_65378)) {\n            int64_t tmp_79876;\n            \n            tmp_79876 = ((__local\n                          int64_t *) scan_arr_mem_79860)[sext_i32_i64(local_tid_79856)];\n            ((__global int64_t *) mem_77968)[gtid_74121 * n_65378 +\n                                             gtid_74122] = tmp_79876;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_74117\n}\n__kernel void mainziscan_stage3_67884(__global int *global_failure,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t num_groups_67879,\n                                      int32_t num_threads_78359,\n                                      int32_t required_groups_78410, __global\n                                      unsigned char *mem_77116)\n{\n    #define segscan_group_sizze_67878 (mainzisegscan_group_sizze_67858)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78411;\n    int32_t local_tid_78412;\n    int64_t group_sizze_78415;\n    int32_t wave_sizze_78414;\n    int32_t group_tid_78413;\n    \n    global_tid_78411 = get_global_id(0);\n    local_tid_78412 = get_local_id(0);\n    group_sizze_78415 = get_local_size(0);\n    wave_sizze_78414 = LOCKSTEP_WIDTH;\n    group_tid_78413 = get_group_id(0);\n    \n    int32_t phys_tid_67884 = global_tid_78411;\n    int32_t phys_group_id_78416;\n    \n    phys_group_id_78416 = get_group_id(0);\n    for (int32_t i_78417 = 0; i_78417 < sdiv_up32(required_groups_78410 -\n                                                  phys_group_id_78416,\n                                                  sext_i64_i32(num_groups_67879));\n         i_78417++) {\n        int32_t virt_group_id_78418 = phys_group_id_78416 + i_78417 *\n                sext_i64_i32(num_groups_67879);\n        int64_t flat_idx_78419 = sext_i32_i64(virt_group_id_78418) *\n                segscan_group_",
                   "sizze_67878 + sext_i32_i64(local_tid_78412);\n        int64_t gtid_67882 = squot64(flat_idx_78419, n_65378);\n        int64_t gtid_67883 = flat_idx_78419 - squot64(flat_idx_78419, n_65378) *\n                n_65378;\n        int64_t orig_group_78420 = squot64(flat_idx_78419,\n                                           segscan_group_sizze_67878 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_78359)));\n        int64_t carry_in_flat_idx_78421 = orig_group_78420 *\n                (segscan_group_sizze_67878 * sdiv_up64(m_65377 * n_65378,\n                                                       sext_i32_i64(num_threads_78359))) -\n                (int64_t) 1;\n        \n        if (slt64(gtid_67882, m_65377) && slt64(gtid_67883, n_65378)) {\n            if (!(orig_group_78420 == (int64_t) 0 || (flat_idx_78419 ==\n                                                      (orig_group_78420 +\n                                                       (int64_t) 1) *\n                                                      (segscan_group_sizze_67878 *\n                                                       sdiv_up64(m_65377 *\n                                                                 n_65378,\n                                                                 sext_i32_i64(num_threads_78359))) -\n                                                      (int64_t) 1 ||\n                                                      slt64(srem64(flat_idx_78419,\n                                                                   n_65378),\n                                                            flat_idx_78419 -\n                                                            carry_in_flat_idx_78421)))) {\n                int64_t x_67885;\n                int64_t x_67886;\n                \n                x_67885 = ((__global\n                            int64_t *) mem_77116)[squot64(carry_in_flat_idx_78421,\n            ",
                   "                                              n_65378) * n_65378 +\n                                                  (carry_in_flat_idx_78421 -\n                                                   squot64(carry_in_flat_idx_78421,\n                                                           n_65378) * n_65378)];\n                x_67886 = ((__global int64_t *) mem_77116)[gtid_67882 *\n                                                           n_65378 +\n                                                           gtid_67883];\n                \n                int64_t defunc_1_op_res_67887 = add64(x_67885, x_67886);\n                \n                x_67885 = defunc_1_op_res_67887;\n                ((__global int64_t *) mem_77116)[gtid_67882 * n_65378 +\n                                                 gtid_67883] = x_67885;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_67878\n}\n__kernel void mainziscan_stage3_69675(__global int *global_failure,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t num_groups_69670,\n                                      int32_t num_threads_78724,\n                                      int32_t required_groups_78775, __global\n                                      unsigned char *mem_77350)\n{\n    #define segscan_group_sizze_69669 (mainzisegscan_group_sizze_69649)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78776;\n    int32_t local_tid_78777;\n    int64_t group_sizze_78780;\n    int32_t wave_sizze_78779;\n    int32_t group_tid_78778;\n    \n    global_tid_78776 = get_global_id(0);\n    local_tid_78777 = get_local_id(0);\n    group_sizze_78780 = get_local_size(0);\n    wave_sizze_78779 = LOCKSTEP_WIDTH;\n    group_tid_78778 = get_group_id(0);\n    \n    int32_t phys_tid_696",
                   "75 = global_tid_78776;\n    int32_t phys_group_id_78781;\n    \n    phys_group_id_78781 = get_group_id(0);\n    for (int32_t i_78782 = 0; i_78782 < sdiv_up32(required_groups_78775 -\n                                                  phys_group_id_78781,\n                                                  sext_i64_i32(num_groups_69670));\n         i_78782++) {\n        int32_t virt_group_id_78783 = phys_group_id_78781 + i_78782 *\n                sext_i64_i32(num_groups_69670);\n        int64_t flat_idx_78784 = sext_i32_i64(virt_group_id_78783) *\n                segscan_group_sizze_69669 + sext_i32_i64(local_tid_78777);\n        int64_t gtid_69673 = squot64(flat_idx_78784, n_65378);\n        int64_t gtid_69674 = flat_idx_78784 - squot64(flat_idx_78784, n_65378) *\n                n_65378;\n        int64_t orig_group_78785 = squot64(flat_idx_78784,\n                                           segscan_group_sizze_69669 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_78724)));\n        int64_t carry_in_flat_idx_78786 = orig_group_78785 *\n                (segscan_group_sizze_69669 * sdiv_up64(m_65377 * n_65378,\n                                                       sext_i32_i64(num_threads_78724))) -\n                (int64_t) 1;\n        \n        if (slt64(gtid_69673, m_65377) && slt64(gtid_69674, n_65378)) {\n            if (!(orig_group_78785 == (int64_t) 0 || (flat_idx_78784 ==\n                                                      (orig_group_78785 +\n                                                       (int64_t) 1) *\n                                                      (segscan_group_sizze_69669 *\n                                                       sdiv_up64(m_65377 *\n                                                                 n_65378,\n                                                                 sext_i32_i64(num_threads_78724))) -\n                                        ",
                   "              (int64_t) 1 ||\n                                                      slt64(srem64(flat_idx_78784,\n                                                                   n_65378),\n                                                            flat_idx_78784 -\n                                                            carry_in_flat_idx_78786)))) {\n                int64_t x_69676;\n                int64_t x_69677;\n                \n                x_69676 = ((__global\n                            int64_t *) mem_77350)[squot64(carry_in_flat_idx_78786,\n                                                          n_65378) * n_65378 +\n                                                  (carry_in_flat_idx_78786 -\n                                                   squot64(carry_in_flat_idx_78786,\n                                                           n_65378) * n_65378)];\n                x_69677 = ((__global int64_t *) mem_77350)[gtid_69673 *\n                                                           n_65378 +\n                                                           gtid_69674];\n                \n                int64_t defunc_1_op_res_69678 = add64(x_69676, x_69677);\n                \n                x_69676 = defunc_1_op_res_69678;\n                ((__global int64_t *) mem_77350)[gtid_69673 * n_65378 +\n                                                 gtid_69674] = x_69676;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_69669\n}\n__kernel void mainziscan_stage3_71714(__global int *global_failure,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t num_groups_71709,\n                                      int32_t num_threads_79141,\n                                      int32_t required_groups_79192, __global\n                                      unsigned char *mem_77642)\n{\n    #define segscan_group_sizze_7170",
                   "8 (mainzisegscan_group_sizze_71688)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79193;\n    int32_t local_tid_79194;\n    int64_t group_sizze_79197;\n    int32_t wave_sizze_79196;\n    int32_t group_tid_79195;\n    \n    global_tid_79193 = get_global_id(0);\n    local_tid_79194 = get_local_id(0);\n    group_sizze_79197 = get_local_size(0);\n    wave_sizze_79196 = LOCKSTEP_WIDTH;\n    group_tid_79195 = get_group_id(0);\n    \n    int32_t phys_tid_71714 = global_tid_79193;\n    int32_t phys_group_id_79198;\n    \n    phys_group_id_79198 = get_group_id(0);\n    for (int32_t i_79199 = 0; i_79199 < sdiv_up32(required_groups_79192 -\n                                                  phys_group_id_79198,\n                                                  sext_i64_i32(num_groups_71709));\n         i_79199++) {\n        int32_t virt_group_id_79200 = phys_group_id_79198 + i_79199 *\n                sext_i64_i32(num_groups_71709);\n        int64_t flat_idx_79201 = sext_i32_i64(virt_group_id_79200) *\n                segscan_group_sizze_71708 + sext_i32_i64(local_tid_79194);\n        int64_t gtid_71712 = squot64(flat_idx_79201, n_65378);\n        int64_t gtid_71713 = flat_idx_79201 - squot64(flat_idx_79201, n_65378) *\n                n_65378;\n        int64_t orig_group_79202 = squot64(flat_idx_79201,\n                                           segscan_group_sizze_71708 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79141)));\n        int64_t carry_in_flat_idx_79203 = orig_group_79202 *\n                (segscan_group_sizze_71708 * sdiv_up64(m_65377 * n_65378,\n                                                       sext_i32_i64(num_threads_79141))) -\n                (int64_t) 1;\n        \n        if (slt64(gtid_71712, m_65377) && slt64(gtid_71713, n_65378)) {\n            if (!(",
                   "orig_group_79202 == (int64_t) 0 || (flat_idx_79201 ==\n                                                      (orig_group_79202 +\n                                                       (int64_t) 1) *\n                                                      (segscan_group_sizze_71708 *\n                                                       sdiv_up64(m_65377 *\n                                                                 n_65378,\n                                                                 sext_i32_i64(num_threads_79141))) -\n                                                      (int64_t) 1 ||\n                                                      slt64(srem64(flat_idx_79201,\n                                                                   n_65378),\n                                                            flat_idx_79201 -\n                                                            carry_in_flat_idx_79203)))) {\n                int64_t x_71715;\n                int64_t x_71716;\n                \n                x_71715 = ((__global\n                            int64_t *) mem_77642)[squot64(carry_in_flat_idx_79203,\n                                                          n_65378) * n_65378 +\n                                                  (carry_in_flat_idx_79203 -\n                                                   squot64(carry_in_flat_idx_79203,\n                                                           n_65378) * n_65378)];\n                x_71716 = ((__global int64_t *) mem_77642)[gtid_71712 *\n                                                           n_65378 +\n                                                           gtid_71713];\n                \n                int64_t defunc_1_op_res_71717 = add64(x_71715, x_71716);\n                \n                x_71715 = defunc_1_op_res_71717;\n                ((__global int64_t *) mem_77642)[gtid_71712 * n_65378 +\n                                                 gtid_71713] = x_71715;\n            }\n        }\n        barr",
                   "ier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_71708\n}\n__kernel void mainziscan_stage3_72699(__global int *global_failure,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t num_groups_72694,\n                                      int32_t num_threads_79558,\n                                      int32_t required_groups_79609, __global\n                                      unsigned char *mem_77867)\n{\n    #define segscan_group_sizze_72693 (mainzisegscan_group_sizze_72673)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79610;\n    int32_t local_tid_79611;\n    int64_t group_sizze_79614;\n    int32_t wave_sizze_79613;\n    int32_t group_tid_79612;\n    \n    global_tid_79610 = get_global_id(0);\n    local_tid_79611 = get_local_id(0);\n    group_sizze_79614 = get_local_size(0);\n    wave_sizze_79613 = LOCKSTEP_WIDTH;\n    group_tid_79612 = get_group_id(0);\n    \n    int32_t phys_tid_72699 = global_tid_79610;\n    int32_t phys_group_id_79615;\n    \n    phys_group_id_79615 = get_group_id(0);\n    for (int32_t i_79616 = 0; i_79616 < sdiv_up32(required_groups_79609 -\n                                                  phys_group_id_79615,\n                                                  sext_i64_i32(num_groups_72694));\n         i_79616++) {\n        int32_t virt_group_id_79617 = phys_group_id_79615 + i_79616 *\n                sext_i64_i32(num_groups_72694);\n        int64_t flat_idx_79618 = sext_i32_i64(virt_group_id_79617) *\n                segscan_group_sizze_72693 + sext_i32_i64(local_tid_79611);\n        int64_t gtid_72697 = squot64(flat_idx_79618, n_65378);\n        int64_t gtid_72698 = flat_idx_79618 - squot64(flat_idx_79618, n_65378) *\n                n_65378;\n        int64_t orig_group_79619 = squot64(flat_idx_79618,\n              ",
                   "                             segscan_group_sizze_72693 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79558)));\n        int64_t carry_in_flat_idx_79620 = orig_group_79619 *\n                (segscan_group_sizze_72693 * sdiv_up64(m_65377 * n_65378,\n                                                       sext_i32_i64(num_threads_79558))) -\n                (int64_t) 1;\n        \n        if (slt64(gtid_72697, m_65377) && slt64(gtid_72698, n_65378)) {\n            if (!(orig_group_79619 == (int64_t) 0 || (flat_idx_79618 ==\n                                                      (orig_group_79619 +\n                                                       (int64_t) 1) *\n                                                      (segscan_group_sizze_72693 *\n                                                       sdiv_up64(m_65377 *\n                                                                 n_65378,\n                                                                 sext_i32_i64(num_threads_79558))) -\n                                                      (int64_t) 1 ||\n                                                      slt64(srem64(flat_idx_79618,\n                                                                   n_65378),\n                                                            flat_idx_79618 -\n                                                            carry_in_flat_idx_79620)))) {\n                int64_t x_72700;\n                int64_t x_72701;\n                \n                x_72700 = ((__global\n                            int64_t *) mem_77867)[squot64(carry_in_flat_idx_79620,\n                                                          n_65378) * n_65378 +\n                                                  (carry_in_flat_idx_79620 -\n                                                   squot64(carry_in_flat_idx_79620,\n                                                           ",
                   "n_65378) * n_65378)];\n                x_72701 = ((__global int64_t *) mem_77867)[gtid_72697 *\n                                                           n_65378 +\n                                                           gtid_72698];\n                \n                int64_t defunc_1_op_res_72702 = add64(x_72700, x_72701);\n                \n                x_72700 = defunc_1_op_res_72702;\n                ((__global int64_t *) mem_77867)[gtid_72697 * n_65378 +\n                                                 gtid_72698] = x_72700;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_72693\n}\n__kernel void mainziscan_stage3_73366(__global int *global_failure,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t num_groups_73361,\n                                      int32_t num_threads_79689,\n                                      int32_t required_groups_79740, __global\n                                      unsigned char *mem_77914)\n{\n    #define segscan_group_sizze_73360 (mainzisegscan_group_sizze_73340)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79741;\n    int32_t local_tid_79742;\n    int64_t group_sizze_79745;\n    int32_t wave_sizze_79744;\n    int32_t group_tid_79743;\n    \n    global_tid_79741 = get_global_id(0);\n    local_tid_79742 = get_local_id(0);\n    group_sizze_79745 = get_local_size(0);\n    wave_sizze_79744 = LOCKSTEP_WIDTH;\n    group_tid_79743 = get_group_id(0);\n    \n    int32_t phys_tid_73366 = global_tid_79741;\n    int32_t phys_group_id_79746;\n    \n    phys_group_id_79746 = get_group_id(0);\n    for (int32_t i_79747 = 0; i_79747 < sdiv_up32(required_groups_79740 -\n                                                  phys_group_id_79746,\n                                      ",
                   "            sext_i64_i32(num_groups_73361));\n         i_79747++) {\n        int32_t virt_group_id_79748 = phys_group_id_79746 + i_79747 *\n                sext_i64_i32(num_groups_73361);\n        int64_t flat_idx_79749 = sext_i32_i64(virt_group_id_79748) *\n                segscan_group_sizze_73360 + sext_i32_i64(local_tid_79742);\n        int64_t gtid_73364 = squot64(flat_idx_79749, n_65378);\n        int64_t gtid_73365 = flat_idx_79749 - squot64(flat_idx_79749, n_65378) *\n                n_65378;\n        int64_t orig_group_79750 = squot64(flat_idx_79749,\n                                           segscan_group_sizze_73360 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79689)));\n        int64_t carry_in_flat_idx_79751 = orig_group_79750 *\n                (segscan_group_sizze_73360 * sdiv_up64(m_65377 * n_65378,\n                                                       sext_i32_i64(num_threads_79689))) -\n                (int64_t) 1;\n        \n        if (slt64(gtid_73364, m_65377) && slt64(gtid_73365, n_65378)) {\n            if (!(orig_group_79750 == (int64_t) 0 || (flat_idx_79749 ==\n                                                      (orig_group_79750 +\n                                                       (int64_t) 1) *\n                                                      (segscan_group_sizze_73360 *\n                                                       sdiv_up64(m_65377 *\n                                                                 n_65378,\n                                                                 sext_i32_i64(num_threads_79689))) -\n                                                      (int64_t) 1 ||\n                                                      slt64(srem64(flat_idx_79749,\n                                                                   n_65378),\n                                                            flat_idx_79749 -\n                     ",
                   "                                       carry_in_flat_idx_79751)))) {\n                int64_t x_73367;\n                int64_t x_73368;\n                \n                x_73367 = ((__global\n                            int64_t *) mem_77914)[squot64(carry_in_flat_idx_79751,\n                                                          n_65378) * n_65378 +\n                                                  (carry_in_flat_idx_79751 -\n                                                   squot64(carry_in_flat_idx_79751,\n                                                           n_65378) * n_65378)];\n                x_73368 = ((__global int64_t *) mem_77914)[gtid_73364 *\n                                                           n_65378 +\n                                                           gtid_73365];\n                \n                int64_t defunc_1_op_res_73369 = add64(x_73367, x_73368);\n                \n                x_73367 = defunc_1_op_res_73369;\n                ((__global int64_t *) mem_77914)[gtid_73364 * n_65378 +\n                                                 gtid_73365] = x_73367;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_73360\n}\n__kernel void mainziscan_stage3_74123(__global int *global_failure,\n                                      int64_t m_65377, int64_t n_65378,\n                                      int64_t num_groups_74118,\n                                      int32_t num_threads_79826,\n                                      int32_t required_groups_79877, __global\n                                      unsigned char *mem_77968)\n{\n    #define segscan_group_sizze_74117 (mainzisegscan_group_sizze_74097)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79878;\n    int32_t local_tid_79879;\n    int64_t group_sizze_79882;\n    int32_",
                   "t wave_sizze_79881;\n    int32_t group_tid_79880;\n    \n    global_tid_79878 = get_global_id(0);\n    local_tid_79879 = get_local_id(0);\n    group_sizze_79882 = get_local_size(0);\n    wave_sizze_79881 = LOCKSTEP_WIDTH;\n    group_tid_79880 = get_group_id(0);\n    \n    int32_t phys_tid_74123 = global_tid_79878;\n    int32_t phys_group_id_79883;\n    \n    phys_group_id_79883 = get_group_id(0);\n    for (int32_t i_79884 = 0; i_79884 < sdiv_up32(required_groups_79877 -\n                                                  phys_group_id_79883,\n                                                  sext_i64_i32(num_groups_74118));\n         i_79884++) {\n        int32_t virt_group_id_79885 = phys_group_id_79883 + i_79884 *\n                sext_i64_i32(num_groups_74118);\n        int64_t flat_idx_79886 = sext_i32_i64(virt_group_id_79885) *\n                segscan_group_sizze_74117 + sext_i32_i64(local_tid_79879);\n        int64_t gtid_74121 = squot64(flat_idx_79886, n_65378);\n        int64_t gtid_74122 = flat_idx_79886 - squot64(flat_idx_79886, n_65378) *\n                n_65378;\n        int64_t orig_group_79887 = squot64(flat_idx_79886,\n                                           segscan_group_sizze_74117 *\n                                           sdiv_up64(m_65377 * n_65378,\n                                                     sext_i32_i64(num_threads_79826)));\n        int64_t carry_in_flat_idx_79888 = orig_group_79887 *\n                (segscan_group_sizze_74117 * sdiv_up64(m_65377 * n_65378,\n                                                       sext_i32_i64(num_threads_79826))) -\n                (int64_t) 1;\n        \n        if (slt64(gtid_74121, m_65377) && slt64(gtid_74122, n_65378)) {\n            if (!(orig_group_79887 == (int64_t) 0 || (flat_idx_79886 ==\n                                                      (orig_group_79887 +\n                                                       (int64_t) 1) *\n                                                      (segscan_group_sizze_74117 *\n      ",
                   "                                                 sdiv_up64(m_65377 *\n                                                                 n_65378,\n                                                                 sext_i32_i64(num_threads_79826))) -\n                                                      (int64_t) 1 ||\n                                                      slt64(srem64(flat_idx_79886,\n                                                                   n_65378),\n                                                            flat_idx_79886 -\n                                                            carry_in_flat_idx_79888)))) {\n                int64_t x_74124;\n                int64_t x_74125;\n                \n                x_74124 = ((__global\n                            int64_t *) mem_77968)[squot64(carry_in_flat_idx_79888,\n                                                          n_65378) * n_65378 +\n                                                  (carry_in_flat_idx_79888 -\n                                                   squot64(carry_in_flat_idx_79888,\n                                                           n_65378) * n_65378)];\n                x_74125 = ((__global int64_t *) mem_77968)[gtid_74121 *\n                                                           n_65378 +\n                                                           gtid_74122];\n                \n                int64_t defunc_1_op_res_74126 = add64(x_74124, x_74125);\n                \n                x_74124 = defunc_1_op_res_74126;\n                ((__global int64_t *) mem_77968)[gtid_74121 * n_65378 +\n                                                 gtid_74122] = x_74124;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_74117\n}\n__kernel void mainzisegmap_66915(__global int *global_failure,\n                                 int failure_is_an_option, __global\n                                 i",
                   "nt64_t *global_failure_args, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t jump_65382, int64_t n_m_65386,\n                                 int64_t i_65392, unsigned char x_65393_bits,\n                                 int64_t min_res_65398,\n                                 unsigned char loop_cond_65403_bits,\n                                 double i64_res_65404, int64_t num_groups_66911,\n                                 int64_t num_threads_78238, __global\n                                 unsigned char *mem_77017, __global\n                                 unsigned char *mem_77111, __global\n                                 unsigned char *color_78164, __global\n                                 unsigned char *color_78165, __global\n                                 unsigned char *color_78166, __global\n                                 unsigned char *color_78167, __global\n                                 unsigned char *color_78168)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    \n    #define segmap_group_sizze_66910 (mainzisegmap_group_sizze_66731)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_78324;\n    int32_t local_tid_78325;\n    int64_t group_sizze_78328;\n    int32_t wave_sizze_78327;\n    int32_t group_tid_78326;\n    \n    global_tid_78324 = get_global_id(0);\n    local_tid_78325 = get_local_id(0);\n    group_sizze_78328 = get_local_size(0);\n    wave_sizze_78327 = LOCKSTEP_WIDTH;\n    group_tid_78326 = get_group_id(0);\n    \n    int32_t phys_tid_66915 = global_tid_78324;\n    int32_t phys_group_id_78329;\n    \n    phys_group_id_78329 = get_group_id(0);\n ",
                   "   for (int32_t i_78330 = 0; i_78330 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377, segmap_group_sizze_66910)) -\n                   phys_group_id_78329, sext_i64_i32(num_groups_66911));\n         i_78330++) {\n        int32_t virt_group_id_78331 = phys_group_id_78329 + i_78330 *\n                sext_i64_i32(num_groups_66911);\n        int64_t global_tid_78332 = sext_i32_i64(virt_group_id_78331) *\n                segmap_group_sizze_66910 + sext_i32_i64(local_tid_78325);\n        int64_t slice_78333 = m_65377;\n        int64_t gtid_66914 = global_tid_78332;\n        int64_t remnant_78334 = global_tid_78332 - gtid_66914;\n        \n        if (slt64(gtid_66914, m_65377)) {\n            int64_t discard_76825;\n            int64_t scanacc_76821 = (int64_t) 0;\n            \n            for (int64_t i_76823 = 0; i_76823 < n_65378; i_76823++) {\n                double x_66921;\n                \n                x_66921 = ((__global double *) mem_77017)[i_76823 * m_65377 +\n                                                          gtid_66914];\n                \n                bool isnan_res_66922;\n                \n                isnan_res_66922 = futrts_isnan64(x_66921);\n                \n                bool defunc_0_p_res_66923 = !isnan_res_66922;\n                int64_t defunc_0_f_res_66924 =\n                        btoi_bool_i64(defunc_0_p_res_66923);\n                int64_t defunc_1_op_res_66920 = add64(defunc_0_f_res_66924,\n                                                      scanacc_76821);\n                \n                ((__global int64_t *) color_78164)[phys_tid_66915 + i_76823 *\n                                                   num_threads_78238] =\n                    defunc_1_op_res_66920;\n                \n                int64_t scanacc_tmp_78335 = defunc_1_op_res_66920;\n                \n                scanacc_76821 = scanacc_tmp_78335;\n            }\n            discard_76825 = scanacc_76821;\n            \n            int64_t last_res_66925;\n            \n            l",
                   "ast_res_66925 = ((__global int64_t *) color_78164)[phys_tid_66915 +\n                                                                i_65392 *\n                                                                num_threads_78238];\n            for (int64_t i_78337 = 0; i_78337 < n_65378; i_78337++) {\n                ((__global double *) color_78168)[phys_tid_66915 + i_78337 *\n                                                  num_threads_78238] = 0.0;\n            }\n            for (int64_t i_78338 = 0; i_78338 < n_65378; i_78338++) {\n                ((__global int64_t *) color_78167)[phys_tid_66915 + i_78338 *\n                                                   num_threads_78238] =\n                    (int64_t) -1;\n            }\n            for (int64_t write_iter_76826 = 0; write_iter_76826 < n_65378;\n                 write_iter_76826++) {\n                double write_iv_76829;\n                \n                write_iv_76829 = ((__global\n                                   double *) mem_77017)[write_iter_76826 *\n                                                        m_65377 + gtid_66914];\n                \n                bool isnan_res_66933;\n                \n                isnan_res_66933 = futrts_isnan64(write_iv_76829);\n                \n                bool defunc_0_p_res_66934 = !isnan_res_66933;\n                int64_t defunc_1_f_res_66935;\n                \n                if (defunc_0_p_res_66934) {\n                    int64_t write_iv_76830;\n                    \n                    write_iv_76830 = ((__global\n                                       int64_t *) color_78164)[phys_tid_66915 +\n                                                               write_iter_76826 *\n                                                               num_threads_78238];\n                    \n                    int64_t defunc_1_f_res_t_res_66936 = sub64(write_iv_76830,\n                                                               (int64_t) 1);\n                    \n                    d",
                   "efunc_1_f_res_66935 = defunc_1_f_res_t_res_66936;\n                } else {\n                    defunc_1_f_res_66935 = (int64_t) -1;\n                }\n                if (sle64((int64_t) 0, defunc_1_f_res_66935) &&\n                    slt64(defunc_1_f_res_66935, n_65378)) {\n                    ((__global int64_t *) color_78167)[phys_tid_66915 +\n                                                       defunc_1_f_res_66935 *\n                                                       num_threads_78238] =\n                        write_iter_76826;\n                }\n                if (sle64((int64_t) 0, defunc_1_f_res_66935) &&\n                    slt64(defunc_1_f_res_66935, n_65378)) {\n                    for (int64_t i_78341 = 0; i_78341 < (int64_t) 1;\n                         i_78341++) {\n                        double tmp_78342;\n                        \n                        tmp_78342 = ((__global double *) mem_77017)[m_65377 *\n                                                                    write_iter_76826 +\n                                                                    gtid_66914 +\n                                                                    i_78341 *\n                                                                    m_65377];\n                        ((__global double *) color_78168)[phys_tid_66915 +\n                                                          num_threads_78238 *\n                                                          defunc_1_f_res_66935 +\n                                                          i_78341 *\n                                                          num_threads_78238] =\n                            tmp_78342;\n                    }\n                }\n            }\n            for (int64_t i_76836 = 0; i_76836 < n_65378; i_76836++) {\n                int64_t x_66938;\n                \n                x_66938 = ((__global int64_t *) color_78167)[phys_tid_66915 +\n                                                             i_76836",
                   " *\n                                                             num_threads_78238];\n                \n                int64_t defunc_0_f_res_66939 = add64((int64_t) 1, x_66938);\n                \n                ((__global int64_t *) color_78166)[phys_tid_66915 + i_76836 *\n                                                   num_threads_78238] =\n                    defunc_0_f_res_66939;\n            }\n            \n            int64_t min_arg_66940 = sub64(last_res_66925, (int64_t) 1);\n            int64_t min_arg_66941 = sub64(last_res_66925, min_res_65398);\n            int64_t min_res_66942 = smin64(q_65380, last_res_66925);\n            double i64_res_66943 = sitofp_i64_f64(last_res_66925);\n            double x_66944 = i64_res_65404 - i64_res_66943;\n            double max_arg_66945 = x_66944 / 2.0;\n            double max_res_66946 = fmax64(0.0, max_arg_66945);\n            \n            for (int64_t i_76840 = 0; i_76840 < q_65380; i_76840++) {\n                bool cond_66949 = sle64(last_res_66925, i_76840);\n                double defunc_0_f_res_66950;\n                \n                if (cond_66949) {\n                    defunc_0_f_res_66950 = 0.0;\n                } else {\n                    defunc_0_f_res_66950 = 1.0;\n                }\n                ((__global double *) color_78165)[phys_tid_66915 + i_76840 *\n                                                  num_threads_78238] =\n                    defunc_0_f_res_66950;\n            }\n            for (int64_t i_76844 = 0; i_76844 < n_m_65386; i_76844++) {\n                int64_t min_arg_66953 = mul64(jump_65382, i_76844);\n                int64_t min_res_66954 = smin64(i_65392, min_arg_66953);\n                int64_t defunc_0_g_res_66955 = add64((int64_t) 1,\n                                                     min_res_66954);\n                bool init_idx_66956;\n                int64_t init_idx_66957;\n                int64_t init_idx_66958;\n                bool loop_while_66959;\n                int64_t low_66960;\n      ",
                   "          int64_t high_66961;\n                \n                loop_while_66959 = x_65393;\n                low_66960 = (int64_t) 0;\n                high_66961 = i_65392;\n                while (loop_while_66959) {\n                    int64_t x_66962 = add64(low_66960, high_66961);\n                    int64_t mid_66963 = sdiv64(x_66962, (int64_t) 2);\n                    bool x_66964 = sle64((int64_t) 0, mid_66963);\n                    bool y_66965 = slt64(mid_66963, n_65378);\n                    bool bounds_check_66966 = x_66964 && y_66965;\n                    bool index_certs_66967;\n                    \n                    if (!bounds_check_66966) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          0) == -1) {\n                                global_failure_args[0] = (int64_t) mid_66963;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t mid_id_66968;\n                    \n                    mid_id_66968 = ((__global\n                                     int64_t *) color_78166)[phys_tid_66915 +\n                                                             mid_66963 *\n                                                             num_threads_78238];\n                    \n                    bool cond_66969 = slt64(mid_id_66968, (int64_t) 0);\n                    int64_t mid_idx_66970;\n                    \n                    if (cond_66969) {\n                        mid_idx_66970 = (int64_t) 9223372036854775807;\n                    } else {\n                        mid_idx_66970 = mid_id_66968;\n                    }\n                    \n                    bool cond_66971 = sle64(defunc_0_g_re",
                   "s_66955,\n                                            mid_idx_66970);\n                    int64_t loopres_66972;\n                    int64_t loopres_66973;\n                    \n                    if (cond_66971) {\n                        int64_t loopres_t_res_66974 = sub64(mid_66963,\n                                                            (int64_t) 1);\n                        \n                        loopres_66972 = low_66960;\n                        loopres_66973 = loopres_t_res_66974;\n                    } else {\n                        int64_t loopres_f_res_66975 = add64((int64_t) 1,\n                                                            mid_66963);\n                        \n                        loopres_66972 = loopres_f_res_66975;\n                        loopres_66973 = high_66961;\n                    }\n                    \n                    bool loop_cond_66976 = sle64(loopres_66972, loopres_66973);\n                    bool loop_while_tmp_78346 = loop_cond_66976;\n                    int64_t low_tmp_78347 = loopres_66972;\n                    int64_t high_tmp_78348 = loopres_66973;\n                    \n                    loop_while_66959 = loop_while_tmp_78346;\n                    low_66960 = low_tmp_78347;\n                    high_66961 = high_tmp_78348;\n                }\n                init_idx_66956 = loop_while_66959;\n                init_idx_66957 = low_66960;\n                init_idx_66958 = high_66961;\n                \n                bool idx_66977;\n                int64_t idx_66978;\n                int64_t idx_66979;\n                int64_t idx_66980;\n                bool loop_while_66981;\n                int64_t l_idx_66982;\n                int64_t r_idx_66983;\n                int64_t span_66984;\n                \n                loop_while_66981 = loop_cond_65403;\n                l_idx_66982 = init_idx_66957;\n                r_idx_66983 = init_idx_66957;\n                span_66984 = (int64_t) 1;\n                while (loop_while_66981) {\n",
                   "                    int64_t max_arg_66985 = sub64(l_idx_66982, (int64_t) 1);\n                    int64_t max_res_66986 = smax64((int64_t) 0, max_arg_66985);\n                    int64_t min_arg_66987 = add64((int64_t) 1, r_idx_66983);\n                    int64_t min_res_66988 = smin64(min_arg_66940,\n                                                   min_arg_66987);\n                    bool x_66989 = sle64((int64_t) 0, max_res_66986);\n                    bool y_66990 = slt64(max_res_66986, n_65378);\n                    bool bounds_check_66991 = x_66989 && y_66990;\n                    bool index_certs_66992;\n                    \n                    if (!bounds_check_66991) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          1) == -1) {\n                                global_failure_args[0] =\n                                    (int64_t) max_res_66986;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t x_66993;\n                    \n                    x_66993 = ((__global\n                                int64_t *) color_78166)[phys_tid_66915 +\n                                                        max_res_66986 *\n                                                        num_threads_78238];\n                    \n                    int64_t abs_arg_66994 = sub64(x_66993,\n                                                  defunc_0_g_res_66955);\n                    int64_t abs_res_66995 = abs64(abs_arg_66994);\n                    bool x_66996 = sle64((int64_t) 0, min_res_66988);\n                    bool y_66997 = slt64(min_res_66988, n_65378);\n                    bool bounds_check_66998 = x_669",
                   "96 && y_66997;\n                    bool index_certs_66999;\n                    \n                    if (!bounds_check_66998) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          2) == -1) {\n                                global_failure_args[0] =\n                                    (int64_t) min_res_66988;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t x_67000;\n                    \n                    x_67000 = ((__global\n                                int64_t *) color_78166)[phys_tid_66915 +\n                                                        min_res_66988 *\n                                                        num_threads_78238];\n                    \n                    int64_t abs_arg_67001 = sub64(x_67000,\n                                                  defunc_0_g_res_66955);\n                    int64_t abs_res_67002 = abs64(abs_arg_67001);\n                    bool cond_67003 = max_res_66986 == l_idx_66982;\n                    int64_t loopres_67004;\n                    int64_t loopres_67005;\n                    int64_t loopres_67006;\n                    \n                    if (cond_67003) {\n                        loopres_67004 = l_idx_66982;\n                        loopres_67005 = r_idx_66983;\n                        loopres_67006 = min_res_65398;\n                    } else {\n                        bool cond_67007 = slt64(abs_res_66995, abs_res_67002);\n                        bool cond_f_res_67008 = min_res_66988 == r_idx_66983;\n                        bool x_67009 = !cond_67007;\n                        bool y_67010 = cond_f_res_67008 && x_67009;\n                  ",
                   "      bool cond_67011 = cond_67007 || y_67010;\n                        int64_t loopres_f_res_67012;\n                        \n                        if (cond_67011) {\n                            loopres_f_res_67012 = max_res_66986;\n                        } else {\n                            loopres_f_res_67012 = l_idx_66982;\n                        }\n                        \n                        int64_t loopres_f_res_67013;\n                        \n                        if (cond_67011) {\n                            loopres_f_res_67013 = r_idx_66983;\n                        } else {\n                            loopres_f_res_67013 = min_res_66988;\n                        }\n                        \n                        int64_t loopres_f_res_67014;\n                        \n                        if (cond_67011) {\n                            int64_t loopres_f_res_t_res_67015 =\n                                    add64((int64_t) 1, span_66984);\n                            \n                            loopres_f_res_67014 = loopres_f_res_t_res_67015;\n                        } else {\n                            int64_t loopres_f_res_f_res_67016 =\n                                    add64((int64_t) 1, span_66984);\n                            \n                            loopres_f_res_67014 = loopres_f_res_f_res_67016;\n                        }\n                        loopres_67004 = loopres_f_res_67012;\n                        loopres_67005 = loopres_f_res_67013;\n                        loopres_67006 = loopres_f_res_67014;\n                    }\n                    \n                    bool loop_cond_67017 = slt64(loopres_67006, min_res_65398);\n                    bool loop_while_tmp_78349 = loop_cond_67017;\n                    int64_t l_idx_tmp_78350 = loopres_67004;\n                    int64_t r_idx_tmp_78351 = loopres_67005;\n                    int64_t span_tmp_78352 = loopres_67006;\n                    \n                    loop_while_66981 = loop_while_tmp_78349;",
                   "\n                    l_idx_66982 = l_idx_tmp_78350;\n                    r_idx_66983 = r_idx_tmp_78351;\n                    span_66984 = span_tmp_78352;\n                }\n                idx_66977 = loop_while_66981;\n                idx_66978 = l_idx_66982;\n                idx_66979 = r_idx_66983;\n                idx_66980 = span_66984;\n                \n                int64_t min_res_67018 = smin64(min_arg_66941, idx_66978);\n                int64_t max_res_67019 = smax64((int64_t) 0, min_res_67018);\n                int64_t x_67020 = add64(min_res_66942, max_res_67019);\n                int64_t r_67021 = sub64(x_67020, (int64_t) 1);\n                bool x_67022 = sle64((int64_t) 0, r_67021);\n                bool y_67023 = slt64(r_67021, n_65378);\n                bool bounds_check_67024 = x_67022 && y_67023;\n                bool index_certs_67025;\n                \n                if (!bounds_check_67024) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 3) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) r_67021;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_67026;\n                \n                x_67026 = ((__global int64_t *) color_78167)[phys_tid_66915 +\n                                                             r_67021 *\n                                                             num_threads_78238];\n                \n                int64_t abs_arg_67027 = sub64(x_67026, min_res_66954);\n                int64_t abs_res_67028 = abs64(abs_arg_67027);\n                bool x_67029 = sle64((int64_t) 0, max_res_67019);\n                bool y_67030 = slt64(max_res_67019, n_65378);\n                bool bounds_check_67031 = x_6702",
                   "9 && y_67030;\n                bool index_certs_67032;\n                \n                if (!bounds_check_67031) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 4) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) max_res_67019;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_67033;\n                \n                x_67033 = ((__global int64_t *) color_78167)[phys_tid_66915 +\n                                                             max_res_67019 *\n                                                             num_threads_78238];\n                \n                int64_t abs_arg_67034 = sub64(x_67033, min_res_66954);\n                int64_t abs_res_67035 = abs64(abs_arg_67034);\n                int64_t max_res_67036 = smax64(abs_res_67028, abs_res_67035);\n                double defunc_0_f_res_67037 = sitofp_i64_f64(max_res_67036);\n                double defunc_1_f_res_67038 = max_res_66946 +\n                       defunc_0_f_res_67037;\n                double defunc_2_reduce_res_67039;\n                double redout_76846 = 0.0;\n                \n                for (int64_t i_76847 = 0; i_76847 < q_65380; i_76847++) {\n                    double x_67044;\n                    \n                    x_67044 = ((__global double *) color_78165)[phys_tid_66915 +\n                                                                i_76847 *\n                                                                num_threads_78238];\n                    \n                    bool cond_67045 = sle64(last_res_66925, i_76847);\n                    int64_t defunc_0_f_res_67046;\n                    \n                    if (cond_67045) {\n                        d",
                   "efunc_0_f_res_67046 = (int64_t) 0;\n                    } else {\n                        int64_t i_67047 = add64(max_res_67019, i_76847);\n                        int64_t defunc_0_add_arg_67048;\n                        \n                        defunc_0_add_arg_67048 = ((__global\n                                                   int64_t *) color_78167)[phys_tid_66915 +\n                                                                           i_67047 *\n                                                                           num_threads_78238];\n                        \n                        int64_t defunc_1_add_res_67049 = add64((int64_t) 1,\n                                                               defunc_0_add_arg_67048);\n                        \n                        defunc_0_f_res_67046 = defunc_1_add_res_67049;\n                    }\n                    \n                    int64_t binop_p_67050 = sub64(defunc_0_f_res_67046,\n                                                  min_res_66954);\n                    double defunc_0_f_res_67051 = sitofp_i64_f64(binop_p_67050);\n                    double abs_res_67052 = fabs(defunc_0_f_res_67051);\n                    double tmp1_67053 = abs_res_67052 / defunc_1_f_res_67038;\n                    double x_67054 = tmp1_67053 * tmp1_67053;\n                    double y_67055 = tmp1_67053 * x_67054;\n                    double tmp2_67056 = 1.0 - y_67055;\n                    double x_67057 = tmp2_67056 * tmp2_67056;\n                    double tmp3_67058 = tmp2_67056 * x_67057;\n                    double w_j_67059 = x_67044 * tmp3_67058;\n                    double defunc_1_op_res_67042 = w_j_67059 + redout_76846;\n                    double redout_tmp_78353 = defunc_1_op_res_67042;\n                    \n                    redout_76846 = redout_tmp_78353;\n                }\n                defunc_2_reduce_res_67039 = redout_76846;\n                \n                double a0_67060 = 1.0 / defunc_2_reduce_res_67039;\n             ",
                   "   double defunc_2_reduce_res_67061;\n                double redout_76848 = 0.0;\n                \n                for (int64_t i_76849 = 0; i_76849 < q_65380; i_76849++) {\n                    double x_67066;\n                    \n                    x_67066 = ((__global double *) color_78165)[phys_tid_66915 +\n                                                                i_76849 *\n                                                                num_threads_78238];\n                    \n                    bool cond_67067 = sle64(last_res_66925, i_76849);\n                    int64_t defunc_0_f_res_67068;\n                    \n                    if (cond_67067) {\n                        defunc_0_f_res_67068 = (int64_t) 0;\n                    } else {\n                        int64_t i_67069 = add64(max_res_67019, i_76849);\n                        int64_t defunc_0_add_arg_67070;\n                        \n                        defunc_0_add_arg_67070 = ((__global\n                                                   int64_t *) color_78167)[phys_tid_66915 +\n                                                                           i_67069 *\n                                                                           num_threads_78238];\n                        \n                        int64_t defunc_1_add_res_67071 = add64((int64_t) 1,\n                                                               defunc_0_add_arg_67070);\n                        \n                        defunc_0_f_res_67068 = defunc_1_add_res_67071;\n                    }\n                    \n                    int64_t binop_p_67072 = sub64(defunc_0_f_res_67068,\n                                                  min_res_66954);\n                    double defunc_0_f_res_67073 = sitofp_i64_f64(binop_p_67072);\n                    double abs_res_67074 = fabs(defunc_0_f_res_67073);\n                    double tmp1_67075 = abs_res_67074 / defunc_1_f_res_67038;\n                    double x_67076 = tmp1_67075 * tmp1_67075;\n",
                   "                    double y_67077 = tmp1_67075 * x_67076;\n                    double tmp2_67078 = 1.0 - y_67077;\n                    double x_67079 = tmp2_67078 * tmp2_67078;\n                    double tmp3_67080 = tmp2_67078 * x_67079;\n                    double tmp4_67081 = x_67066 * tmp3_67080;\n                    double defunc_0_f_res_67082;\n                    \n                    if (cond_67067) {\n                        defunc_0_f_res_67082 = 0.0;\n                    } else {\n                        int64_t i_67083 = add64(max_res_67019, i_76849);\n                        double defunc_0_add_arg_67084;\n                        \n                        defunc_0_add_arg_67084 = ((__global\n                                                   double *) color_78168)[phys_tid_66915 +\n                                                                          i_67083 *\n                                                                          num_threads_78238];\n                        defunc_0_f_res_67082 = defunc_0_add_arg_67084;\n                    }\n                    \n                    double x_67085 = a0_67060 * tmp4_67081;\n                    double defunc_9_fit_fun_res_67086 = defunc_0_f_res_67082 *\n                           x_67085;\n                    double defunc_1_op_res_67064 = defunc_9_fit_fun_res_67086 +\n                           redout_76848;\n                    double redout_tmp_78354 = defunc_1_op_res_67064;\n                    \n                    redout_76848 = redout_tmp_78354;\n                }\n                defunc_2_reduce_res_67061 = redout_76848;\n                ((__global double *) color_78164)[phys_tid_66915 + i_76844 *\n                                                  num_threads_78238] =\n                    defunc_2_reduce_res_67061;\n            }\n            for (int64_t i_78355 = 0; i_78355 < n_m_65386; i_78355++) {\n                double tmp_78356;\n                \n                tmp_78356 = ((__global double *) color_78164)[phys_t",
                   "id_66915 +\n                                                              i_78355 *\n                                                              num_threads_78238];\n                ((__global double *) mem_77111)[gtid_66914 + i_78355 *\n                                                m_65377] = tmp_78356;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_66910\n}\n__kernel void mainzisegmap_67937(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *Y_mem_77010, __global\n                                 unsigned char *mem_77116, __global\n                                 unsigned char *mem_77120, __global\n                                 unsigned char *mem_77124)\n{\n    #define segmap_group_sizze_67931 (mainzisegmap_group_sizze_67772)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78434;\n    int32_t local_tid_78435;\n    int64_t group_sizze_78438;\n    int32_t wave_sizze_78437;\n    int32_t group_tid_78436;\n    \n    global_tid_78434 = get_global_id(0);\n    local_tid_78435 = get_local_id(0);\n    group_sizze_78438 = get_local_size(0);\n    wave_sizze_78437 = LOCKSTEP_WIDTH;\n    group_tid_78436 = get_group_id(0);\n    \n    int32_t phys_tid_67937 = global_tid_78434;\n    int64_t global_tid_78439 = sext_i32_i64(group_tid_78436) *\n            segmap_group_sizze_67931 + sext_i32_i64(local_tid_78435);\n    int64_t slice_78440 = n_65378;\n    int64_t slice_78441 = m_65377 * slice_78440;\n    int64_t gtid_67935 = squot64(global_tid_78439, slice_78440);\n    int64_t remnant_78442 = global_tid_78439 - gtid_67935 * slice_78440;\n    int64_t gtid_67936 = remnant_78442;\n    int64_t remnant_78443 = remnant_78442 - gtid_67936;\n    \n    if (slt64(gtid_67935, m_65377) && slt64(gti",
                   "d_67936, n_65378)) {\n        double x_67938;\n        \n        x_67938 = ((__global double *) Y_mem_77010)[gtid_67935 * n_65378 +\n                                                    gtid_67936];\n        \n        bool isnan_res_67941;\n        \n        isnan_res_67941 = futrts_isnan64(x_67938);\n        \n        bool defunc_0_p_res_67942 = !isnan_res_67941;\n        int64_t defunc_1_f_res_67943;\n        \n        if (defunc_0_p_res_67942) {\n            int64_t x_67939;\n            \n            x_67939 = ((__global int64_t *) mem_77116)[gtid_67935 * n_65378 +\n                                                       gtid_67936];\n            \n            int64_t defunc_1_f_res_t_res_67944 = sub64(x_67939, (int64_t) 1);\n            \n            defunc_1_f_res_67943 = defunc_1_f_res_t_res_67944;\n        } else {\n            defunc_1_f_res_67943 = (int64_t) -1;\n        }\n        if ((sle64((int64_t) 0, gtid_67935) && slt64(gtid_67935, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_67943) &&\n             slt64(defunc_1_f_res_67943, n_65378))) {\n            ((__global int64_t *) mem_77124)[gtid_67935 * n_65378 +\n                                             defunc_1_f_res_67943] = gtid_67936;\n        }\n        if ((sle64((int64_t) 0, gtid_67935) && slt64(gtid_67935, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_67943) &&\n             slt64(defunc_1_f_res_67943, n_65378))) {\n            ((__global double *) mem_77120)[gtid_67935 * n_65378 +\n                                            defunc_1_f_res_67943] = x_67938;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_67931\n}\n__kernel void mainzisegmap_67956(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *mem_77124, __global\n                                 unsigned char *mem_77130)\n{\n    #define segmap_group_sizze_67951 (mainzisegmap_group_sizze_67746)\n    \n    const int block_dim0",
                   " = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78444;\n    int32_t local_tid_78445;\n    int64_t group_sizze_78448;\n    int32_t wave_sizze_78447;\n    int32_t group_tid_78446;\n    \n    global_tid_78444 = get_global_id(0);\n    local_tid_78445 = get_local_id(0);\n    group_sizze_78448 = get_local_size(0);\n    wave_sizze_78447 = LOCKSTEP_WIDTH;\n    group_tid_78446 = get_group_id(0);\n    \n    int32_t phys_tid_67956 = global_tid_78444;\n    int64_t global_tid_78449 = sext_i32_i64(group_tid_78446) *\n            segmap_group_sizze_67951 + sext_i32_i64(local_tid_78445);\n    int64_t slice_78450 = n_65378;\n    int64_t slice_78451 = m_65377 * slice_78450;\n    int64_t gtid_67954 = squot64(global_tid_78449, slice_78450);\n    int64_t remnant_78452 = global_tid_78449 - gtid_67954 * slice_78450;\n    int64_t gtid_67955 = remnant_78452;\n    int64_t remnant_78453 = remnant_78452 - gtid_67955;\n    \n    if (slt64(gtid_67954, m_65377) && slt64(gtid_67955, n_65378)) {\n        int64_t x_67957;\n        \n        x_67957 = ((__global int64_t *) mem_77124)[gtid_67954 * n_65378 +\n                                                   gtid_67955];\n        \n        int64_t defunc_0_f_res_67958 = add64((int64_t) 1, x_67957);\n        \n        ((__global int64_t *) mem_77130)[gtid_67954 * n_65378 + gtid_67955] =\n            defunc_0_f_res_67958;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_67951\n}\n__kernel void mainzisegmap_67968(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, int64_t min_res_65398,\n                                 double i64_res_65404, __global\n                                 unsigned char *mem_77116, __global\n                                 unsigned char *mem_77134, __global\n                                 unsigned char *mem_77137, __global\n                 ",
                   "                unsigned char *mem_77140, __global\n                                 unsigned char *mem_77143)\n{\n    #define segmap_group_sizze_67961 (mainzisegmap_group_sizze_67720)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78454;\n    int32_t local_tid_78455;\n    int64_t group_sizze_78458;\n    int32_t wave_sizze_78457;\n    int32_t group_tid_78456;\n    \n    global_tid_78454 = get_global_id(0);\n    local_tid_78455 = get_local_id(0);\n    group_sizze_78458 = get_local_size(0);\n    wave_sizze_78457 = LOCKSTEP_WIDTH;\n    group_tid_78456 = get_group_id(0);\n    \n    int32_t phys_tid_67968 = global_tid_78454;\n    int64_t global_tid_78459 = sext_i32_i64(group_tid_78456) *\n            segmap_group_sizze_67961 + sext_i32_i64(local_tid_78455);\n    int64_t slice_78460 = m_65377;\n    int64_t gtid_67967 = global_tid_78459;\n    int64_t remnant_78461 = global_tid_78459 - gtid_67967;\n    \n    if (slt64(gtid_67967, m_65377)) {\n        int64_t last_res_67969;\n        \n        last_res_67969 = ((__global int64_t *) mem_77116)[gtid_67967 * n_65378 +\n                                                          i_65392];\n        \n        int64_t min_arg_67970 = sub64(last_res_67969, (int64_t) 1);\n        int64_t min_arg_67971 = sub64(last_res_67969, min_res_65398);\n        int64_t min_res_67972 = smin64(q_65380, last_res_67969);\n        double i64_res_67973 = sitofp_i64_f64(last_res_67969);\n        double x_67974 = i64_res_65404 - i64_res_67973;\n        double max_arg_67975 = x_67974 / 2.0;\n        double max_res_67976 = fmax64(0.0, max_arg_67975);\n        \n        ((__global int64_t *) mem_77134)[gtid_67967] = min_arg_67970;\n        ((__global int64_t *) mem_77137)[gtid_67967] = min_arg_67971;\n        ((__global int64_t *) mem_77140)[gtid_67967] = min_res_67972;\n        ((__global double *) mem_77143)[gtid_67967] = max_res_67976;\n    }\n    \n  error_0:\n    return;",
                   "\n    #undef segmap_group_sizze_67961\n}\n__kernel void mainzisegmap_67988(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, __global\n                                 unsigned char *mem_77116, __global\n                                 unsigned char *mem_77148)\n{\n    #define segmap_group_sizze_67983 (mainzisegmap_group_sizze_67695)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78462;\n    int32_t local_tid_78463;\n    int64_t group_sizze_78466;\n    int32_t wave_sizze_78465;\n    int32_t group_tid_78464;\n    \n    global_tid_78462 = get_global_id(0);\n    local_tid_78463 = get_local_id(0);\n    group_sizze_78466 = get_local_size(0);\n    wave_sizze_78465 = LOCKSTEP_WIDTH;\n    group_tid_78464 = get_group_id(0);\n    \n    int32_t phys_tid_67988 = global_tid_78462;\n    int64_t global_tid_78467 = sext_i32_i64(group_tid_78464) *\n            segmap_group_sizze_67983 + sext_i32_i64(local_tid_78463);\n    int64_t slice_78468 = q_65380;\n    int64_t slice_78469 = m_65377 * slice_78468;\n    int64_t gtid_67986 = squot64(global_tid_78467, slice_78468);\n    int64_t remnant_78470 = global_tid_78467 - gtid_67986 * slice_78468;\n    int64_t gtid_67987 = remnant_78470;\n    int64_t remnant_78471 = remnant_78470 - gtid_67987;\n    \n    if (slt64(gtid_67986, m_65377) && slt64(gtid_67987, q_65380)) {\n        int64_t last_res_67989;\n        \n        last_res_67989 = ((__global int64_t *) mem_77116)[gtid_67986 * n_65378 +\n                                                          i_65392];\n        \n        bool cond_67991 = sle64(last_res_67989, gtid_67987);\n        double defunc_0_f_res_67992;\n        \n        if (cond_67991) {\n            defunc_0_f_res_67992 = 0.0;\n        } else {\n            defunc_0_f_res_67992 = 1.0;\n        }\n        ((__global double *) mem_77",
                   "148)[gtid_67986 * q_65380 + gtid_67987] =\n            defunc_0_f_res_67992;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_67983\n}\n__kernel void mainzisegmap_68159(__global int *global_failure,\n                                 int failure_is_an_option, __global\n                                 int64_t *global_failure_args, int64_t m_65377,\n                                 int64_t n_65378, int64_t jump_65382,\n                                 int64_t n_m_65386, int64_t i_65392,\n                                 unsigned char x_65393_bits,\n                                 int64_t min_res_65398,\n                                 unsigned char loop_cond_65403_bits, __global\n                                 unsigned char *mem_77124, __global\n                                 unsigned char *mem_77130, __global\n                                 unsigned char *mem_77134, __global\n                                 unsigned char *mem_77137, __global\n                                 unsigned char *mem_77140, __global\n                                 unsigned char *mem_77143, __global\n                                 unsigned char *mem_77200, __global\n                                 unsigned char *mem_77204, __global\n                                 unsigned char *mem_77208)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    \n    #define segmap_group_sizze_68152 (mainzisegmap_group_sizze_67381)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78506;\n    int32_t local_tid_78507;\n    int64_t group_sizze_78510;\n    int32_t wave_sizze_78509;\n    int32_t group_tid_78508;\n    \n    global_tid_78506 = get_global_id(0);\n    local_tid_78507 = get_local_id(0);\n    group_sizze_78510 = get_local_size(0);\n    wave_sizze_78509 = LOCKSTEP_WIDTH;\n    group_tid_78508 = get_group_id(0);\n    \n    int32_t phys_tid_68159 = globa",
                   "l_tid_78506;\n    int64_t global_tid_78511 = sext_i32_i64(group_tid_78508) *\n            segmap_group_sizze_68152 + sext_i32_i64(local_tid_78507);\n    int64_t slice_78512 = n_m_65386;\n    int64_t slice_78513 = m_65377 * slice_78512;\n    int64_t gtid_68157 = squot64(global_tid_78511, slice_78512);\n    int64_t remnant_78514 = global_tid_78511 - gtid_68157 * slice_78512;\n    int64_t gtid_68158 = remnant_78514;\n    int64_t remnant_78515 = remnant_78514 - gtid_68158;\n    \n    if (slt64(gtid_68157, m_65377) && slt64(gtid_68158, n_m_65386)) {\n        int64_t min_arg_68162;\n        \n        min_arg_68162 = ((__global int64_t *) mem_77134)[gtid_68157];\n        \n        int64_t min_arg_68163;\n        \n        min_arg_68163 = ((__global int64_t *) mem_77137)[gtid_68157];\n        \n        int64_t min_res_68164;\n        \n        min_res_68164 = ((__global int64_t *) mem_77140)[gtid_68157];\n        \n        double max_res_68165;\n        \n        max_res_68165 = ((__global double *) mem_77143)[gtid_68157];\n        \n        int64_t min_arg_68167 = mul64(jump_65382, gtid_68158);\n        int64_t min_res_68168 = smin64(i_65392, min_arg_68167);\n        int64_t defunc_0_g_res_68169 = add64((int64_t) 1, min_res_68168);\n        bool init_idx_68170;\n        int64_t init_idx_68171;\n        int64_t init_idx_68172;\n        bool loop_while_68173;\n        int64_t low_68174;\n        int64_t high_68175;\n        \n        loop_while_68173 = x_65393;\n        low_68174 = (int64_t) 0;\n        high_68175 = i_65392;\n        while (loop_while_68173) {\n            int64_t x_68176 = add64(low_68174, high_68175);\n            int64_t mid_68177 = sdiv64(x_68176, (int64_t) 2);\n            bool x_68178 = sle64((int64_t) 0, mid_68177);\n            bool y_68179 = slt64(mid_68177, n_65378);\n            bool bounds_check_68180 = x_68178 && y_68179;\n            bool index_certs_68181;\n            \n            if (!bounds_check_68180) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure",
                   ", -1, 10) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) mid_68177;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t mid_id_68182;\n            \n            mid_id_68182 = ((__global int64_t *) mem_77130)[gtid_68157 *\n                                                            n_65378 +\n                                                            mid_68177];\n            \n            bool cond_68183 = slt64(mid_id_68182, (int64_t) 0);\n            int64_t mid_idx_68184;\n            \n            if (cond_68183) {\n                mid_idx_68184 = (int64_t) 9223372036854775807;\n            } else {\n                mid_idx_68184 = mid_id_68182;\n            }\n            \n            bool cond_68185 = sle64(defunc_0_g_res_68169, mid_idx_68184);\n            int64_t loopres_68186;\n            int64_t loopres_68187;\n            \n            if (cond_68185) {\n                int64_t loopres_t_res_68188 = sub64(mid_68177, (int64_t) 1);\n                \n                loopres_68186 = low_68174;\n                loopres_68187 = loopres_t_res_68188;\n            } else {\n                int64_t loopres_f_res_68189 = add64((int64_t) 1, mid_68177);\n                \n                loopres_68186 = loopres_f_res_68189;\n                loopres_68187 = high_68175;\n            }\n            \n            bool loop_cond_68190 = sle64(loopres_68186, loopres_68187);\n            bool loop_while_tmp_78516 = loop_cond_68190;\n            int64_t low_tmp_78517 = loopres_68186;\n            int64_t high_tmp_78518 = loopres_68187;\n            \n            loop_while_68173 = loop_while_tmp_78516;\n            low_68174 = low_tmp_78517;\n            high_68175 = high_tmp_78518;\n        }\n        init_idx_68170 = loop_while_68173;\n        init_idx_68171 = low_68174;\n        init_idx_68172 = high_68175;\n    ",
                   "    \n        bool idx_68191;\n        int64_t idx_68192;\n        int64_t idx_68193;\n        int64_t idx_68194;\n        bool loop_while_68195;\n        int64_t l_idx_68196;\n        int64_t r_idx_68197;\n        int64_t span_68198;\n        \n        loop_while_68195 = loop_cond_65403;\n        l_idx_68196 = init_idx_68171;\n        r_idx_68197 = init_idx_68171;\n        span_68198 = (int64_t) 1;\n        while (loop_while_68195) {\n            int64_t max_arg_68199 = sub64(l_idx_68196, (int64_t) 1);\n            int64_t max_res_68200 = smax64((int64_t) 0, max_arg_68199);\n            int64_t min_arg_68201 = add64((int64_t) 1, r_idx_68197);\n            int64_t min_res_68202 = smin64(min_arg_68162, min_arg_68201);\n            bool x_68203 = sle64((int64_t) 0, max_res_68200);\n            bool y_68204 = slt64(max_res_68200, n_65378);\n            bool bounds_check_68205 = x_68203 && y_68204;\n            bool index_certs_68206;\n            \n            if (!bounds_check_68205) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 11) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) max_res_68200;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t x_68207;\n            \n            x_68207 = ((__global int64_t *) mem_77130)[gtid_68157 * n_65378 +\n                                                       max_res_68200];\n            \n            int64_t abs_arg_68208 = sub64(x_68207, defunc_0_g_res_68169);\n            int64_t abs_res_68209 = abs64(abs_arg_68208);\n            bool x_68210 = sle64((int64_t) 0, min_res_68202);\n            bool y_68211 = slt64(min_res_68202, n_65378);\n            bool bounds_check_68212 = x_68210 && y_68211;\n            bool index_certs_68213;\n            \n            if (!bounds_check_68212) {\n                {\n                 ",
                   "   if (atomic_cmpxchg_i32_global(global_failure, -1, 12) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) min_res_68202;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t x_68214;\n            \n            x_68214 = ((__global int64_t *) mem_77130)[gtid_68157 * n_65378 +\n                                                       min_res_68202];\n            \n            int64_t abs_arg_68215 = sub64(x_68214, defunc_0_g_res_68169);\n            int64_t abs_res_68216 = abs64(abs_arg_68215);\n            bool cond_68217 = max_res_68200 == l_idx_68196;\n            int64_t loopres_68218;\n            int64_t loopres_68219;\n            int64_t loopres_68220;\n            \n            if (cond_68217) {\n                loopres_68218 = l_idx_68196;\n                loopres_68219 = r_idx_68197;\n                loopres_68220 = min_res_65398;\n            } else {\n                bool cond_68221 = slt64(abs_res_68209, abs_res_68216);\n                bool cond_f_res_68222 = min_res_68202 == r_idx_68197;\n                bool x_68223 = !cond_68221;\n                bool y_68224 = cond_f_res_68222 && x_68223;\n                bool cond_68225 = cond_68221 || y_68224;\n                int64_t loopres_f_res_68226;\n                \n                if (cond_68225) {\n                    loopres_f_res_68226 = max_res_68200;\n                } else {\n                    loopres_f_res_68226 = l_idx_68196;\n                }\n                \n                int64_t loopres_f_res_68227;\n                \n                if (cond_68225) {\n                    loopres_f_res_68227 = r_idx_68197;\n                } else {\n                    loopres_f_res_68227 = min_res_68202;\n                }\n                \n                int64_t loopres_f_res_68228;\n                \n                if (cond_68225) {\n           ",
                   "         int64_t loopres_f_res_t_res_68229 = add64((int64_t) 1,\n                                                              span_68198);\n                    \n                    loopres_f_res_68228 = loopres_f_res_t_res_68229;\n                } else {\n                    int64_t loopres_f_res_f_res_68230 = add64((int64_t) 1,\n                                                              span_68198);\n                    \n                    loopres_f_res_68228 = loopres_f_res_f_res_68230;\n                }\n                loopres_68218 = loopres_f_res_68226;\n                loopres_68219 = loopres_f_res_68227;\n                loopres_68220 = loopres_f_res_68228;\n            }\n            \n            bool loop_cond_68231 = slt64(loopres_68220, min_res_65398);\n            bool loop_while_tmp_78519 = loop_cond_68231;\n            int64_t l_idx_tmp_78520 = loopres_68218;\n            int64_t r_idx_tmp_78521 = loopres_68219;\n            int64_t span_tmp_78522 = loopres_68220;\n            \n            loop_while_68195 = loop_while_tmp_78519;\n            l_idx_68196 = l_idx_tmp_78520;\n            r_idx_68197 = r_idx_tmp_78521;\n            span_68198 = span_tmp_78522;\n        }\n        idx_68191 = loop_while_68195;\n        idx_68192 = l_idx_68196;\n        idx_68193 = r_idx_68197;\n        idx_68194 = span_68198;\n        \n        int64_t min_res_68232 = smin64(min_arg_68163, idx_68192);\n        int64_t max_res_68233 = smax64((int64_t) 0, min_res_68232);\n        int64_t x_68234 = add64(min_res_68164, max_res_68233);\n        int64_t r_68235 = sub64(x_68234, (int64_t) 1);\n        bool x_68236 = sle64((int64_t) 0, r_68235);\n        bool y_68237 = slt64(r_68235, n_65378);\n        bool bounds_check_68238 = x_68236 && y_68237;\n        bool index_certs_68239;\n        \n        if (!bounds_check_68238) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 13) == -1) {\n                    global_failure_args[0] = (int64_t) r_68235;\n                    global_f",
                   "ailure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        int64_t x_68240;\n        \n        x_68240 = ((__global int64_t *) mem_77124)[gtid_68157 * n_65378 +\n                                                   r_68235];\n        \n        int64_t abs_arg_68241 = sub64(x_68240, min_res_68168);\n        int64_t abs_res_68242 = abs64(abs_arg_68241);\n        bool x_68243 = sle64((int64_t) 0, max_res_68233);\n        bool y_68244 = slt64(max_res_68233, n_65378);\n        bool bounds_check_68245 = x_68243 && y_68244;\n        bool index_certs_68246;\n        \n        if (!bounds_check_68245) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 14) == -1) {\n                    global_failure_args[0] = (int64_t) max_res_68233;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        int64_t x_68247;\n        \n        x_68247 = ((__global int64_t *) mem_77124)[gtid_68157 * n_65378 +\n                                                   max_res_68233];\n        \n        int64_t abs_arg_68248 = sub64(x_68247, min_res_68168);\n        int64_t abs_res_68249 = abs64(abs_arg_68248);\n        int64_t max_res_68250 = smax64(abs_res_68242, abs_res_68249);\n        double defunc_0_f_res_68251 = sitofp_i64_f64(max_res_68250);\n        double defunc_1_f_res_68252 = max_res_68165 + defunc_0_f_res_68251;\n        \n        ((__global int64_t *) mem_77200)[gtid_68157 * n_m_65386 + gtid_68158] =\n            min_res_68168;\n        ((__global int64_t *) mem_77204)[gtid_68157 * n_m_65386 + gtid_68158] =\n            max_res_68233;\n        ((__global double *) mem_77208)[gtid_68157 * n_m_65386 + gtid_68158] =\n            defunc_1_f_res_68252;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_68152\n}\n__kernel void mainzisegmap_68300(__global int *global_failure, int64_t m_65377,\n  ",
                   "                               int64_t n_m_65386, __global\n                                 unsigned char *mem_77213, __global\n                                 unsigned char *mem_77218)\n{\n    #define segmap_group_sizze_68295 (mainzisegmap_group_sizze_67323)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78595;\n    int32_t local_tid_78596;\n    int64_t group_sizze_78599;\n    int32_t wave_sizze_78598;\n    int32_t group_tid_78597;\n    \n    global_tid_78595 = get_global_id(0);\n    local_tid_78596 = get_local_id(0);\n    group_sizze_78599 = get_local_size(0);\n    wave_sizze_78598 = LOCKSTEP_WIDTH;\n    group_tid_78597 = get_group_id(0);\n    \n    int32_t phys_tid_68300 = global_tid_78595;\n    int64_t global_tid_78600 = sext_i32_i64(group_tid_78597) *\n            segmap_group_sizze_68295 + sext_i32_i64(local_tid_78596);\n    int64_t slice_78601 = n_m_65386;\n    int64_t slice_78602 = m_65377 * slice_78601;\n    int64_t gtid_68298 = squot64(global_tid_78600, slice_78601);\n    int64_t remnant_78603 = global_tid_78600 - gtid_68298 * slice_78601;\n    int64_t gtid_68299 = remnant_78603;\n    int64_t remnant_78604 = remnant_78603 - gtid_68299;\n    \n    if (slt64(gtid_68298, m_65377) && slt64(gtid_68299, n_m_65386)) {\n        double defunc_2_reduce_res_68301;\n        \n        defunc_2_reduce_res_68301 = ((__global double *) mem_77213)[gtid_68298 *\n                                                                    n_m_65386 +\n                                                                    gtid_68299];\n        \n        double a0_68302 = 1.0 / defunc_2_reduce_res_68301;\n        \n        ((__global double *) mem_77218)[gtid_68298 * n_m_65386 + gtid_68299] =\n            a0_68302;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_68295\n}\n__kernel void mainzisegmap_68572(__global int *global_failure,\n                                 int failure_is_an",
                   "_option, __global\n                                 int64_t *global_failure_args, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t jump_65382, int64_t n_m_65386,\n                                 int64_t i_65392, unsigned char x_65393_bits,\n                                 int64_t min_res_65398,\n                                 unsigned char loop_cond_65403_bits,\n                                 double i64_res_65404, int64_t num_groups_68567,\n                                 int64_t num_threads_78254, __global\n                                 unsigned char *mem_77233, __global\n                                 unsigned char *mem_77342, __global\n                                 unsigned char *mem_77345, __global\n                                 unsigned char *color_78178, __global\n                                 unsigned char *color_78179, __global\n                                 unsigned char *color_78180, __global\n                                 unsigned char *color_78181, __global\n                                 unsigned char *color_78182, __global\n                                 unsigned char *color_78183)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    \n    #define segmap_group_sizze_68566 (mainzisegmap_group_sizze_68358)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_78683;\n    int32_t local_tid_78684;\n    int64_t group_sizze_78687;\n    int32_t wave_sizze_78686;\n    int32_t group_tid_78685;\n    \n    global_tid_78683 = get_global_id(0);\n    local_tid_78684 = get_local_id(0);\n    group_sizze_78687 = get_local_size(0);\n    wave_sizze_78686 =",
                   " LOCKSTEP_WIDTH;\n    group_tid_78685 = get_group_id(0);\n    \n    int32_t phys_tid_68572 = global_tid_78683;\n    int32_t phys_group_id_78688;\n    \n    phys_group_id_78688 = get_group_id(0);\n    for (int32_t i_78689 = 0; i_78689 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377, segmap_group_sizze_68566)) -\n                   phys_group_id_78688, sext_i64_i32(num_groups_68567));\n         i_78689++) {\n        int32_t virt_group_id_78690 = phys_group_id_78688 + i_78689 *\n                sext_i64_i32(num_groups_68567);\n        int64_t global_tid_78691 = sext_i32_i64(virt_group_id_78690) *\n                segmap_group_sizze_68566 + sext_i32_i64(local_tid_78684);\n        int64_t slice_78692 = m_65377;\n        int64_t gtid_68571 = global_tid_78691;\n        int64_t remnant_78693 = global_tid_78691 - gtid_68571;\n        \n        if (slt64(gtid_68571, m_65377)) {\n            int64_t discard_76861;\n            int64_t scanacc_76857 = (int64_t) 0;\n            \n            for (int64_t i_76859 = 0; i_76859 < n_65378; i_76859++) {\n                double x_68578;\n                \n                x_68578 = ((__global double *) mem_77233)[i_76859 * m_65377 +\n                                                          gtid_68571];\n                \n                bool isnan_res_68579;\n                \n                isnan_res_68579 = futrts_isnan64(x_68578);\n                \n                bool defunc_0_p_res_68580 = !isnan_res_68579;\n                int64_t defunc_0_f_res_68581 =\n                        btoi_bool_i64(defunc_0_p_res_68580);\n                int64_t defunc_1_op_res_68577 = add64(defunc_0_f_res_68581,\n                                                      scanacc_76857);\n                \n                ((__global int64_t *) color_78178)[phys_tid_68572 + i_76859 *\n                                                   num_threads_78254] =\n                    defunc_1_op_res_68577;\n                \n                int64_t scanacc_tmp_78694 = defunc_1_op_res_68577;\n          ",
                   "      \n                scanacc_76857 = scanacc_tmp_78694;\n            }\n            discard_76861 = scanacc_76857;\n            \n            int64_t last_res_68582;\n            \n            last_res_68582 = ((__global int64_t *) color_78178)[phys_tid_68572 +\n                                                                i_65392 *\n                                                                num_threads_78254];\n            for (int64_t i_78696 = 0; i_78696 < n_65378; i_78696++) {\n                ((__global double *) color_78183)[phys_tid_68572 + i_78696 *\n                                                  num_threads_78254] = 0.0;\n            }\n            for (int64_t i_78697 = 0; i_78697 < n_65378; i_78697++) {\n                ((__global int64_t *) color_78182)[phys_tid_68572 + i_78697 *\n                                                   num_threads_78254] =\n                    (int64_t) -1;\n            }\n            for (int64_t write_iter_76862 = 0; write_iter_76862 < n_65378;\n                 write_iter_76862++) {\n                double write_iv_76865;\n                \n                write_iv_76865 = ((__global\n                                   double *) mem_77233)[write_iter_76862 *\n                                                        m_65377 + gtid_68571];\n                \n                bool isnan_res_68590;\n                \n                isnan_res_68590 = futrts_isnan64(write_iv_76865);\n                \n                bool defunc_0_p_res_68591 = !isnan_res_68590;\n                int64_t defunc_1_f_res_68592;\n                \n                if (defunc_0_p_res_68591) {\n                    int64_t write_iv_76866;\n                    \n                    write_iv_76866 = ((__global\n                                       int64_t *) color_78178)[phys_tid_68572 +\n                                                               write_iter_76862 *\n                                                               num_threads_78254];\n                    \n        ",
                   "            int64_t defunc_1_f_res_t_res_68593 = sub64(write_iv_76866,\n                                                               (int64_t) 1);\n                    \n                    defunc_1_f_res_68592 = defunc_1_f_res_t_res_68593;\n                } else {\n                    defunc_1_f_res_68592 = (int64_t) -1;\n                }\n                if (sle64((int64_t) 0, defunc_1_f_res_68592) &&\n                    slt64(defunc_1_f_res_68592, n_65378)) {\n                    ((__global int64_t *) color_78182)[phys_tid_68572 +\n                                                       defunc_1_f_res_68592 *\n                                                       num_threads_78254] =\n                        write_iter_76862;\n                }\n                if (sle64((int64_t) 0, defunc_1_f_res_68592) &&\n                    slt64(defunc_1_f_res_68592, n_65378)) {\n                    for (int64_t i_78700 = 0; i_78700 < (int64_t) 1;\n                         i_78700++) {\n                        double tmp_78701;\n                        \n                        tmp_78701 = ((__global double *) mem_77233)[m_65377 *\n                                                                    write_iter_76862 +\n                                                                    gtid_68571 +\n                                                                    i_78700 *\n                                                                    m_65377];\n                        ((__global double *) color_78183)[phys_tid_68572 +\n                                                          num_threads_78254 *\n                                                          defunc_1_f_res_68592 +\n                                                          i_78700 *\n                                                          num_threads_78254] =\n                            tmp_78701;\n                    }\n                }\n            }\n            for (int64_t i_76872 = 0; i_76872 < n_65378; i_76872++) {\n      ",
                   "          int64_t x_68595;\n                \n                x_68595 = ((__global int64_t *) color_78182)[phys_tid_68572 +\n                                                             i_76872 *\n                                                             num_threads_78254];\n                \n                int64_t defunc_0_f_res_68596 = add64((int64_t) 1, x_68595);\n                \n                ((__global int64_t *) color_78181)[phys_tid_68572 + i_76872 *\n                                                   num_threads_78254] =\n                    defunc_0_f_res_68596;\n            }\n            \n            int64_t min_arg_68597 = sub64(last_res_68582, (int64_t) 1);\n            int64_t min_arg_68598 = sub64(last_res_68582, min_res_65398);\n            int64_t min_res_68599 = smin64(q_65380, last_res_68582);\n            double i64_res_68600 = sitofp_i64_f64(last_res_68582);\n            double x_68601 = i64_res_65404 - i64_res_68600;\n            double max_arg_68602 = x_68601 / 2.0;\n            double max_res_68603 = fmax64(0.0, max_arg_68602);\n            \n            for (int64_t i_76876 = 0; i_76876 < q_65380; i_76876++) {\n                bool cond_68606 = sle64(last_res_68582, i_76876);\n                double defunc_0_f_res_68607;\n                \n                if (cond_68606) {\n                    defunc_0_f_res_68607 = 0.0;\n                } else {\n                    defunc_0_f_res_68607 = 1.0;\n                }\n                ((__global double *) color_78180)[phys_tid_68572 + i_76876 *\n                                                  num_threads_78254] =\n                    defunc_0_f_res_68607;\n            }\n            for (int64_t i_76882 = 0; i_76882 < n_m_65386; i_76882++) {\n                int64_t min_arg_68611 = mul64(jump_65382, i_76882);\n                int64_t min_res_68612 = smin64(i_65392, min_arg_68611);\n                int64_t defunc_0_g_res_68613 = add64((int64_t) 1,\n                                                     min_res_68612);\n       ",
                   "         bool init_idx_68614;\n                int64_t init_idx_68615;\n                int64_t init_idx_68616;\n                bool loop_while_68617;\n                int64_t low_68618;\n                int64_t high_68619;\n                \n                loop_while_68617 = x_65393;\n                low_68618 = (int64_t) 0;\n                high_68619 = i_65392;\n                while (loop_while_68617) {\n                    int64_t x_68620 = add64(low_68618, high_68619);\n                    int64_t mid_68621 = sdiv64(x_68620, (int64_t) 2);\n                    bool x_68622 = sle64((int64_t) 0, mid_68621);\n                    bool y_68623 = slt64(mid_68621, n_65378);\n                    bool bounds_check_68624 = x_68622 && y_68623;\n                    bool index_certs_68625;\n                    \n                    if (!bounds_check_68624) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          15) == -1) {\n                                global_failure_args[0] = (int64_t) mid_68621;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t mid_id_68626;\n                    \n                    mid_id_68626 = ((__global\n                                     int64_t *) color_78181)[phys_tid_68572 +\n                                                             mid_68621 *\n                                                             num_threads_78254];\n                    \n                    bool cond_68627 = slt64(mid_id_68626, (int64_t) 0);\n                    int64_t mid_idx_68628;\n                    \n                    if (cond_68627) {\n                        mid_idx_68628 = (int64_t) 9223372036854",
                   "775807;\n                    } else {\n                        mid_idx_68628 = mid_id_68626;\n                    }\n                    \n                    bool cond_68629 = sle64(defunc_0_g_res_68613,\n                                            mid_idx_68628);\n                    int64_t loopres_68630;\n                    int64_t loopres_68631;\n                    \n                    if (cond_68629) {\n                        int64_t loopres_t_res_68632 = sub64(mid_68621,\n                                                            (int64_t) 1);\n                        \n                        loopres_68630 = low_68618;\n                        loopres_68631 = loopres_t_res_68632;\n                    } else {\n                        int64_t loopres_f_res_68633 = add64((int64_t) 1,\n                                                            mid_68621);\n                        \n                        loopres_68630 = loopres_f_res_68633;\n                        loopres_68631 = high_68619;\n                    }\n                    \n                    bool loop_cond_68634 = sle64(loopres_68630, loopres_68631);\n                    bool loop_while_tmp_78706 = loop_cond_68634;\n                    int64_t low_tmp_78707 = loopres_68630;\n                    int64_t high_tmp_78708 = loopres_68631;\n                    \n                    loop_while_68617 = loop_while_tmp_78706;\n                    low_68618 = low_tmp_78707;\n                    high_68619 = high_tmp_78708;\n                }\n                init_idx_68614 = loop_while_68617;\n                init_idx_68615 = low_68618;\n                init_idx_68616 = high_68619;\n                \n                bool idx_68635;\n                int64_t idx_68636;\n                int64_t idx_68637;\n                int64_t idx_68638;\n                bool loop_while_68639;\n                int64_t l_idx_68640;\n                int64_t r_idx_68641;\n                int64_t span_68642;\n                \n                loop_while_68639 = loo",
                   "p_cond_65403;\n                l_idx_68640 = init_idx_68615;\n                r_idx_68641 = init_idx_68615;\n                span_68642 = (int64_t) 1;\n                while (loop_while_68639) {\n                    int64_t max_arg_68643 = sub64(l_idx_68640, (int64_t) 1);\n                    int64_t max_res_68644 = smax64((int64_t) 0, max_arg_68643);\n                    int64_t min_arg_68645 = add64((int64_t) 1, r_idx_68641);\n                    int64_t min_res_68646 = smin64(min_arg_68597,\n                                                   min_arg_68645);\n                    bool x_68647 = sle64((int64_t) 0, max_res_68644);\n                    bool y_68648 = slt64(max_res_68644, n_65378);\n                    bool bounds_check_68649 = x_68647 && y_68648;\n                    bool index_certs_68650;\n                    \n                    if (!bounds_check_68649) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          16) == -1) {\n                                global_failure_args[0] =\n                                    (int64_t) max_res_68644;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t x_68651;\n                    \n                    x_68651 = ((__global\n                                int64_t *) color_78181)[phys_tid_68572 +\n                                                        max_res_68644 *\n                                                        num_threads_78254];\n                    \n                    int64_t abs_arg_68652 = sub64(x_68651,\n                                                  defunc_0_g_res_68613);\n                    int64_t abs_res_68653 = abs64(abs_arg_686",
                   "52);\n                    bool x_68654 = sle64((int64_t) 0, min_res_68646);\n                    bool y_68655 = slt64(min_res_68646, n_65378);\n                    bool bounds_check_68656 = x_68654 && y_68655;\n                    bool index_certs_68657;\n                    \n                    if (!bounds_check_68656) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          17) == -1) {\n                                global_failure_args[0] =\n                                    (int64_t) min_res_68646;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t x_68658;\n                    \n                    x_68658 = ((__global\n                                int64_t *) color_78181)[phys_tid_68572 +\n                                                        min_res_68646 *\n                                                        num_threads_78254];\n                    \n                    int64_t abs_arg_68659 = sub64(x_68658,\n                                                  defunc_0_g_res_68613);\n                    int64_t abs_res_68660 = abs64(abs_arg_68659);\n                    bool cond_68661 = max_res_68644 == l_idx_68640;\n                    int64_t loopres_68662;\n                    int64_t loopres_68663;\n                    int64_t loopres_68664;\n                    \n                    if (cond_68661) {\n                        loopres_68662 = l_idx_68640;\n                        loopres_68663 = r_idx_68641;\n                        loopres_68664 = min_res_65398;\n                    } else {\n                        bool cond_68665 = slt64(abs_res_68653, abs_res_68660);\n                       ",
                   " bool cond_f_res_68666 = min_res_68646 == r_idx_68641;\n                        bool x_68667 = !cond_68665;\n                        bool y_68668 = cond_f_res_68666 && x_68667;\n                        bool cond_68669 = cond_68665 || y_68668;\n                        int64_t loopres_f_res_68670;\n                        \n                        if (cond_68669) {\n                            loopres_f_res_68670 = max_res_68644;\n                        } else {\n                            loopres_f_res_68670 = l_idx_68640;\n                        }\n                        \n                        int64_t loopres_f_res_68671;\n                        \n                        if (cond_68669) {\n                            loopres_f_res_68671 = r_idx_68641;\n                        } else {\n                            loopres_f_res_68671 = min_res_68646;\n                        }\n                        \n                        int64_t loopres_f_res_68672;\n                        \n                        if (cond_68669) {\n                            int64_t loopres_f_res_t_res_68673 =\n                                    add64((int64_t) 1, span_68642);\n                            \n                            loopres_f_res_68672 = loopres_f_res_t_res_68673;\n                        } else {\n                            int64_t loopres_f_res_f_res_68674 =\n                                    add64((int64_t) 1, span_68642);\n                            \n                            loopres_f_res_68672 = loopres_f_res_f_res_68674;\n                        }\n                        loopres_68662 = loopres_f_res_68670;\n                        loopres_68663 = loopres_f_res_68671;\n                        loopres_68664 = loopres_f_res_68672;\n                    }\n                    \n                    bool loop_cond_68675 = slt64(loopres_68664, min_res_65398);\n                    bool loop_while_tmp_78709 = loop_cond_68675;\n                    int64_t l_idx_tmp_78710 = loopres_68662;\n         ",
                   "           int64_t r_idx_tmp_78711 = loopres_68663;\n                    int64_t span_tmp_78712 = loopres_68664;\n                    \n                    loop_while_68639 = loop_while_tmp_78709;\n                    l_idx_68640 = l_idx_tmp_78710;\n                    r_idx_68641 = r_idx_tmp_78711;\n                    span_68642 = span_tmp_78712;\n                }\n                idx_68635 = loop_while_68639;\n                idx_68636 = l_idx_68640;\n                idx_68637 = r_idx_68641;\n                idx_68638 = span_68642;\n                \n                int64_t min_res_68676 = smin64(min_arg_68598, idx_68636);\n                int64_t max_res_68677 = smax64((int64_t) 0, min_res_68676);\n                int64_t x_68678 = add64(min_res_68599, max_res_68677);\n                int64_t r_68679 = sub64(x_68678, (int64_t) 1);\n                bool x_68680 = sle64((int64_t) 0, r_68679);\n                bool y_68681 = slt64(r_68679, n_65378);\n                bool bounds_check_68682 = x_68680 && y_68681;\n                bool index_certs_68683;\n                \n                if (!bounds_check_68682) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 18) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) r_68679;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_68684;\n                \n                x_68684 = ((__global int64_t *) color_78182)[phys_tid_68572 +\n                                                             r_68679 *\n                                                             num_threads_78254];\n                \n                int64_t abs_arg_68685 = sub64(x_68684, min_res_68612);\n                int64_t abs_res_68686 = abs6",
                   "4(abs_arg_68685);\n                bool x_68687 = sle64((int64_t) 0, max_res_68677);\n                bool y_68688 = slt64(max_res_68677, n_65378);\n                bool bounds_check_68689 = x_68687 && y_68688;\n                bool index_certs_68690;\n                \n                if (!bounds_check_68689) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 19) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) max_res_68677;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_68691;\n                \n                x_68691 = ((__global int64_t *) color_78182)[phys_tid_68572 +\n                                                             max_res_68677 *\n                                                             num_threads_78254];\n                \n                int64_t abs_arg_68692 = sub64(x_68691, min_res_68612);\n                int64_t abs_res_68693 = abs64(abs_arg_68692);\n                int64_t max_res_68694 = smax64(abs_res_68686, abs_res_68693);\n                double defunc_0_f_res_68695 = sitofp_i64_f64(max_res_68694);\n                double defunc_1_f_res_68696 = max_res_68603 +\n                       defunc_0_f_res_68695;\n                double defunc_2_reduce_res_68697;\n                double defunc_2_reduce_res_68698;\n                double defunc_2_reduce_res_68699;\n                double redout_76885;\n                double redout_76886;\n                double redout_76887;\n                \n                redout_76885 = 0.0;\n                redout_76886 = 0.0;\n                redout_76887 = 0.0;\n                for (int64_t i_76888 = 0; i_76888 < q_65380; i_76888++) {\n                    double x_68710;\n              ",
                   "      \n                    x_68710 = ((__global double *) color_78180)[phys_tid_68572 +\n                                                                i_76888 *\n                                                                num_threads_78254];\n                    \n                    bool cond_68711 = sle64(last_res_68582, i_76888);\n                    int64_t defunc_0_f_res_68712;\n                    \n                    if (cond_68711) {\n                        defunc_0_f_res_68712 = (int64_t) 0;\n                    } else {\n                        int64_t i_68713 = add64(max_res_68677, i_76888);\n                        int64_t defunc_0_add_arg_68714;\n                        \n                        defunc_0_add_arg_68714 = ((__global\n                                                   int64_t *) color_78182)[phys_tid_68572 +\n                                                                           i_68713 *\n                                                                           num_threads_78254];\n                        \n                        int64_t defunc_1_add_res_68715 = add64((int64_t) 1,\n                                                               defunc_0_add_arg_68714);\n                        \n                        defunc_0_f_res_68712 = defunc_1_add_res_68715;\n                    }\n                    \n                    int64_t binop_p_68716 = sub64(defunc_0_f_res_68712,\n                                                  min_res_68612);\n                    double defunc_0_f_res_68717 = sitofp_i64_f64(binop_p_68716);\n                    double abs_res_68718 = fabs(defunc_0_f_res_68717);\n                    double tmp1_68719 = abs_res_68718 / defunc_1_f_res_68696;\n                    double x_68720 = tmp1_68719 * tmp1_68719;\n                    double y_68721 = tmp1_68719 * x_68720;\n                    double tmp2_68722 = 1.0 - y_68721;\n                    double x_68723 = tmp2_68722 * tmp2_68722;\n                    double tmp3_68724 = tmp2_",
                   "68722 * x_68723;\n                    double w_j_68725 = x_68710 * tmp3_68724;\n                    double xw_j_68726 = defunc_0_f_res_68717 * w_j_68725;\n                    double x2w_j_68727 = defunc_0_f_res_68717 * xw_j_68726;\n                    double defunc_1_op_res_68702 = w_j_68725 + redout_76885;\n                    double defunc_1_op_res_68705 = xw_j_68726 + redout_76886;\n                    double defunc_1_op_res_68708 = x2w_j_68727 + redout_76887;\n                    double redout_tmp_78713 = defunc_1_op_res_68702;\n                    double redout_tmp_78714 = defunc_1_op_res_68705;\n                    double redout_tmp_78715 = defunc_1_op_res_68708;\n                    \n                    redout_76885 = redout_tmp_78713;\n                    redout_76886 = redout_tmp_78714;\n                    redout_76887 = redout_tmp_78715;\n                }\n                defunc_2_reduce_res_68697 = redout_76885;\n                defunc_2_reduce_res_68698 = redout_76886;\n                defunc_2_reduce_res_68699 = redout_76887;\n                \n                double x_68728 = defunc_2_reduce_res_68697 *\n                       defunc_2_reduce_res_68699;\n                double y_68729 = defunc_2_reduce_res_68698 *\n                       defunc_2_reduce_res_68698;\n                double y_68730 = x_68728 - y_68729;\n                double det1_68731 = 1.0 / y_68730;\n                double a11_68732 = defunc_2_reduce_res_68699 * det1_68731;\n                double x_68733 = 0.0 - defunc_2_reduce_res_68698;\n                double b11_68734 = det1_68731 * x_68733;\n                double c11_68735 = defunc_2_reduce_res_68697 * det1_68731;\n                double defunc_2_reduce_res_68736;\n                double defunc_2_reduce_res_68737;\n                double redout_76889;\n                double redout_76890;\n                \n                redout_76889 = 0.0;\n                redout_76890 = 0.0;\n                for (int64_t i_76891 = 0; i_76891 < q_65380; i_76891++) {\n       ",
                   "             double x_68745;\n                    \n                    x_68745 = ((__global double *) color_78180)[phys_tid_68572 +\n                                                                i_76891 *\n                                                                num_threads_78254];\n                    \n                    bool cond_68746 = sle64(last_res_68582, i_76891);\n                    int64_t defunc_0_f_res_68747;\n                    \n                    if (cond_68746) {\n                        defunc_0_f_res_68747 = (int64_t) 0;\n                    } else {\n                        int64_t i_68748 = add64(max_res_68677, i_76891);\n                        int64_t defunc_0_add_arg_68749;\n                        \n                        defunc_0_add_arg_68749 = ((__global\n                                                   int64_t *) color_78182)[phys_tid_68572 +\n                                                                           i_68748 *\n                                                                           num_threads_78254];\n                        \n                        int64_t defunc_1_add_res_68750 = add64((int64_t) 1,\n                                                               defunc_0_add_arg_68749);\n                        \n                        defunc_0_f_res_68747 = defunc_1_add_res_68750;\n                    }\n                    \n                    int64_t binop_p_68751 = sub64(defunc_0_f_res_68747,\n                                                  min_res_68612);\n                    double defunc_0_f_res_68752 = sitofp_i64_f64(binop_p_68751);\n                    double abs_res_68753 = fabs(defunc_0_f_res_68752);\n                    double tmp1_68754 = abs_res_68753 / defunc_1_f_res_68696;\n                    double x_68755 = tmp1_68754 * tmp1_68754;\n                    double y_68756 = tmp1_68754 * x_68755;\n                    double tmp2_68757 = 1.0 - y_68756;\n                    double x_68758 = tmp2_68757 * tmp2_68757;\n  ",
                   "                  double tmp3_68759 = tmp2_68757 * x_68758;\n                    double tmp4_68760 = x_68745 * tmp3_68759;\n                    double defunc_1_f_res_68761 = defunc_0_f_res_68752 *\n                           tmp4_68760;\n                    double defunc_0_f_res_68762;\n                    \n                    if (cond_68746) {\n                        defunc_0_f_res_68762 = 0.0;\n                    } else {\n                        int64_t i_68763 = add64(max_res_68677, i_76891);\n                        double defunc_0_add_arg_68764;\n                        \n                        defunc_0_add_arg_68764 = ((__global\n                                                   double *) color_78183)[phys_tid_68572 +\n                                                                          i_68763 *\n                                                                          num_threads_78254];\n                        defunc_0_f_res_68762 = defunc_0_add_arg_68764;\n                    }\n                    \n                    double x_68765 = a11_68732 * tmp4_68760;\n                    double y_68766 = b11_68734 * defunc_1_f_res_68761;\n                    double x_68767 = x_68765 + y_68766;\n                    double defunc_9_fit_fun_res_68768 = defunc_0_f_res_68762 *\n                           x_68767;\n                    double x_68769 = b11_68734 * tmp4_68760;\n                    double y_68770 = c11_68735 * defunc_1_f_res_68761;\n                    double x_68771 = x_68769 + y_68770;\n                    double defunc_9_slope_fun_res_68772 = defunc_0_f_res_68762 *\n                           x_68771;\n                    double defunc_1_op_res_68740 = defunc_9_fit_fun_res_68768 +\n                           redout_76889;\n                    double defunc_1_op_res_68743 =\n                           defunc_9_slope_fun_res_68772 + redout_76890;\n                    double redout_tmp_78716 = defunc_1_op_res_68740;\n                    double redout_tmp_78717 = defunc_1_op_re",
                   "s_68743;\n                    \n                    redout_76889 = redout_tmp_78716;\n                    redout_76890 = redout_tmp_78717;\n                }\n                defunc_2_reduce_res_68736 = redout_76889;\n                defunc_2_reduce_res_68737 = redout_76890;\n                ((__global double *) color_78179)[phys_tid_68572 + i_76882 *\n                                                  num_threads_78254] =\n                    defunc_2_reduce_res_68736;\n                ((__global double *) color_78178)[phys_tid_68572 + i_76882 *\n                                                  num_threads_78254] =\n                    defunc_2_reduce_res_68737;\n            }\n            for (int64_t i_78718 = 0; i_78718 < n_m_65386; i_78718++) {\n                double tmp_78719;\n                \n                tmp_78719 = ((__global double *) color_78179)[phys_tid_68572 +\n                                                              i_78718 *\n                                                              num_threads_78254];\n                ((__global double *) mem_77342)[gtid_68571 + i_78718 *\n                                                m_65377] = tmp_78719;\n            }\n            for (int64_t i_78720 = 0; i_78720 < n_m_65386; i_78720++) {\n                double tmp_78721;\n                \n                tmp_78721 = ((__global double *) color_78178)[phys_tid_68572 +\n                                                              i_78720 *\n                                                              num_threads_78254];\n                ((__global double *) mem_77345)[gtid_68571 + i_78720 *\n                                                m_65377] = tmp_78721;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_68566\n}\n__kernel void mainzisegmap_69728(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                      ",
                   "           unsigned char *Y_mem_77010, __global\n                                 unsigned char *mem_77350, __global\n                                 unsigned char *mem_77354, __global\n                                 unsigned char *mem_77358)\n{\n    #define segmap_group_sizze_69722 (mainzisegmap_group_sizze_69563)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78787;\n    int32_t local_tid_78788;\n    int64_t group_sizze_78791;\n    int32_t wave_sizze_78790;\n    int32_t group_tid_78789;\n    \n    global_tid_78787 = get_global_id(0);\n    local_tid_78788 = get_local_id(0);\n    group_sizze_78791 = get_local_size(0);\n    wave_sizze_78790 = LOCKSTEP_WIDTH;\n    group_tid_78789 = get_group_id(0);\n    \n    int32_t phys_tid_69728 = global_tid_78787;\n    int64_t global_tid_78792 = sext_i32_i64(group_tid_78789) *\n            segmap_group_sizze_69722 + sext_i32_i64(local_tid_78788);\n    int64_t slice_78793 = n_65378;\n    int64_t slice_78794 = m_65377 * slice_78793;\n    int64_t gtid_69726 = squot64(global_tid_78792, slice_78793);\n    int64_t remnant_78795 = global_tid_78792 - gtid_69726 * slice_78793;\n    int64_t gtid_69727 = remnant_78795;\n    int64_t remnant_78796 = remnant_78795 - gtid_69727;\n    \n    if (slt64(gtid_69726, m_65377) && slt64(gtid_69727, n_65378)) {\n        double x_69729;\n        \n        x_69729 = ((__global double *) Y_mem_77010)[gtid_69726 * n_65378 +\n                                                    gtid_69727];\n        \n        bool isnan_res_69732;\n        \n        isnan_res_69732 = futrts_isnan64(x_69729);\n        \n        bool defunc_0_p_res_69733 = !isnan_res_69732;\n        int64_t defunc_1_f_res_69734;\n        \n        if (defunc_0_p_res_69733) {\n            int64_t x_69730;\n            \n            x_69730 = ((__global int64_t *) mem_77350)[gtid_69726 * n_65378 +\n                                                       gtid_69727",
                   "];\n            \n            int64_t defunc_1_f_res_t_res_69735 = sub64(x_69730, (int64_t) 1);\n            \n            defunc_1_f_res_69734 = defunc_1_f_res_t_res_69735;\n        } else {\n            defunc_1_f_res_69734 = (int64_t) -1;\n        }\n        if ((sle64((int64_t) 0, gtid_69726) && slt64(gtid_69726, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_69734) &&\n             slt64(defunc_1_f_res_69734, n_65378))) {\n            ((__global int64_t *) mem_77358)[gtid_69726 * n_65378 +\n                                             defunc_1_f_res_69734] = gtid_69727;\n        }\n        if ((sle64((int64_t) 0, gtid_69726) && slt64(gtid_69726, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_69734) &&\n             slt64(defunc_1_f_res_69734, n_65378))) {\n            ((__global double *) mem_77354)[gtid_69726 * n_65378 +\n                                            defunc_1_f_res_69734] = x_69729;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_69722\n}\n__kernel void mainzisegmap_69747(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *mem_77358, __global\n                                 unsigned char *mem_77364)\n{\n    #define segmap_group_sizze_69742 (mainzisegmap_group_sizze_69537)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78797;\n    int32_t local_tid_78798;\n    int64_t group_sizze_78801;\n    int32_t wave_sizze_78800;\n    int32_t group_tid_78799;\n    \n    global_tid_78797 = get_global_id(0);\n    local_tid_78798 = get_local_id(0);\n    group_sizze_78801 = get_local_size(0);\n    wave_sizze_78800 = LOCKSTEP_WIDTH;\n    group_tid_78799 = get_group_id(0);\n    \n    int32_t phys_tid_69747 = global_tid_78797;\n    int64_t global_tid_78802 = sext_i32_i64(group_tid_78799) *\n            segmap_group_sizze_6",
                   "9742 + sext_i32_i64(local_tid_78798);\n    int64_t slice_78803 = n_65378;\n    int64_t slice_78804 = m_65377 * slice_78803;\n    int64_t gtid_69745 = squot64(global_tid_78802, slice_78803);\n    int64_t remnant_78805 = global_tid_78802 - gtid_69745 * slice_78803;\n    int64_t gtid_69746 = remnant_78805;\n    int64_t remnant_78806 = remnant_78805 - gtid_69746;\n    \n    if (slt64(gtid_69745, m_65377) && slt64(gtid_69746, n_65378)) {\n        int64_t x_69748;\n        \n        x_69748 = ((__global int64_t *) mem_77358)[gtid_69745 * n_65378 +\n                                                   gtid_69746];\n        \n        int64_t defunc_0_f_res_69749 = add64((int64_t) 1, x_69748);\n        \n        ((__global int64_t *) mem_77364)[gtid_69745 * n_65378 + gtid_69746] =\n            defunc_0_f_res_69749;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_69742\n}\n__kernel void mainzisegmap_69759(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, int64_t min_res_65398,\n                                 double i64_res_65404, __global\n                                 unsigned char *mem_77350, __global\n                                 unsigned char *mem_77368, __global\n                                 unsigned char *mem_77371, __global\n                                 unsigned char *mem_77374, __global\n                                 unsigned char *mem_77377)\n{\n    #define segmap_group_sizze_69752 (mainzisegmap_group_sizze_69511)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78807;\n    int32_t local_tid_78808;\n    int64_t group_sizze_78811;\n    int32_t wave_sizze_78810;\n    int32_t group_tid_78809;\n    \n    global_tid_78807 = get_global_id(0);\n    local_tid_78808 = get_local_id(0);\n    group_sizze_78811 = get_local_size(0);\n    wave_sizze",
                   "_78810 = LOCKSTEP_WIDTH;\n    group_tid_78809 = get_group_id(0);\n    \n    int32_t phys_tid_69759 = global_tid_78807;\n    int64_t global_tid_78812 = sext_i32_i64(group_tid_78809) *\n            segmap_group_sizze_69752 + sext_i32_i64(local_tid_78808);\n    int64_t slice_78813 = m_65377;\n    int64_t gtid_69758 = global_tid_78812;\n    int64_t remnant_78814 = global_tid_78812 - gtid_69758;\n    \n    if (slt64(gtid_69758, m_65377)) {\n        int64_t last_res_69760;\n        \n        last_res_69760 = ((__global int64_t *) mem_77350)[gtid_69758 * n_65378 +\n                                                          i_65392];\n        \n        int64_t min_arg_69761 = sub64(last_res_69760, (int64_t) 1);\n        int64_t min_arg_69762 = sub64(last_res_69760, min_res_65398);\n        int64_t min_res_69763 = smin64(q_65380, last_res_69760);\n        double i64_res_69764 = sitofp_i64_f64(last_res_69760);\n        double x_69765 = i64_res_65404 - i64_res_69764;\n        double max_arg_69766 = x_69765 / 2.0;\n        double max_res_69767 = fmax64(0.0, max_arg_69766);\n        \n        ((__global int64_t *) mem_77368)[gtid_69758] = min_arg_69761;\n        ((__global int64_t *) mem_77371)[gtid_69758] = min_arg_69762;\n        ((__global int64_t *) mem_77374)[gtid_69758] = min_res_69763;\n        ((__global double *) mem_77377)[gtid_69758] = max_res_69767;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_69752\n}\n__kernel void mainzisegmap_69779(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, __global\n                                 unsigned char *mem_77350, __global\n                                 unsigned char *mem_77382)\n{\n    #define segmap_group_sizze_69774 (mainzisegmap_group_sizze_69486)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78815;",
                   "\n    int32_t local_tid_78816;\n    int64_t group_sizze_78819;\n    int32_t wave_sizze_78818;\n    int32_t group_tid_78817;\n    \n    global_tid_78815 = get_global_id(0);\n    local_tid_78816 = get_local_id(0);\n    group_sizze_78819 = get_local_size(0);\n    wave_sizze_78818 = LOCKSTEP_WIDTH;\n    group_tid_78817 = get_group_id(0);\n    \n    int32_t phys_tid_69779 = global_tid_78815;\n    int64_t global_tid_78820 = sext_i32_i64(group_tid_78817) *\n            segmap_group_sizze_69774 + sext_i32_i64(local_tid_78816);\n    int64_t slice_78821 = q_65380;\n    int64_t slice_78822 = m_65377 * slice_78821;\n    int64_t gtid_69777 = squot64(global_tid_78820, slice_78821);\n    int64_t remnant_78823 = global_tid_78820 - gtid_69777 * slice_78821;\n    int64_t gtid_69778 = remnant_78823;\n    int64_t remnant_78824 = remnant_78823 - gtid_69778;\n    \n    if (slt64(gtid_69777, m_65377) && slt64(gtid_69778, q_65380)) {\n        int64_t last_res_69780;\n        \n        last_res_69780 = ((__global int64_t *) mem_77350)[gtid_69777 * n_65378 +\n                                                          i_65392];\n        \n        bool cond_69782 = sle64(last_res_69780, gtid_69778);\n        double defunc_0_f_res_69783;\n        \n        if (cond_69782) {\n            defunc_0_f_res_69783 = 0.0;\n        } else {\n            defunc_0_f_res_69783 = 1.0;\n        }\n        ((__global double *) mem_77382)[gtid_69777 * q_65380 + gtid_69778] =\n            defunc_0_f_res_69783;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_69774\n}\n__kernel void mainzisegmap_69980(__global int *global_failure,\n                                 int failure_is_an_option, __global\n                                 int64_t *global_failure_args, int64_t m_65377,\n                                 int64_t n_65378, int64_t jump_65382,\n                                 int64_t n_m_65386, int64_t i_65392,\n                                 unsigned char x_65393_bits,\n                                 int64_t min_res_65398,\n         ",
                   "                        unsigned char loop_cond_65403_bits, __global\n                                 unsigned char *mem_77358, __global\n                                 unsigned char *mem_77364, __global\n                                 unsigned char *mem_77368, __global\n                                 unsigned char *mem_77371, __global\n                                 unsigned char *mem_77374, __global\n                                 unsigned char *mem_77377, __global\n                                 unsigned char *mem_77465, __global\n                                 unsigned char *mem_77469, __global\n                                 unsigned char *mem_77473)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    \n    #define segmap_group_sizze_69973 (mainzisegmap_group_sizze_69135)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78879;\n    int32_t local_tid_78880;\n    int64_t group_sizze_78883;\n    int32_t wave_sizze_78882;\n    int32_t group_tid_78881;\n    \n    global_tid_78879 = get_global_id(0);\n    local_tid_78880 = get_local_id(0);\n    group_sizze_78883 = get_local_size(0);\n    wave_sizze_78882 = LOCKSTEP_WIDTH;\n    group_tid_78881 = get_group_id(0);\n    \n    int32_t phys_tid_69980 = global_tid_78879;\n    int64_t global_tid_78884 = sext_i32_i64(group_tid_78881) *\n            segmap_group_sizze_69973 + sext_i32_i64(local_tid_78880);\n    int64_t slice_78885 = n_m_65386;\n    int64_t slice_78886 = m_65377 * slice_78885;\n    int64_t gtid_69978 = squot64(global_tid_78884, slice_78885);\n    int64_t remnant_78887 = global_tid_78884 - gtid_69978 * slice_78885;\n    int64_t gtid_69979 = remnant_78887;\n    int64_t remnant_78888 = remnant_78887 - gtid_69979;\n    \n    if (slt64(gtid_69978, m_65377) && slt64(gtid_69979, n_m_65386)) {\n        int64_t min_arg_69983;\n        \n        min_arg_69983 = ((__global int64_t ",
                   "*) mem_77368)[gtid_69978];\n        \n        int64_t min_arg_69984;\n        \n        min_arg_69984 = ((__global int64_t *) mem_77371)[gtid_69978];\n        \n        int64_t min_res_69985;\n        \n        min_res_69985 = ((__global int64_t *) mem_77374)[gtid_69978];\n        \n        double max_res_69986;\n        \n        max_res_69986 = ((__global double *) mem_77377)[gtid_69978];\n        \n        int64_t min_arg_69988 = mul64(jump_65382, gtid_69979);\n        int64_t min_res_69989 = smin64(i_65392, min_arg_69988);\n        int64_t defunc_0_g_res_69990 = add64((int64_t) 1, min_res_69989);\n        bool init_idx_69991;\n        int64_t init_idx_69992;\n        int64_t init_idx_69993;\n        bool loop_while_69994;\n        int64_t low_69995;\n        int64_t high_69996;\n        \n        loop_while_69994 = x_65393;\n        low_69995 = (int64_t) 0;\n        high_69996 = i_65392;\n        while (loop_while_69994) {\n            int64_t x_69997 = add64(low_69995, high_69996);\n            int64_t mid_69998 = sdiv64(x_69997, (int64_t) 2);\n            bool x_69999 = sle64((int64_t) 0, mid_69998);\n            bool y_70000 = slt64(mid_69998, n_65378);\n            bool bounds_check_70001 = x_69999 && y_70000;\n            bool index_certs_70002;\n            \n            if (!bounds_check_70001) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 25) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) mid_69998;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t mid_id_70003;\n            \n            mid_id_70003 = ((__global int64_t *) mem_77364)[gtid_69978 *\n                                                            n_65378 +\n                                                            mid_69998];\n            \n            bool cond_70004 = slt64(mid_id_7000",
                   "3, (int64_t) 0);\n            int64_t mid_idx_70005;\n            \n            if (cond_70004) {\n                mid_idx_70005 = (int64_t) 9223372036854775807;\n            } else {\n                mid_idx_70005 = mid_id_70003;\n            }\n            \n            bool cond_70006 = sle64(defunc_0_g_res_69990, mid_idx_70005);\n            int64_t loopres_70007;\n            int64_t loopres_70008;\n            \n            if (cond_70006) {\n                int64_t loopres_t_res_70009 = sub64(mid_69998, (int64_t) 1);\n                \n                loopres_70007 = low_69995;\n                loopres_70008 = loopres_t_res_70009;\n            } else {\n                int64_t loopres_f_res_70010 = add64((int64_t) 1, mid_69998);\n                \n                loopres_70007 = loopres_f_res_70010;\n                loopres_70008 = high_69996;\n            }\n            \n            bool loop_cond_70011 = sle64(loopres_70007, loopres_70008);\n            bool loop_while_tmp_78889 = loop_cond_70011;\n            int64_t low_tmp_78890 = loopres_70007;\n            int64_t high_tmp_78891 = loopres_70008;\n            \n            loop_while_69994 = loop_while_tmp_78889;\n            low_69995 = low_tmp_78890;\n            high_69996 = high_tmp_78891;\n        }\n        init_idx_69991 = loop_while_69994;\n        init_idx_69992 = low_69995;\n        init_idx_69993 = high_69996;\n        \n        bool idx_70012;\n        int64_t idx_70013;\n        int64_t idx_70014;\n        int64_t idx_70015;\n        bool loop_while_70016;\n        int64_t l_idx_70017;\n        int64_t r_idx_70018;\n        int64_t span_70019;\n        \n        loop_while_70016 = loop_cond_65403;\n        l_idx_70017 = init_idx_69992;\n        r_idx_70018 = init_idx_69992;\n        span_70019 = (int64_t) 1;\n        while (loop_while_70016) {\n            int64_t max_arg_70020 = sub64(l_idx_70017, (int64_t) 1);\n            int64_t max_res_70021 = smax64((int64_t) 0, max_arg_70020);\n            int64_t min_arg_70022 = add64((int64_t) 1, r_i",
                   "dx_70018);\n            int64_t min_res_70023 = smin64(min_arg_69983, min_arg_70022);\n            bool x_70024 = sle64((int64_t) 0, max_res_70021);\n            bool y_70025 = slt64(max_res_70021, n_65378);\n            bool bounds_check_70026 = x_70024 && y_70025;\n            bool index_certs_70027;\n            \n            if (!bounds_check_70026) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 26) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) max_res_70021;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t x_70028;\n            \n            x_70028 = ((__global int64_t *) mem_77364)[gtid_69978 * n_65378 +\n                                                       max_res_70021];\n            \n            int64_t abs_arg_70029 = sub64(x_70028, defunc_0_g_res_69990);\n            int64_t abs_res_70030 = abs64(abs_arg_70029);\n            bool x_70031 = sle64((int64_t) 0, min_res_70023);\n            bool y_70032 = slt64(min_res_70023, n_65378);\n            bool bounds_check_70033 = x_70031 && y_70032;\n            bool index_certs_70034;\n            \n            if (!bounds_check_70033) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 27) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) min_res_70023;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t x_70035;\n            \n            x_70035 = ((__global int64_t *) mem_77364)[gtid_69978 * n_65378 +\n                                                       min_res_70023];\n            \n            int64_t abs_arg_70036 = sub64(x_70035, defunc_0_g_res_6",
                   "9990);\n            int64_t abs_res_70037 = abs64(abs_arg_70036);\n            bool cond_70038 = max_res_70021 == l_idx_70017;\n            int64_t loopres_70039;\n            int64_t loopres_70040;\n            int64_t loopres_70041;\n            \n            if (cond_70038) {\n                loopres_70039 = l_idx_70017;\n                loopres_70040 = r_idx_70018;\n                loopres_70041 = min_res_65398;\n            } else {\n                bool cond_70042 = slt64(abs_res_70030, abs_res_70037);\n                bool cond_f_res_70043 = min_res_70023 == r_idx_70018;\n                bool x_70044 = !cond_70042;\n                bool y_70045 = cond_f_res_70043 && x_70044;\n                bool cond_70046 = cond_70042 || y_70045;\n                int64_t loopres_f_res_70047;\n                \n                if (cond_70046) {\n                    loopres_f_res_70047 = max_res_70021;\n                } else {\n                    loopres_f_res_70047 = l_idx_70017;\n                }\n                \n                int64_t loopres_f_res_70048;\n                \n                if (cond_70046) {\n                    loopres_f_res_70048 = r_idx_70018;\n                } else {\n                    loopres_f_res_70048 = min_res_70023;\n                }\n                \n                int64_t loopres_f_res_70049;\n                \n                if (cond_70046) {\n                    int64_t loopres_f_res_t_res_70050 = add64((int64_t) 1,\n                                                              span_70019);\n                    \n                    loopres_f_res_70049 = loopres_f_res_t_res_70050;\n                } else {\n                    int64_t loopres_f_res_f_res_70051 = add64((int64_t) 1,\n                                                              span_70019);\n                    \n                    loopres_f_res_70049 = loopres_f_res_f_res_70051;\n                }\n                loopres_70039 = loopres_f_res_70047;\n                loopres_70040 = loopres_f_res_70048;\n      ",
                   "          loopres_70041 = loopres_f_res_70049;\n            }\n            \n            bool loop_cond_70052 = slt64(loopres_70041, min_res_65398);\n            bool loop_while_tmp_78892 = loop_cond_70052;\n            int64_t l_idx_tmp_78893 = loopres_70039;\n            int64_t r_idx_tmp_78894 = loopres_70040;\n            int64_t span_tmp_78895 = loopres_70041;\n            \n            loop_while_70016 = loop_while_tmp_78892;\n            l_idx_70017 = l_idx_tmp_78893;\n            r_idx_70018 = r_idx_tmp_78894;\n            span_70019 = span_tmp_78895;\n        }\n        idx_70012 = loop_while_70016;\n        idx_70013 = l_idx_70017;\n        idx_70014 = r_idx_70018;\n        idx_70015 = span_70019;\n        \n        int64_t min_res_70053 = smin64(min_arg_69984, idx_70013);\n        int64_t max_res_70054 = smax64((int64_t) 0, min_res_70053);\n        int64_t x_70055 = add64(min_res_69985, max_res_70054);\n        int64_t r_70056 = sub64(x_70055, (int64_t) 1);\n        bool x_70057 = sle64((int64_t) 0, r_70056);\n        bool y_70058 = slt64(r_70056, n_65378);\n        bool bounds_check_70059 = x_70057 && y_70058;\n        bool index_certs_70060;\n        \n        if (!bounds_check_70059) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 28) == -1) {\n                    global_failure_args[0] = (int64_t) r_70056;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        int64_t x_70061;\n        \n        x_70061 = ((__global int64_t *) mem_77358)[gtid_69978 * n_65378 +\n                                                   r_70056];\n        \n        int64_t abs_arg_70062 = sub64(x_70061, min_res_69989);\n        int64_t abs_res_70063 = abs64(abs_arg_70062);\n        bool x_70064 = sle64((int64_t) 0, max_res_70054);\n        bool y_70065 = slt64(max_res_70054, n_65378);\n        bool bounds_check_70066 = x_70064 && y_70065;\n        bool index_certs_70067",
                   ";\n        \n        if (!bounds_check_70066) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 29) == -1) {\n                    global_failure_args[0] = (int64_t) max_res_70054;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        int64_t x_70068;\n        \n        x_70068 = ((__global int64_t *) mem_77358)[gtid_69978 * n_65378 +\n                                                   max_res_70054];\n        \n        int64_t abs_arg_70069 = sub64(x_70068, min_res_69989);\n        int64_t abs_res_70070 = abs64(abs_arg_70069);\n        int64_t max_res_70071 = smax64(abs_res_70063, abs_res_70070);\n        double defunc_0_f_res_70072 = sitofp_i64_f64(max_res_70071);\n        double defunc_1_f_res_70073 = max_res_69986 + defunc_0_f_res_70072;\n        \n        ((__global int64_t *) mem_77465)[gtid_69978 * n_m_65386 + gtid_69979] =\n            min_res_69989;\n        ((__global int64_t *) mem_77469)[gtid_69978 * n_m_65386 + gtid_69979] =\n            max_res_70054;\n        ((__global double *) mem_77473)[gtid_69978 * n_m_65386 + gtid_69979] =\n            defunc_1_f_res_70073;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_69973\n}\n__kernel void mainzisegmap_70133(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_m_65386, __global\n                                 unsigned char *mem_77478, __global\n                                 unsigned char *mem_77482, __global\n                                 unsigned char *mem_77486, __global\n                                 unsigned char *mem_77491, __global\n                                 unsigned char *mem_77495, __global\n                                 unsigned char *mem_77499)\n{\n    #define segmap_group_sizze_70126 (mainzisegmap_group_sizze_69060)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;",
                   "\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78996;\n    int32_t local_tid_78997;\n    int64_t group_sizze_79000;\n    int32_t wave_sizze_78999;\n    int32_t group_tid_78998;\n    \n    global_tid_78996 = get_global_id(0);\n    local_tid_78997 = get_local_id(0);\n    group_sizze_79000 = get_local_size(0);\n    wave_sizze_78999 = LOCKSTEP_WIDTH;\n    group_tid_78998 = get_group_id(0);\n    \n    int32_t phys_tid_70133 = global_tid_78996;\n    int64_t global_tid_79001 = sext_i32_i64(group_tid_78998) *\n            segmap_group_sizze_70126 + sext_i32_i64(local_tid_78997);\n    int64_t slice_79002 = n_m_65386;\n    int64_t slice_79003 = m_65377 * slice_79002;\n    int64_t gtid_70131 = squot64(global_tid_79001, slice_79002);\n    int64_t remnant_79004 = global_tid_79001 - gtid_70131 * slice_79002;\n    int64_t gtid_70132 = remnant_79004;\n    int64_t remnant_79005 = remnant_79004 - gtid_70132;\n    \n    if (slt64(gtid_70131, m_65377) && slt64(gtid_70132, n_m_65386)) {\n        double defunc_2_reduce_res_70134;\n        \n        defunc_2_reduce_res_70134 = ((__global double *) mem_77478)[gtid_70131 *\n                                                                    n_m_65386 +\n                                                                    gtid_70132];\n        \n        double defunc_2_reduce_res_70135;\n        \n        defunc_2_reduce_res_70135 = ((__global double *) mem_77482)[gtid_70131 *\n                                                                    n_m_65386 +\n                                                                    gtid_70132];\n        \n        double defunc_2_reduce_res_70136;\n        \n        defunc_2_reduce_res_70136 = ((__global double *) mem_77486)[gtid_70131 *\n                                                                    n_m_65386 +\n                                                                    gtid_70132];\n        \n        double x_70137 = defunc_2_reduce_res_70134 * defunc_2_reduce_res_70136;\n        double y_70138",
                   " = defunc_2_reduce_res_70135 * defunc_2_reduce_res_70135;\n        double y_70139 = x_70137 - y_70138;\n        double det1_70140 = 1.0 / y_70139;\n        double a11_70141 = defunc_2_reduce_res_70136 * det1_70140;\n        double x_70142 = 0.0 - defunc_2_reduce_res_70135;\n        double b11_70143 = det1_70140 * x_70142;\n        double c11_70144 = defunc_2_reduce_res_70134 * det1_70140;\n        \n        ((__global double *) mem_77491)[gtid_70131 * n_m_65386 + gtid_70132] =\n            a11_70141;\n        ((__global double *) mem_77495)[gtid_70131 * n_m_65386 + gtid_70132] =\n            b11_70143;\n        ((__global double *) mem_77499)[gtid_70131 * n_m_65386 + gtid_70132] =\n            c11_70144;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_70126\n}\n__kernel void mainzisegmap_70463(__global int *global_failure,\n                                 int failure_is_an_option, __global\n                                 int64_t *global_failure_args, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t jump_65382, int64_t n_m_65386,\n                                 int64_t i_65392, unsigned char x_65393_bits,\n                                 int64_t min_res_65398,\n                                 unsigned char loop_cond_65403_bits,\n                                 double i64_res_65404, int64_t num_groups_70458,\n                                 int64_t num_threads_78271, __global\n                                 unsigned char *mem_77525, __global\n                                 unsigned char *mem_77634, __global\n                                 unsigned char *mem_77637, __global\n                                 unsigned char *color_78201, __global\n                                 unsigned char *color_78202, __global\n                                 unsigned char *color_78203, __global\n                                 unsigned char *color_78204, __global\n                                 unsigne",
                   "d char *color_78205, __global\n                                 unsigned char *color_78206)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    \n    #define segmap_group_sizze_70457 (mainzisegmap_group_sizze_70217)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_79098;\n    int32_t local_tid_79099;\n    int64_t group_sizze_79102;\n    int32_t wave_sizze_79101;\n    int32_t group_tid_79100;\n    \n    global_tid_79098 = get_global_id(0);\n    local_tid_79099 = get_local_id(0);\n    group_sizze_79102 = get_local_size(0);\n    wave_sizze_79101 = LOCKSTEP_WIDTH;\n    group_tid_79100 = get_group_id(0);\n    \n    int32_t phys_tid_70463 = global_tid_79098;\n    int32_t phys_group_id_79103;\n    \n    phys_group_id_79103 = get_group_id(0);\n    for (int32_t i_79104 = 0; i_79104 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377, segmap_group_sizze_70457)) -\n                   phys_group_id_79103, sext_i64_i32(num_groups_70458));\n         i_79104++) {\n        int32_t virt_group_id_79105 = phys_group_id_79103 + i_79104 *\n                sext_i64_i32(num_groups_70458);\n        int64_t global_tid_79106 = sext_i32_i64(virt_group_id_79105) *\n                segmap_group_sizze_70457 + sext_i32_i64(local_tid_79099);\n        int64_t slice_79107 = m_65377;\n        int64_t gtid_70462 = global_tid_79106;\n        int64_t remnant_79108 = global_tid_79106 - gtid_70462;\n        \n        if (slt64(gtid_70462, m_65377)) {\n            int64_t discard_76908;\n            int64_t scanacc_76904 = (int64_t) 0;\n            \n            for (int64_t i_76906 = 0; i_76906 < n_65378; i_76906++) {\n                double x_70469;\n                \n                x_70469 = ((__g",
                   "lobal double *) mem_77525)[i_76906 * m_65377 +\n                                                          gtid_70462];\n                \n                bool isnan_res_70470;\n                \n                isnan_res_70470 = futrts_isnan64(x_70469);\n                \n                bool defunc_0_p_res_70471 = !isnan_res_70470;\n                int64_t defunc_0_f_res_70472 =\n                        btoi_bool_i64(defunc_0_p_res_70471);\n                int64_t defunc_1_op_res_70468 = add64(defunc_0_f_res_70472,\n                                                      scanacc_76904);\n                \n                ((__global int64_t *) color_78201)[phys_tid_70463 + i_76906 *\n                                                   num_threads_78271] =\n                    defunc_1_op_res_70468;\n                \n                int64_t scanacc_tmp_79109 = defunc_1_op_res_70468;\n                \n                scanacc_76904 = scanacc_tmp_79109;\n            }\n            discard_76908 = scanacc_76904;\n            \n            int64_t last_res_70473;\n            \n            last_res_70473 = ((__global int64_t *) color_78201)[phys_tid_70463 +\n                                                                i_65392 *\n                                                                num_threads_78271];\n            for (int64_t i_79111 = 0; i_79111 < n_65378; i_79111++) {\n                ((__global double *) color_78206)[phys_tid_70463 + i_79111 *\n                                                  num_threads_78271] = 0.0;\n            }\n            for (int64_t i_79112 = 0; i_79112 < n_65378; i_79112++) {\n                ((__global int64_t *) color_78205)[phys_tid_70463 + i_79112 *\n                                                   num_threads_78271] =\n                    (int64_t) -1;\n            }\n            for (int64_t write_iter_76909 = 0; write_iter_76909 < n_65378;\n                 write_iter_76909++) {\n                double write_iv_76912;\n                \n                write_i",
                   "v_76912 = ((__global\n                                   double *) mem_77525)[write_iter_76909 *\n                                                        m_65377 + gtid_70462];\n                \n                bool isnan_res_70481;\n                \n                isnan_res_70481 = futrts_isnan64(write_iv_76912);\n                \n                bool defunc_0_p_res_70482 = !isnan_res_70481;\n                int64_t defunc_1_f_res_70483;\n                \n                if (defunc_0_p_res_70482) {\n                    int64_t write_iv_76913;\n                    \n                    write_iv_76913 = ((__global\n                                       int64_t *) color_78201)[phys_tid_70463 +\n                                                               write_iter_76909 *\n                                                               num_threads_78271];\n                    \n                    int64_t defunc_1_f_res_t_res_70484 = sub64(write_iv_76913,\n                                                               (int64_t) 1);\n                    \n                    defunc_1_f_res_70483 = defunc_1_f_res_t_res_70484;\n                } else {\n                    defunc_1_f_res_70483 = (int64_t) -1;\n                }\n                if (sle64((int64_t) 0, defunc_1_f_res_70483) &&\n                    slt64(defunc_1_f_res_70483, n_65378)) {\n                    ((__global int64_t *) color_78205)[phys_tid_70463 +\n                                                       defunc_1_f_res_70483 *\n                                                       num_threads_78271] =\n                        write_iter_76909;\n                }\n                if (sle64((int64_t) 0, defunc_1_f_res_70483) &&\n                    slt64(defunc_1_f_res_70483, n_65378)) {\n                    for (int64_t i_79115 = 0; i_79115 < (int64_t) 1;\n                         i_79115++) {\n                        double tmp_79116;\n                        \n                        tmp_79116 = ((__global double *) mem_77525",
                   ")[m_65377 *\n                                                                    write_iter_76909 +\n                                                                    gtid_70462 +\n                                                                    i_79115 *\n                                                                    m_65377];\n                        ((__global double *) color_78206)[phys_tid_70463 +\n                                                          num_threads_78271 *\n                                                          defunc_1_f_res_70483 +\n                                                          i_79115 *\n                                                          num_threads_78271] =\n                            tmp_79116;\n                    }\n                }\n            }\n            for (int64_t i_76919 = 0; i_76919 < n_65378; i_76919++) {\n                int64_t x_70486;\n                \n                x_70486 = ((__global int64_t *) color_78205)[phys_tid_70463 +\n                                                             i_76919 *\n                                                             num_threads_78271];\n                \n                int64_t defunc_0_f_res_70487 = add64((int64_t) 1, x_70486);\n                \n                ((__global int64_t *) color_78204)[phys_tid_70463 + i_76919 *\n                                                   num_threads_78271] =\n                    defunc_0_f_res_70487;\n            }\n            \n            int64_t min_arg_70488 = sub64(last_res_70473, (int64_t) 1);\n            int64_t min_arg_70489 = sub64(last_res_70473, min_res_65398);\n            int64_t min_res_70490 = smin64(q_65380, last_res_70473);\n            double i64_res_70491 = sitofp_i64_f64(last_res_70473);\n            double x_70492 = i64_res_65404 - i64_res_70491;\n            double max_arg_70493 = x_70492 / 2.0;\n            double max_res_70494 = fmax64(0.0, max_arg_70493);\n            \n            for (int64_t i_76923 = 0; i_769",
                   "23 < q_65380; i_76923++) {\n                bool cond_70497 = sle64(last_res_70473, i_76923);\n                double defunc_0_f_res_70498;\n                \n                if (cond_70497) {\n                    defunc_0_f_res_70498 = 0.0;\n                } else {\n                    defunc_0_f_res_70498 = 1.0;\n                }\n                ((__global double *) color_78203)[phys_tid_70463 + i_76923 *\n                                                  num_threads_78271] =\n                    defunc_0_f_res_70498;\n            }\n            for (int64_t i_76929 = 0; i_76929 < n_m_65386; i_76929++) {\n                int64_t min_arg_70502 = mul64(jump_65382, i_76929);\n                int64_t min_res_70503 = smin64(i_65392, min_arg_70502);\n                int64_t defunc_0_g_res_70504 = add64((int64_t) 1,\n                                                     min_res_70503);\n                bool init_idx_70505;\n                int64_t init_idx_70506;\n                int64_t init_idx_70507;\n                bool loop_while_70508;\n                int64_t low_70509;\n                int64_t high_70510;\n                \n                loop_while_70508 = x_65393;\n                low_70509 = (int64_t) 0;\n                high_70510 = i_65392;\n                while (loop_while_70508) {\n                    int64_t x_70511 = add64(low_70509, high_70510);\n                    int64_t mid_70512 = sdiv64(x_70511, (int64_t) 2);\n                    bool x_70513 = sle64((int64_t) 0, mid_70512);\n                    bool y_70514 = slt64(mid_70512, n_65378);\n                    bool bounds_check_70515 = x_70513 && y_70514;\n                    bool index_certs_70516;\n                    \n                    if (!bounds_check_70515) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          30) == -1) {\n                                global_failure_args[0] = (int64_t) mid_70512;\n              ",
                   "                  global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t mid_id_70517;\n                    \n                    mid_id_70517 = ((__global\n                                     int64_t *) color_78204)[phys_tid_70463 +\n                                                             mid_70512 *\n                                                             num_threads_78271];\n                    \n                    bool cond_70518 = slt64(mid_id_70517, (int64_t) 0);\n                    int64_t mid_idx_70519;\n                    \n                    if (cond_70518) {\n                        mid_idx_70519 = (int64_t) 9223372036854775807;\n                    } else {\n                        mid_idx_70519 = mid_id_70517;\n                    }\n                    \n                    bool cond_70520 = sle64(defunc_0_g_res_70504,\n                                            mid_idx_70519);\n                    int64_t loopres_70521;\n                    int64_t loopres_70522;\n                    \n                    if (cond_70520) {\n                        int64_t loopres_t_res_70523 = sub64(mid_70512,\n                                                            (int64_t) 1);\n                        \n                        loopres_70521 = low_70509;\n                        loopres_70522 = loopres_t_res_70523;\n                    } else {\n                        int64_t loopres_f_res_70524 = add64((int64_t) 1,\n                                                            mid_70512);\n                        \n                        loopres_70521 = loopres_f_res_70524;\n                        loopres_70522 = high_70510;\n                    }\n                    \n                    bool loop_cond_70525 = sle64(loopres_70521, loopres_",
                   "70522);\n                    bool loop_while_tmp_79121 = loop_cond_70525;\n                    int64_t low_tmp_79122 = loopres_70521;\n                    int64_t high_tmp_79123 = loopres_70522;\n                    \n                    loop_while_70508 = loop_while_tmp_79121;\n                    low_70509 = low_tmp_79122;\n                    high_70510 = high_tmp_79123;\n                }\n                init_idx_70505 = loop_while_70508;\n                init_idx_70506 = low_70509;\n                init_idx_70507 = high_70510;\n                \n                bool idx_70526;\n                int64_t idx_70527;\n                int64_t idx_70528;\n                int64_t idx_70529;\n                bool loop_while_70530;\n                int64_t l_idx_70531;\n                int64_t r_idx_70532;\n                int64_t span_70533;\n                \n                loop_while_70530 = loop_cond_65403;\n                l_idx_70531 = init_idx_70506;\n                r_idx_70532 = init_idx_70506;\n                span_70533 = (int64_t) 1;\n                while (loop_while_70530) {\n                    int64_t max_arg_70534 = sub64(l_idx_70531, (int64_t) 1);\n                    int64_t max_res_70535 = smax64((int64_t) 0, max_arg_70534);\n                    int64_t min_arg_70536 = add64((int64_t) 1, r_idx_70532);\n                    int64_t min_res_70537 = smin64(min_arg_70488,\n                                                   min_arg_70536);\n                    bool x_70538 = sle64((int64_t) 0, max_res_70535);\n                    bool y_70539 = slt64(max_res_70535, n_65378);\n                    bool bounds_check_70540 = x_70538 && y_70539;\n                    bool index_certs_70541;\n                    \n                    if (!bounds_check_70540) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          31) == -1) {\n                                global_failure_args[0] =\n          ",
                   "                          (int64_t) max_res_70535;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t x_70542;\n                    \n                    x_70542 = ((__global\n                                int64_t *) color_78204)[phys_tid_70463 +\n                                                        max_res_70535 *\n                                                        num_threads_78271];\n                    \n                    int64_t abs_arg_70543 = sub64(x_70542,\n                                                  defunc_0_g_res_70504);\n                    int64_t abs_res_70544 = abs64(abs_arg_70543);\n                    bool x_70545 = sle64((int64_t) 0, min_res_70537);\n                    bool y_70546 = slt64(min_res_70537, n_65378);\n                    bool bounds_check_70547 = x_70545 && y_70546;\n                    bool index_certs_70548;\n                    \n                    if (!bounds_check_70547) {\n                        {\n                            if (atomic_cmpxchg_i32_global(global_failure, -1,\n                                                          32) == -1) {\n                                global_failure_args[0] =\n                                    (int64_t) min_res_70537;\n                                global_failure_args[1] = (int64_t) n_65378;\n                                ;\n                            }\n                            local_failure = true;\n                            goto error_0;\n                        }\n                    }\n                    \n                    int64_t x_70549;\n                    \n                    x_70549 = ((__global\n                                int64_t *) color_78204)[phys_tid_70463 +\n                             ",
                   "                           min_res_70537 *\n                                                        num_threads_78271];\n                    \n                    int64_t abs_arg_70550 = sub64(x_70549,\n                                                  defunc_0_g_res_70504);\n                    int64_t abs_res_70551 = abs64(abs_arg_70550);\n                    bool cond_70552 = max_res_70535 == l_idx_70531;\n                    int64_t loopres_70553;\n                    int64_t loopres_70554;\n                    int64_t loopres_70555;\n                    \n                    if (cond_70552) {\n                        loopres_70553 = l_idx_70531;\n                        loopres_70554 = r_idx_70532;\n                        loopres_70555 = min_res_65398;\n                    } else {\n                        bool cond_70556 = slt64(abs_res_70544, abs_res_70551);\n                        bool cond_f_res_70557 = min_res_70537 == r_idx_70532;\n                        bool x_70558 = !cond_70556;\n                        bool y_70559 = cond_f_res_70557 && x_70558;\n                        bool cond_70560 = cond_70556 || y_70559;\n                        int64_t loopres_f_res_70561;\n                        \n                        if (cond_70560) {\n                            loopres_f_res_70561 = max_res_70535;\n                        } else {\n                            loopres_f_res_70561 = l_idx_70531;\n                        }\n                        \n                        int64_t loopres_f_res_70562;\n                        \n                        if (cond_70560) {\n                            loopres_f_res_70562 = r_idx_70532;\n                        } else {\n                            loopres_f_res_70562 = min_res_70537;\n                        }\n                        \n                        int64_t loopres_f_res_70563;\n                        \n                        if (cond_70560) {\n                            int64_t loopres_f_res_t_res_70564 =\n                          ",
                   "          add64((int64_t) 1, span_70533);\n                            \n                            loopres_f_res_70563 = loopres_f_res_t_res_70564;\n                        } else {\n                            int64_t loopres_f_res_f_res_70565 =\n                                    add64((int64_t) 1, span_70533);\n                            \n                            loopres_f_res_70563 = loopres_f_res_f_res_70565;\n                        }\n                        loopres_70553 = loopres_f_res_70561;\n                        loopres_70554 = loopres_f_res_70562;\n                        loopres_70555 = loopres_f_res_70563;\n                    }\n                    \n                    bool loop_cond_70566 = slt64(loopres_70555, min_res_65398);\n                    bool loop_while_tmp_79124 = loop_cond_70566;\n                    int64_t l_idx_tmp_79125 = loopres_70553;\n                    int64_t r_idx_tmp_79126 = loopres_70554;\n                    int64_t span_tmp_79127 = loopres_70555;\n                    \n                    loop_while_70530 = loop_while_tmp_79124;\n                    l_idx_70531 = l_idx_tmp_79125;\n                    r_idx_70532 = r_idx_tmp_79126;\n                    span_70533 = span_tmp_79127;\n                }\n                idx_70526 = loop_while_70530;\n                idx_70527 = l_idx_70531;\n                idx_70528 = r_idx_70532;\n                idx_70529 = span_70533;\n                \n                int64_t min_res_70567 = smin64(min_arg_70489, idx_70527);\n                int64_t max_res_70568 = smax64((int64_t) 0, min_res_70567);\n                int64_t x_70569 = add64(min_res_70490, max_res_70568);\n                int64_t r_70570 = sub64(x_70569, (int64_t) 1);\n                bool x_70571 = sle64((int64_t) 0, r_70570);\n                bool y_70572 = slt64(r_70570, n_65378);\n                bool bounds_check_70573 = x_70571 && y_70572;\n                bool index_certs_70574;\n                \n                if (!bounds_check_70573) {\n    ",
                   "                {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 33) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) r_70570;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_70575;\n                \n                x_70575 = ((__global int64_t *) color_78205)[phys_tid_70463 +\n                                                             r_70570 *\n                                                             num_threads_78271];\n                \n                int64_t abs_arg_70576 = sub64(x_70575, min_res_70503);\n                int64_t abs_res_70577 = abs64(abs_arg_70576);\n                bool x_70578 = sle64((int64_t) 0, max_res_70568);\n                bool y_70579 = slt64(max_res_70568, n_65378);\n                bool bounds_check_70580 = x_70578 && y_70579;\n                bool index_certs_70581;\n                \n                if (!bounds_check_70580) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 34) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) max_res_70568;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_70582;\n                \n                x_70582 = ((__global int64_t *) color_78205)[phys_tid_70463 +\n                                                             max_res_70568 *\n                                                             num_threads_78271];\n                \n                int",
                   "64_t abs_arg_70583 = sub64(x_70582, min_res_70503);\n                int64_t abs_res_70584 = abs64(abs_arg_70583);\n                int64_t max_res_70585 = smax64(abs_res_70577, abs_res_70584);\n                double defunc_0_f_res_70586 = sitofp_i64_f64(max_res_70585);\n                double defunc_1_f_res_70587 = max_res_70494 +\n                       defunc_0_f_res_70586;\n                double defunc_2_reduce_res_70588;\n                double defunc_2_reduce_res_70589;\n                double defunc_2_reduce_res_70590;\n                double defunc_2_reduce_res_70591;\n                double defunc_2_reduce_res_70592;\n                double redout_76932;\n                double redout_76933;\n                double redout_76934;\n                double redout_76935;\n                double redout_76936;\n                \n                redout_76932 = 0.0;\n                redout_76933 = 0.0;\n                redout_76934 = 0.0;\n                redout_76935 = 0.0;\n                redout_76936 = 0.0;\n                for (int64_t i_76937 = 0; i_76937 < q_65380; i_76937++) {\n                    double x_70609;\n                    \n                    x_70609 = ((__global double *) color_78203)[phys_tid_70463 +\n                                                                i_76937 *\n                                                                num_threads_78271];\n                    \n                    bool cond_70610 = sle64(last_res_70473, i_76937);\n                    int64_t defunc_0_f_res_70611;\n                    \n                    if (cond_70610) {\n                        defunc_0_f_res_70611 = (int64_t) 0;\n                    } else {\n                        int64_t i_70612 = add64(max_res_70568, i_76937);\n                        int64_t defunc_0_add_arg_70613;\n                        \n                        defunc_0_add_arg_70613 = ((__global\n                                                   int64_t *) color_78205)[phys_tid_70463 +\n                           ",
                   "                                                i_70612 *\n                                                                           num_threads_78271];\n                        \n                        int64_t defunc_1_add_res_70614 = add64((int64_t) 1,\n                                                               defunc_0_add_arg_70613);\n                        \n                        defunc_0_f_res_70611 = defunc_1_add_res_70614;\n                    }\n                    \n                    int64_t binop_p_70615 = sub64(defunc_0_f_res_70611,\n                                                  min_res_70503);\n                    double defunc_0_f_res_70616 = sitofp_i64_f64(binop_p_70615);\n                    double abs_res_70617 = fabs(defunc_0_f_res_70616);\n                    double tmp1_70618 = abs_res_70617 / defunc_1_f_res_70587;\n                    double x_70619 = tmp1_70618 * tmp1_70618;\n                    double y_70620 = tmp1_70618 * x_70619;\n                    double tmp2_70621 = 1.0 - y_70620;\n                    double x_70622 = tmp2_70621 * tmp2_70621;\n                    double tmp3_70623 = tmp2_70621 * x_70622;\n                    double w_j_70624 = x_70609 * tmp3_70623;\n                    double xw_j_70625 = defunc_0_f_res_70616 * w_j_70624;\n                    double x2w_j_70626 = defunc_0_f_res_70616 * xw_j_70625;\n                    double x3w_j_70627 = defunc_0_f_res_70616 * x2w_j_70626;\n                    double x4w_j_70628 = defunc_0_f_res_70616 * x3w_j_70627;\n                    double defunc_1_op_res_70595 = w_j_70624 + redout_76932;\n                    double defunc_1_op_res_70598 = xw_j_70625 + redout_76933;\n                    double defunc_1_op_res_70601 = x2w_j_70626 + redout_76934;\n                    double defunc_1_op_res_70604 = x3w_j_70627 + redout_76935;\n                    double defunc_1_op_res_70607 = x4w_j_70628 + redout_76936;\n                    double redout_tmp_79128 = defunc_1_op_res_70595;\n                    doubl",
                   "e redout_tmp_79129 = defunc_1_op_res_70598;\n                    double redout_tmp_79130 = defunc_1_op_res_70601;\n                    double redout_tmp_79131 = defunc_1_op_res_70604;\n                    double redout_tmp_79132 = defunc_1_op_res_70607;\n                    \n                    redout_76932 = redout_tmp_79128;\n                    redout_76933 = redout_tmp_79129;\n                    redout_76934 = redout_tmp_79130;\n                    redout_76935 = redout_tmp_79131;\n                    redout_76936 = redout_tmp_79132;\n                }\n                defunc_2_reduce_res_70588 = redout_76932;\n                defunc_2_reduce_res_70589 = redout_76933;\n                defunc_2_reduce_res_70590 = redout_76934;\n                defunc_2_reduce_res_70591 = redout_76935;\n                defunc_2_reduce_res_70592 = redout_76936;\n                \n                double x_70629 = defunc_2_reduce_res_70590 *\n                       defunc_2_reduce_res_70592;\n                double y_70630 = defunc_2_reduce_res_70591 *\n                       defunc_2_reduce_res_70591;\n                double a12_70631 = x_70629 - y_70630;\n                double x_70632 = defunc_2_reduce_res_70590 *\n                       defunc_2_reduce_res_70591;\n                double y_70633 = defunc_2_reduce_res_70589 *\n                       defunc_2_reduce_res_70592;\n                double b12_70634 = x_70632 - y_70633;\n                double x_70635 = defunc_2_reduce_res_70589 *\n                       defunc_2_reduce_res_70591;\n                double y_70636 = defunc_2_reduce_res_70590 *\n                       defunc_2_reduce_res_70590;\n                double c12_70637 = x_70635 - y_70636;\n                double x_70638 = defunc_2_reduce_res_70588 *\n                       defunc_2_reduce_res_70592;\n                double b2_70639 = x_70638 - y_70636;\n                double x_70640 = defunc_2_reduce_res_70589 *\n                       defunc_2_reduce_res_70590;\n                double y_70641 = de",
                   "func_2_reduce_res_70588 *\n                       defunc_2_reduce_res_70591;\n                double c2_70642 = x_70640 - y_70641;\n                double x_70643 = defunc_2_reduce_res_70588 * a12_70631;\n                double y_70644 = defunc_2_reduce_res_70589 * b12_70634;\n                double x_70645 = x_70643 + y_70644;\n                double y_70646 = defunc_2_reduce_res_70590 * c12_70637;\n                double y_70647 = x_70645 + y_70646;\n                double det_70648 = 1.0 / y_70647;\n                double a12_70649 = a12_70631 * det_70648;\n                double b12_70650 = b12_70634 * det_70648;\n                double c12_70651 = c12_70637 * det_70648;\n                double b2_70652 = b2_70639 * det_70648;\n                double c2_70653 = c2_70642 * det_70648;\n                double defunc_2_reduce_res_70654;\n                double defunc_2_reduce_res_70655;\n                double redout_76938;\n                double redout_76939;\n                \n                redout_76938 = 0.0;\n                redout_76939 = 0.0;\n                for (int64_t i_76940 = 0; i_76940 < q_65380; i_76940++) {\n                    double x_70663;\n                    \n                    x_70663 = ((__global double *) color_78203)[phys_tid_70463 +\n                                                                i_76940 *\n                                                                num_threads_78271];\n                    \n                    bool cond_70664 = sle64(last_res_70473, i_76940);\n                    int64_t defunc_0_f_res_70665;\n                    \n                    if (cond_70664) {\n                        defunc_0_f_res_70665 = (int64_t) 0;\n                    } else {\n                        int64_t i_70666 = add64(max_res_70568, i_76940);\n                        int64_t defunc_0_add_arg_70667;\n                        \n                        defunc_0_add_arg_70667 = ((__global\n                                                   int64_t *) color_78205)[phys",
                   "_tid_70463 +\n                                                                           i_70666 *\n                                                                           num_threads_78271];\n                        \n                        int64_t defunc_1_add_res_70668 = add64((int64_t) 1,\n                                                               defunc_0_add_arg_70667);\n                        \n                        defunc_0_f_res_70665 = defunc_1_add_res_70668;\n                    }\n                    \n                    int64_t binop_p_70669 = sub64(defunc_0_f_res_70665,\n                                                  min_res_70503);\n                    double defunc_0_f_res_70670 = sitofp_i64_f64(binop_p_70669);\n                    double abs_res_70671 = fabs(defunc_0_f_res_70670);\n                    double tmp1_70672 = abs_res_70671 / defunc_1_f_res_70587;\n                    double x_70673 = tmp1_70672 * tmp1_70672;\n                    double y_70674 = tmp1_70672 * x_70673;\n                    double tmp2_70675 = 1.0 - y_70674;\n                    double x_70676 = tmp2_70675 * tmp2_70675;\n                    double tmp3_70677 = tmp2_70675 * x_70676;\n                    double tmp4_70678 = x_70663 * tmp3_70677;\n                    double defunc_1_f_res_70679 = defunc_0_f_res_70670 *\n                           tmp4_70678;\n                    double defunc_1_f_res_70680 = defunc_0_f_res_70670 *\n                           defunc_1_f_res_70679;\n                    double defunc_0_f_res_70681;\n                    \n                    if (cond_70664) {\n                        defunc_0_f_res_70681 = 0.0;\n                    } else {\n                        int64_t i_70682 = add64(max_res_70568, i_76940);\n                        double defunc_0_add_arg_70683;\n                        \n                        defunc_0_add_arg_70683 = ((__global\n                                                   double *) color_78206)[phys_tid_70463 +\n                      ",
                   "                                                    i_70682 *\n                                                                          num_threads_78271];\n                        defunc_0_f_res_70681 = defunc_0_add_arg_70683;\n                    }\n                    \n                    double x_70684 = a12_70649 * tmp4_70678;\n                    double y_70685 = b12_70650 * defunc_1_f_res_70679;\n                    double x_70686 = x_70684 + y_70685;\n                    double y_70687 = c12_70651 * defunc_1_f_res_70680;\n                    double x_70688 = x_70686 + y_70687;\n                    double defunc_9_fit_fun_res_70689 = defunc_0_f_res_70681 *\n                           x_70688;\n                    double x_70690 = b12_70650 * tmp4_70678;\n                    double y_70691 = b2_70652 * defunc_1_f_res_70679;\n                    double x_70692 = x_70690 + y_70691;\n                    double y_70693 = c2_70653 * defunc_1_f_res_70680;\n                    double x_70694 = x_70692 + y_70693;\n                    double defunc_9_slope_fun_res_70695 = defunc_0_f_res_70681 *\n                           x_70694;\n                    double defunc_1_op_res_70658 = defunc_9_fit_fun_res_70689 +\n                           redout_76938;\n                    double defunc_1_op_res_70661 =\n                           defunc_9_slope_fun_res_70695 + redout_76939;\n                    double redout_tmp_79133 = defunc_1_op_res_70658;\n                    double redout_tmp_79134 = defunc_1_op_res_70661;\n                    \n                    redout_76938 = redout_tmp_79133;\n                    redout_76939 = redout_tmp_79134;\n                }\n                defunc_2_reduce_res_70654 = redout_76938;\n                defunc_2_reduce_res_70655 = redout_76939;\n                ((__global double *) color_78202)[phys_tid_70463 + i_76929 *\n                                                  num_threads_78271] =\n                    defunc_2_reduce_res_70654;\n                ((__global doubl",
                   "e *) color_78201)[phys_tid_70463 + i_76929 *\n                                                  num_threads_78271] =\n                    defunc_2_reduce_res_70655;\n            }\n            for (int64_t i_79135 = 0; i_79135 < n_m_65386; i_79135++) {\n                double tmp_79136;\n                \n                tmp_79136 = ((__global double *) color_78202)[phys_tid_70463 +\n                                                              i_79135 *\n                                                              num_threads_78271];\n                ((__global double *) mem_77634)[gtid_70462 + i_79135 *\n                                                m_65377] = tmp_79136;\n            }\n            for (int64_t i_79137 = 0; i_79137 < n_m_65386; i_79137++) {\n                double tmp_79138;\n                \n                tmp_79138 = ((__global double *) color_78201)[phys_tid_70463 +\n                                                              i_79137 *\n                                                              num_threads_78271];\n                ((__global double *) mem_77637)[gtid_70462 + i_79137 *\n                                                m_65377] = tmp_79138;\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_70457\n}\n__kernel void mainzisegmap_71767(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *Y_mem_77010, __global\n                                 unsigned char *mem_77642, __global\n                                 unsigned char *mem_77646, __global\n                                 unsigned char *mem_77650)\n{\n    #define segmap_group_sizze_71761 (mainzisegmap_group_sizze_71602)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79204;\n ",
                   "   int32_t local_tid_79205;\n    int64_t group_sizze_79208;\n    int32_t wave_sizze_79207;\n    int32_t group_tid_79206;\n    \n    global_tid_79204 = get_global_id(0);\n    local_tid_79205 = get_local_id(0);\n    group_sizze_79208 = get_local_size(0);\n    wave_sizze_79207 = LOCKSTEP_WIDTH;\n    group_tid_79206 = get_group_id(0);\n    \n    int32_t phys_tid_71767 = global_tid_79204;\n    int64_t global_tid_79209 = sext_i32_i64(group_tid_79206) *\n            segmap_group_sizze_71761 + sext_i32_i64(local_tid_79205);\n    int64_t slice_79210 = n_65378;\n    int64_t slice_79211 = m_65377 * slice_79210;\n    int64_t gtid_71765 = squot64(global_tid_79209, slice_79210);\n    int64_t remnant_79212 = global_tid_79209 - gtid_71765 * slice_79210;\n    int64_t gtid_71766 = remnant_79212;\n    int64_t remnant_79213 = remnant_79212 - gtid_71766;\n    \n    if (slt64(gtid_71765, m_65377) && slt64(gtid_71766, n_65378)) {\n        double x_71768;\n        \n        x_71768 = ((__global double *) Y_mem_77010)[gtid_71765 * n_65378 +\n                                                    gtid_71766];\n        \n        bool isnan_res_71771;\n        \n        isnan_res_71771 = futrts_isnan64(x_71768);\n        \n        bool defunc_0_p_res_71772 = !isnan_res_71771;\n        int64_t defunc_1_f_res_71773;\n        \n        if (defunc_0_p_res_71772) {\n            int64_t x_71769;\n            \n            x_71769 = ((__global int64_t *) mem_77642)[gtid_71765 * n_65378 +\n                                                       gtid_71766];\n            \n            int64_t defunc_1_f_res_t_res_71774 = sub64(x_71769, (int64_t) 1);\n            \n            defunc_1_f_res_71773 = defunc_1_f_res_t_res_71774;\n        } else {\n            defunc_1_f_res_71773 = (int64_t) -1;\n        }\n        if ((sle64((int64_t) 0, gtid_71765) && slt64(gtid_71765, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_71773) &&\n             slt64(defunc_1_f_res_71773, n_65378))) {\n            ((__global int64_t *) mem_77650)[gtid_71765 * n_65",
                   "378 +\n                                             defunc_1_f_res_71773] = gtid_71766;\n        }\n        if ((sle64((int64_t) 0, gtid_71765) && slt64(gtid_71765, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_71773) &&\n             slt64(defunc_1_f_res_71773, n_65378))) {\n            ((__global double *) mem_77646)[gtid_71765 * n_65378 +\n                                            defunc_1_f_res_71773] = x_71768;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_71761\n}\n__kernel void mainzisegmap_71786(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *mem_77650, __global\n                                 unsigned char *mem_77656)\n{\n    #define segmap_group_sizze_71781 (mainzisegmap_group_sizze_71576)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79214;\n    int32_t local_tid_79215;\n    int64_t group_sizze_79218;\n    int32_t wave_sizze_79217;\n    int32_t group_tid_79216;\n    \n    global_tid_79214 = get_global_id(0);\n    local_tid_79215 = get_local_id(0);\n    group_sizze_79218 = get_local_size(0);\n    wave_sizze_79217 = LOCKSTEP_WIDTH;\n    group_tid_79216 = get_group_id(0);\n    \n    int32_t phys_tid_71786 = global_tid_79214;\n    int64_t global_tid_79219 = sext_i32_i64(group_tid_79216) *\n            segmap_group_sizze_71781 + sext_i32_i64(local_tid_79215);\n    int64_t slice_79220 = n_65378;\n    int64_t slice_79221 = m_65377 * slice_79220;\n    int64_t gtid_71784 = squot64(global_tid_79219, slice_79220);\n    int64_t remnant_79222 = global_tid_79219 - gtid_71784 * slice_79220;\n    int64_t gtid_71785 = remnant_79222;\n    int64_t remnant_79223 = remnant_79222 - gtid_71785;\n    \n    if (slt64(gtid_71784, m_65377) && slt64(gtid_71785, n_65378)) {\n        int64_t x_71787;\n        \n        x_71787 = ((__global int64",
                   "_t *) mem_77650)[gtid_71784 * n_65378 +\n                                                   gtid_71785];\n        \n        int64_t defunc_0_f_res_71788 = add64((int64_t) 1, x_71787);\n        \n        ((__global int64_t *) mem_77656)[gtid_71784 * n_65378 + gtid_71785] =\n            defunc_0_f_res_71788;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_71781\n}\n__kernel void mainzisegmap_71798(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, int64_t min_res_65398,\n                                 double i64_res_65404, __global\n                                 unsigned char *mem_77642, __global\n                                 unsigned char *mem_77660, __global\n                                 unsigned char *mem_77663, __global\n                                 unsigned char *mem_77666, __global\n                                 unsigned char *mem_77669)\n{\n    #define segmap_group_sizze_71791 (mainzisegmap_group_sizze_71550)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79224;\n    int32_t local_tid_79225;\n    int64_t group_sizze_79228;\n    int32_t wave_sizze_79227;\n    int32_t group_tid_79226;\n    \n    global_tid_79224 = get_global_id(0);\n    local_tid_79225 = get_local_id(0);\n    group_sizze_79228 = get_local_size(0);\n    wave_sizze_79227 = LOCKSTEP_WIDTH;\n    group_tid_79226 = get_group_id(0);\n    \n    int32_t phys_tid_71798 = global_tid_79224;\n    int64_t global_tid_79229 = sext_i32_i64(group_tid_79226) *\n            segmap_group_sizze_71791 + sext_i32_i64(local_tid_79225);\n    int64_t slice_79230 = m_65377;\n    int64_t gtid_71797 = global_tid_79229;\n    int64_t remnant_79231 = global_tid_79229 - gtid_71797;\n    \n    if (slt64(gtid_71797, m_65377)) {\n        int64_t last_res_71799;\n        \n        last_res_71799 = ((",
                   "__global int64_t *) mem_77642)[gtid_71797 * n_65378 +\n                                                          i_65392];\n        \n        int64_t min_arg_71800 = sub64(last_res_71799, (int64_t) 1);\n        int64_t min_arg_71801 = sub64(last_res_71799, min_res_65398);\n        int64_t min_res_71802 = smin64(q_65380, last_res_71799);\n        double i64_res_71803 = sitofp_i64_f64(last_res_71799);\n        double x_71804 = i64_res_65404 - i64_res_71803;\n        double max_arg_71805 = x_71804 / 2.0;\n        double max_res_71806 = fmax64(0.0, max_arg_71805);\n        \n        ((__global int64_t *) mem_77660)[gtid_71797] = min_arg_71800;\n        ((__global int64_t *) mem_77663)[gtid_71797] = min_arg_71801;\n        ((__global int64_t *) mem_77666)[gtid_71797] = min_res_71802;\n        ((__global double *) mem_77669)[gtid_71797] = max_res_71806;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_71791\n}\n__kernel void mainzisegmap_71818(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, __global\n                                 unsigned char *mem_77642, __global\n                                 unsigned char *mem_77674)\n{\n    #define segmap_group_sizze_71813 (mainzisegmap_group_sizze_71525)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79232;\n    int32_t local_tid_79233;\n    int64_t group_sizze_79236;\n    int32_t wave_sizze_79235;\n    int32_t group_tid_79234;\n    \n    global_tid_79232 = get_global_id(0);\n    local_tid_79233 = get_local_id(0);\n    group_sizze_79236 = get_local_size(0);\n    wave_sizze_79235 = LOCKSTEP_WIDTH;\n    group_tid_79234 = get_group_id(0);\n    \n    int32_t phys_tid_71818 = global_tid_79232;\n    int64_t global_tid_79237 = sext_i32_i64(group_tid_79234) *\n            segmap_group_sizze_71813 + sext_i32_i64(loca",
                   "l_tid_79233);\n    int64_t slice_79238 = q_65380;\n    int64_t slice_79239 = m_65377 * slice_79238;\n    int64_t gtid_71816 = squot64(global_tid_79237, slice_79238);\n    int64_t remnant_79240 = global_tid_79237 - gtid_71816 * slice_79238;\n    int64_t gtid_71817 = remnant_79240;\n    int64_t remnant_79241 = remnant_79240 - gtid_71817;\n    \n    if (slt64(gtid_71816, m_65377) && slt64(gtid_71817, q_65380)) {\n        int64_t last_res_71819;\n        \n        last_res_71819 = ((__global int64_t *) mem_77642)[gtid_71816 * n_65378 +\n                                                          i_65392];\n        \n        bool cond_71821 = sle64(last_res_71819, gtid_71817);\n        double defunc_0_f_res_71822;\n        \n        if (cond_71821) {\n            defunc_0_f_res_71822 = 0.0;\n        } else {\n            defunc_0_f_res_71822 = 1.0;\n        }\n        ((__global double *) mem_77674)[gtid_71816 * q_65380 + gtid_71817] =\n            defunc_0_f_res_71822;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_71813\n}\n__kernel void mainzisegmap_72051(__global int *global_failure,\n                                 int failure_is_an_option, __global\n                                 int64_t *global_failure_args, int64_t m_65377,\n                                 int64_t n_65378, int64_t jump_65382,\n                                 int64_t n_m_65386, int64_t i_65392,\n                                 unsigned char x_65393_bits,\n                                 int64_t min_res_65398,\n                                 unsigned char loop_cond_65403_bits, __global\n                                 unsigned char *mem_77650, __global\n                                 unsigned char *mem_77656, __global\n                                 unsigned char *mem_77660, __global\n                                 unsigned char *mem_77663, __global\n                                 unsigned char *mem_77666, __global\n                                 unsigned char *mem_77669, __global\n                    ",
                   "             unsigned char *mem_77781, __global\n                                 unsigned char *mem_77785, __global\n                                 unsigned char *mem_77789)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    \n    #define segmap_group_sizze_72044 (mainzisegmap_group_sizze_71134)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79312;\n    int32_t local_tid_79313;\n    int64_t group_sizze_79316;\n    int32_t wave_sizze_79315;\n    int32_t group_tid_79314;\n    \n    global_tid_79312 = get_global_id(0);\n    local_tid_79313 = get_local_id(0);\n    group_sizze_79316 = get_local_size(0);\n    wave_sizze_79315 = LOCKSTEP_WIDTH;\n    group_tid_79314 = get_group_id(0);\n    \n    int32_t phys_tid_72051 = global_tid_79312;\n    int64_t global_tid_79317 = sext_i32_i64(group_tid_79314) *\n            segmap_group_sizze_72044 + sext_i32_i64(local_tid_79313);\n    int64_t slice_79318 = n_m_65386;\n    int64_t slice_79319 = m_65377 * slice_79318;\n    int64_t gtid_72049 = squot64(global_tid_79317, slice_79318);\n    int64_t remnant_79320 = global_tid_79317 - gtid_72049 * slice_79318;\n    int64_t gtid_72050 = remnant_79320;\n    int64_t remnant_79321 = remnant_79320 - gtid_72050;\n    \n    if (slt64(gtid_72049, m_65377) && slt64(gtid_72050, n_m_65386)) {\n        int64_t min_arg_72054;\n        \n        min_arg_72054 = ((__global int64_t *) mem_77660)[gtid_72049];\n        \n        int64_t min_arg_72055;\n        \n        min_arg_72055 = ((__global int64_t *) mem_77663)[gtid_72049];\n        \n        int64_t min_res_72056;\n        \n        min_res_72056 = ((__global int64_t *) mem_77666)[gtid_72049];\n        \n        double max_res_72057;\n        \n        max_res_72057 = ((__global double *) mem_77669)[gtid_72049];\n        \n        int64_t min_arg_72059 = mul64(jump_65382, gtid_72050);\n        int64_t min_res_72060 = smin64(i_65",
                   "392, min_arg_72059);\n        int64_t defunc_0_g_res_72061 = add64((int64_t) 1, min_res_72060);\n        bool init_idx_72062;\n        int64_t init_idx_72063;\n        int64_t init_idx_72064;\n        bool loop_while_72065;\n        int64_t low_72066;\n        int64_t high_72067;\n        \n        loop_while_72065 = x_65393;\n        low_72066 = (int64_t) 0;\n        high_72067 = i_65392;\n        while (loop_while_72065) {\n            int64_t x_72068 = add64(low_72066, high_72067);\n            int64_t mid_72069 = sdiv64(x_72068, (int64_t) 2);\n            bool x_72070 = sle64((int64_t) 0, mid_72069);\n            bool y_72071 = slt64(mid_72069, n_65378);\n            bool bounds_check_72072 = x_72070 && y_72071;\n            bool index_certs_72073;\n            \n            if (!bounds_check_72072) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 40) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) mid_72069;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t mid_id_72074;\n            \n            mid_id_72074 = ((__global int64_t *) mem_77656)[gtid_72049 *\n                                                            n_65378 +\n                                                            mid_72069];\n            \n            bool cond_72075 = slt64(mid_id_72074, (int64_t) 0);\n            int64_t mid_idx_72076;\n            \n            if (cond_72075) {\n                mid_idx_72076 = (int64_t) 9223372036854775807;\n            } else {\n                mid_idx_72076 = mid_id_72074;\n            }\n            \n            bool cond_72077 = sle64(defunc_0_g_res_72061, mid_idx_72076);\n            int64_t loopres_72078;\n            int64_t loopres_72079;\n            \n            if (cond_72077) {\n                int64_t loopres_t_res_72080 = sub64(mid_72",
                   "069, (int64_t) 1);\n                \n                loopres_72078 = low_72066;\n                loopres_72079 = loopres_t_res_72080;\n            } else {\n                int64_t loopres_f_res_72081 = add64((int64_t) 1, mid_72069);\n                \n                loopres_72078 = loopres_f_res_72081;\n                loopres_72079 = high_72067;\n            }\n            \n            bool loop_cond_72082 = sle64(loopres_72078, loopres_72079);\n            bool loop_while_tmp_79322 = loop_cond_72082;\n            int64_t low_tmp_79323 = loopres_72078;\n            int64_t high_tmp_79324 = loopres_72079;\n            \n            loop_while_72065 = loop_while_tmp_79322;\n            low_72066 = low_tmp_79323;\n            high_72067 = high_tmp_79324;\n        }\n        init_idx_72062 = loop_while_72065;\n        init_idx_72063 = low_72066;\n        init_idx_72064 = high_72067;\n        \n        bool idx_72083;\n        int64_t idx_72084;\n        int64_t idx_72085;\n        int64_t idx_72086;\n        bool loop_while_72087;\n        int64_t l_idx_72088;\n        int64_t r_idx_72089;\n        int64_t span_72090;\n        \n        loop_while_72087 = loop_cond_65403;\n        l_idx_72088 = init_idx_72063;\n        r_idx_72089 = init_idx_72063;\n        span_72090 = (int64_t) 1;\n        while (loop_while_72087) {\n            int64_t max_arg_72091 = sub64(l_idx_72088, (int64_t) 1);\n            int64_t max_res_72092 = smax64((int64_t) 0, max_arg_72091);\n            int64_t min_arg_72093 = add64((int64_t) 1, r_idx_72089);\n            int64_t min_res_72094 = smin64(min_arg_72054, min_arg_72093);\n            bool x_72095 = sle64((int64_t) 0, max_res_72092);\n            bool y_72096 = slt64(max_res_72092, n_65378);\n            bool bounds_check_72097 = x_72095 && y_72096;\n            bool index_certs_72098;\n            \n            if (!bounds_check_72097) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 41) ==\n                        -1) {\n                     ",
                   "   global_failure_args[0] = (int64_t) max_res_72092;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t x_72099;\n            \n            x_72099 = ((__global int64_t *) mem_77656)[gtid_72049 * n_65378 +\n                                                       max_res_72092];\n            \n            int64_t abs_arg_72100 = sub64(x_72099, defunc_0_g_res_72061);\n            int64_t abs_res_72101 = abs64(abs_arg_72100);\n            bool x_72102 = sle64((int64_t) 0, min_res_72094);\n            bool y_72103 = slt64(min_res_72094, n_65378);\n            bool bounds_check_72104 = x_72102 && y_72103;\n            bool index_certs_72105;\n            \n            if (!bounds_check_72104) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 42) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) min_res_72094;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    return;\n                }\n            }\n            \n            int64_t x_72106;\n            \n            x_72106 = ((__global int64_t *) mem_77656)[gtid_72049 * n_65378 +\n                                                       min_res_72094];\n            \n            int64_t abs_arg_72107 = sub64(x_72106, defunc_0_g_res_72061);\n            int64_t abs_res_72108 = abs64(abs_arg_72107);\n            bool cond_72109 = max_res_72092 == l_idx_72088;\n            int64_t loopres_72110;\n            int64_t loopres_72111;\n            int64_t loopres_72112;\n            \n            if (cond_72109) {\n                loopres_72110 = l_idx_72088;\n                loopres_72111 = r_idx_72089;\n                loopres_72112 = min_res_65398;\n            } else {\n                bool cond_72113 = slt64(abs_res_72101, abs_res_721",
                   "08);\n                bool cond_f_res_72114 = min_res_72094 == r_idx_72089;\n                bool x_72115 = !cond_72113;\n                bool y_72116 = cond_f_res_72114 && x_72115;\n                bool cond_72117 = cond_72113 || y_72116;\n                int64_t loopres_f_res_72118;\n                \n                if (cond_72117) {\n                    loopres_f_res_72118 = max_res_72092;\n                } else {\n                    loopres_f_res_72118 = l_idx_72088;\n                }\n                \n                int64_t loopres_f_res_72119;\n                \n                if (cond_72117) {\n                    loopres_f_res_72119 = r_idx_72089;\n                } else {\n                    loopres_f_res_72119 = min_res_72094;\n                }\n                \n                int64_t loopres_f_res_72120;\n                \n                if (cond_72117) {\n                    int64_t loopres_f_res_t_res_72121 = add64((int64_t) 1,\n                                                              span_72090);\n                    \n                    loopres_f_res_72120 = loopres_f_res_t_res_72121;\n                } else {\n                    int64_t loopres_f_res_f_res_72122 = add64((int64_t) 1,\n                                                              span_72090);\n                    \n                    loopres_f_res_72120 = loopres_f_res_f_res_72122;\n                }\n                loopres_72110 = loopres_f_res_72118;\n                loopres_72111 = loopres_f_res_72119;\n                loopres_72112 = loopres_f_res_72120;\n            }\n            \n            bool loop_cond_72123 = slt64(loopres_72112, min_res_65398);\n            bool loop_while_tmp_79325 = loop_cond_72123;\n            int64_t l_idx_tmp_79326 = loopres_72110;\n            int64_t r_idx_tmp_79327 = loopres_72111;\n            int64_t span_tmp_79328 = loopres_72112;\n            \n            loop_while_72087 = loop_while_tmp_79325;\n            l_idx_72088 = l_idx_tmp_79326;\n            r_idx_72089 = r",
                   "_idx_tmp_79327;\n            span_72090 = span_tmp_79328;\n        }\n        idx_72083 = loop_while_72087;\n        idx_72084 = l_idx_72088;\n        idx_72085 = r_idx_72089;\n        idx_72086 = span_72090;\n        \n        int64_t min_res_72124 = smin64(min_arg_72055, idx_72084);\n        int64_t max_res_72125 = smax64((int64_t) 0, min_res_72124);\n        int64_t x_72126 = add64(min_res_72056, max_res_72125);\n        int64_t r_72127 = sub64(x_72126, (int64_t) 1);\n        bool x_72128 = sle64((int64_t) 0, r_72127);\n        bool y_72129 = slt64(r_72127, n_65378);\n        bool bounds_check_72130 = x_72128 && y_72129;\n        bool index_certs_72131;\n        \n        if (!bounds_check_72130) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 43) == -1) {\n                    global_failure_args[0] = (int64_t) r_72127;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        int64_t x_72132;\n        \n        x_72132 = ((__global int64_t *) mem_77650)[gtid_72049 * n_65378 +\n                                                   r_72127];\n        \n        int64_t abs_arg_72133 = sub64(x_72132, min_res_72060);\n        int64_t abs_res_72134 = abs64(abs_arg_72133);\n        bool x_72135 = sle64((int64_t) 0, max_res_72125);\n        bool y_72136 = slt64(max_res_72125, n_65378);\n        bool bounds_check_72137 = x_72135 && y_72136;\n        bool index_certs_72138;\n        \n        if (!bounds_check_72137) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 44) == -1) {\n                    global_failure_args[0] = (int64_t) max_res_72125;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        int64_t x_72139;\n        \n        x_72139 = ((__global int64_t *) mem_77650)[gtid_72049 * n_65378 +\n                   ",
                   "                                max_res_72125];\n        \n        int64_t abs_arg_72140 = sub64(x_72139, min_res_72060);\n        int64_t abs_res_72141 = abs64(abs_arg_72140);\n        int64_t max_res_72142 = smax64(abs_res_72134, abs_res_72141);\n        double defunc_0_f_res_72143 = sitofp_i64_f64(max_res_72142);\n        double defunc_1_f_res_72144 = max_res_72057 + defunc_0_f_res_72143;\n        \n        ((__global int64_t *) mem_77781)[gtid_72049 * n_m_65386 + gtid_72050] =\n            min_res_72060;\n        ((__global int64_t *) mem_77785)[gtid_72049 * n_m_65386 + gtid_72050] =\n            max_res_72125;\n        ((__global double *) mem_77789)[gtid_72049 * n_m_65386 + gtid_72050] =\n            defunc_1_f_res_72144;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_72044\n}\n__kernel void mainzisegmap_72216(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_m_65386, __global\n                                 unsigned char *mem_77794, __global\n                                 unsigned char *mem_77798, __global\n                                 unsigned char *mem_77802, __global\n                                 unsigned char *mem_77806, __global\n                                 unsigned char *mem_77810, __global\n                                 unsigned char *mem_77815, __global\n                                 unsigned char *mem_77819, __global\n                                 unsigned char *mem_77823, __global\n                                 unsigned char *mem_77827, __global\n                                 unsigned char *mem_77831)\n{\n    #define segmap_group_sizze_72207 (mainzisegmap_group_sizze_71032)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79457;\n    int32_t local_tid_79458;\n    int64_t group_sizze_79461;\n    int32_t wave_sizze_79460;\n    int32_t group_tid_79459;\n    \n    global_tid",
                   "_79457 = get_global_id(0);\n    local_tid_79458 = get_local_id(0);\n    group_sizze_79461 = get_local_size(0);\n    wave_sizze_79460 = LOCKSTEP_WIDTH;\n    group_tid_79459 = get_group_id(0);\n    \n    int32_t phys_tid_72216 = global_tid_79457;\n    int64_t global_tid_79462 = sext_i32_i64(group_tid_79459) *\n            segmap_group_sizze_72207 + sext_i32_i64(local_tid_79458);\n    int64_t slice_79463 = n_m_65386;\n    int64_t slice_79464 = m_65377 * slice_79463;\n    int64_t gtid_72214 = squot64(global_tid_79462, slice_79463);\n    int64_t remnant_79465 = global_tid_79462 - gtid_72214 * slice_79463;\n    int64_t gtid_72215 = remnant_79465;\n    int64_t remnant_79466 = remnant_79465 - gtid_72215;\n    \n    if (slt64(gtid_72214, m_65377) && slt64(gtid_72215, n_m_65386)) {\n        double defunc_2_reduce_res_72217;\n        \n        defunc_2_reduce_res_72217 = ((__global double *) mem_77794)[gtid_72214 *\n                                                                    n_m_65386 +\n                                                                    gtid_72215];\n        \n        double defunc_2_reduce_res_72218;\n        \n        defunc_2_reduce_res_72218 = ((__global double *) mem_77798)[gtid_72214 *\n                                                                    n_m_65386 +\n                                                                    gtid_72215];\n        \n        double defunc_2_reduce_res_72219;\n        \n        defunc_2_reduce_res_72219 = ((__global double *) mem_77802)[gtid_72214 *\n                                                                    n_m_65386 +\n                                                                    gtid_72215];\n        \n        double defunc_2_reduce_res_72220;\n        \n        defunc_2_reduce_res_72220 = ((__global double *) mem_77806)[gtid_72214 *\n                                                                    n_m_65386 +\n                                                                    gtid_72215];\n        \n        double defunc_2_r",
                   "educe_res_72221;\n        \n        defunc_2_reduce_res_72221 = ((__global double *) mem_77810)[gtid_72214 *\n                                                                    n_m_65386 +\n                                                                    gtid_72215];\n        \n        double x_72222 = defunc_2_reduce_res_72219 * defunc_2_reduce_res_72221;\n        double y_72223 = defunc_2_reduce_res_72220 * defunc_2_reduce_res_72220;\n        double a12_72224 = x_72222 - y_72223;\n        double x_72225 = defunc_2_reduce_res_72219 * defunc_2_reduce_res_72220;\n        double y_72226 = defunc_2_reduce_res_72218 * defunc_2_reduce_res_72221;\n        double b12_72227 = x_72225 - y_72226;\n        double x_72228 = defunc_2_reduce_res_72218 * defunc_2_reduce_res_72220;\n        double y_72229 = defunc_2_reduce_res_72219 * defunc_2_reduce_res_72219;\n        double c12_72230 = x_72228 - y_72229;\n        double x_72231 = defunc_2_reduce_res_72217 * defunc_2_reduce_res_72221;\n        double b2_72232 = x_72231 - y_72229;\n        double x_72233 = defunc_2_reduce_res_72218 * defunc_2_reduce_res_72219;\n        double y_72234 = defunc_2_reduce_res_72217 * defunc_2_reduce_res_72220;\n        double c2_72235 = x_72233 - y_72234;\n        double x_72236 = defunc_2_reduce_res_72217 * a12_72224;\n        double y_72237 = defunc_2_reduce_res_72218 * b12_72227;\n        double x_72238 = x_72236 + y_72237;\n        double y_72239 = defunc_2_reduce_res_72219 * c12_72230;\n        double y_72240 = x_72238 + y_72239;\n        double det_72241 = 1.0 / y_72240;\n        double a12_72242 = a12_72224 * det_72241;\n        double b12_72243 = b12_72227 * det_72241;\n        double c12_72244 = c12_72230 * det_72241;\n        double b2_72245 = b2_72232 * det_72241;\n        double c2_72246 = c2_72235 * det_72241;\n        \n        ((__global double *) mem_77815)[gtid_72214 * n_m_65386 + gtid_72215] =\n            a12_72242;\n        ((__global double *) mem_77819)[gtid_72214 * n_m_65386 + gtid_72215] =\n            b12_7",
                   "2243;\n        ((__global double *) mem_77823)[gtid_72214 * n_m_65386 + gtid_72215] =\n            c12_72244;\n        ((__global double *) mem_77827)[gtid_72214 * n_m_65386 + gtid_72215] =\n            b2_72245;\n        ((__global double *) mem_77831)[gtid_72214 * n_m_65386 + gtid_72215] =\n            c2_72246;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_72207\n}\n__kernel void mainzisegmap_72752(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *Y_mem_77010, __global\n                                 unsigned char *mem_77867, __global\n                                 unsigned char *mem_77871, __global\n                                 unsigned char *mem_77875)\n{\n    #define segmap_group_sizze_72746 (mainzisegmap_group_sizze_72587)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79621;\n    int32_t local_tid_79622;\n    int64_t group_sizze_79625;\n    int32_t wave_sizze_79624;\n    int32_t group_tid_79623;\n    \n    global_tid_79621 = get_global_id(0);\n    local_tid_79622 = get_local_id(0);\n    group_sizze_79625 = get_local_size(0);\n    wave_sizze_79624 = LOCKSTEP_WIDTH;\n    group_tid_79623 = get_group_id(0);\n    \n    int32_t phys_tid_72752 = global_tid_79621;\n    int64_t global_tid_79626 = sext_i32_i64(group_tid_79623) *\n            segmap_group_sizze_72746 + sext_i32_i64(local_tid_79622);\n    int64_t slice_79627 = n_65378;\n    int64_t slice_79628 = m_65377 * slice_79627;\n    int64_t gtid_72750 = squot64(global_tid_79626, slice_79627);\n    int64_t remnant_79629 = global_tid_79626 - gtid_72750 * slice_79627;\n    int64_t gtid_72751 = remnant_79629;\n    int64_t remnant_79630 = remnant_79629 - gtid_72751;\n    \n    if (slt64(gtid_72750, m_65377) && slt64(gtid_72751, n_65378)) {\n        double x_72753;\n        \n        x_72753 = ((__globa",
                   "l double *) Y_mem_77010)[gtid_72750 * n_65378 +\n                                                    gtid_72751];\n        \n        bool isnan_res_72756;\n        \n        isnan_res_72756 = futrts_isnan64(x_72753);\n        \n        bool defunc_0_p_res_72757 = !isnan_res_72756;\n        int64_t defunc_1_f_res_72758;\n        \n        if (defunc_0_p_res_72757) {\n            int64_t x_72754;\n            \n            x_72754 = ((__global int64_t *) mem_77867)[gtid_72750 * n_65378 +\n                                                       gtid_72751];\n            \n            int64_t defunc_1_f_res_t_res_72759 = sub64(x_72754, (int64_t) 1);\n            \n            defunc_1_f_res_72758 = defunc_1_f_res_t_res_72759;\n        } else {\n            defunc_1_f_res_72758 = (int64_t) -1;\n        }\n        if ((sle64((int64_t) 0, gtid_72750) && slt64(gtid_72750, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_72758) &&\n             slt64(defunc_1_f_res_72758, n_65378))) {\n            ((__global int64_t *) mem_77875)[gtid_72750 * n_65378 +\n                                             defunc_1_f_res_72758] = gtid_72751;\n        }\n        if ((sle64((int64_t) 0, gtid_72750) && slt64(gtid_72750, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_72758) &&\n             slt64(defunc_1_f_res_72758, n_65378))) {\n            ((__global double *) mem_77871)[gtid_72750 * n_65378 +\n                                            defunc_1_f_res_72758] = x_72753;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_72746\n}\n__kernel void mainzisegmap_72771(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *mem_77875, __global\n                                 unsigned char *mem_77881)\n{\n    #define segmap_group_sizze_72766 (mainzisegmap_group_sizze_72561)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*g",
                   "lobal_failure >= 0)\n        return;\n    \n    int32_t global_tid_79631;\n    int32_t local_tid_79632;\n    int64_t group_sizze_79635;\n    int32_t wave_sizze_79634;\n    int32_t group_tid_79633;\n    \n    global_tid_79631 = get_global_id(0);\n    local_tid_79632 = get_local_id(0);\n    group_sizze_79635 = get_local_size(0);\n    wave_sizze_79634 = LOCKSTEP_WIDTH;\n    group_tid_79633 = get_group_id(0);\n    \n    int32_t phys_tid_72771 = global_tid_79631;\n    int64_t global_tid_79636 = sext_i32_i64(group_tid_79633) *\n            segmap_group_sizze_72766 + sext_i32_i64(local_tid_79632);\n    int64_t slice_79637 = n_65378;\n    int64_t slice_79638 = m_65377 * slice_79637;\n    int64_t gtid_72769 = squot64(global_tid_79636, slice_79637);\n    int64_t remnant_79639 = global_tid_79636 - gtid_72769 * slice_79637;\n    int64_t gtid_72770 = remnant_79639;\n    int64_t remnant_79640 = remnant_79639 - gtid_72770;\n    \n    if (slt64(gtid_72769, m_65377) && slt64(gtid_72770, n_65378)) {\n        int64_t x_72772;\n        \n        x_72772 = ((__global int64_t *) mem_77875)[gtid_72769 * n_65378 +\n                                                   gtid_72770];\n        \n        int64_t defunc_0_f_res_72773 = add64((int64_t) 1, x_72772);\n        \n        ((__global int64_t *) mem_77881)[gtid_72769 * n_65378 + gtid_72770] =\n            defunc_0_f_res_72773;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_72766\n}\n__kernel void mainzisegmap_72783(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, int64_t min_res_65398,\n                                 double i64_res_65404, __global\n                                 unsigned char *mem_77867, __global\n                                 unsigned char *mem_77885, __global\n                                 unsigned char *mem_77888, __global\n                                 unsigned char *mem_77891, __global\n                              ",
                   "   unsigned char *mem_77894)\n{\n    #define segmap_group_sizze_72776 (mainzisegmap_group_sizze_72535)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79641;\n    int32_t local_tid_79642;\n    int64_t group_sizze_79645;\n    int32_t wave_sizze_79644;\n    int32_t group_tid_79643;\n    \n    global_tid_79641 = get_global_id(0);\n    local_tid_79642 = get_local_id(0);\n    group_sizze_79645 = get_local_size(0);\n    wave_sizze_79644 = LOCKSTEP_WIDTH;\n    group_tid_79643 = get_group_id(0);\n    \n    int32_t phys_tid_72783 = global_tid_79641;\n    int64_t global_tid_79646 = sext_i32_i64(group_tid_79643) *\n            segmap_group_sizze_72776 + sext_i32_i64(local_tid_79642);\n    int64_t slice_79647 = m_65377;\n    int64_t gtid_72782 = global_tid_79646;\n    int64_t remnant_79648 = global_tid_79646 - gtid_72782;\n    \n    if (slt64(gtid_72782, m_65377)) {\n        int64_t last_res_72784;\n        \n        last_res_72784 = ((__global int64_t *) mem_77867)[gtid_72782 * n_65378 +\n                                                          i_65392];\n        \n        int64_t min_arg_72785 = sub64(last_res_72784, (int64_t) 1);\n        int64_t min_arg_72786 = sub64(last_res_72784, min_res_65398);\n        int64_t min_res_72787 = smin64(q_65380, last_res_72784);\n        double i64_res_72788 = sitofp_i64_f64(last_res_72784);\n        double x_72789 = i64_res_65404 - i64_res_72788;\n        double max_arg_72790 = x_72789 / 2.0;\n        double max_res_72791 = fmax64(0.0, max_arg_72790);\n        \n        ((__global int64_t *) mem_77885)[gtid_72782] = min_arg_72785;\n        ((__global int64_t *) mem_77888)[gtid_72782] = min_arg_72786;\n        ((__global int64_t *) mem_77891)[gtid_72782] = min_res_72787;\n        ((__global double *) mem_77894)[gtid_72782] = max_res_72791;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_72776\n}\n__kernel void mainzisegmap_72803(__global ",
                   "int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, __global\n                                 unsigned char *mem_77867, __global\n                                 unsigned char *mem_77899)\n{\n    #define segmap_group_sizze_72798 (mainzisegmap_group_sizze_72510)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79649;\n    int32_t local_tid_79650;\n    int64_t group_sizze_79653;\n    int32_t wave_sizze_79652;\n    int32_t group_tid_79651;\n    \n    global_tid_79649 = get_global_id(0);\n    local_tid_79650 = get_local_id(0);\n    group_sizze_79653 = get_local_size(0);\n    wave_sizze_79652 = LOCKSTEP_WIDTH;\n    group_tid_79651 = get_group_id(0);\n    \n    int32_t phys_tid_72803 = global_tid_79649;\n    int64_t global_tid_79654 = sext_i32_i64(group_tid_79651) *\n            segmap_group_sizze_72798 + sext_i32_i64(local_tid_79650);\n    int64_t slice_79655 = q_65380;\n    int64_t slice_79656 = m_65377 * slice_79655;\n    int64_t gtid_72801 = squot64(global_tid_79654, slice_79655);\n    int64_t remnant_79657 = global_tid_79654 - gtid_72801 * slice_79655;\n    int64_t gtid_72802 = remnant_79657;\n    int64_t remnant_79658 = remnant_79657 - gtid_72802;\n    \n    if (slt64(gtid_72801, m_65377) && slt64(gtid_72802, q_65380)) {\n        int64_t last_res_72804;\n        \n        last_res_72804 = ((__global int64_t *) mem_77867)[gtid_72801 * n_65378 +\n                                                          i_65392];\n        \n        bool cond_72806 = sle64(last_res_72804, gtid_72802);\n        double defunc_0_f_res_72807;\n        \n        if (cond_72806) {\n            defunc_0_f_res_72807 = 0.0;\n        } else {\n            defunc_0_f_res_72807 = 1.0;\n        }\n        ((__global double *) mem_77899)[gtid_72801 * q_65380 + gtid_72802] =\n            defunc_0_f_res_72807;\n    }",
                   "\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_72798\n}\n__kernel void mainzisegmap_73419(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *Y_mem_77010, __global\n                                 unsigned char *mem_77914, __global\n                                 unsigned char *mem_77918, __global\n                                 unsigned char *mem_77922)\n{\n    #define segmap_group_sizze_73413 (mainzisegmap_group_sizze_73254)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79752;\n    int32_t local_tid_79753;\n    int64_t group_sizze_79756;\n    int32_t wave_sizze_79755;\n    int32_t group_tid_79754;\n    \n    global_tid_79752 = get_global_id(0);\n    local_tid_79753 = get_local_id(0);\n    group_sizze_79756 = get_local_size(0);\n    wave_sizze_79755 = LOCKSTEP_WIDTH;\n    group_tid_79754 = get_group_id(0);\n    \n    int32_t phys_tid_73419 = global_tid_79752;\n    int64_t global_tid_79757 = sext_i32_i64(group_tid_79754) *\n            segmap_group_sizze_73413 + sext_i32_i64(local_tid_79753);\n    int64_t slice_79758 = n_65378;\n    int64_t slice_79759 = m_65377 * slice_79758;\n    int64_t gtid_73417 = squot64(global_tid_79757, slice_79758);\n    int64_t remnant_79760 = global_tid_79757 - gtid_73417 * slice_79758;\n    int64_t gtid_73418 = remnant_79760;\n    int64_t remnant_79761 = remnant_79760 - gtid_73418;\n    \n    if (slt64(gtid_73417, m_65377) && slt64(gtid_73418, n_65378)) {\n        double x_73420;\n        \n        x_73420 = ((__global double *) Y_mem_77010)[gtid_73417 * n_65378 +\n                                                    gtid_73418];\n        \n        bool isnan_res_73423;\n        \n        isnan_res_73423 = futrts_isnan64(x_73420);\n        \n        bool defunc_0_p_res_73424 = !isnan_res_73423;\n        int64_t defunc_1_f_res_73425;\n  ",
                   "      \n        if (defunc_0_p_res_73424) {\n            int64_t x_73421;\n            \n            x_73421 = ((__global int64_t *) mem_77914)[gtid_73417 * n_65378 +\n                                                       gtid_73418];\n            \n            int64_t defunc_1_f_res_t_res_73426 = sub64(x_73421, (int64_t) 1);\n            \n            defunc_1_f_res_73425 = defunc_1_f_res_t_res_73426;\n        } else {\n            defunc_1_f_res_73425 = (int64_t) -1;\n        }\n        if ((sle64((int64_t) 0, gtid_73417) && slt64(gtid_73417, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_73425) &&\n             slt64(defunc_1_f_res_73425, n_65378))) {\n            ((__global int64_t *) mem_77922)[gtid_73417 * n_65378 +\n                                             defunc_1_f_res_73425] = gtid_73418;\n        }\n        if ((sle64((int64_t) 0, gtid_73417) && slt64(gtid_73417, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_73425) &&\n             slt64(defunc_1_f_res_73425, n_65378))) {\n            ((__global double *) mem_77918)[gtid_73417 * n_65378 +\n                                            defunc_1_f_res_73425] = x_73420;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_73413\n}\n__kernel void mainzisegmap_73438(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *mem_77922, __global\n                                 unsigned char *mem_77928)\n{\n    #define segmap_group_sizze_73433 (mainzisegmap_group_sizze_73228)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79762;\n    int32_t local_tid_79763;\n    int64_t group_sizze_79766;\n    int32_t wave_sizze_79765;\n    int32_t group_tid_79764;\n    \n    global_tid_79762 = get_global_id(0);\n    local_tid_79763 = get_local_id(0);\n    group_sizze_79766 = get_local_size(0",
                   ");\n    wave_sizze_79765 = LOCKSTEP_WIDTH;\n    group_tid_79764 = get_group_id(0);\n    \n    int32_t phys_tid_73438 = global_tid_79762;\n    int64_t global_tid_79767 = sext_i32_i64(group_tid_79764) *\n            segmap_group_sizze_73433 + sext_i32_i64(local_tid_79763);\n    int64_t slice_79768 = n_65378;\n    int64_t slice_79769 = m_65377 * slice_79768;\n    int64_t gtid_73436 = squot64(global_tid_79767, slice_79768);\n    int64_t remnant_79770 = global_tid_79767 - gtid_73436 * slice_79768;\n    int64_t gtid_73437 = remnant_79770;\n    int64_t remnant_79771 = remnant_79770 - gtid_73437;\n    \n    if (slt64(gtid_73436, m_65377) && slt64(gtid_73437, n_65378)) {\n        int64_t x_73439;\n        \n        x_73439 = ((__global int64_t *) mem_77922)[gtid_73436 * n_65378 +\n                                                   gtid_73437];\n        \n        int64_t defunc_0_f_res_73440 = add64((int64_t) 1, x_73439);\n        \n        ((__global int64_t *) mem_77928)[gtid_73436 * n_65378 + gtid_73437] =\n            defunc_0_f_res_73440;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_73433\n}\n__kernel void mainzisegmap_73450(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, int64_t min_res_65398,\n                                 double i64_res_65404, __global\n                                 unsigned char *mem_77914, __global\n                                 unsigned char *mem_77932, __global\n                                 unsigned char *mem_77935, __global\n                                 unsigned char *mem_77938, __global\n                                 unsigned char *mem_77941)\n{\n    #define segmap_group_sizze_73443 (mainzisegmap_group_sizze_73202)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79772;\n    int32_t local_tid_79773;\n    ",
                   "int64_t group_sizze_79776;\n    int32_t wave_sizze_79775;\n    int32_t group_tid_79774;\n    \n    global_tid_79772 = get_global_id(0);\n    local_tid_79773 = get_local_id(0);\n    group_sizze_79776 = get_local_size(0);\n    wave_sizze_79775 = LOCKSTEP_WIDTH;\n    group_tid_79774 = get_group_id(0);\n    \n    int32_t phys_tid_73450 = global_tid_79772;\n    int64_t global_tid_79777 = sext_i32_i64(group_tid_79774) *\n            segmap_group_sizze_73443 + sext_i32_i64(local_tid_79773);\n    int64_t slice_79778 = m_65377;\n    int64_t gtid_73449 = global_tid_79777;\n    int64_t remnant_79779 = global_tid_79777 - gtid_73449;\n    \n    if (slt64(gtid_73449, m_65377)) {\n        int64_t last_res_73451;\n        \n        last_res_73451 = ((__global int64_t *) mem_77914)[gtid_73449 * n_65378 +\n                                                          i_65392];\n        \n        int64_t min_arg_73452 = sub64(last_res_73451, (int64_t) 1);\n        int64_t min_arg_73453 = sub64(last_res_73451, min_res_65398);\n        int64_t min_res_73454 = smin64(q_65380, last_res_73451);\n        double i64_res_73455 = sitofp_i64_f64(last_res_73451);\n        double x_73456 = i64_res_65404 - i64_res_73455;\n        double max_arg_73457 = x_73456 / 2.0;\n        double max_res_73458 = fmax64(0.0, max_arg_73457);\n        \n        ((__global int64_t *) mem_77932)[gtid_73449] = min_arg_73452;\n        ((__global int64_t *) mem_77935)[gtid_73449] = min_arg_73453;\n        ((__global int64_t *) mem_77938)[gtid_73449] = min_res_73454;\n        ((__global double *) mem_77941)[gtid_73449] = max_res_73458;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_73443\n}\n__kernel void mainzisegmap_73470(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, __global\n                                 unsigned char *mem_77914, __global\n                                 unsigned char *mem_77946)\n{\n    #define segmap_gro",
                   "up_sizze_73465 (mainzisegmap_group_sizze_73177)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79780;\n    int32_t local_tid_79781;\n    int64_t group_sizze_79784;\n    int32_t wave_sizze_79783;\n    int32_t group_tid_79782;\n    \n    global_tid_79780 = get_global_id(0);\n    local_tid_79781 = get_local_id(0);\n    group_sizze_79784 = get_local_size(0);\n    wave_sizze_79783 = LOCKSTEP_WIDTH;\n    group_tid_79782 = get_group_id(0);\n    \n    int32_t phys_tid_73470 = global_tid_79780;\n    int64_t global_tid_79785 = sext_i32_i64(group_tid_79782) *\n            segmap_group_sizze_73465 + sext_i32_i64(local_tid_79781);\n    int64_t slice_79786 = q_65380;\n    int64_t slice_79787 = m_65377 * slice_79786;\n    int64_t gtid_73468 = squot64(global_tid_79785, slice_79786);\n    int64_t remnant_79788 = global_tid_79785 - gtid_73468 * slice_79786;\n    int64_t gtid_73469 = remnant_79788;\n    int64_t remnant_79789 = remnant_79788 - gtid_73469;\n    \n    if (slt64(gtid_73468, m_65377) && slt64(gtid_73469, q_65380)) {\n        int64_t last_res_73471;\n        \n        last_res_73471 = ((__global int64_t *) mem_77914)[gtid_73468 * n_65378 +\n                                                          i_65392];\n        \n        bool cond_73473 = sle64(last_res_73471, gtid_73469);\n        double defunc_0_f_res_73474;\n        \n        if (cond_73473) {\n            defunc_0_f_res_73474 = 0.0;\n        } else {\n            defunc_0_f_res_73474 = 1.0;\n        }\n        ((__global double *) mem_77946)[gtid_73468 * q_65380 + gtid_73469] =\n            defunc_0_f_res_73474;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_73465\n}\n__kernel void mainzisegmap_74176(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *Y_mem_77010, __global\n                                 unsign",
                   "ed char *mem_77968, __global\n                                 unsigned char *mem_77972, __global\n                                 unsigned char *mem_77976)\n{\n    #define segmap_group_sizze_74170 (mainzisegmap_group_sizze_74011)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79889;\n    int32_t local_tid_79890;\n    int64_t group_sizze_79893;\n    int32_t wave_sizze_79892;\n    int32_t group_tid_79891;\n    \n    global_tid_79889 = get_global_id(0);\n    local_tid_79890 = get_local_id(0);\n    group_sizze_79893 = get_local_size(0);\n    wave_sizze_79892 = LOCKSTEP_WIDTH;\n    group_tid_79891 = get_group_id(0);\n    \n    int32_t phys_tid_74176 = global_tid_79889;\n    int64_t global_tid_79894 = sext_i32_i64(group_tid_79891) *\n            segmap_group_sizze_74170 + sext_i32_i64(local_tid_79890);\n    int64_t slice_79895 = n_65378;\n    int64_t slice_79896 = m_65377 * slice_79895;\n    int64_t gtid_74174 = squot64(global_tid_79894, slice_79895);\n    int64_t remnant_79897 = global_tid_79894 - gtid_74174 * slice_79895;\n    int64_t gtid_74175 = remnant_79897;\n    int64_t remnant_79898 = remnant_79897 - gtid_74175;\n    \n    if (slt64(gtid_74174, m_65377) && slt64(gtid_74175, n_65378)) {\n        double x_74177;\n        \n        x_74177 = ((__global double *) Y_mem_77010)[gtid_74174 * n_65378 +\n                                                    gtid_74175];\n        \n        bool isnan_res_74180;\n        \n        isnan_res_74180 = futrts_isnan64(x_74177);\n        \n        bool defunc_0_p_res_74181 = !isnan_res_74180;\n        int64_t defunc_1_f_res_74182;\n        \n        if (defunc_0_p_res_74181) {\n            int64_t x_74178;\n            \n            x_74178 = ((__global int64_t *) mem_77968)[gtid_74174 * n_65378 +\n                                                       gtid_74175];\n            \n            int64_t defunc_1_f_res_t_res_74183 = sub64(x_74178, (int64_",
                   "t) 1);\n            \n            defunc_1_f_res_74182 = defunc_1_f_res_t_res_74183;\n        } else {\n            defunc_1_f_res_74182 = (int64_t) -1;\n        }\n        if ((sle64((int64_t) 0, gtid_74174) && slt64(gtid_74174, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_74182) &&\n             slt64(defunc_1_f_res_74182, n_65378))) {\n            ((__global int64_t *) mem_77976)[gtid_74174 * n_65378 +\n                                             defunc_1_f_res_74182] = gtid_74175;\n        }\n        if ((sle64((int64_t) 0, gtid_74174) && slt64(gtid_74174, m_65377)) &&\n            (sle64((int64_t) 0, defunc_1_f_res_74182) &&\n             slt64(defunc_1_f_res_74182, n_65378))) {\n            ((__global double *) mem_77972)[gtid_74174 * n_65378 +\n                                            defunc_1_f_res_74182] = x_74177;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_74170\n}\n__kernel void mainzisegmap_74195(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, __global\n                                 unsigned char *mem_77976, __global\n                                 unsigned char *mem_77982)\n{\n    #define segmap_group_sizze_74190 (mainzisegmap_group_sizze_73985)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79899;\n    int32_t local_tid_79900;\n    int64_t group_sizze_79903;\n    int32_t wave_sizze_79902;\n    int32_t group_tid_79901;\n    \n    global_tid_79899 = get_global_id(0);\n    local_tid_79900 = get_local_id(0);\n    group_sizze_79903 = get_local_size(0);\n    wave_sizze_79902 = LOCKSTEP_WIDTH;\n    group_tid_79901 = get_group_id(0);\n    \n    int32_t phys_tid_74195 = global_tid_79899;\n    int64_t global_tid_79904 = sext_i32_i64(group_tid_79901) *\n            segmap_group_sizze_74190 + sext_i32_i64(local_tid_79900);\n    int64_t slice_79905 = n_65378;\n    int64_t sl",
                   "ice_79906 = m_65377 * slice_79905;\n    int64_t gtid_74193 = squot64(global_tid_79904, slice_79905);\n    int64_t remnant_79907 = global_tid_79904 - gtid_74193 * slice_79905;\n    int64_t gtid_74194 = remnant_79907;\n    int64_t remnant_79908 = remnant_79907 - gtid_74194;\n    \n    if (slt64(gtid_74193, m_65377) && slt64(gtid_74194, n_65378)) {\n        int64_t x_74196;\n        \n        x_74196 = ((__global int64_t *) mem_77976)[gtid_74193 * n_65378 +\n                                                   gtid_74194];\n        \n        int64_t defunc_0_f_res_74197 = add64((int64_t) 1, x_74196);\n        \n        ((__global int64_t *) mem_77982)[gtid_74193 * n_65378 + gtid_74194] =\n            defunc_0_f_res_74197;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_74190\n}\n__kernel void mainzisegmap_74207(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, int64_t min_res_65398,\n                                 double i64_res_65404, __global\n                                 unsigned char *mem_77968, __global\n                                 unsigned char *mem_77986, __global\n                                 unsigned char *mem_77989, __global\n                                 unsigned char *mem_77992, __global\n                                 unsigned char *mem_77995)\n{\n    #define segmap_group_sizze_74200 (mainzisegmap_group_sizze_73959)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79909;\n    int32_t local_tid_79910;\n    int64_t group_sizze_79913;\n    int32_t wave_sizze_79912;\n    int32_t group_tid_79911;\n    \n    global_tid_79909 = get_global_id(0);\n    local_tid_79910 = get_local_id(0);\n    group_sizze_79913 = get_local_size(0);\n    wave_sizze_79912 = LOCKSTEP_WIDTH;\n    group_tid_79911 = get_group_id(0);\n    \n    int32_t phys_t",
                   "id_74207 = global_tid_79909;\n    int64_t global_tid_79914 = sext_i32_i64(group_tid_79911) *\n            segmap_group_sizze_74200 + sext_i32_i64(local_tid_79910);\n    int64_t slice_79915 = m_65377;\n    int64_t gtid_74206 = global_tid_79914;\n    int64_t remnant_79916 = global_tid_79914 - gtid_74206;\n    \n    if (slt64(gtid_74206, m_65377)) {\n        int64_t last_res_74208;\n        \n        last_res_74208 = ((__global int64_t *) mem_77968)[gtid_74206 * n_65378 +\n                                                          i_65392];\n        \n        int64_t min_arg_74209 = sub64(last_res_74208, (int64_t) 1);\n        int64_t min_arg_74210 = sub64(last_res_74208, min_res_65398);\n        int64_t min_res_74211 = smin64(q_65380, last_res_74208);\n        double i64_res_74212 = sitofp_i64_f64(last_res_74208);\n        double x_74213 = i64_res_65404 - i64_res_74212;\n        double max_arg_74214 = x_74213 / 2.0;\n        double max_res_74215 = fmax64(0.0, max_arg_74214);\n        \n        ((__global int64_t *) mem_77986)[gtid_74206] = min_arg_74209;\n        ((__global int64_t *) mem_77989)[gtid_74206] = min_arg_74210;\n        ((__global int64_t *) mem_77992)[gtid_74206] = min_res_74211;\n        ((__global double *) mem_77995)[gtid_74206] = max_res_74215;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_74200\n}\n__kernel void mainzisegmap_74227(__global int *global_failure, int64_t m_65377,\n                                 int64_t n_65378, int64_t q_65380,\n                                 int64_t i_65392, __global\n                                 unsigned char *mem_77968, __global\n                                 unsigned char *mem_78000)\n{\n    #define segmap_group_sizze_74222 (mainzisegmap_group_sizze_73934)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79917;\n    int32_t local_tid_79918;\n    int64_t group_sizze_79921;\n    int32_t wave_sizze_799",
                   "20;\n    int32_t group_tid_79919;\n    \n    global_tid_79917 = get_global_id(0);\n    local_tid_79918 = get_local_id(0);\n    group_sizze_79921 = get_local_size(0);\n    wave_sizze_79920 = LOCKSTEP_WIDTH;\n    group_tid_79919 = get_group_id(0);\n    \n    int32_t phys_tid_74227 = global_tid_79917;\n    int64_t global_tid_79922 = sext_i32_i64(group_tid_79919) *\n            segmap_group_sizze_74222 + sext_i32_i64(local_tid_79918);\n    int64_t slice_79923 = q_65380;\n    int64_t slice_79924 = m_65377 * slice_79923;\n    int64_t gtid_74225 = squot64(global_tid_79922, slice_79923);\n    int64_t remnant_79925 = global_tid_79922 - gtid_74225 * slice_79923;\n    int64_t gtid_74226 = remnant_79925;\n    int64_t remnant_79926 = remnant_79925 - gtid_74226;\n    \n    if (slt64(gtid_74225, m_65377) && slt64(gtid_74226, q_65380)) {\n        int64_t last_res_74228;\n        \n        last_res_74228 = ((__global int64_t *) mem_77968)[gtid_74225 * n_65378 +\n                                                          i_65392];\n        \n        bool cond_74230 = sle64(last_res_74228, gtid_74226);\n        double defunc_0_f_res_74231;\n        \n        if (cond_74230) {\n            defunc_0_f_res_74231 = 0.0;\n        } else {\n            defunc_0_f_res_74231 = 1.0;\n        }\n        ((__global double *) mem_78000)[gtid_74225 * q_65380 + gtid_74226] =\n            defunc_0_f_res_74231;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_74222\n}\n__kernel void mainzisegmap_74589(__global int *global_failure,\n                                 int failure_is_an_option, __global\n                                 int64_t *global_failure_args, int64_t m_65377,\n                                 int64_t n_65378, int64_t jump_65382,\n                                 int64_t n_m_65386, int64_t i_65392,\n                                 int64_t y_66671, __global\n                                 unsigned char *ext_mem_78029, __global\n                                 unsigned char *ext_mem_78030, __global\n          ",
                   "                       unsigned char *mem_78035)\n{\n    #define segmap_group_sizze_74584 (mainzisegmap_group_sizze_74466)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79964;\n    int32_t local_tid_79965;\n    int64_t group_sizze_79968;\n    int32_t wave_sizze_79967;\n    int32_t group_tid_79966;\n    \n    global_tid_79964 = get_global_id(0);\n    local_tid_79965 = get_local_id(0);\n    group_sizze_79968 = get_local_size(0);\n    wave_sizze_79967 = LOCKSTEP_WIDTH;\n    group_tid_79966 = get_group_id(0);\n    \n    int32_t phys_tid_74589 = global_tid_79964;\n    int64_t global_tid_79969 = sext_i32_i64(group_tid_79966) *\n            segmap_group_sizze_74584 + sext_i32_i64(local_tid_79965);\n    int64_t slice_79970 = n_65378;\n    int64_t slice_79971 = m_65377 * slice_79970;\n    int64_t gtid_74587 = squot64(global_tid_79969, slice_79970);\n    int64_t remnant_79972 = global_tid_79969 - gtid_74587 * slice_79970;\n    int64_t gtid_74588 = remnant_79972;\n    int64_t remnant_79973 = remnant_79972 - gtid_74588;\n    \n    if (slt64(gtid_74587, m_65377) && slt64(gtid_74588, n_65378)) {\n        int64_t m_v_74593 = sdiv64(gtid_74588, jump_65382);\n        bool cond_74594 = m_v_74593 == y_66671;\n        int64_t j_74595;\n        \n        if (cond_74594) {\n            int64_t j_t_res_74596 = sub64(m_v_74593, (int64_t) 1);\n            \n            j_74595 = j_t_res_74596;\n        } else {\n            j_74595 = m_v_74593;\n        }\n        \n        int64_t min_arg_74597 = mul64(jump_65382, j_74595);\n        int64_t min_res_74598 = smin64(i_65392, min_arg_74597);\n        int64_t defunc_0_m_fun_arg_74599 = add64((int64_t) 1, j_74595);\n        int64_t min_arg_74600 = mul64(jump_65382, defunc_0_m_fun_arg_74599);\n        int64_t min_res_74601 = smin64(i_65392, min_arg_74600);\n        int64_t i64_arg_74602 = sub64(min_res_74601, min_res_74598);\n        double i64_res_74603 = sitofp",
                   "_i64_f64(i64_arg_74602);\n        int64_t i64_arg_74604 = sub64(gtid_74588, min_res_74598);\n        double i64_res_74605 = sitofp_i64_f64(i64_arg_74604);\n        double u_74606 = i64_res_74605 / i64_res_74603;\n        double u2_74607 = u_74606 * u_74606;\n        double u3_74608 = u_74606 * u2_74607;\n        double x_74609 = 2.0 * u3_74608;\n        double y_74610 = 3.0 * u2_74607;\n        double x_74611 = x_74609 - y_74610;\n        double x_74612 = 1.0 + x_74611;\n        bool x_74613 = sle64((int64_t) 0, j_74595);\n        bool y_74614 = slt64(j_74595, n_m_65386);\n        bool bounds_check_74615 = x_74613 && y_74614;\n        bool index_certs_74616;\n        \n        if (!bounds_check_74615) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 60) == -1) {\n                    global_failure_args[0] = (int64_t) j_74595;\n                    global_failure_args[1] = (int64_t) n_m_65386;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        double y_74617;\n        \n        y_74617 = ((__global double *) ext_mem_78030)[gtid_74587 * n_m_65386 +\n                                                      j_74595];\n        \n        double x_74618 = x_74612 * y_74617;\n        double x_74619 = y_74610 - x_74609;\n        bool x_74620 = sle64((int64_t) 0, defunc_0_m_fun_arg_74599);\n        bool y_74621 = slt64(defunc_0_m_fun_arg_74599, n_m_65386);\n        bool bounds_check_74622 = x_74620 && y_74621;\n        bool index_certs_74623;\n        \n        if (!bounds_check_74622) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 61) == -1) {\n                    global_failure_args[0] = (int64_t) defunc_0_m_fun_arg_74599;\n                    global_failure_args[1] = (int64_t) n_m_65386;\n                    ;\n                }\n                return;\n            }\n        }\n        \n        double y_74624;\n        \n        y_74624 = ((__global double *) ext_mem_78030)[gtid_74587 * n_m_65",
                   "386 +\n                                                      defunc_0_m_fun_arg_74599];\n        \n        double y_74625 = x_74619 * y_74624;\n        double x_74626 = x_74618 + y_74625;\n        double y_74627 = 2.0 * u2_74607;\n        double x_74628 = u3_74608 - y_74627;\n        double x_74629 = u_74606 + x_74628;\n        double y_74630;\n        \n        y_74630 = ((__global double *) ext_mem_78029)[gtid_74587 * n_m_65386 +\n                                                      j_74595];\n        \n        double x_74631 = x_74629 * y_74630;\n        double y_74632 = i64_res_74603 * x_74631;\n        double x_74633 = x_74626 + y_74632;\n        double x_74634 = u3_74608 - u2_74607;\n        double y_74635;\n        \n        y_74635 = ((__global double *) ext_mem_78029)[gtid_74587 * n_m_65386 +\n                                                      defunc_0_m_fun_arg_74599];\n        \n        double x_74636 = x_74634 * y_74635;\n        double y_74637 = i64_res_74603 * x_74636;\n        double defunc_4_interpolate_proc_res_74638 = x_74633 + y_74637;\n        \n        ((__global double *) mem_78035)[gtid_74587 * n_65378 + gtid_74588] =\n            defunc_4_interpolate_proc_res_74638;\n    }\n    \n  error_0:\n    return;\n    #undef segmap_group_sizze_74584\n}\n__kernel void mainzisegmap_intragroup_72819(__global int *global_failure,\n                                            int failure_is_an_option, __global\n                                            int64_t *global_failure_args,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79682_backing_aligned_0,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79678_backing_aligned_1,\n                                            __local volatile\n                                            int64_t *color_78231_backing_aligned_2,\n                                            int64_t m_65377, int64_t",
                   " n_65378,\n                                            int64_t q_65380, int64_t jump_65382,\n                                            int64_t n_m_65386, int64_t i_65392,\n                                            unsigned char x_65393_bits,\n                                            int64_t min_res_65398,\n                                            unsigned char loop_cond_65403_bits,\n                                            __global unsigned char *mem_77867,\n                                            __global unsigned char *mem_77871,\n                                            __global unsigned char *mem_77875,\n                                            __global unsigned char *mem_77881,\n                                            __global unsigned char *mem_77885,\n                                            __global unsigned char *mem_77888,\n                                            __global unsigned char *mem_77891,\n                                            __global unsigned char *mem_77894,\n                                            __global unsigned char *mem_77899,\n                                            __global unsigned char *mem_77909)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_79682_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79682_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_79678_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79678_backing_aligned_1;\n    __local volatile unsigned char *restrict color_78231_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) color_78231_backing_aligned_2;\n    ",
                   "volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_79659;\n    int32_t local_tid_79660;\n    int64_t group_sizze_79663;\n    int32_t wave_sizze_79662;\n    int32_t group_tid_79661;\n    \n    global_tid_79659 = get_global_id(0);\n    local_tid_79660 = get_local_id(0);\n    group_sizze_79663 = get_local_size(0);\n    wave_sizze_79662 = LOCKSTEP_WIDTH;\n    group_tid_79661 = get_group_id(0);\n    \n    int32_t phys_tid_72819 = group_tid_79661;\n    int64_t slice_79665 = q_65380;\n    int64_t ltid_pre_79664 = sext_i32_i64(local_tid_79660);\n    int64_t remnant_79666 = sext_i32_i64(local_tid_79660) - ltid_pre_79664;\n    int64_t slice_79667 = n_m_65386;\n    int64_t slice_79668 = m_65377 * slice_79667;\n    int64_t gtid_72817 = squot64(sext_i32_i64(group_tid_79661), slice_79667);\n    int64_t remnant_79669 = sext_i32_i64(group_tid_79661) - gtid_72817 *\n            slice_79667;\n    int64_t gtid_72818 = remnant_79669;\n    int64_t remnant_79670 = remnant_79669 - gtid_72818;\n    __local unsigned char *color_78231;\n    \n    color_78231 = (__local unsigned char *) color_78231_backing_0;\n    \n    int64_t last_res_72820;\n    \n    last_res_72820 = ((__global int64_t *) mem_77867)[gtid_72817 * n_65378 +\n                                                      i_65392];\n    \n    int64_t min_arg_72827;\n    \n    min_arg_72827 = ((__global int64_t *) mem_77885)[gtid_72817];\n    \n    int64_t min_arg_72828;\n    \n    min_arg_72828 = ((__global int64_t *) mem_77888)[gtid_72817];\n    \n    int64_t min_res_72829;\n    \n    min_res_72829 = ((__global int64_t *) mem_77891)[gtid_72817];\n    \n    double max_res_72830;\n    \n    max_res_72830 = ((__global double *) mem_77894)[gtid_72817];\n    \n    int64_t min_arg_72834 = mul64(jump_65382, gtid_72818);\n    int64_t min_res_72835 = smin64(i_65392, min_arg_72834);\n  ",
                   "  int64_t defunc_0_g_res_72836 = add64((int64_t) 1, min_res_72835);\n    bool init_idx_72837;\n    int64_t init_idx_72838;\n    int64_t init_idx_72839;\n    bool loop_while_72840;\n    int64_t low_72841;\n    int64_t high_72842;\n    \n    loop_while_72840 = x_65393;\n    low_72841 = (int64_t) 0;\n    high_72842 = i_65392;\n    while (loop_while_72840) {\n        int64_t x_72843 = add64(low_72841, high_72842);\n        int64_t mid_72844 = sdiv64(x_72843, (int64_t) 2);\n        bool x_72845 = sle64((int64_t) 0, mid_72844);\n        bool y_72846 = slt64(mid_72844, n_65378);\n        bool bounds_check_72847 = x_72845 && y_72846;\n        bool index_certs_72848;\n        \n        if (!bounds_check_72847) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 45) == -1) {\n                    global_failure_args[0] = (int64_t) mid_72844;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t mid_id_72849;\n        \n        mid_id_72849 = ((__global int64_t *) mem_77881)[gtid_72817 * n_65378 +\n                                                        mid_72844];\n        \n        bool cond_72850 = slt64(mid_id_72849, (int64_t) 0);\n        int64_t mid_idx_72851;\n        \n        if (cond_72850) {\n            mid_idx_72851 = (int64_t) 9223372036854775807;\n        } else {\n            mid_idx_72851 = mid_id_72849;\n        }\n        \n        bool cond_72852 = sle64(defunc_0_g_res_72836, mid_idx_72851);\n        int64_t loopres_72853;\n        int64_t loopres_72854;\n        \n        if (cond_72852) {\n            int64_t loopres_t_res_72855 = sub64(mid_72844, (int64_t) 1);\n            \n            loopres_72853 = low_72841;\n            loopres_72854 = loopres_t_res_72855;\n        } else {\n            int64_t loopres_f_res_72856 = add64((int64_t) 1, mid_72844);\n            \n            loopres_72853 = loopres_f_re",
                   "s_72856;\n            loopres_72854 = high_72842;\n        }\n        \n        bool loop_cond_72857 = sle64(loopres_72853, loopres_72854);\n        bool loop_while_tmp_79671 = loop_cond_72857;\n        int64_t low_tmp_79672 = loopres_72853;\n        int64_t high_tmp_79673 = loopres_72854;\n        \n        loop_while_72840 = loop_while_tmp_79671;\n        low_72841 = low_tmp_79672;\n        high_72842 = high_tmp_79673;\n    }\n    init_idx_72837 = loop_while_72840;\n    init_idx_72838 = low_72841;\n    init_idx_72839 = high_72842;\n    \n    bool idx_72858;\n    int64_t idx_72859;\n    int64_t idx_72860;\n    int64_t idx_72861;\n    bool loop_while_72862;\n    int64_t l_idx_72863;\n    int64_t r_idx_72864;\n    int64_t span_72865;\n    \n    loop_while_72862 = loop_cond_65403;\n    l_idx_72863 = init_idx_72838;\n    r_idx_72864 = init_idx_72838;\n    span_72865 = (int64_t) 1;\n    while (loop_while_72862) {\n        int64_t max_arg_72866 = sub64(l_idx_72863, (int64_t) 1);\n        int64_t max_res_72867 = smax64((int64_t) 0, max_arg_72866);\n        int64_t min_arg_72868 = add64((int64_t) 1, r_idx_72864);\n        int64_t min_res_72869 = smin64(min_arg_72827, min_arg_72868);\n        bool x_72870 = sle64((int64_t) 0, max_res_72867);\n        bool y_72871 = slt64(max_res_72867, n_65378);\n        bool bounds_check_72872 = x_72870 && y_72871;\n        bool index_certs_72873;\n        \n        if (!bounds_check_72872) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 46) == -1) {\n                    global_failure_args[0] = (int64_t) max_res_72867;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t x_72874;\n        \n        x_72874 = ((__global int64_t *) mem_77881)[gtid_72817 * n_65378 +\n                                                   max_res_72867];\n        \n        int64_t abs_arg_72875 = sub64(x_72874",
                   ", defunc_0_g_res_72836);\n        int64_t abs_res_72876 = abs64(abs_arg_72875);\n        bool x_72877 = sle64((int64_t) 0, min_res_72869);\n        bool y_72878 = slt64(min_res_72869, n_65378);\n        bool bounds_check_72879 = x_72877 && y_72878;\n        bool index_certs_72880;\n        \n        if (!bounds_check_72879) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 47) == -1) {\n                    global_failure_args[0] = (int64_t) min_res_72869;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t x_72881;\n        \n        x_72881 = ((__global int64_t *) mem_77881)[gtid_72817 * n_65378 +\n                                                   min_res_72869];\n        \n        int64_t abs_arg_72882 = sub64(x_72881, defunc_0_g_res_72836);\n        int64_t abs_res_72883 = abs64(abs_arg_72882);\n        bool cond_72884 = max_res_72867 == l_idx_72863;\n        int64_t loopres_72885;\n        int64_t loopres_72886;\n        int64_t loopres_72887;\n        \n        if (cond_72884) {\n            loopres_72885 = l_idx_72863;\n            loopres_72886 = r_idx_72864;\n            loopres_72887 = min_res_65398;\n        } else {\n            bool cond_72888 = slt64(abs_res_72876, abs_res_72883);\n            bool cond_f_res_72889 = min_res_72869 == r_idx_72864;\n            bool x_72890 = !cond_72888;\n            bool y_72891 = cond_f_res_72889 && x_72890;\n            bool cond_72892 = cond_72888 || y_72891;\n            int64_t loopres_f_res_72893;\n            \n            if (cond_72892) {\n                loopres_f_res_72893 = max_res_72867;\n            } else {\n                loopres_f_res_72893 = l_idx_72863;\n            }\n            \n            int64_t loopres_f_res_72894;\n            \n            if (cond_72892) {\n                loopres_f_res_72894 = r_idx_72864;\n            } else {\n   ",
                   "             loopres_f_res_72894 = min_res_72869;\n            }\n            \n            int64_t loopres_f_res_72895;\n            \n            if (cond_72892) {\n                int64_t loopres_f_res_t_res_72896 = add64((int64_t) 1,\n                                                          span_72865);\n                \n                loopres_f_res_72895 = loopres_f_res_t_res_72896;\n            } else {\n                int64_t loopres_f_res_f_res_72897 = add64((int64_t) 1,\n                                                          span_72865);\n                \n                loopres_f_res_72895 = loopres_f_res_f_res_72897;\n            }\n            loopres_72885 = loopres_f_res_72893;\n            loopres_72886 = loopres_f_res_72894;\n            loopres_72887 = loopres_f_res_72895;\n        }\n        \n        bool loop_cond_72898 = slt64(loopres_72887, min_res_65398);\n        bool loop_while_tmp_79674 = loop_cond_72898;\n        int64_t l_idx_tmp_79675 = loopres_72885;\n        int64_t r_idx_tmp_79676 = loopres_72886;\n        int64_t span_tmp_79677 = loopres_72887;\n        \n        loop_while_72862 = loop_while_tmp_79674;\n        l_idx_72863 = l_idx_tmp_79675;\n        r_idx_72864 = r_idx_tmp_79676;\n        span_72865 = span_tmp_79677;\n    }\n    idx_72858 = loop_while_72862;\n    idx_72859 = l_idx_72863;\n    idx_72860 = r_idx_72864;\n    idx_72861 = span_72865;\n    \n    int64_t min_res_72899 = smin64(min_arg_72828, idx_72859);\n    int64_t max_res_72900 = smax64((int64_t) 0, min_res_72899);\n    int64_t x_72901 = add64(min_res_72829, max_res_72900);\n    int64_t r_72902 = sub64(x_72901, (int64_t) 1);\n    bool x_72903 = sle64((int64_t) 0, r_72902);\n    bool y_72904 = slt64(r_72902, n_65378);\n    bool bounds_check_72905 = x_72903 && y_72904;\n    bool index_certs_72906;\n    \n    if (!bounds_check_72905) {\n        {\n            if (atomic_cmpxchg_i32_global(global_failure, -1, 48) == -1) {\n                global_failure_args[0] = (int64_t) r_72902;\n                global_failure_a",
                   "rgs[1] = (int64_t) n_65378;\n                ;\n            }\n            local_failure = true;\n            goto error_0;\n        }\n    }\n    \n    int64_t x_72907;\n    \n    x_72907 = ((__global int64_t *) mem_77875)[gtid_72817 * n_65378 + r_72902];\n    \n    int64_t abs_arg_72908 = sub64(x_72907, min_res_72835);\n    int64_t abs_res_72909 = abs64(abs_arg_72908);\n    bool x_72910 = sle64((int64_t) 0, max_res_72900);\n    bool y_72911 = slt64(max_res_72900, n_65378);\n    bool bounds_check_72912 = x_72910 && y_72911;\n    bool index_certs_72913;\n    \n    if (!bounds_check_72912) {\n        {\n            if (atomic_cmpxchg_i32_global(global_failure, -1, 49) == -1) {\n                global_failure_args[0] = (int64_t) max_res_72900;\n                global_failure_args[1] = (int64_t) n_65378;\n                ;\n            }\n            local_failure = true;\n            goto error_0;\n        }\n    }\n    \n    int64_t x_72914;\n    \n    x_72914 = ((__global int64_t *) mem_77875)[gtid_72817 * n_65378 +\n                                               max_res_72900];\n    \n    int64_t abs_arg_72915 = sub64(x_72914, min_res_72835);\n    int64_t abs_res_72916 = abs64(abs_arg_72915);\n    int64_t max_res_72917 = smax64(abs_res_72909, abs_res_72916);\n    double defunc_0_f_res_72918 = sitofp_i64_f64(max_res_72917);\n    double defunc_1_f_res_72919 = max_res_72830 + defunc_0_f_res_72918;\n    double defunc_2_reduce_res_72920;\n    int64_t gtid_72922 = sext_i32_i64(sext_i64_i32(ltid_pre_79664));\n    int32_t phys_tid_72923 = local_tid_79660;\n    __local unsigned char *red_arr_mem_79678;\n    \n    red_arr_mem_79678 = (__local unsigned char *) red_arr_mem_79678_backing_1;\n    \n    double x_72928;\n    \n    x_72928 = ((__global double *) mem_77899)[gtid_72817 * q_65380 +\n                                              gtid_72922];\n    \n    bool cond_72929 = sle64(last_res_72820, gtid_72922);\n    int64_t defunc_0_f_res_72930;\n    \n    if (cond_72929) {\n        defunc_0_f_res_72930 = (int64_t) 0;\n    } else {\n",
                   "        int64_t i_72931 = add64(max_res_72900, gtid_72922);\n        int64_t defunc_0_add_arg_72932;\n        \n        defunc_0_add_arg_72932 = ((__global int64_t *) mem_77875)[gtid_72817 *\n                                                                  n_65378 +\n                                                                  i_72931];\n        \n        int64_t defunc_1_add_res_72933 = add64((int64_t) 1,\n                                               defunc_0_add_arg_72932);\n        \n        defunc_0_f_res_72930 = defunc_1_add_res_72933;\n    }\n    \n    int64_t binop_p_72934 = sub64(defunc_0_f_res_72930, min_res_72835);\n    double defunc_0_f_res_72935 = sitofp_i64_f64(binop_p_72934);\n    double abs_res_72936 = fabs(defunc_0_f_res_72935);\n    double tmp1_72937 = abs_res_72936 / defunc_1_f_res_72919;\n    double x_72938 = tmp1_72937 * tmp1_72937;\n    double y_72939 = tmp1_72937 * x_72938;\n    double tmp2_72940 = 1.0 - y_72939;\n    double x_72941 = tmp2_72940 * tmp2_72940;\n    double tmp3_72942 = tmp2_72940 * x_72941;\n    double tmp4_72943 = x_72928 * tmp3_72942;\n    \n    ((__local double *) red_arr_mem_79678)[gtid_72922] = tmp4_72943;\n    ((__local double *) color_78231)[gtid_72922] = tmp4_72943;\n    \n  error_0:\n    barrier(CLK_LOCAL_MEM_FENCE);\n    if (local_failure)\n        return;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_79680;\n    int32_t skip_waves_79681 = 1;\n    double x_72924;\n    double x_72925;\n    \n    offset_79680 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79660, sext_i64_i32(q_65380))) {\n            x_72924 = ((__local\n                        double *) red_arr_mem_79678)[sext_i32_i64(local_tid_79660 +\n                                                     offset_79680)];\n        }\n    }\n    offset_79680 = 1;\n    while (slt32(offset_79680, wave_sizze_79662)) {\n        if (slt32(local_tid_79660 + offset_79680, sext_i64_i32(q_65380)) &&\n            ((local_tid_79660 - squot32(local_tid_79660, wav",
                   "e_sizze_79662) *\n              wave_sizze_79662) & (2 * offset_79680 - 1)) == 0) {\n            // read array element\n            {\n                x_72925 = ((volatile __local\n                            double *) red_arr_mem_79678)[sext_i32_i64(local_tid_79660 +\n                                                         offset_79680)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_72926 = x_72924 + x_72925;\n                \n                x_72924 = defunc_1_op_res_72926;\n            }\n            // write result of operation\n            {\n                ((volatile __local\n                  double *) red_arr_mem_79678)[sext_i32_i64(local_tid_79660)] =\n                    x_72924;\n            }\n        }\n        offset_79680 *= 2;\n    }\n    while (slt32(skip_waves_79681, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79662 - 1,\n                                           wave_sizze_79662))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79680 = skip_waves_79681 * wave_sizze_79662;\n        if (slt32(local_tid_79660 + offset_79680, sext_i64_i32(q_65380)) &&\n            ((local_tid_79660 - squot32(local_tid_79660, wave_sizze_79662) *\n              wave_sizze_79662) == 0 && (squot32(local_tid_79660,\n                                                 wave_sizze_79662) & (2 *\n                                                                      skip_waves_79681 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_72925 = ((__local\n                            double *) red_arr_mem_79678)[sext_i32_i64(local_tid_79660 +\n                                                         offset_79680)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_72926 = x_72924 + x_72925;\n                \n                x_7292",
                   "4 = defunc_1_op_res_72926;\n            }\n            // write result of operation\n            {\n                ((__local\n                  double *) red_arr_mem_79678)[sext_i32_i64(local_tid_79660)] =\n                    x_72924;\n            }\n        }\n        skip_waves_79681 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_72920 = ((__local\n                                  double *) red_arr_mem_79678)[(int64_t) 0];\n    \n    double a0_72944 = 1.0 / defunc_2_reduce_res_72920;\n    double defunc_2_reduce_res_72945;\n    int64_t gtid_72946 = sext_i32_i64(sext_i64_i32(ltid_pre_79664));\n    int32_t phys_tid_72947 = local_tid_79660;\n    __local unsigned char *red_arr_mem_79682;\n    \n    red_arr_mem_79682 = (__local unsigned char *) red_arr_mem_79682_backing_2;\n    \n    double x_72952;\n    \n    x_72952 = ((__local double *) color_78231)[gtid_72946];\n    \n    bool cond_72953 = sle64(last_res_72820, gtid_72946);\n    double defunc_0_f_res_72954;\n    \n    if (cond_72953) {\n        defunc_0_f_res_72954 = 0.0;\n    } else {\n        int64_t i_72955 = add64(max_res_72900, gtid_72946);\n        double defunc_0_add_arg_72956;\n        \n        defunc_0_add_arg_72956 = ((__global double *) mem_77871)[gtid_72817 *\n                                                                 n_65378 +\n                                                                 i_72955];\n        defunc_0_f_res_72954 = defunc_0_add_arg_72956;\n    }\n    \n    double x_72957 = a0_72944 * x_72952;\n    double defunc_9_fit_fun_res_72958 = defunc_0_f_res_72954 * x_72957;\n    \n    ((__local double *) red_arr_mem_79682)[gtid_72946] =\n        defunc_9_fit_fun_res_72958;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_79684;\n    int32_t skip_waves_79685 = 1;\n    double x_72948;\n    double x_72949;\n    \n    offset_79684 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79660, sext_i64_i32(q_65380))) {\n            x_72948 = ((__local\n                   ",
                   "     double *) red_arr_mem_79682)[sext_i32_i64(local_tid_79660 +\n                                                     offset_79684)];\n        }\n    }\n    offset_79684 = 1;\n    while (slt32(offset_79684, wave_sizze_79662)) {\n        if (slt32(local_tid_79660 + offset_79684, sext_i64_i32(q_65380)) &&\n            ((local_tid_79660 - squot32(local_tid_79660, wave_sizze_79662) *\n              wave_sizze_79662) & (2 * offset_79684 - 1)) == 0) {\n            // read array element\n            {\n                x_72949 = ((volatile __local\n                            double *) red_arr_mem_79682)[sext_i32_i64(local_tid_79660 +\n                                                         offset_79684)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_72950 = x_72948 + x_72949;\n                \n                x_72948 = defunc_1_op_res_72950;\n            }\n            // write result of operation\n            {\n                ((volatile __local\n                  double *) red_arr_mem_79682)[sext_i32_i64(local_tid_79660)] =\n                    x_72948;\n            }\n        }\n        offset_79684 *= 2;\n    }\n    while (slt32(skip_waves_79685, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79662 - 1,\n                                           wave_sizze_79662))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79684 = skip_waves_79685 * wave_sizze_79662;\n        if (slt32(local_tid_79660 + offset_79684, sext_i64_i32(q_65380)) &&\n            ((local_tid_79660 - squot32(local_tid_79660, wave_sizze_79662) *\n              wave_sizze_79662) == 0 && (squot32(local_tid_79660,\n                                                 wave_sizze_79662) & (2 *\n                                                                      skip_waves_79685 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n           ",
                   "     x_72949 = ((__local\n                            double *) red_arr_mem_79682)[sext_i32_i64(local_tid_79660 +\n                                                         offset_79684)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_72950 = x_72948 + x_72949;\n                \n                x_72948 = defunc_1_op_res_72950;\n            }\n            // write result of operation\n            {\n                ((__local\n                  double *) red_arr_mem_79682)[sext_i32_i64(local_tid_79660)] =\n                    x_72948;\n            }\n        }\n        skip_waves_79685 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_72945 = ((__local\n                                  double *) red_arr_mem_79682)[(int64_t) 0];\n    if (local_tid_79660 == 0) {\n        ((__global double *) mem_77909)[gtid_72817 * n_m_65386 + gtid_72818] =\n            defunc_2_reduce_res_72945;\n    }\n    \n  error_4:\n    return;\n}\n__kernel void mainzisegmap_intragroup_73487(__global int *global_failure,\n                                            int failure_is_an_option, __global\n                                            int64_t *global_failure_args,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79819_backing_aligned_0,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79817_backing_aligned_1,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79813_backing_aligned_2,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79811_backing_aligned_3,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79809_backing_aligned_4,\n                           ",
                   "                 __local volatile\n                                            int64_t *color_78233_backing_aligned_5,\n                                            __local volatile\n                                            int64_t *color_78232_backing_aligned_6,\n                                            int64_t m_65377, int64_t n_65378,\n                                            int64_t q_65380, int64_t jump_65382,\n                                            int64_t n_m_65386, int64_t i_65392,\n                                            unsigned char x_65393_bits,\n                                            int64_t min_res_65398,\n                                            unsigned char loop_cond_65403_bits,\n                                            __global unsigned char *mem_77914,\n                                            __global unsigned char *mem_77918,\n                                            __global unsigned char *mem_77922,\n                                            __global unsigned char *mem_77928,\n                                            __global unsigned char *mem_77932,\n                                            __global unsigned char *mem_77935,\n                                            __global unsigned char *mem_77938,\n                                            __global unsigned char *mem_77941,\n                                            __global unsigned char *mem_77946,\n                                            __global unsigned char *mem_77959,\n                                            __global unsigned char *mem_77963)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_79819_backing_6 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79819_backing_aligned_0;\n    __local volati",
                   "le unsigned char *restrict red_arr_mem_79817_backing_5 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79817_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_79813_backing_4 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79813_backing_aligned_2;\n    __local volatile unsigned char *restrict red_arr_mem_79811_backing_3 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79811_backing_aligned_3;\n    __local volatile unsigned char *restrict red_arr_mem_79809_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79809_backing_aligned_4;\n    __local volatile unsigned char *restrict color_78233_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) color_78233_backing_aligned_5;\n    __local volatile unsigned char *restrict color_78232_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) color_78232_backing_aligned_6;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_79790;\n    int32_t local_tid_79791;\n    int64_t group_sizze_79794;\n    int32_t wave_sizze_79793;\n    int32_t group_tid_79792;\n    \n    global_tid_79790 = get_global_id(0);\n    local_tid_79791 = get_local_id(0);\n    group_sizze_79794 = get_local_size(0);\n    wave_sizze_79793 = LOCKSTEP_WIDTH;\n    group_tid_79792 = get_group_id(0);\n    \n    int32_t phys_tid_73487 = group_tid_79792;\n    int64_t slice_79796 = q_65380;\n    int64_t ltid_pre_79795 = sext_i32_i64(local_tid",
                   "_79791);\n    int64_t remnant_79797 = sext_i32_i64(local_tid_79791) - ltid_pre_79795;\n    int64_t slice_79798 = n_m_65386;\n    int64_t slice_79799 = m_65377 * slice_79798;\n    int64_t gtid_73485 = squot64(sext_i32_i64(group_tid_79792), slice_79798);\n    int64_t remnant_79800 = sext_i32_i64(group_tid_79792) - gtid_73485 *\n            slice_79798;\n    int64_t gtid_73486 = remnant_79800;\n    int64_t remnant_79801 = remnant_79800 - gtid_73486;\n    __local unsigned char *color_78232;\n    \n    color_78232 = (__local unsigned char *) color_78232_backing_0;\n    \n    __local unsigned char *color_78233;\n    \n    color_78233 = (__local unsigned char *) color_78233_backing_1;\n    \n    int64_t last_res_73488;\n    \n    last_res_73488 = ((__global int64_t *) mem_77914)[gtid_73485 * n_65378 +\n                                                      i_65392];\n    \n    int64_t min_arg_73495;\n    \n    min_arg_73495 = ((__global int64_t *) mem_77932)[gtid_73485];\n    \n    int64_t min_arg_73496;\n    \n    min_arg_73496 = ((__global int64_t *) mem_77935)[gtid_73485];\n    \n    int64_t min_res_73497;\n    \n    min_res_73497 = ((__global int64_t *) mem_77938)[gtid_73485];\n    \n    double max_res_73498;\n    \n    max_res_73498 = ((__global double *) mem_77941)[gtid_73485];\n    \n    int64_t min_arg_73502 = mul64(jump_65382, gtid_73486);\n    int64_t min_res_73503 = smin64(i_65392, min_arg_73502);\n    int64_t defunc_0_g_res_73504 = add64((int64_t) 1, min_res_73503);\n    bool init_idx_73505;\n    int64_t init_idx_73506;\n    int64_t init_idx_73507;\n    bool loop_while_73508;\n    int64_t low_73509;\n    int64_t high_73510;\n    \n    loop_while_73508 = x_65393;\n    low_73509 = (int64_t) 0;\n    high_73510 = i_65392;\n    while (loop_while_73508) {\n        int64_t x_73511 = add64(low_73509, high_73510);\n        int64_t mid_73512 = sdiv64(x_73511, (int64_t) 2);\n        bool x_73513 = sle64((int64_t) 0, mid_73512);\n        bool y_73514 = slt64(mid_73512, n_65378);\n        bool bounds_check_73515 = x_73513 && y_73",
                   "514;\n        bool index_certs_73516;\n        \n        if (!bounds_check_73515) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 50) == -1) {\n                    global_failure_args[0] = (int64_t) mid_73512;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t mid_id_73517;\n        \n        mid_id_73517 = ((__global int64_t *) mem_77928)[gtid_73485 * n_65378 +\n                                                        mid_73512];\n        \n        bool cond_73518 = slt64(mid_id_73517, (int64_t) 0);\n        int64_t mid_idx_73519;\n        \n        if (cond_73518) {\n            mid_idx_73519 = (int64_t) 9223372036854775807;\n        } else {\n            mid_idx_73519 = mid_id_73517;\n        }\n        \n        bool cond_73520 = sle64(defunc_0_g_res_73504, mid_idx_73519);\n        int64_t loopres_73521;\n        int64_t loopres_73522;\n        \n        if (cond_73520) {\n            int64_t loopres_t_res_73523 = sub64(mid_73512, (int64_t) 1);\n            \n            loopres_73521 = low_73509;\n            loopres_73522 = loopres_t_res_73523;\n        } else {\n            int64_t loopres_f_res_73524 = add64((int64_t) 1, mid_73512);\n            \n            loopres_73521 = loopres_f_res_73524;\n            loopres_73522 = high_73510;\n        }\n        \n        bool loop_cond_73525 = sle64(loopres_73521, loopres_73522);\n        bool loop_while_tmp_79802 = loop_cond_73525;\n        int64_t low_tmp_79803 = loopres_73521;\n        int64_t high_tmp_79804 = loopres_73522;\n        \n        loop_while_73508 = loop_while_tmp_79802;\n        low_73509 = low_tmp_79803;\n        high_73510 = high_tmp_79804;\n    }\n    init_idx_73505 = loop_while_73508;\n    init_idx_73506 = low_73509;\n    init_idx_73507 = high_73510;\n    \n    bool idx_73526;\n    int64_t idx_73527;\n    int64_t idx_73528;\n    int64_t idx_73",
                   "529;\n    bool loop_while_73530;\n    int64_t l_idx_73531;\n    int64_t r_idx_73532;\n    int64_t span_73533;\n    \n    loop_while_73530 = loop_cond_65403;\n    l_idx_73531 = init_idx_73506;\n    r_idx_73532 = init_idx_73506;\n    span_73533 = (int64_t) 1;\n    while (loop_while_73530) {\n        int64_t max_arg_73534 = sub64(l_idx_73531, (int64_t) 1);\n        int64_t max_res_73535 = smax64((int64_t) 0, max_arg_73534);\n        int64_t min_arg_73536 = add64((int64_t) 1, r_idx_73532);\n        int64_t min_res_73537 = smin64(min_arg_73495, min_arg_73536);\n        bool x_73538 = sle64((int64_t) 0, max_res_73535);\n        bool y_73539 = slt64(max_res_73535, n_65378);\n        bool bounds_check_73540 = x_73538 && y_73539;\n        bool index_certs_73541;\n        \n        if (!bounds_check_73540) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 51) == -1) {\n                    global_failure_args[0] = (int64_t) max_res_73535;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t x_73542;\n        \n        x_73542 = ((__global int64_t *) mem_77928)[gtid_73485 * n_65378 +\n                                                   max_res_73535];\n        \n        int64_t abs_arg_73543 = sub64(x_73542, defunc_0_g_res_73504);\n        int64_t abs_res_73544 = abs64(abs_arg_73543);\n        bool x_73545 = sle64((int64_t) 0, min_res_73537);\n        bool y_73546 = slt64(min_res_73537, n_65378);\n        bool bounds_check_73547 = x_73545 && y_73546;\n        bool index_certs_73548;\n        \n        if (!bounds_check_73547) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 52) == -1) {\n                    global_failure_args[0] = (int64_t) min_res_73537;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_fai",
                   "lure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t x_73549;\n        \n        x_73549 = ((__global int64_t *) mem_77928)[gtid_73485 * n_65378 +\n                                                   min_res_73537];\n        \n        int64_t abs_arg_73550 = sub64(x_73549, defunc_0_g_res_73504);\n        int64_t abs_res_73551 = abs64(abs_arg_73550);\n        bool cond_73552 = max_res_73535 == l_idx_73531;\n        int64_t loopres_73553;\n        int64_t loopres_73554;\n        int64_t loopres_73555;\n        \n        if (cond_73552) {\n            loopres_73553 = l_idx_73531;\n            loopres_73554 = r_idx_73532;\n            loopres_73555 = min_res_65398;\n        } else {\n            bool cond_73556 = slt64(abs_res_73544, abs_res_73551);\n            bool cond_f_res_73557 = min_res_73537 == r_idx_73532;\n            bool x_73558 = !cond_73556;\n            bool y_73559 = cond_f_res_73557 && x_73558;\n            bool cond_73560 = cond_73556 || y_73559;\n            int64_t loopres_f_res_73561;\n            \n            if (cond_73560) {\n                loopres_f_res_73561 = max_res_73535;\n            } else {\n                loopres_f_res_73561 = l_idx_73531;\n            }\n            \n            int64_t loopres_f_res_73562;\n            \n            if (cond_73560) {\n                loopres_f_res_73562 = r_idx_73532;\n            } else {\n                loopres_f_res_73562 = min_res_73537;\n            }\n            \n            int64_t loopres_f_res_73563;\n            \n            if (cond_73560) {\n                int64_t loopres_f_res_t_res_73564 = add64((int64_t) 1,\n                                                          span_73533);\n                \n                loopres_f_res_73563 = loopres_f_res_t_res_73564;\n            } else {\n                int64_t loopres_f_res_f_res_73565 = add64((int64_t) 1,\n                                                          span_73533);\n                \n                loopres_f_res_73563 = loopres_f_",
                   "res_f_res_73565;\n            }\n            loopres_73553 = loopres_f_res_73561;\n            loopres_73554 = loopres_f_res_73562;\n            loopres_73555 = loopres_f_res_73563;\n        }\n        \n        bool loop_cond_73566 = slt64(loopres_73555, min_res_65398);\n        bool loop_while_tmp_79805 = loop_cond_73566;\n        int64_t l_idx_tmp_79806 = loopres_73553;\n        int64_t r_idx_tmp_79807 = loopres_73554;\n        int64_t span_tmp_79808 = loopres_73555;\n        \n        loop_while_73530 = loop_while_tmp_79805;\n        l_idx_73531 = l_idx_tmp_79806;\n        r_idx_73532 = r_idx_tmp_79807;\n        span_73533 = span_tmp_79808;\n    }\n    idx_73526 = loop_while_73530;\n    idx_73527 = l_idx_73531;\n    idx_73528 = r_idx_73532;\n    idx_73529 = span_73533;\n    \n    int64_t min_res_73567 = smin64(min_arg_73496, idx_73527);\n    int64_t max_res_73568 = smax64((int64_t) 0, min_res_73567);\n    int64_t x_73569 = add64(min_res_73497, max_res_73568);\n    int64_t r_73570 = sub64(x_73569, (int64_t) 1);\n    bool x_73571 = sle64((int64_t) 0, r_73570);\n    bool y_73572 = slt64(r_73570, n_65378);\n    bool bounds_check_73573 = x_73571 && y_73572;\n    bool index_certs_73574;\n    \n    if (!bounds_check_73573) {\n        {\n            if (atomic_cmpxchg_i32_global(global_failure, -1, 53) == -1) {\n                global_failure_args[0] = (int64_t) r_73570;\n                global_failure_args[1] = (int64_t) n_65378;\n                ;\n            }\n            local_failure = true;\n            goto error_0;\n        }\n    }\n    \n    int64_t x_73575;\n    \n    x_73575 = ((__global int64_t *) mem_77922)[gtid_73485 * n_65378 + r_73570];\n    \n    int64_t abs_arg_73576 = sub64(x_73575, min_res_73503);\n    int64_t abs_res_73577 = abs64(abs_arg_73576);\n    bool x_73578 = sle64((int64_t) 0, max_res_73568);\n    bool y_73579 = slt64(max_res_73568, n_65378);\n    bool bounds_check_73580 = x_73578 && y_73579;\n    bool index_certs_73581;\n    \n    if (!bounds_check_73580) {\n        {\n            if (atomic_c",
                   "mpxchg_i32_global(global_failure, -1, 54) == -1) {\n                global_failure_args[0] = (int64_t) max_res_73568;\n                global_failure_args[1] = (int64_t) n_65378;\n                ;\n            }\n            local_failure = true;\n            goto error_0;\n        }\n    }\n    \n    int64_t x_73582;\n    \n    x_73582 = ((__global int64_t *) mem_77922)[gtid_73485 * n_65378 +\n                                               max_res_73568];\n    \n    int64_t abs_arg_73583 = sub64(x_73582, min_res_73503);\n    int64_t abs_res_73584 = abs64(abs_arg_73583);\n    int64_t max_res_73585 = smax64(abs_res_73577, abs_res_73584);\n    double defunc_0_f_res_73586 = sitofp_i64_f64(max_res_73585);\n    double defunc_1_f_res_73587 = max_res_73498 + defunc_0_f_res_73586;\n    double defunc_2_reduce_res_73588;\n    double defunc_2_reduce_res_73589;\n    double defunc_2_reduce_res_73590;\n    int64_t gtid_73593 = sext_i32_i64(sext_i64_i32(ltid_pre_79795));\n    int32_t phys_tid_73594 = local_tid_79791;\n    __local unsigned char *red_arr_mem_79809;\n    \n    red_arr_mem_79809 = (__local unsigned char *) red_arr_mem_79809_backing_2;\n    \n    __local unsigned char *red_arr_mem_79811;\n    \n    red_arr_mem_79811 = (__local unsigned char *) red_arr_mem_79811_backing_3;\n    \n    __local unsigned char *red_arr_mem_79813;\n    \n    red_arr_mem_79813 = (__local unsigned char *) red_arr_mem_79813_backing_4;\n    \n    double x_73605;\n    \n    x_73605 = ((__global double *) mem_77946)[gtid_73485 * q_65380 +\n                                              gtid_73593];\n    \n    bool cond_73606 = sle64(last_res_73488, gtid_73593);\n    int64_t defunc_0_f_res_73607;\n    \n    if (cond_73606) {\n        defunc_0_f_res_73607 = (int64_t) 0;\n    } else {\n        int64_t i_73608 = add64(max_res_73568, gtid_73593);\n        int64_t defunc_0_add_arg_73609;\n        \n        defunc_0_add_arg_73609 = ((__global int64_t *) mem_77922)[gtid_73485 *\n                                                                  n_65378 +\n   ",
                   "                                                               i_73608];\n        \n        int64_t defunc_1_add_res_73610 = add64((int64_t) 1,\n                                               defunc_0_add_arg_73609);\n        \n        defunc_0_f_res_73607 = defunc_1_add_res_73610;\n    }\n    \n    int64_t binop_p_73611 = sub64(defunc_0_f_res_73607, min_res_73503);\n    double defunc_0_f_res_73612 = sitofp_i64_f64(binop_p_73611);\n    double abs_res_73613 = fabs(defunc_0_f_res_73612);\n    double tmp1_73614 = abs_res_73613 / defunc_1_f_res_73587;\n    double x_73615 = tmp1_73614 * tmp1_73614;\n    double y_73616 = tmp1_73614 * x_73615;\n    double tmp2_73617 = 1.0 - y_73616;\n    double x_73618 = tmp2_73617 * tmp2_73617;\n    double tmp3_73619 = tmp2_73617 * x_73618;\n    double tmp4_73620 = x_73605 * tmp3_73619;\n    double defunc_1_f_res_73621 = defunc_0_f_res_73612 * tmp4_73620;\n    double defunc_1_f_res_73622 = defunc_0_f_res_73612 * defunc_1_f_res_73621;\n    \n    ((__local double *) red_arr_mem_79809)[gtid_73593] = tmp4_73620;\n    ((__local double *) red_arr_mem_79811)[gtid_73593] = defunc_1_f_res_73621;\n    ((__local double *) red_arr_mem_79813)[gtid_73593] = defunc_1_f_res_73622;\n    ((__local double *) color_78233)[gtid_73593] = defunc_1_f_res_73621;\n    ((__local double *) color_78232)[gtid_73593] = tmp4_73620;\n    \n  error_0:\n    barrier(CLK_LOCAL_MEM_FENCE);\n    if (local_failure)\n        return;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_79815;\n    int32_t skip_waves_79816 = 1;\n    double x_73595;\n    double x_73596;\n    double x_73597;\n    double x_73598;\n    double x_73599;\n    double x_73600;\n    \n    offset_79815 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79791, sext_i64_i32(q_65380))) {\n            x_73595 = ((__local\n                        double *) red_arr_mem_79809)[sext_i32_i64(local_tid_79791 +\n                                                     offset_79815)];\n            x_73596 = ((__local\n  ",
                   "                      double *) red_arr_mem_79811)[sext_i32_i64(local_tid_79791 +\n                                                     offset_79815)];\n            x_73597 = ((__local\n                        double *) red_arr_mem_79813)[sext_i32_i64(local_tid_79791 +\n                                                     offset_79815)];\n        }\n    }\n    offset_79815 = 1;\n    while (slt32(offset_79815, wave_sizze_79793)) {\n        if (slt32(local_tid_79791 + offset_79815, sext_i64_i32(q_65380)) &&\n            ((local_tid_79791 - squot32(local_tid_79791, wave_sizze_79793) *\n              wave_sizze_79793) & (2 * offset_79815 - 1)) == 0) {\n            // read array element\n            {\n                x_73598 = ((volatile __local\n                            double *) red_arr_mem_79809)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79815)];\n                x_73599 = ((volatile __local\n                            double *) red_arr_mem_79811)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79815)];\n                x_73600 = ((volatile __local\n                            double *) red_arr_mem_79813)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79815)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_73601 = x_73595 + x_73598;\n                double defunc_1_op_res_73602 = x_73596 + x_73599;\n                double defunc_1_op_res_73603 = x_73597 + x_73600;\n                \n                x_73595 = defunc_1_op_res_73601;\n                x_73596 = defunc_1_op_res_73602;\n                x_73597 = defunc_1_op_res_73603;\n            }\n            // write result of operation\n            {\n                ((volatile __local\n                  double *) red_arr_mem_79809)[sext_i32_i64(local_tid_79791)] =\n                    x_73595;\n                ((volatile __local\n          ",
                   "        double *) red_arr_mem_79811)[sext_i32_i64(local_tid_79791)] =\n                    x_73596;\n                ((volatile __local\n                  double *) red_arr_mem_79813)[sext_i32_i64(local_tid_79791)] =\n                    x_73597;\n            }\n        }\n        offset_79815 *= 2;\n    }\n    while (slt32(skip_waves_79816, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79793 - 1,\n                                           wave_sizze_79793))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79815 = skip_waves_79816 * wave_sizze_79793;\n        if (slt32(local_tid_79791 + offset_79815, sext_i64_i32(q_65380)) &&\n            ((local_tid_79791 - squot32(local_tid_79791, wave_sizze_79793) *\n              wave_sizze_79793) == 0 && (squot32(local_tid_79791,\n                                                 wave_sizze_79793) & (2 *\n                                                                      skip_waves_79816 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_73598 = ((__local\n                            double *) red_arr_mem_79809)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79815)];\n                x_73599 = ((__local\n                            double *) red_arr_mem_79811)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79815)];\n                x_73600 = ((__local\n                            double *) red_arr_mem_79813)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79815)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_73601 = x_73595 + x_73598;\n                double defunc_1_op_res_73602 = x_73596 + x_73599;\n                double defunc_1_op_res_73603 = x_73597 + x_73600;\n                \n    ",
                   "            x_73595 = defunc_1_op_res_73601;\n                x_73596 = defunc_1_op_res_73602;\n                x_73597 = defunc_1_op_res_73603;\n            }\n            // write result of operation\n            {\n                ((__local\n                  double *) red_arr_mem_79809)[sext_i32_i64(local_tid_79791)] =\n                    x_73595;\n                ((__local\n                  double *) red_arr_mem_79811)[sext_i32_i64(local_tid_79791)] =\n                    x_73596;\n                ((__local\n                  double *) red_arr_mem_79813)[sext_i32_i64(local_tid_79791)] =\n                    x_73597;\n            }\n        }\n        skip_waves_79816 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_73588 = ((__local\n                                  double *) red_arr_mem_79809)[(int64_t) 0];\n    defunc_2_reduce_res_73589 = ((__local\n                                  double *) red_arr_mem_79811)[(int64_t) 0];\n    defunc_2_reduce_res_73590 = ((__local\n                                  double *) red_arr_mem_79813)[(int64_t) 0];\n    \n    double x_73623 = defunc_2_reduce_res_73588 * defunc_2_reduce_res_73590;\n    double y_73624 = defunc_2_reduce_res_73589 * defunc_2_reduce_res_73589;\n    double y_73625 = x_73623 - y_73624;\n    double det1_73626 = 1.0 / y_73625;\n    double a11_73627 = defunc_2_reduce_res_73590 * det1_73626;\n    double x_73628 = 0.0 - defunc_2_reduce_res_73589;\n    double b11_73629 = det1_73626 * x_73628;\n    double c11_73630 = defunc_2_reduce_res_73588 * det1_73626;\n    double defunc_2_reduce_res_73631;\n    double defunc_2_reduce_res_73632;\n    int64_t gtid_73633 = sext_i32_i64(sext_i64_i32(ltid_pre_79795));\n    int32_t phys_tid_73634 = local_tid_79791;\n    __local unsigned char *red_arr_mem_79817;\n    \n    red_arr_mem_79817 = (__local unsigned char *) red_arr_mem_79817_backing_5;\n    \n    __local unsigned char *red_arr_mem_79819;\n    \n    red_arr_mem_79819 = (__local unsigned char *) red_arr_mem_79819_backing_6;\n    \n    doubl",
                   "e x_73642;\n    \n    x_73642 = ((__local double *) color_78232)[gtid_73633];\n    \n    double x_73643;\n    \n    x_73643 = ((__local double *) color_78233)[gtid_73633];\n    \n    bool cond_73644 = sle64(last_res_73488, gtid_73633);\n    double defunc_0_f_res_73645;\n    \n    if (cond_73644) {\n        defunc_0_f_res_73645 = 0.0;\n    } else {\n        int64_t i_73646 = add64(max_res_73568, gtid_73633);\n        double defunc_0_add_arg_73647;\n        \n        defunc_0_add_arg_73647 = ((__global double *) mem_77918)[gtid_73485 *\n                                                                 n_65378 +\n                                                                 i_73646];\n        defunc_0_f_res_73645 = defunc_0_add_arg_73647;\n    }\n    \n    double x_73648 = a11_73627 * x_73642;\n    double y_73649 = b11_73629 * x_73643;\n    double x_73650 = x_73648 + y_73649;\n    double defunc_9_fit_fun_res_73651 = defunc_0_f_res_73645 * x_73650;\n    double x_73652 = b11_73629 * x_73642;\n    double y_73653 = c11_73630 * x_73643;\n    double x_73654 = x_73652 + y_73653;\n    double defunc_9_slope_fun_res_73655 = defunc_0_f_res_73645 * x_73654;\n    \n    ((__local double *) red_arr_mem_79817)[gtid_73633] =\n        defunc_9_fit_fun_res_73651;\n    ((__local double *) red_arr_mem_79819)[gtid_73633] =\n        defunc_9_slope_fun_res_73655;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_79821;\n    int32_t skip_waves_79822 = 1;\n    double x_73635;\n    double x_73636;\n    double x_73637;\n    double x_73638;\n    \n    offset_79821 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79791, sext_i64_i32(q_65380))) {\n            x_73635 = ((__local\n                        double *) red_arr_mem_79817)[sext_i32_i64(local_tid_79791 +\n                                                     offset_79821)];\n            x_73636 = ((__local\n                        double *) red_arr_mem_79819)[sext_i32_i64(local_tid_79791 +\n                                              ",
                   "       offset_79821)];\n        }\n    }\n    offset_79821 = 1;\n    while (slt32(offset_79821, wave_sizze_79793)) {\n        if (slt32(local_tid_79791 + offset_79821, sext_i64_i32(q_65380)) &&\n            ((local_tid_79791 - squot32(local_tid_79791, wave_sizze_79793) *\n              wave_sizze_79793) & (2 * offset_79821 - 1)) == 0) {\n            // read array element\n            {\n                x_73637 = ((volatile __local\n                            double *) red_arr_mem_79817)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79821)];\n                x_73638 = ((volatile __local\n                            double *) red_arr_mem_79819)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79821)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_73639 = x_73635 + x_73637;\n                double defunc_1_op_res_73640 = x_73636 + x_73638;\n                \n                x_73635 = defunc_1_op_res_73639;\n                x_73636 = defunc_1_op_res_73640;\n            }\n            // write result of operation\n            {\n                ((volatile __local\n                  double *) red_arr_mem_79817)[sext_i32_i64(local_tid_79791)] =\n                    x_73635;\n                ((volatile __local\n                  double *) red_arr_mem_79819)[sext_i32_i64(local_tid_79791)] =\n                    x_73636;\n            }\n        }\n        offset_79821 *= 2;\n    }\n    while (slt32(skip_waves_79822, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79793 - 1,\n                                           wave_sizze_79793))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79821 = skip_waves_79822 * wave_sizze_79793;\n        if (slt32(local_tid_79791 + offset_79821, sext_i64_i32(q_65380)) &&\n            ((local_tid_79791 - squot32(local_tid_79791, wave_sizze_79793) *\n              wave_sizze_79793",
                   ") == 0 && (squot32(local_tid_79791,\n                                                 wave_sizze_79793) & (2 *\n                                                                      skip_waves_79822 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_73637 = ((__local\n                            double *) red_arr_mem_79817)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79821)];\n                x_73638 = ((__local\n                            double *) red_arr_mem_79819)[sext_i32_i64(local_tid_79791 +\n                                                         offset_79821)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_73639 = x_73635 + x_73637;\n                double defunc_1_op_res_73640 = x_73636 + x_73638;\n                \n                x_73635 = defunc_1_op_res_73639;\n                x_73636 = defunc_1_op_res_73640;\n            }\n            // write result of operation\n            {\n                ((__local\n                  double *) red_arr_mem_79817)[sext_i32_i64(local_tid_79791)] =\n                    x_73635;\n                ((__local\n                  double *) red_arr_mem_79819)[sext_i32_i64(local_tid_79791)] =\n                    x_73636;\n            }\n        }\n        skip_waves_79822 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_73631 = ((__local\n                                  double *) red_arr_mem_79817)[(int64_t) 0];\n    defunc_2_reduce_res_73632 = ((__local\n                                  double *) red_arr_mem_79819)[(int64_t) 0];\n    if (local_tid_79791 == 0) {\n        ((__global double *) mem_77959)[gtid_73485 * n_m_65386 + gtid_73486] =\n            defunc_2_reduce_res_73631;\n    }\n    if (local_tid_79791 == 0) {\n        ((__global double *) mem_77963)[gtid_73485 * n_m_65386 + gtid_73486] =\n        ",
                   "    defunc_2_reduce_res_73632;\n    }\n    \n  error_4:\n    return;\n}\n__kernel void mainzisegmap_intragroup_74244(__global int *global_failure,\n                                            int failure_is_an_option, __global\n                                            int64_t *global_failure_args,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79960_backing_aligned_0,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79958_backing_aligned_1,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79954_backing_aligned_2,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79952_backing_aligned_3,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79950_backing_aligned_4,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79948_backing_aligned_5,\n                                            __local volatile\n                                            int64_t *red_arr_mem_79946_backing_aligned_6,\n                                            __local volatile\n                                            int64_t *color_78237_backing_aligned_7,\n                                            __local volatile\n                                            int64_t *color_78236_backing_aligned_8,\n                                            __local volatile\n                                            int64_t *color_78235_backing_aligned_9,\n                                            __local volatile\n                                            int64_t *color_78234_backing_aligned_10,\n                                            int64_t m_65377, int64_t",
                   " n_65378,\n                                            int64_t q_65380, int64_t jump_65382,\n                                            int64_t n_m_65386, int64_t i_65392,\n                                            unsigned char x_65393_bits,\n                                            int64_t min_res_65398,\n                                            unsigned char loop_cond_65403_bits,\n                                            __global unsigned char *mem_77968,\n                                            __global unsigned char *mem_77972,\n                                            __global unsigned char *mem_77976,\n                                            __global unsigned char *mem_77982,\n                                            __global unsigned char *mem_77986,\n                                            __global unsigned char *mem_77989,\n                                            __global unsigned char *mem_77992,\n                                            __global unsigned char *mem_77995,\n                                            __global unsigned char *mem_78000,\n                                            __global unsigned char *mem_78020,\n                                            __global unsigned char *mem_78024)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_79960_backing_10 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79960_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_79958_backing_9 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79958_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_79954_backing_8 =\n                                   (__local volatile\n  ",
                   "                                  unsigned char *) red_arr_mem_79954_backing_aligned_2;\n    __local volatile unsigned char *restrict red_arr_mem_79952_backing_7 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79952_backing_aligned_3;\n    __local volatile unsigned char *restrict red_arr_mem_79950_backing_6 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79950_backing_aligned_4;\n    __local volatile unsigned char *restrict red_arr_mem_79948_backing_5 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79948_backing_aligned_5;\n    __local volatile unsigned char *restrict red_arr_mem_79946_backing_4 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79946_backing_aligned_6;\n    __local volatile unsigned char *restrict color_78237_backing_3 =\n                                   (__local volatile\n                                    unsigned char *) color_78237_backing_aligned_7;\n    __local volatile unsigned char *restrict color_78236_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) color_78236_backing_aligned_8;\n    __local volatile unsigned char *restrict color_78235_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) color_78235_backing_aligned_9;\n    __local volatile unsigned char *restrict color_78234_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) color_78234_backing_aligned_10;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(",
                   "CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_79927;\n    int32_t local_tid_79928;\n    int64_t group_sizze_79931;\n    int32_t wave_sizze_79930;\n    int32_t group_tid_79929;\n    \n    global_tid_79927 = get_global_id(0);\n    local_tid_79928 = get_local_id(0);\n    group_sizze_79931 = get_local_size(0);\n    wave_sizze_79930 = LOCKSTEP_WIDTH;\n    group_tid_79929 = get_group_id(0);\n    \n    int32_t phys_tid_74244 = group_tid_79929;\n    int64_t slice_79933 = q_65380;\n    int64_t ltid_pre_79932 = sext_i32_i64(local_tid_79928);\n    int64_t remnant_79934 = sext_i32_i64(local_tid_79928) - ltid_pre_79932;\n    int64_t slice_79935 = n_m_65386;\n    int64_t slice_79936 = m_65377 * slice_79935;\n    int64_t gtid_74242 = squot64(sext_i32_i64(group_tid_79929), slice_79935);\n    int64_t remnant_79937 = sext_i32_i64(group_tid_79929) - gtid_74242 *\n            slice_79935;\n    int64_t gtid_74243 = remnant_79937;\n    int64_t remnant_79938 = remnant_79937 - gtid_74243;\n    __local unsigned char *color_78234;\n    \n    color_78234 = (__local unsigned char *) color_78234_backing_0;\n    \n    __local unsigned char *color_78235;\n    \n    color_78235 = (__local unsigned char *) color_78235_backing_1;\n    \n    __local unsigned char *color_78236;\n    \n    color_78236 = (__local unsigned char *) color_78236_backing_2;\n    \n    __local unsigned char *color_78237;\n    \n    color_78237 = (__local unsigned char *) color_78237_backing_3;\n    \n    int64_t last_res_74245;\n    \n    last_res_74245 = ((__global int64_t *) mem_77968)[gtid_74242 * n_65378 +\n                                                      i_65392];\n    \n    int64_t min_arg_74252;\n    \n    min_arg_74252 = ((__global int64_t *) mem_77986)[gtid_74242];\n    \n    int64_t min_arg_74253;\n    \n    min_arg_74253 = ((__global int64_t *) mem_77989)[gtid_74242];\n    \n    int64_t min_res_74254;\n    \n    min_res_74254 = ((__global int64_t *) mem_77992)[gtid_74242];\n    \n    double max_res_74255;\n    \n    max_res_74255 = ((__global double *) mem_77995)",
                   "[gtid_74242];\n    \n    int64_t min_arg_74259 = mul64(jump_65382, gtid_74243);\n    int64_t min_res_74260 = smin64(i_65392, min_arg_74259);\n    int64_t defunc_0_g_res_74261 = add64((int64_t) 1, min_res_74260);\n    bool init_idx_74262;\n    int64_t init_idx_74263;\n    int64_t init_idx_74264;\n    bool loop_while_74265;\n    int64_t low_74266;\n    int64_t high_74267;\n    \n    loop_while_74265 = x_65393;\n    low_74266 = (int64_t) 0;\n    high_74267 = i_65392;\n    while (loop_while_74265) {\n        int64_t x_74268 = add64(low_74266, high_74267);\n        int64_t mid_74269 = sdiv64(x_74268, (int64_t) 2);\n        bool x_74270 = sle64((int64_t) 0, mid_74269);\n        bool y_74271 = slt64(mid_74269, n_65378);\n        bool bounds_check_74272 = x_74270 && y_74271;\n        bool index_certs_74273;\n        \n        if (!bounds_check_74272) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 55) == -1) {\n                    global_failure_args[0] = (int64_t) mid_74269;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t mid_id_74274;\n        \n        mid_id_74274 = ((__global int64_t *) mem_77982)[gtid_74242 * n_65378 +\n                                                        mid_74269];\n        \n        bool cond_74275 = slt64(mid_id_74274, (int64_t) 0);\n        int64_t mid_idx_74276;\n        \n        if (cond_74275) {\n            mid_idx_74276 = (int64_t) 9223372036854775807;\n        } else {\n            mid_idx_74276 = mid_id_74274;\n        }\n        \n        bool cond_74277 = sle64(defunc_0_g_res_74261, mid_idx_74276);\n        int64_t loopres_74278;\n        int64_t loopres_74279;\n        \n        if (cond_74277) {\n            int64_t loopres_t_res_74280 = sub64(mid_74269, (int64_t) 1);\n            \n            loopres_74278 = low_74266;\n            loopres_74279 = loopres_t_res_74280;\n   ",
                   "     } else {\n            int64_t loopres_f_res_74281 = add64((int64_t) 1, mid_74269);\n            \n            loopres_74278 = loopres_f_res_74281;\n            loopres_74279 = high_74267;\n        }\n        \n        bool loop_cond_74282 = sle64(loopres_74278, loopres_74279);\n        bool loop_while_tmp_79939 = loop_cond_74282;\n        int64_t low_tmp_79940 = loopres_74278;\n        int64_t high_tmp_79941 = loopres_74279;\n        \n        loop_while_74265 = loop_while_tmp_79939;\n        low_74266 = low_tmp_79940;\n        high_74267 = high_tmp_79941;\n    }\n    init_idx_74262 = loop_while_74265;\n    init_idx_74263 = low_74266;\n    init_idx_74264 = high_74267;\n    \n    bool idx_74283;\n    int64_t idx_74284;\n    int64_t idx_74285;\n    int64_t idx_74286;\n    bool loop_while_74287;\n    int64_t l_idx_74288;\n    int64_t r_idx_74289;\n    int64_t span_74290;\n    \n    loop_while_74287 = loop_cond_65403;\n    l_idx_74288 = init_idx_74263;\n    r_idx_74289 = init_idx_74263;\n    span_74290 = (int64_t) 1;\n    while (loop_while_74287) {\n        int64_t max_arg_74291 = sub64(l_idx_74288, (int64_t) 1);\n        int64_t max_res_74292 = smax64((int64_t) 0, max_arg_74291);\n        int64_t min_arg_74293 = add64((int64_t) 1, r_idx_74289);\n        int64_t min_res_74294 = smin64(min_arg_74252, min_arg_74293);\n        bool x_74295 = sle64((int64_t) 0, max_res_74292);\n        bool y_74296 = slt64(max_res_74292, n_65378);\n        bool bounds_check_74297 = x_74295 && y_74296;\n        bool index_certs_74298;\n        \n        if (!bounds_check_74297) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 56) == -1) {\n                    global_failure_args[0] = (int64_t) max_res_74292;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t x_74299;\n        \n        x_74299 = ((__global int64_t *) mem_77982)[gtid",
                   "_74242 * n_65378 +\n                                                   max_res_74292];\n        \n        int64_t abs_arg_74300 = sub64(x_74299, defunc_0_g_res_74261);\n        int64_t abs_res_74301 = abs64(abs_arg_74300);\n        bool x_74302 = sle64((int64_t) 0, min_res_74294);\n        bool y_74303 = slt64(min_res_74294, n_65378);\n        bool bounds_check_74304 = x_74302 && y_74303;\n        bool index_certs_74305;\n        \n        if (!bounds_check_74304) {\n            {\n                if (atomic_cmpxchg_i32_global(global_failure, -1, 57) == -1) {\n                    global_failure_args[0] = (int64_t) min_res_74294;\n                    global_failure_args[1] = (int64_t) n_65378;\n                    ;\n                }\n                local_failure = true;\n                goto error_0;\n            }\n        }\n        \n        int64_t x_74306;\n        \n        x_74306 = ((__global int64_t *) mem_77982)[gtid_74242 * n_65378 +\n                                                   min_res_74294];\n        \n        int64_t abs_arg_74307 = sub64(x_74306, defunc_0_g_res_74261);\n        int64_t abs_res_74308 = abs64(abs_arg_74307);\n        bool cond_74309 = max_res_74292 == l_idx_74288;\n        int64_t loopres_74310;\n        int64_t loopres_74311;\n        int64_t loopres_74312;\n        \n        if (cond_74309) {\n            loopres_74310 = l_idx_74288;\n            loopres_74311 = r_idx_74289;\n            loopres_74312 = min_res_65398;\n        } else {\n            bool cond_74313 = slt64(abs_res_74301, abs_res_74308);\n            bool cond_f_res_74314 = min_res_74294 == r_idx_74289;\n            bool x_74315 = !cond_74313;\n            bool y_74316 = cond_f_res_74314 && x_74315;\n            bool cond_74317 = cond_74313 || y_74316;\n            int64_t loopres_f_res_74318;\n            \n            if (cond_74317) {\n                loopres_f_res_74318 = max_res_74292;\n            } else {\n                loopres_f_res_74318 = l_idx_74288;\n            }\n            \n            int64_t",
                   " loopres_f_res_74319;\n            \n            if (cond_74317) {\n                loopres_f_res_74319 = r_idx_74289;\n            } else {\n                loopres_f_res_74319 = min_res_74294;\n            }\n            \n            int64_t loopres_f_res_74320;\n            \n            if (cond_74317) {\n                int64_t loopres_f_res_t_res_74321 = add64((int64_t) 1,\n                                                          span_74290);\n                \n                loopres_f_res_74320 = loopres_f_res_t_res_74321;\n            } else {\n                int64_t loopres_f_res_f_res_74322 = add64((int64_t) 1,\n                                                          span_74290);\n                \n                loopres_f_res_74320 = loopres_f_res_f_res_74322;\n            }\n            loopres_74310 = loopres_f_res_74318;\n            loopres_74311 = loopres_f_res_74319;\n            loopres_74312 = loopres_f_res_74320;\n        }\n        \n        bool loop_cond_74323 = slt64(loopres_74312, min_res_65398);\n        bool loop_while_tmp_79942 = loop_cond_74323;\n        int64_t l_idx_tmp_79943 = loopres_74310;\n        int64_t r_idx_tmp_79944 = loopres_74311;\n        int64_t span_tmp_79945 = loopres_74312;\n        \n        loop_while_74287 = loop_while_tmp_79942;\n        l_idx_74288 = l_idx_tmp_79943;\n        r_idx_74289 = r_idx_tmp_79944;\n        span_74290 = span_tmp_79945;\n    }\n    idx_74283 = loop_while_74287;\n    idx_74284 = l_idx_74288;\n    idx_74285 = r_idx_74289;\n    idx_74286 = span_74290;\n    \n    int64_t min_res_74324 = smin64(min_arg_74253, idx_74284);\n    int64_t max_res_74325 = smax64((int64_t) 0, min_res_74324);\n    int64_t x_74326 = add64(min_res_74254, max_res_74325);\n    int64_t r_74327 = sub64(x_74326, (int64_t) 1);\n    bool x_74328 = sle64((int64_t) 0, r_74327);\n    bool y_74329 = slt64(r_74327, n_65378);\n    bool bounds_check_74330 = x_74328 && y_74329;\n    bool index_certs_74331;\n    \n    if (!bounds_check_74330) {\n        {\n            if (atomic_cmpx",
                   "chg_i32_global(global_failure, -1, 58) == -1) {\n                global_failure_args[0] = (int64_t) r_74327;\n                global_failure_args[1] = (int64_t) n_65378;\n                ;\n            }\n            local_failure = true;\n            goto error_0;\n        }\n    }\n    \n    int64_t x_74332;\n    \n    x_74332 = ((__global int64_t *) mem_77976)[gtid_74242 * n_65378 + r_74327];\n    \n    int64_t abs_arg_74333 = sub64(x_74332, min_res_74260);\n    int64_t abs_res_74334 = abs64(abs_arg_74333);\n    bool x_74335 = sle64((int64_t) 0, max_res_74325);\n    bool y_74336 = slt64(max_res_74325, n_65378);\n    bool bounds_check_74337 = x_74335 && y_74336;\n    bool index_certs_74338;\n    \n    if (!bounds_check_74337) {\n        {\n            if (atomic_cmpxchg_i32_global(global_failure, -1, 59) == -1) {\n                global_failure_args[0] = (int64_t) max_res_74325;\n                global_failure_args[1] = (int64_t) n_65378;\n                ;\n            }\n            local_failure = true;\n            goto error_0;\n        }\n    }\n    \n    int64_t x_74339;\n    \n    x_74339 = ((__global int64_t *) mem_77976)[gtid_74242 * n_65378 +\n                                               max_res_74325];\n    \n    int64_t abs_arg_74340 = sub64(x_74339, min_res_74260);\n    int64_t abs_res_74341 = abs64(abs_arg_74340);\n    int64_t max_res_74342 = smax64(abs_res_74334, abs_res_74341);\n    double defunc_0_f_res_74343 = sitofp_i64_f64(max_res_74342);\n    double defunc_1_f_res_74344 = max_res_74255 + defunc_0_f_res_74343;\n    int64_t gtid_74347 = sext_i32_i64(sext_i64_i32(ltid_pre_79932));\n    int32_t phys_tid_74348 = local_tid_79928;\n    double x_74350;\n    \n    x_74350 = ((__global double *) mem_78000)[gtid_74242 * q_65380 +\n                                              gtid_74347];\n    \n    bool cond_74351 = sle64(last_res_74245, gtid_74347);\n    int64_t defunc_0_f_res_74352;\n    \n    if (cond_74351) {\n        defunc_0_f_res_74352 = (int64_t) 0;\n    } else {\n        int64_t i_74353 = add64(m",
                   "ax_res_74325, gtid_74347);\n        int64_t defunc_0_add_arg_74354;\n        \n        defunc_0_add_arg_74354 = ((__global int64_t *) mem_77976)[gtid_74242 *\n                                                                  n_65378 +\n                                                                  i_74353];\n        \n        int64_t defunc_1_add_res_74355 = add64((int64_t) 1,\n                                               defunc_0_add_arg_74354);\n        \n        defunc_0_f_res_74352 = defunc_1_add_res_74355;\n    }\n    \n    int64_t binop_p_74356 = sub64(defunc_0_f_res_74352, min_res_74260);\n    double defunc_0_f_res_74357 = sitofp_i64_f64(binop_p_74356);\n    double abs_res_74358 = fabs(defunc_0_f_res_74357);\n    double tmp1_74359 = abs_res_74358 / defunc_1_f_res_74344;\n    double x_74360 = tmp1_74359 * tmp1_74359;\n    double y_74361 = tmp1_74359 * x_74360;\n    double tmp2_74362 = 1.0 - y_74361;\n    double x_74363 = tmp2_74362 * tmp2_74362;\n    double tmp3_74364 = tmp2_74362 * x_74363;\n    double tmp4_74365 = x_74350 * tmp3_74364;\n    \n    ((__local double *) color_78237)[gtid_74347] = defunc_0_f_res_74357;\n    ((__local double *) color_78236)[gtid_74347] = tmp4_74365;\n    \n  error_0:\n    barrier(CLK_LOCAL_MEM_FENCE);\n    if (local_failure)\n        return;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    double defunc_2_reduce_res_74366;\n    double defunc_2_reduce_res_74367;\n    double defunc_2_reduce_res_74368;\n    double defunc_2_reduce_res_74369;\n    double defunc_2_reduce_res_74370;\n    int64_t gtid_74373 = sext_i32_i64(sext_i64_i32(ltid_pre_79932));\n    int32_t phys_tid_74374 = local_tid_79928;\n    __local unsigned char *red_arr_mem_79946;\n    \n    red_arr_mem_79946 = (__local unsigned char *) red_arr_mem_79946_backing_4;\n    \n    __local unsigned char *red_arr_mem_79948;\n    \n    red_arr_mem_79948 = (__local unsigned char *) red_arr_mem_79948_backing_5;\n    \n    __local unsigned char *red_arr_mem_79950;\n    \n    red_arr_mem_79950 = (__local unsigned char *) red_arr_mem_",
                   "79950_backing_6;\n    \n    __local unsigned char *red_arr_mem_79952;\n    \n    red_arr_mem_79952 = (__local unsigned char *) red_arr_mem_79952_backing_7;\n    \n    __local unsigned char *red_arr_mem_79954;\n    \n    red_arr_mem_79954 = (__local unsigned char *) red_arr_mem_79954_backing_8;\n    \n    double x_74390;\n    \n    x_74390 = ((__local double *) color_78237)[gtid_74373];\n    \n    double x_74391;\n    \n    x_74391 = ((__local double *) color_78236)[gtid_74373];\n    \n    double defunc_1_f_res_74392 = x_74390 * x_74391;\n    double defunc_1_f_res_74393 = x_74390 * defunc_1_f_res_74392;\n    double defunc_1_f_res_74394 = x_74390 * defunc_1_f_res_74393;\n    double defunc_1_f_res_74395 = x_74390 * defunc_1_f_res_74394;\n    \n    ((__local double *) red_arr_mem_79946)[gtid_74373] = x_74391;\n    ((__local double *) red_arr_mem_79948)[gtid_74373] = defunc_1_f_res_74392;\n    ((__local double *) red_arr_mem_79950)[gtid_74373] = defunc_1_f_res_74393;\n    ((__local double *) red_arr_mem_79952)[gtid_74373] = defunc_1_f_res_74394;\n    ((__local double *) red_arr_mem_79954)[gtid_74373] = defunc_1_f_res_74395;\n    ((__local double *) color_78235)[gtid_74373] = defunc_1_f_res_74393;\n    ((__local double *) color_78234)[gtid_74373] = defunc_1_f_res_74392;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_79956;\n    int32_t skip_waves_79957 = 1;\n    double x_74375;\n    double x_74376;\n    double x_74377;\n    double x_74378;\n    double x_74379;\n    double x_74380;\n    double x_74381;\n    double x_74382;\n    double x_74383;\n    double x_74384;\n    \n    offset_79956 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79928, sext_i64_i32(q_65380))) {\n            x_74375 = ((__local\n                        double *) red_arr_mem_79946)[sext_i32_i64(local_tid_79928 +\n                                                     offset_79956)];\n            x_74376 = ((__local\n                        double *) red_arr_mem_79948)[sext_i32_i64(local_tid_7992",
                   "8 +\n                                                     offset_79956)];\n            x_74377 = ((__local\n                        double *) red_arr_mem_79950)[sext_i32_i64(local_tid_79928 +\n                                                     offset_79956)];\n            x_74378 = ((__local\n                        double *) red_arr_mem_79952)[sext_i32_i64(local_tid_79928 +\n                                                     offset_79956)];\n            x_74379 = ((__local\n                        double *) red_arr_mem_79954)[sext_i32_i64(local_tid_79928 +\n                                                     offset_79956)];\n        }\n    }\n    offset_79956 = 1;\n    while (slt32(offset_79956, wave_sizze_79930)) {\n        if (slt32(local_tid_79928 + offset_79956, sext_i64_i32(q_65380)) &&\n            ((local_tid_79928 - squot32(local_tid_79928, wave_sizze_79930) *\n              wave_sizze_79930) & (2 * offset_79956 - 1)) == 0) {\n            // read array element\n            {\n                x_74380 = ((volatile __local\n                            double *) red_arr_mem_79946)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74381 = ((volatile __local\n                            double *) red_arr_mem_79948)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74382 = ((volatile __local\n                            double *) red_arr_mem_79950)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74383 = ((volatile __local\n                            double *) red_arr_mem_79952)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74384 = ((volatile __local\n                            double *) red_arr_mem_79954)[sext_i32_i64(local_tid_79928 +\n                                                         o",
                   "ffset_79956)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_74385 = x_74375 + x_74380;\n                double defunc_1_op_res_74386 = x_74376 + x_74381;\n                double defunc_1_op_res_74387 = x_74377 + x_74382;\n                double defunc_1_op_res_74388 = x_74378 + x_74383;\n                double defunc_1_op_res_74389 = x_74379 + x_74384;\n                \n                x_74375 = defunc_1_op_res_74385;\n                x_74376 = defunc_1_op_res_74386;\n                x_74377 = defunc_1_op_res_74387;\n                x_74378 = defunc_1_op_res_74388;\n                x_74379 = defunc_1_op_res_74389;\n            }\n            // write result of operation\n            {\n                ((volatile __local\n                  double *) red_arr_mem_79946)[sext_i32_i64(local_tid_79928)] =\n                    x_74375;\n                ((volatile __local\n                  double *) red_arr_mem_79948)[sext_i32_i64(local_tid_79928)] =\n                    x_74376;\n                ((volatile __local\n                  double *) red_arr_mem_79950)[sext_i32_i64(local_tid_79928)] =\n                    x_74377;\n                ((volatile __local\n                  double *) red_arr_mem_79952)[sext_i32_i64(local_tid_79928)] =\n                    x_74378;\n                ((volatile __local\n                  double *) red_arr_mem_79954)[sext_i32_i64(local_tid_79928)] =\n                    x_74379;\n            }\n        }\n        offset_79956 *= 2;\n    }\n    while (slt32(skip_waves_79957, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79930 - 1,\n                                           wave_sizze_79930))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79956 = skip_waves_79957 * wave_sizze_79930;\n        if (slt32(local_tid_79928 + offset_79956, sext_i64_i32(q_65380)) &&\n            ((local_tid_79928 - squot32(local_tid_79928, wave_sizze_79930) *\n              wave_sizze_79930",
                   ") == 0 && (squot32(local_tid_79928,\n                                                 wave_sizze_79930) & (2 *\n                                                                      skip_waves_79957 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_74380 = ((__local\n                            double *) red_arr_mem_79946)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74381 = ((__local\n                            double *) red_arr_mem_79948)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74382 = ((__local\n                            double *) red_arr_mem_79950)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74383 = ((__local\n                            double *) red_arr_mem_79952)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n                x_74384 = ((__local\n                            double *) red_arr_mem_79954)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79956)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_74385 = x_74375 + x_74380;\n                double defunc_1_op_res_74386 = x_74376 + x_74381;\n                double defunc_1_op_res_74387 = x_74377 + x_74382;\n                double defunc_1_op_res_74388 = x_74378 + x_74383;\n                double defunc_1_op_res_74389 = x_74379 + x_74384;\n                \n                x_74375 = defunc_1_op_res_74385;\n                x_74376 = defunc_1_op_res_74386;\n                x_74377 = defunc_1_op_res_74387;\n                x_74378 = defunc_1_op_res_74388;\n                x_74379 = defunc_1_op_res_74389;\n           ",
                   " }\n            // write result of operation\n            {\n                ((__local\n                  double *) red_arr_mem_79946)[sext_i32_i64(local_tid_79928)] =\n                    x_74375;\n                ((__local\n                  double *) red_arr_mem_79948)[sext_i32_i64(local_tid_79928)] =\n                    x_74376;\n                ((__local\n                  double *) red_arr_mem_79950)[sext_i32_i64(local_tid_79928)] =\n                    x_74377;\n                ((__local\n                  double *) red_arr_mem_79952)[sext_i32_i64(local_tid_79928)] =\n                    x_74378;\n                ((__local\n                  double *) red_arr_mem_79954)[sext_i32_i64(local_tid_79928)] =\n                    x_74379;\n            }\n        }\n        skip_waves_79957 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_74366 = ((__local\n                                  double *) red_arr_mem_79946)[(int64_t) 0];\n    defunc_2_reduce_res_74367 = ((__local\n                                  double *) red_arr_mem_79948)[(int64_t) 0];\n    defunc_2_reduce_res_74368 = ((__local\n                                  double *) red_arr_mem_79950)[(int64_t) 0];\n    defunc_2_reduce_res_74369 = ((__local\n                                  double *) red_arr_mem_79952)[(int64_t) 0];\n    defunc_2_reduce_res_74370 = ((__local\n                                  double *) red_arr_mem_79954)[(int64_t) 0];\n    \n    double x_74396 = defunc_2_reduce_res_74368 * defunc_2_reduce_res_74370;\n    double y_74397 = defunc_2_reduce_res_74369 * defunc_2_reduce_res_74369;\n    double a12_74398 = x_74396 - y_74397;\n    double x_74399 = defunc_2_reduce_res_74368 * defunc_2_reduce_res_74369;\n    double y_74400 = defunc_2_reduce_res_74367 * defunc_2_reduce_res_74370;\n    double b12_74401 = x_74399 - y_74400;\n    double x_74402 = defunc_2_reduce_res_74367 * defunc_2_reduce_res_74369;\n    double y_74403 = defunc_2_reduce_res_74368 * defunc_2_reduce_res_74368;\n    double c12_74404 = x_74402 -",
                   " y_74403;\n    double x_74405 = defunc_2_reduce_res_74366 * defunc_2_reduce_res_74370;\n    double b2_74406 = x_74405 - y_74403;\n    double x_74407 = defunc_2_reduce_res_74367 * defunc_2_reduce_res_74368;\n    double y_74408 = defunc_2_reduce_res_74366 * defunc_2_reduce_res_74369;\n    double c2_74409 = x_74407 - y_74408;\n    double x_74410 = defunc_2_reduce_res_74366 * a12_74398;\n    double y_74411 = defunc_2_reduce_res_74367 * b12_74401;\n    double x_74412 = x_74410 + y_74411;\n    double y_74413 = defunc_2_reduce_res_74368 * c12_74404;\n    double y_74414 = x_74412 + y_74413;\n    double det_74415 = 1.0 / y_74414;\n    double a12_74416 = a12_74398 * det_74415;\n    double b12_74417 = b12_74401 * det_74415;\n    double c12_74418 = c12_74404 * det_74415;\n    double b2_74419 = b2_74406 * det_74415;\n    double c2_74420 = c2_74409 * det_74415;\n    double defunc_2_reduce_res_74421;\n    double defunc_2_reduce_res_74422;\n    int64_t gtid_74423 = sext_i32_i64(sext_i64_i32(ltid_pre_79932));\n    int32_t phys_tid_74424 = local_tid_79928;\n    __local unsigned char *red_arr_mem_79958;\n    \n    red_arr_mem_79958 = (__local unsigned char *) red_arr_mem_79958_backing_9;\n    \n    __local unsigned char *red_arr_mem_79960;\n    \n    red_arr_mem_79960 = (__local unsigned char *) red_arr_mem_79960_backing_10;\n    \n    double x_74432;\n    \n    x_74432 = ((__local double *) color_78236)[gtid_74423];\n    \n    double x_74433;\n    \n    x_74433 = ((__local double *) color_78234)[gtid_74423];\n    \n    double x_74434;\n    \n    x_74434 = ((__local double *) color_78235)[gtid_74423];\n    \n    bool cond_74435 = sle64(last_res_74245, gtid_74423);\n    double defunc_0_f_res_74436;\n    \n    if (cond_74435) {\n        defunc_0_f_res_74436 = 0.0;\n    } else {\n        int64_t i_74437 = add64(max_res_74325, gtid_74423);\n        double defunc_0_add_arg_74438;\n        \n        defunc_0_add_arg_74438 = ((__global double *) mem_77972)[gtid_74242 *\n                                                                 n_65378",
                   " +\n                                                                 i_74437];\n        defunc_0_f_res_74436 = defunc_0_add_arg_74438;\n    }\n    \n    double x_74439 = a12_74416 * x_74432;\n    double y_74440 = b12_74417 * x_74433;\n    double x_74441 = x_74439 + y_74440;\n    double y_74442 = c12_74418 * x_74434;\n    double x_74443 = x_74441 + y_74442;\n    double defunc_9_fit_fun_res_74444 = defunc_0_f_res_74436 * x_74443;\n    double x_74445 = b12_74417 * x_74432;\n    double y_74446 = b2_74419 * x_74433;\n    double x_74447 = x_74445 + y_74446;\n    double y_74448 = c2_74420 * x_74434;\n    double x_74449 = x_74447 + y_74448;\n    double defunc_9_slope_fun_res_74450 = defunc_0_f_res_74436 * x_74449;\n    \n    ((__local double *) red_arr_mem_79958)[gtid_74423] =\n        defunc_9_fit_fun_res_74444;\n    ((__local double *) red_arr_mem_79960)[gtid_74423] =\n        defunc_9_slope_fun_res_74450;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_79962;\n    int32_t skip_waves_79963 = 1;\n    double x_74425;\n    double x_74426;\n    double x_74427;\n    double x_74428;\n    \n    offset_79962 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79928, sext_i64_i32(q_65380))) {\n            x_74425 = ((__local\n                        double *) red_arr_mem_79958)[sext_i32_i64(local_tid_79928 +\n                                                     offset_79962)];\n            x_74426 = ((__local\n                        double *) red_arr_mem_79960)[sext_i32_i64(local_tid_79928 +\n                                                     offset_79962)];\n        }\n    }\n    offset_79962 = 1;\n    while (slt32(offset_79962, wave_sizze_79930)) {\n        if (slt32(local_tid_79928 + offset_79962, sext_i64_i32(q_65380)) &&\n            ((local_tid_79928 - squot32(local_tid_79928, wave_sizze_79930) *\n              wave_sizze_79930) & (2 * offset_79962 - 1)) == 0) {\n            // read array element\n            {\n                x_74427 = ((volatile __local\n        ",
                   "                    double *) red_arr_mem_79958)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79962)];\n                x_74428 = ((volatile __local\n                            double *) red_arr_mem_79960)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79962)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_74429 = x_74425 + x_74427;\n                double defunc_1_op_res_74430 = x_74426 + x_74428;\n                \n                x_74425 = defunc_1_op_res_74429;\n                x_74426 = defunc_1_op_res_74430;\n            }\n            // write result of operation\n            {\n                ((volatile __local\n                  double *) red_arr_mem_79958)[sext_i32_i64(local_tid_79928)] =\n                    x_74425;\n                ((volatile __local\n                  double *) red_arr_mem_79960)[sext_i32_i64(local_tid_79928)] =\n                    x_74426;\n            }\n        }\n        offset_79962 *= 2;\n    }\n    while (slt32(skip_waves_79963, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79930 - 1,\n                                           wave_sizze_79930))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79962 = skip_waves_79963 * wave_sizze_79930;\n        if (slt32(local_tid_79928 + offset_79962, sext_i64_i32(q_65380)) &&\n            ((local_tid_79928 - squot32(local_tid_79928, wave_sizze_79930) *\n              wave_sizze_79930) == 0 && (squot32(local_tid_79928,\n                                                 wave_sizze_79930) & (2 *\n                                                                      skip_waves_79963 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_74427 = ((__local\n                            double *) red_arr_mem_7995",
                   "8)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79962)];\n                x_74428 = ((__local\n                            double *) red_arr_mem_79960)[sext_i32_i64(local_tid_79928 +\n                                                         offset_79962)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_74429 = x_74425 + x_74427;\n                double defunc_1_op_res_74430 = x_74426 + x_74428;\n                \n                x_74425 = defunc_1_op_res_74429;\n                x_74426 = defunc_1_op_res_74430;\n            }\n            // write result of operation\n            {\n                ((__local\n                  double *) red_arr_mem_79958)[sext_i32_i64(local_tid_79928)] =\n                    x_74425;\n                ((__local\n                  double *) red_arr_mem_79960)[sext_i32_i64(local_tid_79928)] =\n                    x_74426;\n            }\n        }\n        skip_waves_79963 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_74421 = ((__local\n                                  double *) red_arr_mem_79958)[(int64_t) 0];\n    defunc_2_reduce_res_74422 = ((__local\n                                  double *) red_arr_mem_79960)[(int64_t) 0];\n    if (local_tid_79928 == 0) {\n        ((__global double *) mem_78020)[gtid_74242 * n_m_65386 + gtid_74243] =\n            defunc_2_reduce_res_74421;\n    }\n    if (local_tid_79928 == 0) {\n        ((__global double *) mem_78024)[gtid_74242 * n_m_65386 + gtid_74243] =\n            defunc_2_reduce_res_74422;\n    }\n    \n  error_5:\n    return;\n}\n__kernel void mainzisegmap_intragroup_74792(__global int *global_failure,\n                                            int failure_is_an_option, __global\n                                            int64_t *global_failure_args,\n                                            __local volatile\n                                            int64_t *color_78172_backing_align",
                   "ed_0,\n                                            int64_t m_65377, int64_t n_65378,\n                                            int64_t q_65380, int64_t jump_65382,\n                                            int64_t n_m_65386, int64_t i_65392,\n                                            unsigned char x_65393_bits,\n                                            int64_t min_res_65398,\n                                            unsigned char loop_cond_65403_bits,\n                                            int64_t num_groups_x_74789,\n                                            int64_t num_groups_y_74790,\n                                            int64_t num_whole_tiles_74922,\n                                            int64_t residual_input_75118,\n                                            unsigned char cond_75119_bits,\n                                            __global unsigned char *mem_77116,\n                                            __global unsigned char *mem_77120,\n                                            __global unsigned char *mem_77124,\n                                            __global unsigned char *mem_77130,\n                                            __global unsigned char *mem_77134,\n                                            __global unsigned char *mem_77137,\n                                            __global unsigned char *mem_77140,\n                                            __global unsigned char *mem_77143,\n                                            __global unsigned char *mem_77148,\n                                            __global unsigned char *mem_77195)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    bool cond_75119 = cond_75119_bits;\n    \n    #define tile_sizze_74787 (mainzitile_sizze_74786)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict color_78172_backing_0 =\n                                ",
                   "   (__local volatile\n                                    unsigned char *) color_78172_backing_aligned_0;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_78472;\n    int32_t local_tid_78473;\n    int64_t group_sizze_78476;\n    int32_t wave_sizze_78475;\n    int32_t group_tid_78474;\n    \n    global_tid_78472 = get_global_id(0);\n    local_tid_78473 = get_local_id(0);\n    group_sizze_78476 = get_local_size(0);\n    wave_sizze_78475 = LOCKSTEP_WIDTH;\n    group_tid_78474 = get_group_id(0);\n    \n    int32_t gid_flat_74792 = group_tid_78474;\n    int64_t slice_78479 = tile_sizze_74787;\n    int64_t slice_78480 = tile_sizze_74787 * slice_78479;\n    int64_t ltid_pre_78477 = squot64(sext_i32_i64(local_tid_78473),\n                                     slice_78479);\n    int64_t remnant_78481 = sext_i32_i64(local_tid_78473) - ltid_pre_78477 *\n            slice_78479;\n    int64_t ltid_pre_78478 = remnant_78481;\n    int64_t remnant_78482 = remnant_78481 - ltid_pre_78478;\n    int64_t slice_78483 = num_groups_y_74790;\n    int64_t slice_78484 = num_groups_x_74789 * slice_78483;\n    int64_t gid_x_74784 = squot64(sext_i32_i64(group_tid_78474), slice_78483);\n    int64_t remnant_78485 = sext_i32_i64(group_tid_78474) - gid_x_74784 *\n            slice_78483;\n    int64_t gid_y_74785 = remnant_78485;\n    int64_t remnant_78486 = remnant_78485 - gid_y_74785;\n    double color_78170[1];\n    double color_78171[1];\n    __local unsigned char *color_78172;\n    \n    color_78172 = (__local unsigned char *) color_78172_backing_0;\n    \n    double color_78173[1];\n    int64_t color_78174[1];\n    int64_t color_78175[1];\n    int64_t color_78176[1];\n    int64_t binop_x_74812 = gid_x_74784 * tile_sizze_74787;\n    int64_t binop_x_74814 = gid_y_74785 * tile_sizze_74787;\n    int64_t ltid_y_74811 = sext_i32_",
                   "i64(sext_i64_i32(ltid_pre_78477));\n    int64_t ltid_x_74809 = sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n    int32_t ltid_flat_74810 = local_tid_78473;\n    \n    if (slt64(ltid_y_74811, tile_sizze_74787) && slt64(ltid_x_74809,\n                                                       tile_sizze_74787)) {\n        int64_t gtid_74813 = ltid_y_74811 + binop_x_74812;\n        int64_t gtid_74815 = ltid_x_74809 + binop_x_74814;\n        bool binop_x_74816 = slt64(gtid_74813, m_65377);\n        bool binop_y_74817 = slt64(gtid_74815, n_m_65386);\n        bool cond_74818 = binop_x_74816 && binop_y_74817;\n        int64_t pre_74819;\n        int64_t pre_74820;\n        int64_t pre_74821;\n        double pre_74822;\n        \n        if (cond_74818) {\n            int64_t last_res_74823;\n            \n            last_res_74823 = ((__global int64_t *) mem_77116)[gtid_74813 *\n                                                              n_65378 +\n                                                              i_65392];\n            \n            int64_t min_arg_74824;\n            \n            min_arg_74824 = ((__global int64_t *) mem_77134)[gtid_74813];\n            \n            int64_t min_arg_74825;\n            \n            min_arg_74825 = ((__global int64_t *) mem_77137)[gtid_74813];\n            \n            int64_t min_res_74826;\n            \n            min_res_74826 = ((__global int64_t *) mem_77140)[gtid_74813];\n            \n            double max_res_74827;\n            \n            max_res_74827 = ((__global double *) mem_77143)[gtid_74813];\n            \n            int64_t min_arg_74828 = mul64(jump_65382, gtid_74815);\n            int64_t min_res_74829 = smin64(i_65392, min_arg_74828);\n            int64_t defunc_0_g_res_74830 = add64((int64_t) 1, min_res_74829);\n            bool init_idx_74831;\n            int64_t init_idx_74832;\n            int64_t init_idx_74833;\n            bool loop_while_74834;\n            int64_t low_74835;\n            int64_t high_74836;\n            \n            loo",
                   "p_while_74834 = x_65393;\n            low_74835 = (int64_t) 0;\n            high_74836 = i_65392;\n            while (loop_while_74834) {\n                int64_t x_74837 = add64(low_74835, high_74836);\n                int64_t mid_74838 = sdiv64(x_74837, (int64_t) 2);\n                bool x_74839 = sle64((int64_t) 0, mid_74838);\n                bool y_74840 = slt64(mid_74838, n_65378);\n                bool bounds_check_74841 = x_74839 && y_74840;\n                bool index_certs_74842;\n                \n                if (!bounds_check_74841) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 5) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) mid_74838;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t mid_id_74843;\n                \n                mid_id_74843 = ((__global int64_t *) mem_77130)[gtid_74813 *\n                                                                n_65378 +\n                                                                mid_74838];\n                \n                bool cond_74844 = slt64(mid_id_74843, (int64_t) 0);\n                int64_t mid_idx_74845;\n                \n                if (cond_74844) {\n                    mid_idx_74845 = (int64_t) 9223372036854775807;\n                } else {\n                    mid_idx_74845 = mid_id_74843;\n                }\n                \n                bool cond_74846 = sle64(defunc_0_g_res_74830, mid_idx_74845);\n                int64_t loopres_74847;\n                int64_t loopres_74848;\n                \n                if (cond_74846) {\n                    int64_t loopres_t_res_74849 = sub64(mid_74838, (int64_t) 1);\n                    \n                    loopres_748",
                   "47 = low_74835;\n                    loopres_74848 = loopres_t_res_74849;\n                } else {\n                    int64_t loopres_f_res_74850 = add64((int64_t) 1, mid_74838);\n                    \n                    loopres_74847 = loopres_f_res_74850;\n                    loopres_74848 = high_74836;\n                }\n                \n                bool loop_cond_74851 = sle64(loopres_74847, loopres_74848);\n                bool loop_while_tmp_78487 = loop_cond_74851;\n                int64_t low_tmp_78488 = loopres_74847;\n                int64_t high_tmp_78489 = loopres_74848;\n                \n                loop_while_74834 = loop_while_tmp_78487;\n                low_74835 = low_tmp_78488;\n                high_74836 = high_tmp_78489;\n            }\n            init_idx_74831 = loop_while_74834;\n            init_idx_74832 = low_74835;\n            init_idx_74833 = high_74836;\n            \n            bool idx_74852;\n            int64_t idx_74853;\n            int64_t idx_74854;\n            int64_t idx_74855;\n            bool loop_while_74856;\n            int64_t l_idx_74857;\n            int64_t r_idx_74858;\n            int64_t span_74859;\n            \n            loop_while_74856 = loop_cond_65403;\n            l_idx_74857 = init_idx_74832;\n            r_idx_74858 = init_idx_74832;\n            span_74859 = (int64_t) 1;\n            while (loop_while_74856) {\n                int64_t max_arg_74860 = sub64(l_idx_74857, (int64_t) 1);\n                int64_t max_res_74861 = smax64((int64_t) 0, max_arg_74860);\n                int64_t min_arg_74862 = add64((int64_t) 1, r_idx_74858);\n                int64_t min_res_74863 = smin64(min_arg_74824, min_arg_74862);\n                bool x_74864 = sle64((int64_t) 0, max_res_74861);\n                bool y_74865 = slt64(max_res_74861, n_65378);\n                bool bounds_check_74866 = x_74864 && y_74865;\n                bool index_certs_74867;\n                \n                if (!bounds_check_74866) {\n                    {\n       ",
                   "                 if (atomic_cmpxchg_i32_global(global_failure, -1, 6) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) max_res_74861;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_74868;\n                \n                x_74868 = ((__global int64_t *) mem_77130)[gtid_74813 *\n                                                           n_65378 +\n                                                           max_res_74861];\n                \n                int64_t abs_arg_74869 = sub64(x_74868, defunc_0_g_res_74830);\n                int64_t abs_res_74870 = abs64(abs_arg_74869);\n                bool x_74871 = sle64((int64_t) 0, min_res_74863);\n                bool y_74872 = slt64(min_res_74863, n_65378);\n                bool bounds_check_74873 = x_74871 && y_74872;\n                bool index_certs_74874;\n                \n                if (!bounds_check_74873) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 7) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) min_res_74863;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_74875;\n                \n                x_74875 = ((__global int64_t *) mem_77130)[gtid_74813 *\n                                                           n_65378 +\n                                                           min_res_74863];\n                \n                int64_t abs_arg_74876 = sub64(x_74875, defunc_0_g_r",
                   "es_74830);\n                int64_t abs_res_74877 = abs64(abs_arg_74876);\n                bool cond_74878 = max_res_74861 == l_idx_74857;\n                int64_t loopres_74879;\n                int64_t loopres_74880;\n                int64_t loopres_74881;\n                \n                if (cond_74878) {\n                    loopres_74879 = l_idx_74857;\n                    loopres_74880 = r_idx_74858;\n                    loopres_74881 = min_res_65398;\n                } else {\n                    bool cond_74882 = slt64(abs_res_74870, abs_res_74877);\n                    bool cond_f_res_74883 = min_res_74863 == r_idx_74858;\n                    bool x_74884 = !cond_74882;\n                    bool y_74885 = cond_f_res_74883 && x_74884;\n                    bool cond_74886 = cond_74882 || y_74885;\n                    int64_t loopres_f_res_74887;\n                    \n                    if (cond_74886) {\n                        loopres_f_res_74887 = max_res_74861;\n                    } else {\n                        loopres_f_res_74887 = l_idx_74857;\n                    }\n                    \n                    int64_t loopres_f_res_74888;\n                    \n                    if (cond_74886) {\n                        loopres_f_res_74888 = r_idx_74858;\n                    } else {\n                        loopres_f_res_74888 = min_res_74863;\n                    }\n                    \n                    int64_t loopres_f_res_74889;\n                    \n                    if (cond_74886) {\n                        int64_t loopres_f_res_t_res_74890 = add64((int64_t) 1,\n                                                                  span_74859);\n                        \n                        loopres_f_res_74889 = loopres_f_res_t_res_74890;\n                    } else {\n                        int64_t loopres_f_res_f_res_74891 = add64((int64_t) 1,\n                                                                  span_74859);\n                        \n                       ",
                   " loopres_f_res_74889 = loopres_f_res_f_res_74891;\n                    }\n                    loopres_74879 = loopres_f_res_74887;\n                    loopres_74880 = loopres_f_res_74888;\n                    loopres_74881 = loopres_f_res_74889;\n                }\n                \n                bool loop_cond_74892 = slt64(loopres_74881, min_res_65398);\n                bool loop_while_tmp_78490 = loop_cond_74892;\n                int64_t l_idx_tmp_78491 = loopres_74879;\n                int64_t r_idx_tmp_78492 = loopres_74880;\n                int64_t span_tmp_78493 = loopres_74881;\n                \n                loop_while_74856 = loop_while_tmp_78490;\n                l_idx_74857 = l_idx_tmp_78491;\n                r_idx_74858 = r_idx_tmp_78492;\n                span_74859 = span_tmp_78493;\n            }\n            idx_74852 = loop_while_74856;\n            idx_74853 = l_idx_74857;\n            idx_74854 = r_idx_74858;\n            idx_74855 = span_74859;\n            \n            int64_t min_res_74893 = smin64(min_arg_74825, idx_74853);\n            int64_t max_res_74894 = smax64((int64_t) 0, min_res_74893);\n            int64_t x_74895 = add64(min_res_74826, max_res_74894);\n            int64_t r_74896 = sub64(x_74895, (int64_t) 1);\n            bool x_74897 = sle64((int64_t) 0, r_74896);\n            bool y_74898 = slt64(r_74896, n_65378);\n            bool bounds_check_74899 = x_74897 && y_74898;\n            bool index_certs_74900;\n            \n            if (!bounds_check_74899) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 8) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) r_74896;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    local_failure = true;\n                    goto error_0;\n                }\n            }\n            \n            int64_t x_74901;\n            \n            x_74901 = ((__glob",
                   "al int64_t *) mem_77124)[gtid_74813 * n_65378 +\n                                                       r_74896];\n            \n            int64_t abs_arg_74902 = sub64(x_74901, min_res_74829);\n            int64_t abs_res_74903 = abs64(abs_arg_74902);\n            bool x_74904 = sle64((int64_t) 0, max_res_74894);\n            bool y_74905 = slt64(max_res_74894, n_65378);\n            bool bounds_check_74906 = x_74904 && y_74905;\n            bool index_certs_74907;\n            \n            if (!bounds_check_74906) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 9) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) max_res_74894;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    local_failure = true;\n                    goto error_0;\n                }\n            }\n            \n            int64_t x_74908;\n            \n            x_74908 = ((__global int64_t *) mem_77124)[gtid_74813 * n_65378 +\n                                                       max_res_74894];\n            \n            int64_t abs_arg_74909 = sub64(x_74908, min_res_74829);\n            int64_t abs_res_74910 = abs64(abs_arg_74909);\n            int64_t max_res_74911 = smax64(abs_res_74903, abs_res_74910);\n            double defunc_0_f_res_74912 = sitofp_i64_f64(max_res_74911);\n            double defunc_1_f_res_74913 = max_res_74827 + defunc_0_f_res_74912;\n            \n            pre_74819 = last_res_74823;\n            pre_74820 = min_res_74829;\n            pre_74821 = max_res_74894;\n            pre_74822 = defunc_1_f_res_74913;\n        } else {\n            pre_74819 = (int64_t) 0;\n            pre_74820 = (int64_t) 0;\n            pre_74821 = (int64_t) 0;\n            pre_74822 = 0.0;\n        }\n        color_78176[(int64_t) 0] = pre_74819;\n        color_78175[(int64_t) 0] = pre_74820;\n        color_78174[(int64_t) 0] = pre_74821;\n        co",
                   "lor_78173[(int64_t) 0] = pre_74822;\n    }\n    \n  error_0:\n    barrier(CLK_LOCAL_MEM_FENCE);\n    if (local_failure)\n        return;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t ltid_y_74930 = sext_i32_i64(sext_i64_i32(ltid_pre_78477));\n    int64_t ltid_x_74928 = sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n    int32_t ltid_flat_74929 = local_tid_78473;\n    \n    if (slt64(ltid_y_74930, tile_sizze_74787) && slt64(ltid_x_74928,\n                                                       tile_sizze_74787)) {\n        color_78171[(int64_t) 0] = 0.0;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    double tmp_78494;\n    \n    tmp_78494 = color_78171[(int64_t) 0];\n    color_78170[(int64_t) 0] = tmp_78494;\n    \n    double ext_mem_77177[1];\n    double ext_mem_unused_78112[1];\n    double mem_param_77167[1];\n    double mem_param_out_78113[1];\n    \n    for (int32_t i_1 = 0; i_1 < 1; i_1++)\n        mem_param_77167[i_1] = color_78170[i_1];\n    for (int32_t i_2 = 0; i_2 < 1; i_2++)\n        mem_param_out_78113[i_2] = color_78171[i_2];\n    for (int64_t tile_id_74937 = 0; tile_id_74937 < num_whole_tiles_74922;\n         tile_id_74937++) {\n        int64_t binop_x_75038 = tile_sizze_74787 * tile_id_74937;\n        int64_t ltid_y_75035 = sext_i32_i64(sext_i64_i32(ltid_pre_78477));\n        int64_t ltid_x_75033 = sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n        int32_t ltid_flat_75034 = local_tid_78473;\n        int64_t j_75039 = ltid_x_75033 + binop_x_75038;\n        int64_t gtid_75041 = binop_x_74812 + ltid_y_75035;\n        bool binop_x_75049 = slt64(j_75039, q_65380);\n        bool binop_y_75050 = slt64(gtid_75041, m_65377);\n        bool cond_75051 = binop_x_75049 && binop_y_75050;\n        double pre2d_75052;\n        \n        if (cond_75051) {\n            double x_75053;\n            \n            x_75053 = ((__global double *) mem_77148)[gtid_75041 * q_65380 +\n                                                      j_75039];\n            pre2d_75052 = x_75053;\n        } else {\n            pre2d",
                   "_75052 = 0.0;\n        }\n        ((__local double *) color_78172)[ltid_y_75035 * tile_sizze_74787 +\n                                         ltid_x_75033] = pre2d_75052;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int64_t ltid_y_75058 = sext_i32_i64(sext_i64_i32(ltid_pre_78477));\n        int64_t ltid_x_75056 = sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n        int32_t ltid_flat_75057 = local_tid_78473;\n        int64_t gtid_75060 = binop_x_74812 + ltid_y_75058;\n        int64_t gtid_75062 = binop_x_74814 + ltid_x_75056;\n        double acc_75068;\n        \n        acc_75068 = mem_param_77167[(int64_t) 0];\n        \n        bool binop_x_75072 = slt64(gtid_75060, m_65377);\n        bool binop_y_75073 = slt64(gtid_75062, n_m_65386);\n        bool cond_75074 = binop_x_75072 && binop_y_75073;\n        double acc_75075;\n        \n        if (cond_75074) {\n            int64_t last_res_75063;\n            \n            last_res_75063 = color_78176[(int64_t) 0];\n            \n            int64_t min_res_75064;\n            \n            min_res_75064 = color_78175[(int64_t) 0];\n            \n            int64_t max_res_75065;\n            \n            max_res_75065 = color_78174[(int64_t) 0];\n            \n            double defunc_1_f_res_75066;\n            \n            defunc_1_f_res_75066 = color_78173[(int64_t) 0];\n            \n            double x_75076;\n            double redout_76850 = acc_75068;\n            \n            for (int64_t i_76851 = 0; i_76851 < tile_sizze_74787; i_76851++) {\n                int64_t index_primexp_76973 = add64(binop_x_75038, i_76851);\n                double x_75081;\n                \n                x_75081 = ((__local double *) color_78172)[ltid_y_75058 *\n                                                           tile_sizze_74787 +\n                                                           i_76851];\n                \n                bool cond_75082 = sle64(last_res_75063, index_primexp_76973);\n                int64_t defunc_0_f_res_75083;\n        ",
                   "        \n                if (cond_75082) {\n                    defunc_0_f_res_75083 = (int64_t) 0;\n                } else {\n                    int64_t i_75084 = add64(max_res_75065, index_primexp_76973);\n                    int64_t defunc_0_add_arg_75085;\n                    \n                    defunc_0_add_arg_75085 = ((__global\n                                               int64_t *) mem_77124)[gtid_75060 *\n                                                                     n_65378 +\n                                                                     i_75084];\n                    \n                    int64_t defunc_1_add_res_75086 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_75085);\n                    \n                    defunc_0_f_res_75083 = defunc_1_add_res_75086;\n                }\n                \n                int64_t binop_p_75087 = sub64(defunc_0_f_res_75083,\n                                              min_res_75064);\n                double defunc_0_f_res_75088 = sitofp_i64_f64(binop_p_75087);\n                double abs_res_75089 = fabs(defunc_0_f_res_75088);\n                double tmp1_75090 = abs_res_75089 / defunc_1_f_res_75066;\n                double x_75091 = tmp1_75090 * tmp1_75090;\n                double y_75092 = tmp1_75090 * x_75091;\n                double tmp2_75093 = 1.0 - y_75092;\n                double x_75094 = tmp2_75093 * tmp2_75093;\n                double tmp3_75095 = tmp2_75093 * x_75094;\n                double w_j_75096 = x_75081 * tmp3_75095;\n                double defunc_1_op_res_75079 = w_j_75096 + redout_76850;\n                double redout_tmp_78498 = defunc_1_op_res_75079;\n                \n                redout_76850 = redout_tmp_78498;\n            }\n            x_75076 = redout_76850;\n            acc_75075 = x_75076;\n        } else {\n            acc_75075 = acc_75068;\n        }\n        mem_param_out_78113[(int64_t) 0] = acc_75075;\n        barrier(CLK_LOCAL_MEM_FENCE);\n",
                   "        \n        double mem_param_tmp_78495[1];\n        \n        for (int32_t i_3 = 0; i_3 < 1; i_3++)\n            mem_param_tmp_78495[i_3] = mem_param_out_78113[i_3];\n        \n        double mem_param_out_tmp_78496[1];\n        \n        for (int32_t i_4 = 0; i_4 < 1; i_4++)\n            mem_param_out_tmp_78496[i_4] = mem_param_77167[i_4];\n        for (int32_t i_5 = 0; i_5 < 1; i_5++)\n            mem_param_77167[i_5] = mem_param_tmp_78495[i_5];\n        for (int32_t i_6 = 0; i_6 < 1; i_6++)\n            mem_param_out_78113[i_6] = mem_param_out_tmp_78496[i_6];\n    }\n    for (int32_t i_7 = 0; i_7 < 1; i_7++)\n        ext_mem_77177[i_7] = mem_param_77167[i_7];\n    for (int32_t i_8 = 0; i_8 < 1; i_8++)\n        ext_mem_unused_78112[i_8] = mem_param_out_78113[i_8];\n    if (cond_75119) {\n        double tmp_78499;\n        \n        tmp_78499 = ext_mem_77177[(int64_t) 0];\n        color_78170[(int64_t) 0] = tmp_78499;\n    } else {\n        int64_t binop_x_75221 = tile_sizze_74787 * num_whole_tiles_74922;\n        int64_t ltid_y_75218 = sext_i32_i64(sext_i64_i32(ltid_pre_78477));\n        int64_t ltid_x_75216 = sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n        int32_t ltid_flat_75217 = local_tid_78473;\n        int64_t j_75222 = ltid_x_75216 + binop_x_75221;\n        int64_t gtid_75224 = binop_x_74812 + ltid_y_75218;\n        bool binop_x_75232 = slt64(j_75222, q_65380);\n        bool binop_y_75233 = slt64(gtid_75224, m_65377);\n        bool cond_75234 = binop_x_75232 && binop_y_75233;\n        double pre2d_75235;\n        \n        if (cond_75234) {\n            double x_75236;\n            \n            x_75236 = ((__global double *) mem_77148)[gtid_75224 * q_65380 +\n                                                      j_75222];\n            pre2d_75235 = x_75236;\n        } else {\n            pre2d_75235 = 0.0;\n        }\n        ((__local double *) color_78172)[ltid_y_75218 * tile_sizze_74787 +\n                                         ltid_x_75216] = pre2d_75235;\n        barrier(CLK_LOCAL_MEM",
                   "_FENCE);\n        \n        int64_t ltid_y_75242 = sext_i32_i64(sext_i64_i32(ltid_pre_78477));\n        int64_t ltid_x_75240 = sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n        int32_t ltid_flat_75241 = local_tid_78473;\n        int64_t gtid_75244 = binop_x_74812 + ltid_y_75242;\n        int64_t gtid_75246 = binop_x_74814 + ltid_x_75240;\n        double acc_75252;\n        \n        acc_75252 = ext_mem_77177[(int64_t) 0];\n        \n        bool binop_x_75256 = slt64(gtid_75244, m_65377);\n        bool binop_y_75257 = slt64(gtid_75246, n_m_65386);\n        bool cond_75258 = binop_x_75256 && binop_y_75257;\n        double acc_75259;\n        \n        if (cond_75258) {\n            int64_t last_res_75247;\n            \n            last_res_75247 = color_78176[(int64_t) 0];\n            \n            int64_t min_res_75248;\n            \n            min_res_75248 = color_78175[(int64_t) 0];\n            \n            int64_t max_res_75249;\n            \n            max_res_75249 = color_78174[(int64_t) 0];\n            \n            double defunc_1_f_res_75250;\n            \n            defunc_1_f_res_75250 = color_78173[(int64_t) 0];\n            \n            double x_75260;\n            double redout_76852 = acc_75252;\n            \n            for (int64_t i_76853 = 0; i_76853 < residual_input_75118;\n                 i_76853++) {\n                int64_t index_primexp_76971 = add64(binop_x_75221, i_76853);\n                double x_75265;\n                \n                x_75265 = ((__local double *) color_78172)[ltid_y_75242 *\n                                                           tile_sizze_74787 +\n                                                           i_76853];\n                \n                bool cond_75266 = sle64(last_res_75247, index_primexp_76971);\n                int64_t defunc_0_f_res_75267;\n                \n                if (cond_75266) {\n                    defunc_0_f_res_75267 = (int64_t) 0;\n                } else {\n                    int64_t i_75268 = add64(max_res_752",
                   "49, index_primexp_76971);\n                    int64_t defunc_0_add_arg_75269;\n                    \n                    defunc_0_add_arg_75269 = ((__global\n                                               int64_t *) mem_77124)[gtid_75244 *\n                                                                     n_65378 +\n                                                                     i_75268];\n                    \n                    int64_t defunc_1_add_res_75270 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_75269);\n                    \n                    defunc_0_f_res_75267 = defunc_1_add_res_75270;\n                }\n                \n                int64_t binop_p_75271 = sub64(defunc_0_f_res_75267,\n                                              min_res_75248);\n                double defunc_0_f_res_75272 = sitofp_i64_f64(binop_p_75271);\n                double abs_res_75273 = fabs(defunc_0_f_res_75272);\n                double tmp1_75274 = abs_res_75273 / defunc_1_f_res_75250;\n                double x_75275 = tmp1_75274 * tmp1_75274;\n                double y_75276 = tmp1_75274 * x_75275;\n                double tmp2_75277 = 1.0 - y_75276;\n                double x_75278 = tmp2_75277 * tmp2_75277;\n                double tmp3_75279 = tmp2_75277 * x_75278;\n                double w_j_75280 = x_75265 * tmp3_75279;\n                double defunc_1_op_res_75263 = w_j_75280 + redout_76852;\n                double redout_tmp_78500 = defunc_1_op_res_75263;\n                \n                redout_76852 = redout_tmp_78500;\n            }\n            x_75260 = redout_76852;\n            acc_75259 = x_75260;\n        } else {\n            acc_75259 = acc_75252;\n        }\n        color_78171[(int64_t) 0] = acc_75259;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        double tmp_78501;\n        \n        tmp_78501 = color_78171[(int64_t) 0];\n        color_78170[(int64_t) 0] = tmp_78501;\n    }\n    \n    int64_t ltid_y_75294 = sext_i32_i64(",
                   "sext_i64_i32(ltid_pre_78477));\n    int64_t ltid_x_75292 = sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n    int32_t ltid_flat_75293 = local_tid_78473;\n    \n    if (slt64(ltid_y_75294, tile_sizze_74787) && slt64(ltid_x_75292,\n                                                       tile_sizze_74787)) {\n        int64_t gtid_75296 = binop_x_74812 + ltid_y_75294;\n        int64_t gtid_75298 = binop_x_74814 + ltid_x_75292;\n        bool binop_x_75300 = slt64(gtid_75296, m_65377);\n        bool binop_y_75301 = slt64(gtid_75298, n_m_65386);\n        bool cond_75302 = binop_x_75300 && binop_y_75301;\n        double postlude_75303;\n        \n        if (cond_75302) {\n            double defunc_2_reduce_res_75299;\n            \n            defunc_2_reduce_res_75299 = color_78170[(int64_t) 0];\n            \n            int64_t last_res_75304;\n            \n            last_res_75304 = color_78176[(int64_t) 0];\n            \n            int64_t min_res_75305;\n            \n            min_res_75305 = color_78175[(int64_t) 0];\n            \n            int64_t max_res_75306;\n            \n            max_res_75306 = color_78174[(int64_t) 0];\n            \n            double defunc_1_f_res_75307;\n            \n            defunc_1_f_res_75307 = color_78173[(int64_t) 0];\n            \n            double a0_75309 = 1.0 / defunc_2_reduce_res_75299;\n            double defunc_2_reduce_res_75310;\n            double redout_76854 = 0.0;\n            \n            for (int64_t i_76855 = 0; i_76855 < q_65380; i_76855++) {\n                double x_75315;\n                \n                x_75315 = ((__global double *) mem_77148)[gtid_75296 * q_65380 +\n                                                          i_76855];\n                \n                bool cond_75316 = sle64(last_res_75304, i_76855);\n                int64_t defunc_0_f_res_75317;\n                \n                if (cond_75316) {\n                    defunc_0_f_res_75317 = (int64_t) 0;\n                } else {\n                    int64_t i_75318 = ad",
                   "d64(max_res_75306, i_76855);\n                    int64_t defunc_0_add_arg_75319;\n                    \n                    defunc_0_add_arg_75319 = ((__global\n                                               int64_t *) mem_77124)[gtid_75296 *\n                                                                     n_65378 +\n                                                                     i_75318];\n                    \n                    int64_t defunc_1_add_res_75320 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_75319);\n                    \n                    defunc_0_f_res_75317 = defunc_1_add_res_75320;\n                }\n                \n                int64_t binop_p_75321 = sub64(defunc_0_f_res_75317,\n                                              min_res_75305);\n                double defunc_0_f_res_75322 = sitofp_i64_f64(binop_p_75321);\n                double abs_res_75323 = fabs(defunc_0_f_res_75322);\n                double tmp1_75324 = abs_res_75323 / defunc_1_f_res_75307;\n                double x_75325 = tmp1_75324 * tmp1_75324;\n                double y_75326 = tmp1_75324 * x_75325;\n                double tmp2_75327 = 1.0 - y_75326;\n                double x_75328 = tmp2_75327 * tmp2_75327;\n                double tmp3_75329 = tmp2_75327 * x_75328;\n                double tmp4_75330 = x_75315 * tmp3_75329;\n                double defunc_0_f_res_75331;\n                \n                if (cond_75316) {\n                    defunc_0_f_res_75331 = 0.0;\n                } else {\n                    int64_t i_75332 = add64(max_res_75306, i_76855);\n                    double defunc_0_add_arg_75333;\n                    \n                    defunc_0_add_arg_75333 = ((__global\n                                               double *) mem_77120)[gtid_75296 *\n                                                                    n_65378 +\n                                                                    i_75332];\n             ",
                   "       defunc_0_f_res_75331 = defunc_0_add_arg_75333;\n                }\n                \n                double x_75334 = a0_75309 * tmp4_75330;\n                double defunc_9_fit_fun_res_75335 = defunc_0_f_res_75331 *\n                       x_75334;\n                double defunc_1_op_res_75313 = defunc_9_fit_fun_res_75335 +\n                       redout_76854;\n                double redout_tmp_78502 = defunc_1_op_res_75313;\n                \n                redout_76854 = redout_tmp_78502;\n            }\n            defunc_2_reduce_res_75310 = redout_76854;\n            postlude_75303 = defunc_2_reduce_res_75310;\n        } else {\n            postlude_75303 = 0.0;\n        }\n        color_78171[(int64_t) 0] = postlude_75303;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t thread_out_index_78503 = gid_x_74784 * tile_sizze_74787 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78477));\n    int64_t thread_out_index_78504 = gid_y_74785 * tile_sizze_74787 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78478));\n    \n    if (slt64(thread_out_index_78503, m_65377) && slt64(thread_out_index_78504,\n                                                        n_m_65386)) {\n        double tmp_78505;\n        \n        tmp_78505 = color_78171[(int64_t) 0];\n        ((__global double *) mem_77195)[thread_out_index_78503 * n_m_65386 +\n                                        thread_out_index_78504] = tmp_78505;\n    }\n    \n  error_7:\n    return;\n    #undef tile_sizze_74787\n}\n__kernel void mainzisegmap_intragroup_75346(__global int *global_failure,\n                                            int failure_is_an_option, __global\n                                            int64_t *global_failure_args,\n                                            __local volatile\n                                            int64_t *color_78195_backing_aligned_0,\n                                            int64_t m_65377, int64_t n_65378,\n                                            int64_t q_65380, int64_",
                   "t jump_65382,\n                                            int64_t n_m_65386, int64_t i_65392,\n                                            unsigned char x_65393_bits,\n                                            int64_t min_res_65398,\n                                            unsigned char loop_cond_65403_bits,\n                                            int64_t num_groups_x_75343,\n                                            int64_t num_groups_y_75344,\n                                            int64_t num_whole_tiles_75476,\n                                            int64_t residual_input_75724,\n                                            unsigned char cond_75725_bits,\n                                            __global unsigned char *mem_77350,\n                                            __global unsigned char *mem_77354,\n                                            __global unsigned char *mem_77358,\n                                            __global unsigned char *mem_77364,\n                                            __global unsigned char *mem_77368,\n                                            __global unsigned char *mem_77371,\n                                            __global unsigned char *mem_77374,\n                                            __global unsigned char *mem_77377,\n                                            __global unsigned char *mem_77382,\n                                            __global unsigned char *mem_77456,\n                                            __global unsigned char *mem_77460)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    bool cond_75725 = cond_75725_bits;\n    \n    #define tile_sizze_75341 (mainzitile_sizze_75340)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict color_78195_backing_0 =\n                                   (__local volatile\n                                    unsigned char *",
                   ") color_78195_backing_aligned_0;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_78825;\n    int32_t local_tid_78826;\n    int64_t group_sizze_78829;\n    int32_t wave_sizze_78828;\n    int32_t group_tid_78827;\n    \n    global_tid_78825 = get_global_id(0);\n    local_tid_78826 = get_local_id(0);\n    group_sizze_78829 = get_local_size(0);\n    wave_sizze_78828 = LOCKSTEP_WIDTH;\n    group_tid_78827 = get_group_id(0);\n    \n    int32_t gid_flat_75346 = group_tid_78827;\n    int64_t slice_78832 = tile_sizze_75341;\n    int64_t slice_78833 = tile_sizze_75341 * slice_78832;\n    int64_t ltid_pre_78830 = squot64(sext_i32_i64(local_tid_78826),\n                                     slice_78832);\n    int64_t remnant_78834 = sext_i32_i64(local_tid_78826) - ltid_pre_78830 *\n            slice_78832;\n    int64_t ltid_pre_78831 = remnant_78834;\n    int64_t remnant_78835 = remnant_78834 - ltid_pre_78831;\n    int64_t slice_78836 = num_groups_y_75344;\n    int64_t slice_78837 = num_groups_x_75343 * slice_78836;\n    int64_t gid_x_75338 = squot64(sext_i32_i64(group_tid_78827), slice_78836);\n    int64_t remnant_78838 = sext_i32_i64(group_tid_78827) - gid_x_75338 *\n            slice_78836;\n    int64_t gid_y_75339 = remnant_78838;\n    int64_t remnant_78839 = remnant_78838 - gid_y_75339;\n    double color_78189[1];\n    double color_78190[1];\n    double color_78191[1];\n    double color_78192[1];\n    double color_78193[1];\n    double color_78194[1];\n    __local unsigned char *color_78195;\n    \n    color_78195 = (__local unsigned char *) color_78195_backing_0;\n    \n    double color_78196[1];\n    int64_t color_78197[1];\n    int64_t color_78198[1];\n    int64_t color_78199[1];\n    int64_t binop_x_75366 = gid_x_75338 * tile_sizze_75341;\n    int64_t binop_x_75368 = gid_y_75339 * tile_sizze_75341;\n",
                   "    int64_t ltid_y_75365 = sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n    int64_t ltid_x_75363 = sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n    int32_t ltid_flat_75364 = local_tid_78826;\n    \n    if (slt64(ltid_y_75365, tile_sizze_75341) && slt64(ltid_x_75363,\n                                                       tile_sizze_75341)) {\n        int64_t gtid_75367 = ltid_y_75365 + binop_x_75366;\n        int64_t gtid_75369 = ltid_x_75363 + binop_x_75368;\n        bool binop_x_75370 = slt64(gtid_75367, m_65377);\n        bool binop_y_75371 = slt64(gtid_75369, n_m_65386);\n        bool cond_75372 = binop_x_75370 && binop_y_75371;\n        int64_t pre_75373;\n        int64_t pre_75374;\n        int64_t pre_75375;\n        double pre_75376;\n        \n        if (cond_75372) {\n            int64_t last_res_75377;\n            \n            last_res_75377 = ((__global int64_t *) mem_77350)[gtid_75367 *\n                                                              n_65378 +\n                                                              i_65392];\n            \n            int64_t min_arg_75378;\n            \n            min_arg_75378 = ((__global int64_t *) mem_77368)[gtid_75367];\n            \n            int64_t min_arg_75379;\n            \n            min_arg_75379 = ((__global int64_t *) mem_77371)[gtid_75367];\n            \n            int64_t min_res_75380;\n            \n            min_res_75380 = ((__global int64_t *) mem_77374)[gtid_75367];\n            \n            double max_res_75381;\n            \n            max_res_75381 = ((__global double *) mem_77377)[gtid_75367];\n            \n            int64_t min_arg_75382 = mul64(jump_65382, gtid_75369);\n            int64_t min_res_75383 = smin64(i_65392, min_arg_75382);\n            int64_t defunc_0_g_res_75384 = add64((int64_t) 1, min_res_75383);\n            bool init_idx_75385;\n            int64_t init_idx_75386;\n            int64_t init_idx_75387;\n            bool loop_while_75388;\n            int64_t low_75389;\n            int64_t high",
                   "_75390;\n            \n            loop_while_75388 = x_65393;\n            low_75389 = (int64_t) 0;\n            high_75390 = i_65392;\n            while (loop_while_75388) {\n                int64_t x_75391 = add64(low_75389, high_75390);\n                int64_t mid_75392 = sdiv64(x_75391, (int64_t) 2);\n                bool x_75393 = sle64((int64_t) 0, mid_75392);\n                bool y_75394 = slt64(mid_75392, n_65378);\n                bool bounds_check_75395 = x_75393 && y_75394;\n                bool index_certs_75396;\n                \n                if (!bounds_check_75395) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 20) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) mid_75392;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t mid_id_75397;\n                \n                mid_id_75397 = ((__global int64_t *) mem_77364)[gtid_75367 *\n                                                                n_65378 +\n                                                                mid_75392];\n                \n                bool cond_75398 = slt64(mid_id_75397, (int64_t) 0);\n                int64_t mid_idx_75399;\n                \n                if (cond_75398) {\n                    mid_idx_75399 = (int64_t) 9223372036854775807;\n                } else {\n                    mid_idx_75399 = mid_id_75397;\n                }\n                \n                bool cond_75400 = sle64(defunc_0_g_res_75384, mid_idx_75399);\n                int64_t loopres_75401;\n                int64_t loopres_75402;\n                \n                if (cond_75400) {\n                    int64_t loopres_t_res_75403 = sub64(mid_75392, (int64_t) 1);\n               ",
                   "     \n                    loopres_75401 = low_75389;\n                    loopres_75402 = loopres_t_res_75403;\n                } else {\n                    int64_t loopres_f_res_75404 = add64((int64_t) 1, mid_75392);\n                    \n                    loopres_75401 = loopres_f_res_75404;\n                    loopres_75402 = high_75390;\n                }\n                \n                bool loop_cond_75405 = sle64(loopres_75401, loopres_75402);\n                bool loop_while_tmp_78840 = loop_cond_75405;\n                int64_t low_tmp_78841 = loopres_75401;\n                int64_t high_tmp_78842 = loopres_75402;\n                \n                loop_while_75388 = loop_while_tmp_78840;\n                low_75389 = low_tmp_78841;\n                high_75390 = high_tmp_78842;\n            }\n            init_idx_75385 = loop_while_75388;\n            init_idx_75386 = low_75389;\n            init_idx_75387 = high_75390;\n            \n            bool idx_75406;\n            int64_t idx_75407;\n            int64_t idx_75408;\n            int64_t idx_75409;\n            bool loop_while_75410;\n            int64_t l_idx_75411;\n            int64_t r_idx_75412;\n            int64_t span_75413;\n            \n            loop_while_75410 = loop_cond_65403;\n            l_idx_75411 = init_idx_75386;\n            r_idx_75412 = init_idx_75386;\n            span_75413 = (int64_t) 1;\n            while (loop_while_75410) {\n                int64_t max_arg_75414 = sub64(l_idx_75411, (int64_t) 1);\n                int64_t max_res_75415 = smax64((int64_t) 0, max_arg_75414);\n                int64_t min_arg_75416 = add64((int64_t) 1, r_idx_75412);\n                int64_t min_res_75417 = smin64(min_arg_75378, min_arg_75416);\n                bool x_75418 = sle64((int64_t) 0, max_res_75415);\n                bool y_75419 = slt64(max_res_75415, n_65378);\n                bool bounds_check_75420 = x_75418 && y_75419;\n                bool index_certs_75421;\n                \n                if (!bounds_check_7",
                   "5420) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 21) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) max_res_75415;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_75422;\n                \n                x_75422 = ((__global int64_t *) mem_77364)[gtid_75367 *\n                                                           n_65378 +\n                                                           max_res_75415];\n                \n                int64_t abs_arg_75423 = sub64(x_75422, defunc_0_g_res_75384);\n                int64_t abs_res_75424 = abs64(abs_arg_75423);\n                bool x_75425 = sle64((int64_t) 0, min_res_75417);\n                bool y_75426 = slt64(min_res_75417, n_65378);\n                bool bounds_check_75427 = x_75425 && y_75426;\n                bool index_certs_75428;\n                \n                if (!bounds_check_75427) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 22) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) min_res_75417;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_75429;\n                \n                x_75429 = ((__global int64_t *) mem_77364)[gtid_75367 *\n                                                           n_65378 +\n                                                           min_res_75417];\n                \n                int64_t abs_",
                   "arg_75430 = sub64(x_75429, defunc_0_g_res_75384);\n                int64_t abs_res_75431 = abs64(abs_arg_75430);\n                bool cond_75432 = max_res_75415 == l_idx_75411;\n                int64_t loopres_75433;\n                int64_t loopres_75434;\n                int64_t loopres_75435;\n                \n                if (cond_75432) {\n                    loopres_75433 = l_idx_75411;\n                    loopres_75434 = r_idx_75412;\n                    loopres_75435 = min_res_65398;\n                } else {\n                    bool cond_75436 = slt64(abs_res_75424, abs_res_75431);\n                    bool cond_f_res_75437 = min_res_75417 == r_idx_75412;\n                    bool x_75438 = !cond_75436;\n                    bool y_75439 = cond_f_res_75437 && x_75438;\n                    bool cond_75440 = cond_75436 || y_75439;\n                    int64_t loopres_f_res_75441;\n                    \n                    if (cond_75440) {\n                        loopres_f_res_75441 = max_res_75415;\n                    } else {\n                        loopres_f_res_75441 = l_idx_75411;\n                    }\n                    \n                    int64_t loopres_f_res_75442;\n                    \n                    if (cond_75440) {\n                        loopres_f_res_75442 = r_idx_75412;\n                    } else {\n                        loopres_f_res_75442 = min_res_75417;\n                    }\n                    \n                    int64_t loopres_f_res_75443;\n                    \n                    if (cond_75440) {\n                        int64_t loopres_f_res_t_res_75444 = add64((int64_t) 1,\n                                                                  span_75413);\n                        \n                        loopres_f_res_75443 = loopres_f_res_t_res_75444;\n                    } else {\n                        int64_t loopres_f_res_f_res_75445 = add64((int64_t) 1,\n                                                                  span_75413);\n         ",
                   "               \n                        loopres_f_res_75443 = loopres_f_res_f_res_75445;\n                    }\n                    loopres_75433 = loopres_f_res_75441;\n                    loopres_75434 = loopres_f_res_75442;\n                    loopres_75435 = loopres_f_res_75443;\n                }\n                \n                bool loop_cond_75446 = slt64(loopres_75435, min_res_65398);\n                bool loop_while_tmp_78843 = loop_cond_75446;\n                int64_t l_idx_tmp_78844 = loopres_75433;\n                int64_t r_idx_tmp_78845 = loopres_75434;\n                int64_t span_tmp_78846 = loopres_75435;\n                \n                loop_while_75410 = loop_while_tmp_78843;\n                l_idx_75411 = l_idx_tmp_78844;\n                r_idx_75412 = r_idx_tmp_78845;\n                span_75413 = span_tmp_78846;\n            }\n            idx_75406 = loop_while_75410;\n            idx_75407 = l_idx_75411;\n            idx_75408 = r_idx_75412;\n            idx_75409 = span_75413;\n            \n            int64_t min_res_75447 = smin64(min_arg_75379, idx_75407);\n            int64_t max_res_75448 = smax64((int64_t) 0, min_res_75447);\n            int64_t x_75449 = add64(min_res_75380, max_res_75448);\n            int64_t r_75450 = sub64(x_75449, (int64_t) 1);\n            bool x_75451 = sle64((int64_t) 0, r_75450);\n            bool y_75452 = slt64(r_75450, n_65378);\n            bool bounds_check_75453 = x_75451 && y_75452;\n            bool index_certs_75454;\n            \n            if (!bounds_check_75453) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 23) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) r_75450;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    local_failure = true;\n                    goto error_0;\n                }\n            }\n            \n            int64_t x_75455;\n   ",
                   "         \n            x_75455 = ((__global int64_t *) mem_77358)[gtid_75367 * n_65378 +\n                                                       r_75450];\n            \n            int64_t abs_arg_75456 = sub64(x_75455, min_res_75383);\n            int64_t abs_res_75457 = abs64(abs_arg_75456);\n            bool x_75458 = sle64((int64_t) 0, max_res_75448);\n            bool y_75459 = slt64(max_res_75448, n_65378);\n            bool bounds_check_75460 = x_75458 && y_75459;\n            bool index_certs_75461;\n            \n            if (!bounds_check_75460) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 24) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) max_res_75448;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    local_failure = true;\n                    goto error_0;\n                }\n            }\n            \n            int64_t x_75462;\n            \n            x_75462 = ((__global int64_t *) mem_77358)[gtid_75367 * n_65378 +\n                                                       max_res_75448];\n            \n            int64_t abs_arg_75463 = sub64(x_75462, min_res_75383);\n            int64_t abs_res_75464 = abs64(abs_arg_75463);\n            int64_t max_res_75465 = smax64(abs_res_75457, abs_res_75464);\n            double defunc_0_f_res_75466 = sitofp_i64_f64(max_res_75465);\n            double defunc_1_f_res_75467 = max_res_75381 + defunc_0_f_res_75466;\n            \n            pre_75373 = last_res_75377;\n            pre_75374 = min_res_75383;\n            pre_75375 = max_res_75448;\n            pre_75376 = defunc_1_f_res_75467;\n        } else {\n            pre_75373 = (int64_t) 0;\n            pre_75374 = (int64_t) 0;\n            pre_75375 = (int64_t) 0;\n            pre_75376 = 0.0;\n        }\n        color_78199[(int64_t) 0] = pre_75373;\n        color_78198[(int64_t) 0] = pre_75374;\n        color_7",
                   "8197[(int64_t) 0] = pre_75375;\n        color_78196[(int64_t) 0] = pre_75376;\n    }\n    \n  error_0:\n    barrier(CLK_LOCAL_MEM_FENCE);\n    if (local_failure)\n        return;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t ltid_y_75484 = sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n    int64_t ltid_x_75482 = sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n    int32_t ltid_flat_75483 = local_tid_78826;\n    \n    if (slt64(ltid_y_75484, tile_sizze_75341) && slt64(ltid_x_75482,\n                                                       tile_sizze_75341)) {\n        color_78190[(int64_t) 0] = 0.0;\n        color_78189[(int64_t) 0] = 0.0;\n        color_78192[(int64_t) 0] = 0.0;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    double tmp_78847;\n    \n    tmp_78847 = color_78190[(int64_t) 0];\n    color_78191[(int64_t) 0] = tmp_78847;\n    \n    double tmp_78848;\n    \n    tmp_78848 = color_78189[(int64_t) 0];\n    color_78190[(int64_t) 0] = tmp_78848;\n    \n    double tmp_78849;\n    \n    tmp_78849 = color_78192[(int64_t) 0];\n    color_78189[(int64_t) 0] = tmp_78849;\n    \n    double ext_mem_77427[1];\n    double ext_mem_unused_78118[1];\n    double ext_mem_77426[1];\n    double ext_mem_unused_78123[1];\n    double ext_mem_77425[1];\n    double ext_mem_unused_78128[1];\n    double mem_param_77407[1];\n    double mem_param_77408[1];\n    double mem_param_77409[1];\n    double mem_param_out_78119[1];\n    double mem_param_out_78124[1];\n    double mem_param_out_78129[1];\n    \n    for (int32_t i_1 = 0; i_1 < 1; i_1++)\n        mem_param_77407[i_1] = color_78191[i_1];\n    for (int32_t i_2 = 0; i_2 < 1; i_2++)\n        mem_param_out_78119[i_2] = color_78194[i_2];\n    for (int32_t i_3 = 0; i_3 < 1; i_3++)\n        mem_param_77408[i_3] = color_78190[i_3];\n    for (int32_t i_4 = 0; i_4 < 1; i_4++)\n        mem_param_out_78124[i_4] = color_78193[i_4];\n    for (int32_t i_5 = 0; i_5 < 1; i_5++)\n        mem_param_77409[i_5] = color_78189[i_5];\n    for (int32_t i_6 = 0; i_6 < 1; i_6++)\n        mem_param_out_78129[i_6] =",
                   " color_78192[i_6];\n    for (int64_t tile_id_75495 = 0; tile_id_75495 < num_whole_tiles_75476;\n         tile_id_75495++) {\n        int64_t binop_x_75618 = tile_sizze_75341 * tile_id_75495;\n        int64_t ltid_y_75615 = sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n        int64_t ltid_x_75613 = sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n        int32_t ltid_flat_75614 = local_tid_78826;\n        int64_t j_75619 = ltid_x_75613 + binop_x_75618;\n        int64_t gtid_75621 = binop_x_75366 + ltid_y_75615;\n        bool binop_x_75629 = slt64(j_75619, q_65380);\n        bool binop_y_75630 = slt64(gtid_75621, m_65377);\n        bool cond_75631 = binop_x_75629 && binop_y_75630;\n        double pre2d_75632;\n        \n        if (cond_75631) {\n            double x_75633;\n            \n            x_75633 = ((__global double *) mem_77382)[gtid_75621 * q_65380 +\n                                                      j_75619];\n            pre2d_75632 = x_75633;\n        } else {\n            pre2d_75632 = 0.0;\n        }\n        ((__local double *) color_78195)[ltid_y_75615 * tile_sizze_75341 +\n                                         ltid_x_75613] = pre2d_75632;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int64_t ltid_y_75640 = sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n        int64_t ltid_x_75638 = sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n        int32_t ltid_flat_75639 = local_tid_78826;\n        int64_t gtid_75642 = binop_x_75366 + ltid_y_75640;\n        int64_t gtid_75644 = binop_x_75368 + ltid_x_75638;\n        double acc_75650;\n        \n        acc_75650 = mem_param_77407[(int64_t) 0];\n        \n        double acc_75651;\n        \n        acc_75651 = mem_param_77408[(int64_t) 0];\n        \n        double acc_75652;\n        \n        acc_75652 = mem_param_77409[(int64_t) 0];\n        \n        bool binop_x_75656 = slt64(gtid_75642, m_65377);\n        bool binop_y_75657 = slt64(gtid_75644, n_m_65386);\n        bool cond_75658 = binop_x_75656 && binop_y_75657;\n        double acc_756",
                   "59;\n        double acc_75660;\n        double acc_75661;\n        \n        if (cond_75658) {\n            int64_t last_res_75645;\n            \n            last_res_75645 = color_78199[(int64_t) 0];\n            \n            int64_t min_res_75646;\n            \n            min_res_75646 = color_78198[(int64_t) 0];\n            \n            int64_t max_res_75647;\n            \n            max_res_75647 = color_78197[(int64_t) 0];\n            \n            double defunc_1_f_res_75648;\n            \n            defunc_1_f_res_75648 = color_78196[(int64_t) 0];\n            \n            double x_75662;\n            double x_75663;\n            double x_75664;\n            double redout_76892;\n            double redout_76893;\n            double redout_76894;\n            \n            redout_76892 = acc_75650;\n            redout_76893 = acc_75651;\n            redout_76894 = acc_75652;\n            for (int64_t i_76895 = 0; i_76895 < tile_sizze_75341; i_76895++) {\n                int64_t index_primexp_76991 = add64(binop_x_75618, i_76895);\n                double x_75675;\n                \n                x_75675 = ((__local double *) color_78195)[ltid_y_75640 *\n                                                           tile_sizze_75341 +\n                                                           i_76895];\n                \n                bool cond_75676 = sle64(last_res_75645, index_primexp_76991);\n                int64_t defunc_0_f_res_75677;\n                \n                if (cond_75676) {\n                    defunc_0_f_res_75677 = (int64_t) 0;\n                } else {\n                    int64_t i_75678 = add64(max_res_75647, index_primexp_76991);\n                    int64_t defunc_0_add_arg_75679;\n                    \n                    defunc_0_add_arg_75679 = ((__global\n                                               int64_t *) mem_77358)[gtid_75642 *\n                                                                     n_65378 +\n                                                      ",
                   "               i_75678];\n                    \n                    int64_t defunc_1_add_res_75680 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_75679);\n                    \n                    defunc_0_f_res_75677 = defunc_1_add_res_75680;\n                }\n                \n                int64_t binop_p_75681 = sub64(defunc_0_f_res_75677,\n                                              min_res_75646);\n                double defunc_0_f_res_75682 = sitofp_i64_f64(binop_p_75681);\n                double abs_res_75683 = fabs(defunc_0_f_res_75682);\n                double tmp1_75684 = abs_res_75683 / defunc_1_f_res_75648;\n                double x_75685 = tmp1_75684 * tmp1_75684;\n                double y_75686 = tmp1_75684 * x_75685;\n                double tmp2_75687 = 1.0 - y_75686;\n                double x_75688 = tmp2_75687 * tmp2_75687;\n                double tmp3_75689 = tmp2_75687 * x_75688;\n                double w_j_75690 = x_75675 * tmp3_75689;\n                double xw_j_75691 = defunc_0_f_res_75682 * w_j_75690;\n                double x2w_j_75692 = defunc_0_f_res_75682 * xw_j_75691;\n                double defunc_1_op_res_75671 = w_j_75690 + redout_76892;\n                double defunc_1_op_res_75672 = xw_j_75691 + redout_76893;\n                double defunc_1_op_res_75673 = x2w_j_75692 + redout_76894;\n                double redout_tmp_78859 = defunc_1_op_res_75671;\n                double redout_tmp_78860 = defunc_1_op_res_75672;\n                double redout_tmp_78861 = defunc_1_op_res_75673;\n                \n                redout_76892 = redout_tmp_78859;\n                redout_76893 = redout_tmp_78860;\n                redout_76894 = redout_tmp_78861;\n            }\n            x_75662 = redout_76892;\n            x_75663 = redout_76893;\n            x_75664 = redout_76894;\n            acc_75659 = x_75662;\n            acc_75660 = x_75663;\n            acc_75661 = x_75664;\n        } else {\n            acc_75659 = acc_7",
                   "5650;\n            acc_75660 = acc_75651;\n            acc_75661 = acc_75652;\n        }\n        mem_param_out_78119[(int64_t) 0] = acc_75659;\n        mem_param_out_78124[(int64_t) 0] = acc_75660;\n        mem_param_out_78129[(int64_t) 0] = acc_75661;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        double mem_param_tmp_78850[1];\n        \n        for (int32_t i_7 = 0; i_7 < 1; i_7++)\n            mem_param_tmp_78850[i_7] = mem_param_out_78119[i_7];\n        \n        double mem_param_out_tmp_78851[1];\n        \n        for (int32_t i_8 = 0; i_8 < 1; i_8++)\n            mem_param_out_tmp_78851[i_8] = mem_param_77407[i_8];\n        \n        double mem_param_tmp_78852[1];\n        \n        for (int32_t i_9 = 0; i_9 < 1; i_9++)\n            mem_param_tmp_78852[i_9] = mem_param_out_78124[i_9];\n        \n        double mem_param_out_tmp_78853[1];\n        \n        for (int32_t i_10 = 0; i_10 < 1; i_10++)\n            mem_param_out_tmp_78853[i_10] = mem_param_77408[i_10];\n        \n        double mem_param_tmp_78854[1];\n        \n        for (int32_t i_11 = 0; i_11 < 1; i_11++)\n            mem_param_tmp_78854[i_11] = mem_param_out_78129[i_11];\n        \n        double mem_param_out_tmp_78855[1];\n        \n        for (int32_t i_12 = 0; i_12 < 1; i_12++)\n            mem_param_out_tmp_78855[i_12] = mem_param_77409[i_12];\n        for (int32_t i_13 = 0; i_13 < 1; i_13++)\n            mem_param_77407[i_13] = mem_param_tmp_78850[i_13];\n        for (int32_t i_14 = 0; i_14 < 1; i_14++)\n            mem_param_out_78119[i_14] = mem_param_out_tmp_78851[i_14];\n        for (int32_t i_15 = 0; i_15 < 1; i_15++)\n            mem_param_77408[i_15] = mem_param_tmp_78852[i_15];\n        for (int32_t i_16 = 0; i_16 < 1; i_16++)\n            mem_param_out_78124[i_16] = mem_param_out_tmp_78853[i_16];\n        for (int32_t i_17 = 0; i_17 < 1; i_17++)\n            mem_param_77409[i_17] = mem_param_tmp_78854[i_17];\n        for (int32_t i_18 = 0; i_18 < 1; i_18++)\n            mem_param_out_78129[i_18] = mem_param_out_",
                   "tmp_78855[i_18];\n    }\n    for (int32_t i_19 = 0; i_19 < 1; i_19++)\n        ext_mem_77427[i_19] = mem_param_77407[i_19];\n    for (int32_t i_20 = 0; i_20 < 1; i_20++)\n        ext_mem_unused_78118[i_20] = mem_param_out_78119[i_20];\n    for (int32_t i_21 = 0; i_21 < 1; i_21++)\n        ext_mem_77426[i_21] = mem_param_77408[i_21];\n    for (int32_t i_22 = 0; i_22 < 1; i_22++)\n        ext_mem_unused_78123[i_22] = mem_param_out_78124[i_22];\n    for (int32_t i_23 = 0; i_23 < 1; i_23++)\n        ext_mem_77425[i_23] = mem_param_77409[i_23];\n    for (int32_t i_24 = 0; i_24 < 1; i_24++)\n        ext_mem_unused_78128[i_24] = mem_param_out_78129[i_24];\n    if (cond_75725) {\n        double tmp_78862;\n        \n        tmp_78862 = ext_mem_77427[(int64_t) 0];\n        color_78189[(int64_t) 0] = tmp_78862;\n        \n        double tmp_78863;\n        \n        tmp_78863 = ext_mem_77426[(int64_t) 0];\n        color_78190[(int64_t) 0] = tmp_78863;\n        \n        double tmp_78864;\n        \n        tmp_78864 = ext_mem_77425[(int64_t) 0];\n        color_78191[(int64_t) 0] = tmp_78864;\n    } else {\n        int64_t binop_x_75849 = tile_sizze_75341 * num_whole_tiles_75476;\n        int64_t ltid_y_75846 = sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n        int64_t ltid_x_75844 = sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n        int32_t ltid_flat_75845 = local_tid_78826;\n        int64_t j_75850 = ltid_x_75844 + binop_x_75849;\n        int64_t gtid_75852 = binop_x_75366 + ltid_y_75846;\n        bool binop_x_75860 = slt64(j_75850, q_65380);\n        bool binop_y_75861 = slt64(gtid_75852, m_65377);\n        bool cond_75862 = binop_x_75860 && binop_y_75861;\n        double pre2d_75863;\n        \n        if (cond_75862) {\n            double x_75864;\n            \n            x_75864 = ((__global double *) mem_77382)[gtid_75852 * q_65380 +\n                                                      j_75850];\n            pre2d_75863 = x_75864;\n        } else {\n            pre2d_75863 = 0.0;\n        }\n        ((__local d",
                   "ouble *) color_78195)[ltid_y_75846 * tile_sizze_75341 +\n                                         ltid_x_75844] = pre2d_75863;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int64_t ltid_y_75872 = sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n        int64_t ltid_x_75870 = sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n        int32_t ltid_flat_75871 = local_tid_78826;\n        int64_t gtid_75874 = binop_x_75366 + ltid_y_75872;\n        int64_t gtid_75876 = binop_x_75368 + ltid_x_75870;\n        double acc_75882;\n        \n        acc_75882 = ext_mem_77427[(int64_t) 0];\n        \n        double acc_75883;\n        \n        acc_75883 = ext_mem_77426[(int64_t) 0];\n        \n        double acc_75884;\n        \n        acc_75884 = ext_mem_77425[(int64_t) 0];\n        \n        bool binop_x_75888 = slt64(gtid_75874, m_65377);\n        bool binop_y_75889 = slt64(gtid_75876, n_m_65386);\n        bool cond_75890 = binop_x_75888 && binop_y_75889;\n        double acc_75891;\n        double acc_75892;\n        double acc_75893;\n        \n        if (cond_75890) {\n            int64_t last_res_75877;\n            \n            last_res_75877 = color_78199[(int64_t) 0];\n            \n            int64_t min_res_75878;\n            \n            min_res_75878 = color_78198[(int64_t) 0];\n            \n            int64_t max_res_75879;\n            \n            max_res_75879 = color_78197[(int64_t) 0];\n            \n            double defunc_1_f_res_75880;\n            \n            defunc_1_f_res_75880 = color_78196[(int64_t) 0];\n            \n            double x_75894;\n            double x_75895;\n            double x_75896;\n            double redout_76896;\n            double redout_76897;\n            double redout_76898;\n            \n            redout_76896 = acc_75882;\n            redout_76897 = acc_75883;\n            redout_76898 = acc_75884;\n            for (int64_t i_76899 = 0; i_76899 < residual_input_75724;\n                 i_76899++) {\n                int64_t index_primexp_76989 = add64(binop_x_",
                   "75849, i_76899);\n                double x_75907;\n                \n                x_75907 = ((__local double *) color_78195)[ltid_y_75872 *\n                                                           tile_sizze_75341 +\n                                                           i_76899];\n                \n                bool cond_75908 = sle64(last_res_75877, index_primexp_76989);\n                int64_t defunc_0_f_res_75909;\n                \n                if (cond_75908) {\n                    defunc_0_f_res_75909 = (int64_t) 0;\n                } else {\n                    int64_t i_75910 = add64(max_res_75879, index_primexp_76989);\n                    int64_t defunc_0_add_arg_75911;\n                    \n                    defunc_0_add_arg_75911 = ((__global\n                                               int64_t *) mem_77358)[gtid_75874 *\n                                                                     n_65378 +\n                                                                     i_75910];\n                    \n                    int64_t defunc_1_add_res_75912 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_75911);\n                    \n                    defunc_0_f_res_75909 = defunc_1_add_res_75912;\n                }\n                \n                int64_t binop_p_75913 = sub64(defunc_0_f_res_75909,\n                                              min_res_75878);\n                double defunc_0_f_res_75914 = sitofp_i64_f64(binop_p_75913);\n                double abs_res_75915 = fabs(defunc_0_f_res_75914);\n                double tmp1_75916 = abs_res_75915 / defunc_1_f_res_75880;\n                double x_75917 = tmp1_75916 * tmp1_75916;\n                double y_75918 = tmp1_75916 * x_75917;\n                double tmp2_75919 = 1.0 - y_75918;\n                double x_75920 = tmp2_75919 * tmp2_75919;\n                double tmp3_75921 = tmp2_75919 * x_75920;\n                double w_j_75922 = x_75907 * tmp3_75921;\n     ",
                   "           double xw_j_75923 = defunc_0_f_res_75914 * w_j_75922;\n                double x2w_j_75924 = defunc_0_f_res_75914 * xw_j_75923;\n                double defunc_1_op_res_75903 = w_j_75922 + redout_76896;\n                double defunc_1_op_res_75904 = xw_j_75923 + redout_76897;\n                double defunc_1_op_res_75905 = x2w_j_75924 + redout_76898;\n                double redout_tmp_78865 = defunc_1_op_res_75903;\n                double redout_tmp_78866 = defunc_1_op_res_75904;\n                double redout_tmp_78867 = defunc_1_op_res_75905;\n                \n                redout_76896 = redout_tmp_78865;\n                redout_76897 = redout_tmp_78866;\n                redout_76898 = redout_tmp_78867;\n            }\n            x_75894 = redout_76896;\n            x_75895 = redout_76897;\n            x_75896 = redout_76898;\n            acc_75891 = x_75894;\n            acc_75892 = x_75895;\n            acc_75893 = x_75896;\n        } else {\n            acc_75891 = acc_75882;\n            acc_75892 = acc_75883;\n            acc_75893 = acc_75884;\n        }\n        color_78194[(int64_t) 0] = acc_75891;\n        color_78193[(int64_t) 0] = acc_75892;\n        color_78192[(int64_t) 0] = acc_75893;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        double tmp_78868;\n        \n        tmp_78868 = color_78194[(int64_t) 0];\n        color_78189[(int64_t) 0] = tmp_78868;\n        \n        double tmp_78869;\n        \n        tmp_78869 = color_78193[(int64_t) 0];\n        color_78190[(int64_t) 0] = tmp_78869;\n        \n        double tmp_78870;\n        \n        tmp_78870 = color_78192[(int64_t) 0];\n        color_78191[(int64_t) 0] = tmp_78870;\n    }\n    \n    int64_t ltid_y_75942 = sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n    int64_t ltid_x_75940 = sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n    int32_t ltid_flat_75941 = local_tid_78826;\n    \n    if (slt64(ltid_y_75942, tile_sizze_75341) && slt64(ltid_x_75940,\n                                                       tile_sizze_75341",
                   ")) {\n        int64_t gtid_75944 = binop_x_75366 + ltid_y_75942;\n        int64_t gtid_75946 = binop_x_75368 + ltid_x_75940;\n        bool binop_x_75950 = slt64(gtid_75944, m_65377);\n        bool binop_y_75951 = slt64(gtid_75946, n_m_65386);\n        bool cond_75952 = binop_x_75950 && binop_y_75951;\n        double postlude_75953;\n        double postlude_75954;\n        \n        if (cond_75952) {\n            double defunc_2_reduce_res_75947;\n            \n            defunc_2_reduce_res_75947 = color_78189[(int64_t) 0];\n            \n            double defunc_2_reduce_res_75948;\n            \n            defunc_2_reduce_res_75948 = color_78190[(int64_t) 0];\n            \n            double defunc_2_reduce_res_75949;\n            \n            defunc_2_reduce_res_75949 = color_78191[(int64_t) 0];\n            \n            int64_t last_res_75955;\n            \n            last_res_75955 = color_78199[(int64_t) 0];\n            \n            int64_t min_res_75956;\n            \n            min_res_75956 = color_78198[(int64_t) 0];\n            \n            int64_t max_res_75957;\n            \n            max_res_75957 = color_78197[(int64_t) 0];\n            \n            double defunc_1_f_res_75958;\n            \n            defunc_1_f_res_75958 = color_78196[(int64_t) 0];\n            \n            double x_75960 = defunc_2_reduce_res_75947 *\n                   defunc_2_reduce_res_75949;\n            double y_75961 = defunc_2_reduce_res_75948 *\n                   defunc_2_reduce_res_75948;\n            double y_75962 = x_75960 - y_75961;\n            double det1_75963 = 1.0 / y_75962;\n            double a11_75964 = defunc_2_reduce_res_75949 * det1_75963;\n            double x_75965 = 0.0 - defunc_2_reduce_res_75948;\n            double b11_75966 = det1_75963 * x_75965;\n            double c11_75967 = defunc_2_reduce_res_75947 * det1_75963;\n            double defunc_2_reduce_res_75968;\n            double defunc_2_reduce_res_75969;\n            double redout_76900;\n            double redout_76901;\n ",
                   "           \n            redout_76900 = 0.0;\n            redout_76901 = 0.0;\n            for (int64_t i_76902 = 0; i_76902 < q_65380; i_76902++) {\n                double x_75977;\n                \n                x_75977 = ((__global double *) mem_77382)[gtid_75944 * q_65380 +\n                                                          i_76902];\n                \n                bool cond_75978 = sle64(last_res_75955, i_76902);\n                int64_t defunc_0_f_res_75979;\n                \n                if (cond_75978) {\n                    defunc_0_f_res_75979 = (int64_t) 0;\n                } else {\n                    int64_t i_75980 = add64(max_res_75957, i_76902);\n                    int64_t defunc_0_add_arg_75981;\n                    \n                    defunc_0_add_arg_75981 = ((__global\n                                               int64_t *) mem_77358)[gtid_75944 *\n                                                                     n_65378 +\n                                                                     i_75980];\n                    \n                    int64_t defunc_1_add_res_75982 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_75981);\n                    \n                    defunc_0_f_res_75979 = defunc_1_add_res_75982;\n                }\n                \n                int64_t binop_p_75983 = sub64(defunc_0_f_res_75979,\n                                              min_res_75956);\n                double defunc_0_f_res_75984 = sitofp_i64_f64(binop_p_75983);\n                double abs_res_75985 = fabs(defunc_0_f_res_75984);\n                double tmp1_75986 = abs_res_75985 / defunc_1_f_res_75958;\n                double x_75987 = tmp1_75986 * tmp1_75986;\n                double y_75988 = tmp1_75986 * x_75987;\n                double tmp2_75989 = 1.0 - y_75988;\n                double x_75990 = tmp2_75989 * tmp2_75989;\n                double tmp3_75991 = tmp2_75989 * x_75990;\n                double tmp4_7",
                   "5992 = x_75977 * tmp3_75991;\n                double defunc_1_f_res_75993 = defunc_0_f_res_75984 * tmp4_75992;\n                double defunc_0_f_res_75994;\n                \n                if (cond_75978) {\n                    defunc_0_f_res_75994 = 0.0;\n                } else {\n                    int64_t i_75995 = add64(max_res_75957, i_76902);\n                    double defunc_0_add_arg_75996;\n                    \n                    defunc_0_add_arg_75996 = ((__global\n                                               double *) mem_77354)[gtid_75944 *\n                                                                    n_65378 +\n                                                                    i_75995];\n                    defunc_0_f_res_75994 = defunc_0_add_arg_75996;\n                }\n                \n                double x_75997 = a11_75964 * tmp4_75992;\n                double y_75998 = b11_75966 * defunc_1_f_res_75993;\n                double x_75999 = x_75997 + y_75998;\n                double defunc_9_fit_fun_res_76000 = defunc_0_f_res_75994 *\n                       x_75999;\n                double x_76001 = b11_75966 * tmp4_75992;\n                double y_76002 = c11_75967 * defunc_1_f_res_75993;\n                double x_76003 = x_76001 + y_76002;\n                double defunc_9_slope_fun_res_76004 = defunc_0_f_res_75994 *\n                       x_76003;\n                double defunc_1_op_res_75972 = defunc_9_fit_fun_res_76000 +\n                       redout_76900;\n                double defunc_1_op_res_75975 = defunc_9_slope_fun_res_76004 +\n                       redout_76901;\n                double redout_tmp_78871 = defunc_1_op_res_75972;\n                double redout_tmp_78872 = defunc_1_op_res_75975;\n                \n                redout_76900 = redout_tmp_78871;\n                redout_76901 = redout_tmp_78872;\n            }\n            defunc_2_reduce_res_75968 = redout_76900;\n            defunc_2_reduce_res_75969 = redout_76901;\n            postlude_7",
                   "5953 = defunc_2_reduce_res_75968;\n            postlude_75954 = defunc_2_reduce_res_75969;\n        } else {\n            postlude_75953 = 0.0;\n            postlude_75954 = 0.0;\n        }\n        color_78193[(int64_t) 0] = postlude_75953;\n        color_78192[(int64_t) 0] = postlude_75954;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t thread_out_index_78873 = gid_x_75338 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n    int64_t thread_out_index_78874 = gid_y_75339 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n    \n    if (slt64(thread_out_index_78873, m_65377) && slt64(thread_out_index_78874,\n                                                        n_m_65386)) {\n        double tmp_78875;\n        \n        tmp_78875 = color_78193[(int64_t) 0];\n        ((__global double *) mem_77456)[thread_out_index_78873 * n_m_65386 +\n                                        thread_out_index_78874] = tmp_78875;\n    }\n    \n    int64_t thread_out_index_78876 = gid_x_75338 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78830));\n    int64_t thread_out_index_78877 = gid_y_75339 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78831));\n    \n    if (slt64(thread_out_index_78876, m_65377) && slt64(thread_out_index_78877,\n                                                        n_m_65386)) {\n        double tmp_78878;\n        \n        tmp_78878 = color_78192[(int64_t) 0];\n        ((__global double *) mem_77460)[thread_out_index_78876 * n_m_65386 +\n                                        thread_out_index_78877] = tmp_78878;\n    }\n    \n  error_7:\n    return;\n    #undef tile_sizze_75341\n}\n__kernel void mainzisegmap_intragroup_76017(__global int *global_failure,\n                                            int failure_is_an_option, __global\n                                            int64_t *global_failure_args,\n                                            __local volatile\n                     ",
                   "                       int64_t *color_78226_backing_aligned_0,\n                                            int64_t m_65377, int64_t n_65378,\n                                            int64_t q_65380, int64_t jump_65382,\n                                            int64_t n_m_65386, int64_t i_65392,\n                                            unsigned char x_65393_bits,\n                                            int64_t min_res_65398,\n                                            unsigned char loop_cond_65403_bits,\n                                            int64_t num_groups_x_76014,\n                                            int64_t num_groups_y_76015,\n                                            int64_t num_whole_tiles_76147,\n                                            int64_t residual_input_76447,\n                                            unsigned char cond_76448_bits,\n                                            __global unsigned char *mem_77642,\n                                            __global unsigned char *mem_77646,\n                                            __global unsigned char *mem_77650,\n                                            __global unsigned char *mem_77656,\n                                            __global unsigned char *mem_77660,\n                                            __global unsigned char *mem_77663,\n                                            __global unsigned char *mem_77666,\n                                            __global unsigned char *mem_77669,\n                                            __global unsigned char *mem_77674,\n                                            __global unsigned char *mem_77772,\n                                            __global unsigned char *mem_77776)\n{\n    bool x_65393 = x_65393_bits;\n    bool loop_cond_65403 = loop_cond_65403_bits;\n    bool cond_76448 = cond_76448_bits;\n    \n    #define tile_sizze_76012 (mainzitile_sizze_76011)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 ",
                   "= 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict color_78226_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) color_78226_backing_aligned_0;\n    volatile __local bool local_failure;\n    \n    if (failure_is_an_option) {\n        int failed = *global_failure >= 0;\n        \n        if (failed)\n            return;\n    }\n    local_failure = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_79242;\n    int32_t local_tid_79243;\n    int64_t group_sizze_79246;\n    int32_t wave_sizze_79245;\n    int32_t group_tid_79244;\n    \n    global_tid_79242 = get_global_id(0);\n    local_tid_79243 = get_local_id(0);\n    group_sizze_79246 = get_local_size(0);\n    wave_sizze_79245 = LOCKSTEP_WIDTH;\n    group_tid_79244 = get_group_id(0);\n    \n    int32_t gid_flat_76017 = group_tid_79244;\n    int64_t slice_79249 = tile_sizze_76012;\n    int64_t slice_79250 = tile_sizze_76012 * slice_79249;\n    int64_t ltid_pre_79247 = squot64(sext_i32_i64(local_tid_79243),\n                                     slice_79249);\n    int64_t remnant_79251 = sext_i32_i64(local_tid_79243) - ltid_pre_79247 *\n            slice_79249;\n    int64_t ltid_pre_79248 = remnant_79251;\n    int64_t remnant_79252 = remnant_79251 - ltid_pre_79248;\n    int64_t slice_79253 = num_groups_y_76015;\n    int64_t slice_79254 = num_groups_x_76014 * slice_79253;\n    int64_t gid_x_76009 = squot64(sext_i32_i64(group_tid_79244), slice_79253);\n    int64_t remnant_79255 = sext_i32_i64(group_tid_79244) - gid_x_76009 *\n            slice_79253;\n    int64_t gid_y_76010 = remnant_79255;\n    int64_t remnant_79256 = remnant_79255 - gid_y_76010;\n    double color_78216[1];\n    double color_78217[1];\n    double color_78218[1];\n    double color_78219[1];\n    double color_78220[1];\n    double color_78221[1];\n    double color_78222[1];\n    double color_78223[1];\n    double color_78224[1];\n    double color_78225[1];\n    __local unsigned char *color",
                   "_78226;\n    \n    color_78226 = (__local unsigned char *) color_78226_backing_0;\n    \n    double color_78227[1];\n    int64_t color_78228[1];\n    int64_t color_78229[1];\n    int64_t color_78230[1];\n    int64_t binop_x_76037 = gid_x_76009 * tile_sizze_76012;\n    int64_t binop_x_76039 = gid_y_76010 * tile_sizze_76012;\n    int64_t ltid_y_76036 = sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n    int64_t ltid_x_76034 = sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n    int32_t ltid_flat_76035 = local_tid_79243;\n    \n    if (slt64(ltid_y_76036, tile_sizze_76012) && slt64(ltid_x_76034,\n                                                       tile_sizze_76012)) {\n        int64_t gtid_76038 = ltid_y_76036 + binop_x_76037;\n        int64_t gtid_76040 = ltid_x_76034 + binop_x_76039;\n        bool binop_x_76041 = slt64(gtid_76038, m_65377);\n        bool binop_y_76042 = slt64(gtid_76040, n_m_65386);\n        bool cond_76043 = binop_x_76041 && binop_y_76042;\n        int64_t pre_76044;\n        int64_t pre_76045;\n        int64_t pre_76046;\n        double pre_76047;\n        \n        if (cond_76043) {\n            int64_t last_res_76048;\n            \n            last_res_76048 = ((__global int64_t *) mem_77642)[gtid_76038 *\n                                                              n_65378 +\n                                                              i_65392];\n            \n            int64_t min_arg_76049;\n            \n            min_arg_76049 = ((__global int64_t *) mem_77660)[gtid_76038];\n            \n            int64_t min_arg_76050;\n            \n            min_arg_76050 = ((__global int64_t *) mem_77663)[gtid_76038];\n            \n            int64_t min_res_76051;\n            \n            min_res_76051 = ((__global int64_t *) mem_77666)[gtid_76038];\n            \n            double max_res_76052;\n            \n            max_res_76052 = ((__global double *) mem_77669)[gtid_76038];\n            \n            int64_t min_arg_76053 = mul64(jump_65382, gtid_76040);\n            int64_t min_r",
                   "es_76054 = smin64(i_65392, min_arg_76053);\n            int64_t defunc_0_g_res_76055 = add64((int64_t) 1, min_res_76054);\n            bool init_idx_76056;\n            int64_t init_idx_76057;\n            int64_t init_idx_76058;\n            bool loop_while_76059;\n            int64_t low_76060;\n            int64_t high_76061;\n            \n            loop_while_76059 = x_65393;\n            low_76060 = (int64_t) 0;\n            high_76061 = i_65392;\n            while (loop_while_76059) {\n                int64_t x_76062 = add64(low_76060, high_76061);\n                int64_t mid_76063 = sdiv64(x_76062, (int64_t) 2);\n                bool x_76064 = sle64((int64_t) 0, mid_76063);\n                bool y_76065 = slt64(mid_76063, n_65378);\n                bool bounds_check_76066 = x_76064 && y_76065;\n                bool index_certs_76067;\n                \n                if (!bounds_check_76066) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 35) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) mid_76063;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t mid_id_76068;\n                \n                mid_id_76068 = ((__global int64_t *) mem_77656)[gtid_76038 *\n                                                                n_65378 +\n                                                                mid_76063];\n                \n                bool cond_76069 = slt64(mid_id_76068, (int64_t) 0);\n                int64_t mid_idx_76070;\n                \n                if (cond_76069) {\n                    mid_idx_76070 = (int64_t) 9223372036854775807;\n                } else {\n                    mid_idx_76070 = mid_id_76068;\n                }\n    ",
                   "            \n                bool cond_76071 = sle64(defunc_0_g_res_76055, mid_idx_76070);\n                int64_t loopres_76072;\n                int64_t loopres_76073;\n                \n                if (cond_76071) {\n                    int64_t loopres_t_res_76074 = sub64(mid_76063, (int64_t) 1);\n                    \n                    loopres_76072 = low_76060;\n                    loopres_76073 = loopres_t_res_76074;\n                } else {\n                    int64_t loopres_f_res_76075 = add64((int64_t) 1, mid_76063);\n                    \n                    loopres_76072 = loopres_f_res_76075;\n                    loopres_76073 = high_76061;\n                }\n                \n                bool loop_cond_76076 = sle64(loopres_76072, loopres_76073);\n                bool loop_while_tmp_79257 = loop_cond_76076;\n                int64_t low_tmp_79258 = loopres_76072;\n                int64_t high_tmp_79259 = loopres_76073;\n                \n                loop_while_76059 = loop_while_tmp_79257;\n                low_76060 = low_tmp_79258;\n                high_76061 = high_tmp_79259;\n            }\n            init_idx_76056 = loop_while_76059;\n            init_idx_76057 = low_76060;\n            init_idx_76058 = high_76061;\n            \n            bool idx_76077;\n            int64_t idx_76078;\n            int64_t idx_76079;\n            int64_t idx_76080;\n            bool loop_while_76081;\n            int64_t l_idx_76082;\n            int64_t r_idx_76083;\n            int64_t span_76084;\n            \n            loop_while_76081 = loop_cond_65403;\n            l_idx_76082 = init_idx_76057;\n            r_idx_76083 = init_idx_76057;\n            span_76084 = (int64_t) 1;\n            while (loop_while_76081) {\n                int64_t max_arg_76085 = sub64(l_idx_76082, (int64_t) 1);\n                int64_t max_res_76086 = smax64((int64_t) 0, max_arg_76085);\n                int64_t min_arg_76087 = add64((int64_t) 1, r_idx_76083);\n                int64_t min_res_76088 = smin",
                   "64(min_arg_76049, min_arg_76087);\n                bool x_76089 = sle64((int64_t) 0, max_res_76086);\n                bool y_76090 = slt64(max_res_76086, n_65378);\n                bool bounds_check_76091 = x_76089 && y_76090;\n                bool index_certs_76092;\n                \n                if (!bounds_check_76091) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 36) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) max_res_76086;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n                \n                int64_t x_76093;\n                \n                x_76093 = ((__global int64_t *) mem_77656)[gtid_76038 *\n                                                           n_65378 +\n                                                           max_res_76086];\n                \n                int64_t abs_arg_76094 = sub64(x_76093, defunc_0_g_res_76055);\n                int64_t abs_res_76095 = abs64(abs_arg_76094);\n                bool x_76096 = sle64((int64_t) 0, min_res_76088);\n                bool y_76097 = slt64(min_res_76088, n_65378);\n                bool bounds_check_76098 = x_76096 && y_76097;\n                bool index_certs_76099;\n                \n                if (!bounds_check_76098) {\n                    {\n                        if (atomic_cmpxchg_i32_global(global_failure, -1, 37) ==\n                            -1) {\n                            global_failure_args[0] = (int64_t) min_res_76088;\n                            global_failure_args[1] = (int64_t) n_65378;\n                            ;\n                        }\n                        local_failure = true;\n                        goto error_0;\n                    }\n                }\n            ",
                   "    \n                int64_t x_76100;\n                \n                x_76100 = ((__global int64_t *) mem_77656)[gtid_76038 *\n                                                           n_65378 +\n                                                           min_res_76088];\n                \n                int64_t abs_arg_76101 = sub64(x_76100, defunc_0_g_res_76055);\n                int64_t abs_res_76102 = abs64(abs_arg_76101);\n                bool cond_76103 = max_res_76086 == l_idx_76082;\n                int64_t loopres_76104;\n                int64_t loopres_76105;\n                int64_t loopres_76106;\n                \n                if (cond_76103) {\n                    loopres_76104 = l_idx_76082;\n                    loopres_76105 = r_idx_76083;\n                    loopres_76106 = min_res_65398;\n                } else {\n                    bool cond_76107 = slt64(abs_res_76095, abs_res_76102);\n                    bool cond_f_res_76108 = min_res_76088 == r_idx_76083;\n                    bool x_76109 = !cond_76107;\n                    bool y_76110 = cond_f_res_76108 && x_76109;\n                    bool cond_76111 = cond_76107 || y_76110;\n                    int64_t loopres_f_res_76112;\n                    \n                    if (cond_76111) {\n                        loopres_f_res_76112 = max_res_76086;\n                    } else {\n                        loopres_f_res_76112 = l_idx_76082;\n                    }\n                    \n                    int64_t loopres_f_res_76113;\n                    \n                    if (cond_76111) {\n                        loopres_f_res_76113 = r_idx_76083;\n                    } else {\n                        loopres_f_res_76113 = min_res_76088;\n                    }\n                    \n                    int64_t loopres_f_res_76114;\n                    \n                    if (cond_76111) {\n                        int64_t loopres_f_res_t_res_76115 = add64((int64_t) 1,\n                                                         ",
                   "         span_76084);\n                        \n                        loopres_f_res_76114 = loopres_f_res_t_res_76115;\n                    } else {\n                        int64_t loopres_f_res_f_res_76116 = add64((int64_t) 1,\n                                                                  span_76084);\n                        \n                        loopres_f_res_76114 = loopres_f_res_f_res_76116;\n                    }\n                    loopres_76104 = loopres_f_res_76112;\n                    loopres_76105 = loopres_f_res_76113;\n                    loopres_76106 = loopres_f_res_76114;\n                }\n                \n                bool loop_cond_76117 = slt64(loopres_76106, min_res_65398);\n                bool loop_while_tmp_79260 = loop_cond_76117;\n                int64_t l_idx_tmp_79261 = loopres_76104;\n                int64_t r_idx_tmp_79262 = loopres_76105;\n                int64_t span_tmp_79263 = loopres_76106;\n                \n                loop_while_76081 = loop_while_tmp_79260;\n                l_idx_76082 = l_idx_tmp_79261;\n                r_idx_76083 = r_idx_tmp_79262;\n                span_76084 = span_tmp_79263;\n            }\n            idx_76077 = loop_while_76081;\n            idx_76078 = l_idx_76082;\n            idx_76079 = r_idx_76083;\n            idx_76080 = span_76084;\n            \n            int64_t min_res_76118 = smin64(min_arg_76050, idx_76078);\n            int64_t max_res_76119 = smax64((int64_t) 0, min_res_76118);\n            int64_t x_76120 = add64(min_res_76051, max_res_76119);\n            int64_t r_76121 = sub64(x_76120, (int64_t) 1);\n            bool x_76122 = sle64((int64_t) 0, r_76121);\n            bool y_76123 = slt64(r_76121, n_65378);\n            bool bounds_check_76124 = x_76122 && y_76123;\n            bool index_certs_76125;\n            \n            if (!bounds_check_76124) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 38) ==\n                        -1) {\n                     ",
                   "   global_failure_args[0] = (int64_t) r_76121;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    local_failure = true;\n                    goto error_0;\n                }\n            }\n            \n            int64_t x_76126;\n            \n            x_76126 = ((__global int64_t *) mem_77650)[gtid_76038 * n_65378 +\n                                                       r_76121];\n            \n            int64_t abs_arg_76127 = sub64(x_76126, min_res_76054);\n            int64_t abs_res_76128 = abs64(abs_arg_76127);\n            bool x_76129 = sle64((int64_t) 0, max_res_76119);\n            bool y_76130 = slt64(max_res_76119, n_65378);\n            bool bounds_check_76131 = x_76129 && y_76130;\n            bool index_certs_76132;\n            \n            if (!bounds_check_76131) {\n                {\n                    if (atomic_cmpxchg_i32_global(global_failure, -1, 39) ==\n                        -1) {\n                        global_failure_args[0] = (int64_t) max_res_76119;\n                        global_failure_args[1] = (int64_t) n_65378;\n                        ;\n                    }\n                    local_failure = true;\n                    goto error_0;\n                }\n            }\n            \n            int64_t x_76133;\n            \n            x_76133 = ((__global int64_t *) mem_77650)[gtid_76038 * n_65378 +\n                                                       max_res_76119];\n            \n            int64_t abs_arg_76134 = sub64(x_76133, min_res_76054);\n            int64_t abs_res_76135 = abs64(abs_arg_76134);\n            int64_t max_res_76136 = smax64(abs_res_76128, abs_res_76135);\n            double defunc_0_f_res_76137 = sitofp_i64_f64(max_res_76136);\n            double defunc_1_f_res_76138 = max_res_76052 + defunc_0_f_res_76137;\n            \n            pre_76044 = last_res_76048;\n            pre_76045 = min_res_76054;\n            pre_76046 = max_res_76119;\n    ",
                   "        pre_76047 = defunc_1_f_res_76138;\n        } else {\n            pre_76044 = (int64_t) 0;\n            pre_76045 = (int64_t) 0;\n            pre_76046 = (int64_t) 0;\n            pre_76047 = 0.0;\n        }\n        color_78230[(int64_t) 0] = pre_76044;\n        color_78229[(int64_t) 0] = pre_76045;\n        color_78228[(int64_t) 0] = pre_76046;\n        color_78227[(int64_t) 0] = pre_76047;\n    }\n    \n  error_0:\n    barrier(CLK_LOCAL_MEM_FENCE);\n    if (local_failure)\n        return;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t ltid_y_76155 = sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n    int64_t ltid_x_76153 = sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n    int32_t ltid_flat_76154 = local_tid_79243;\n    \n    if (slt64(ltid_y_76155, tile_sizze_76012) && slt64(ltid_x_76153,\n                                                       tile_sizze_76012)) {\n        color_78219[(int64_t) 0] = 0.0;\n        color_78218[(int64_t) 0] = 0.0;\n        color_78217[(int64_t) 0] = 0.0;\n        color_78216[(int64_t) 0] = 0.0;\n        color_78221[(int64_t) 0] = 0.0;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    double tmp_79264;\n    \n    tmp_79264 = color_78219[(int64_t) 0];\n    color_78220[(int64_t) 0] = tmp_79264;\n    \n    double tmp_79265;\n    \n    tmp_79265 = color_78218[(int64_t) 0];\n    color_78219[(int64_t) 0] = tmp_79265;\n    \n    double tmp_79266;\n    \n    tmp_79266 = color_78217[(int64_t) 0];\n    color_78218[(int64_t) 0] = tmp_79266;\n    \n    double tmp_79267;\n    \n    tmp_79267 = color_78216[(int64_t) 0];\n    color_78217[(int64_t) 0] = tmp_79267;\n    \n    double tmp_79268;\n    \n    tmp_79268 = color_78221[(int64_t) 0];\n    color_78216[(int64_t) 0] = tmp_79268;\n    \n    double ext_mem_77735[1];\n    double ext_mem_unused_78136[1];\n    double ext_mem_77734[1];\n    double ext_mem_unused_78141[1];\n    double ext_mem_77733[1];\n    double ext_mem_unused_78146[1];\n    double ext_mem_77732[1];\n    double ext_mem_unused_78151[1];\n    double ext_mem_77731[1];\n    double ext_mem_u",
                   "nused_78156[1];\n    double mem_param_77705[1];\n    double mem_param_77706[1];\n    double mem_param_77707[1];\n    double mem_param_77708[1];\n    double mem_param_77709[1];\n    double mem_param_out_78137[1];\n    double mem_param_out_78142[1];\n    double mem_param_out_78147[1];\n    double mem_param_out_78152[1];\n    double mem_param_out_78157[1];\n    \n    for (int32_t i_1 = 0; i_1 < 1; i_1++)\n        mem_param_77705[i_1] = color_78220[i_1];\n    for (int32_t i_2 = 0; i_2 < 1; i_2++)\n        mem_param_out_78137[i_2] = color_78225[i_2];\n    for (int32_t i_3 = 0; i_3 < 1; i_3++)\n        mem_param_77706[i_3] = color_78219[i_3];\n    for (int32_t i_4 = 0; i_4 < 1; i_4++)\n        mem_param_out_78142[i_4] = color_78224[i_4];\n    for (int32_t i_5 = 0; i_5 < 1; i_5++)\n        mem_param_77707[i_5] = color_78218[i_5];\n    for (int32_t i_6 = 0; i_6 < 1; i_6++)\n        mem_param_out_78147[i_6] = color_78223[i_6];\n    for (int32_t i_7 = 0; i_7 < 1; i_7++)\n        mem_param_77708[i_7] = color_78217[i_7];\n    for (int32_t i_8 = 0; i_8 < 1; i_8++)\n        mem_param_out_78152[i_8] = color_78222[i_8];\n    for (int32_t i_9 = 0; i_9 < 1; i_9++)\n        mem_param_77709[i_9] = color_78216[i_9];\n    for (int32_t i_10 = 0; i_10 < 1; i_10++)\n        mem_param_out_78157[i_10] = color_78221[i_10];\n    for (int64_t tile_id_76170 = 0; tile_id_76170 < num_whole_tiles_76147;\n         tile_id_76170++) {\n        int64_t binop_x_76315 = tile_sizze_76012 * tile_id_76170;\n        int64_t ltid_y_76312 = sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n        int64_t ltid_x_76310 = sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n        int32_t ltid_flat_76311 = local_tid_79243;\n        int64_t j_76316 = ltid_x_76310 + binop_x_76315;\n        int64_t gtid_76318 = binop_x_76037 + ltid_y_76312;\n        bool binop_x_76326 = slt64(j_76316, q_65380);\n        bool binop_y_76327 = slt64(gtid_76318, m_65377);\n        bool cond_76328 = binop_x_76326 && binop_y_76327;\n        double pre2d_76329;\n        \n        if (cond_76328)",
                   " {\n            double x_76330;\n            \n            x_76330 = ((__global double *) mem_77674)[gtid_76318 * q_65380 +\n                                                      j_76316];\n            pre2d_76329 = x_76330;\n        } else {\n            pre2d_76329 = 0.0;\n        }\n        ((__local double *) color_78226)[ltid_y_76312 * tile_sizze_76012 +\n                                         ltid_x_76310] = pre2d_76329;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int64_t ltid_y_76339 = sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n        int64_t ltid_x_76337 = sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n        int32_t ltid_flat_76338 = local_tid_79243;\n        int64_t gtid_76341 = binop_x_76037 + ltid_y_76339;\n        int64_t gtid_76343 = binop_x_76039 + ltid_x_76337;\n        double acc_76349;\n        \n        acc_76349 = mem_param_77705[(int64_t) 0];\n        \n        double acc_76350;\n        \n        acc_76350 = mem_param_77706[(int64_t) 0];\n        \n        double acc_76351;\n        \n        acc_76351 = mem_param_77707[(int64_t) 0];\n        \n        double acc_76352;\n        \n        acc_76352 = mem_param_77708[(int64_t) 0];\n        \n        double acc_76353;\n        \n        acc_76353 = mem_param_77709[(int64_t) 0];\n        \n        bool binop_x_76357 = slt64(gtid_76341, m_65377);\n        bool binop_y_76358 = slt64(gtid_76343, n_m_65386);\n        bool cond_76359 = binop_x_76357 && binop_y_76358;\n        double acc_76360;\n        double acc_76361;\n        double acc_76362;\n        double acc_76363;\n        double acc_76364;\n        \n        if (cond_76359) {\n            int64_t last_res_76344;\n            \n            last_res_76344 = color_78230[(int64_t) 0];\n            \n            int64_t min_res_76345;\n            \n            min_res_76345 = color_78229[(int64_t) 0];\n            \n            int64_t max_res_76346;\n            \n            max_res_76346 = color_78228[(int64_t) 0];\n            \n            double defunc_1_f_res_76347;\n            \n ",
                   "           defunc_1_f_res_76347 = color_78227[(int64_t) 0];\n            \n            double x_76365;\n            double x_76366;\n            double x_76367;\n            double x_76368;\n            double x_76369;\n            double redout_76941;\n            double redout_76942;\n            double redout_76943;\n            double redout_76944;\n            double redout_76945;\n            \n            redout_76941 = acc_76349;\n            redout_76942 = acc_76350;\n            redout_76943 = acc_76351;\n            redout_76944 = acc_76352;\n            redout_76945 = acc_76353;\n            for (int64_t i_76946 = 0; i_76946 < tile_sizze_76012; i_76946++) {\n                int64_t index_primexp_77009 = add64(binop_x_76315, i_76946);\n                double x_76386;\n                \n                x_76386 = ((__local double *) color_78226)[ltid_y_76339 *\n                                                           tile_sizze_76012 +\n                                                           i_76946];\n                \n                bool cond_76387 = sle64(last_res_76344, index_primexp_77009);\n                int64_t defunc_0_f_res_76388;\n                \n                if (cond_76387) {\n                    defunc_0_f_res_76388 = (int64_t) 0;\n                } else {\n                    int64_t i_76389 = add64(max_res_76346, index_primexp_77009);\n                    int64_t defunc_0_add_arg_76390;\n                    \n                    defunc_0_add_arg_76390 = ((__global\n                                               int64_t *) mem_77650)[gtid_76341 *\n                                                                     n_65378 +\n                                                                     i_76389];\n                    \n                    int64_t defunc_1_add_res_76391 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_76390);\n                    \n                    defunc_0_f_res_76388 = defunc_1_add_res_76391;\n     ",
                   "           }\n                \n                int64_t binop_p_76392 = sub64(defunc_0_f_res_76388,\n                                              min_res_76345);\n                double defunc_0_f_res_76393 = sitofp_i64_f64(binop_p_76392);\n                double abs_res_76394 = fabs(defunc_0_f_res_76393);\n                double tmp1_76395 = abs_res_76394 / defunc_1_f_res_76347;\n                double x_76396 = tmp1_76395 * tmp1_76395;\n                double y_76397 = tmp1_76395 * x_76396;\n                double tmp2_76398 = 1.0 - y_76397;\n                double x_76399 = tmp2_76398 * tmp2_76398;\n                double tmp3_76400 = tmp2_76398 * x_76399;\n                double w_j_76401 = x_76386 * tmp3_76400;\n                double xw_j_76402 = defunc_0_f_res_76393 * w_j_76401;\n                double x2w_j_76403 = defunc_0_f_res_76393 * xw_j_76402;\n                double x3w_j_76404 = defunc_0_f_res_76393 * x2w_j_76403;\n                double x4w_j_76405 = defunc_0_f_res_76393 * x3w_j_76404;\n                double defunc_1_op_res_76380 = w_j_76401 + redout_76941;\n                double defunc_1_op_res_76381 = xw_j_76402 + redout_76942;\n                double defunc_1_op_res_76382 = x2w_j_76403 + redout_76943;\n                double defunc_1_op_res_76383 = x3w_j_76404 + redout_76944;\n                double defunc_1_op_res_76384 = x4w_j_76405 + redout_76945;\n                double redout_tmp_79284 = defunc_1_op_res_76380;\n                double redout_tmp_79285 = defunc_1_op_res_76381;\n                double redout_tmp_79286 = defunc_1_op_res_76382;\n                double redout_tmp_79287 = defunc_1_op_res_76383;\n                double redout_tmp_79288 = defunc_1_op_res_76384;\n                \n                redout_76941 = redout_tmp_79284;\n                redout_76942 = redout_tmp_79285;\n                redout_76943 = redout_tmp_79286;\n                redout_76944 = redout_tmp_79287;\n                redout_76945 = redout_tmp_79288;\n            }\n            x_76365 = re",
                   "dout_76941;\n            x_76366 = redout_76942;\n            x_76367 = redout_76943;\n            x_76368 = redout_76944;\n            x_76369 = redout_76945;\n            acc_76360 = x_76365;\n            acc_76361 = x_76366;\n            acc_76362 = x_76367;\n            acc_76363 = x_76368;\n            acc_76364 = x_76369;\n        } else {\n            acc_76360 = acc_76349;\n            acc_76361 = acc_76350;\n            acc_76362 = acc_76351;\n            acc_76363 = acc_76352;\n            acc_76364 = acc_76353;\n        }\n        mem_param_out_78137[(int64_t) 0] = acc_76360;\n        mem_param_out_78142[(int64_t) 0] = acc_76361;\n        mem_param_out_78147[(int64_t) 0] = acc_76362;\n        mem_param_out_78152[(int64_t) 0] = acc_76363;\n        mem_param_out_78157[(int64_t) 0] = acc_76364;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        double mem_param_tmp_79269[1];\n        \n        for (int32_t i_11 = 0; i_11 < 1; i_11++)\n            mem_param_tmp_79269[i_11] = mem_param_out_78137[i_11];\n        \n        double mem_param_out_tmp_79270[1];\n        \n        for (int32_t i_12 = 0; i_12 < 1; i_12++)\n            mem_param_out_tmp_79270[i_12] = mem_param_77705[i_12];\n        \n        double mem_param_tmp_79271[1];\n        \n        for (int32_t i_13 = 0; i_13 < 1; i_13++)\n            mem_param_tmp_79271[i_13] = mem_param_out_78142[i_13];\n        \n        double mem_param_out_tmp_79272[1];\n        \n        for (int32_t i_14 = 0; i_14 < 1; i_14++)\n            mem_param_out_tmp_79272[i_14] = mem_param_77706[i_14];\n        \n        double mem_param_tmp_79273[1];\n        \n        for (int32_t i_15 = 0; i_15 < 1; i_15++)\n            mem_param_tmp_79273[i_15] = mem_param_out_78147[i_15];\n        \n        double mem_param_out_tmp_79274[1];\n        \n        for (int32_t i_16 = 0; i_16 < 1; i_16++)\n            mem_param_out_tmp_79274[i_16] = mem_param_77707[i_16];\n        \n        double mem_param_tmp_79275[1];\n        \n        for (int32_t i_17 = 0; i_17 < 1; i_17++)\n            m",
                   "em_param_tmp_79275[i_17] = mem_param_out_78152[i_17];\n        \n        double mem_param_out_tmp_79276[1];\n        \n        for (int32_t i_18 = 0; i_18 < 1; i_18++)\n            mem_param_out_tmp_79276[i_18] = mem_param_77708[i_18];\n        \n        double mem_param_tmp_79277[1];\n        \n        for (int32_t i_19 = 0; i_19 < 1; i_19++)\n            mem_param_tmp_79277[i_19] = mem_param_out_78157[i_19];\n        \n        double mem_param_out_tmp_79278[1];\n        \n        for (int32_t i_20 = 0; i_20 < 1; i_20++)\n            mem_param_out_tmp_79278[i_20] = mem_param_77709[i_20];\n        for (int32_t i_21 = 0; i_21 < 1; i_21++)\n            mem_param_77705[i_21] = mem_param_tmp_79269[i_21];\n        for (int32_t i_22 = 0; i_22 < 1; i_22++)\n            mem_param_out_78137[i_22] = mem_param_out_tmp_79270[i_22];\n        for (int32_t i_23 = 0; i_23 < 1; i_23++)\n            mem_param_77706[i_23] = mem_param_tmp_79271[i_23];\n        for (int32_t i_24 = 0; i_24 < 1; i_24++)\n            mem_param_out_78142[i_24] = mem_param_out_tmp_79272[i_24];\n        for (int32_t i_25 = 0; i_25 < 1; i_25++)\n            mem_param_77707[i_25] = mem_param_tmp_79273[i_25];\n        for (int32_t i_26 = 0; i_26 < 1; i_26++)\n            mem_param_out_78147[i_26] = mem_param_out_tmp_79274[i_26];\n        for (int32_t i_27 = 0; i_27 < 1; i_27++)\n            mem_param_77708[i_27] = mem_param_tmp_79275[i_27];\n        for (int32_t i_28 = 0; i_28 < 1; i_28++)\n            mem_param_out_78152[i_28] = mem_param_out_tmp_79276[i_28];\n        for (int32_t i_29 = 0; i_29 < 1; i_29++)\n            mem_param_77709[i_29] = mem_param_tmp_79277[i_29];\n        for (int32_t i_30 = 0; i_30 < 1; i_30++)\n            mem_param_out_78157[i_30] = mem_param_out_tmp_79278[i_30];\n    }\n    for (int32_t i_31 = 0; i_31 < 1; i_31++)\n        ext_mem_77735[i_31] = mem_param_77705[i_31];\n    for (int32_t i_32 = 0; i_32 < 1; i_32++)\n        ext_mem_unused_78136[i_32] = mem_param_out_78137[i_32];\n    for (int32_t i_33 = 0; i_33 < 1; i_33++)\n ",
                   "       ext_mem_77734[i_33] = mem_param_77706[i_33];\n    for (int32_t i_34 = 0; i_34 < 1; i_34++)\n        ext_mem_unused_78141[i_34] = mem_param_out_78142[i_34];\n    for (int32_t i_35 = 0; i_35 < 1; i_35++)\n        ext_mem_77733[i_35] = mem_param_77707[i_35];\n    for (int32_t i_36 = 0; i_36 < 1; i_36++)\n        ext_mem_unused_78146[i_36] = mem_param_out_78147[i_36];\n    for (int32_t i_37 = 0; i_37 < 1; i_37++)\n        ext_mem_77732[i_37] = mem_param_77708[i_37];\n    for (int32_t i_38 = 0; i_38 < 1; i_38++)\n        ext_mem_unused_78151[i_38] = mem_param_out_78152[i_38];\n    for (int32_t i_39 = 0; i_39 < 1; i_39++)\n        ext_mem_77731[i_39] = mem_param_77709[i_39];\n    for (int32_t i_40 = 0; i_40 < 1; i_40++)\n        ext_mem_unused_78156[i_40] = mem_param_out_78157[i_40];\n    if (cond_76448) {\n        double tmp_79289;\n        \n        tmp_79289 = ext_mem_77735[(int64_t) 0];\n        color_78216[(int64_t) 0] = tmp_79289;\n        \n        double tmp_79290;\n        \n        tmp_79290 = ext_mem_77734[(int64_t) 0];\n        color_78217[(int64_t) 0] = tmp_79290;\n        \n        double tmp_79291;\n        \n        tmp_79291 = ext_mem_77733[(int64_t) 0];\n        color_78218[(int64_t) 0] = tmp_79291;\n        \n        double tmp_79292;\n        \n        tmp_79292 = ext_mem_77732[(int64_t) 0];\n        color_78219[(int64_t) 0] = tmp_79292;\n        \n        double tmp_79293;\n        \n        tmp_79293 = ext_mem_77731[(int64_t) 0];\n        color_78220[(int64_t) 0] = tmp_79293;\n    } else {\n        int64_t binop_x_76594 = tile_sizze_76012 * num_whole_tiles_76147;\n        int64_t ltid_y_76591 = sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n        int64_t ltid_x_76589 = sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n        int32_t ltid_flat_76590 = local_tid_79243;\n        int64_t j_76595 = ltid_x_76589 + binop_x_76594;\n        int64_t gtid_76597 = binop_x_76037 + ltid_y_76591;\n        bool binop_x_76605 = slt64(j_76595, q_65380);\n        bool binop_y_76606 = slt64(gtid_76597, m_65377);\n ",
                   "       bool cond_76607 = binop_x_76605 && binop_y_76606;\n        double pre2d_76608;\n        \n        if (cond_76607) {\n            double x_76609;\n            \n            x_76609 = ((__global double *) mem_77674)[gtid_76597 * q_65380 +\n                                                      j_76595];\n            pre2d_76608 = x_76609;\n        } else {\n            pre2d_76608 = 0.0;\n        }\n        ((__local double *) color_78226)[ltid_y_76591 * tile_sizze_76012 +\n                                         ltid_x_76589] = pre2d_76608;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int64_t ltid_y_76619 = sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n        int64_t ltid_x_76617 = sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n        int32_t ltid_flat_76618 = local_tid_79243;\n        int64_t gtid_76621 = binop_x_76037 + ltid_y_76619;\n        int64_t gtid_76623 = binop_x_76039 + ltid_x_76617;\n        double acc_76629;\n        \n        acc_76629 = ext_mem_77735[(int64_t) 0];\n        \n        double acc_76630;\n        \n        acc_76630 = ext_mem_77734[(int64_t) 0];\n        \n        double acc_76631;\n        \n        acc_76631 = ext_mem_77733[(int64_t) 0];\n        \n        double acc_76632;\n        \n        acc_76632 = ext_mem_77732[(int64_t) 0];\n        \n        double acc_76633;\n        \n        acc_76633 = ext_mem_77731[(int64_t) 0];\n        \n        bool binop_x_76637 = slt64(gtid_76621, m_65377);\n        bool binop_y_76638 = slt64(gtid_76623, n_m_65386);\n        bool cond_76639 = binop_x_76637 && binop_y_76638;\n        double acc_76640;\n        double acc_76641;\n        double acc_76642;\n        double acc_76643;\n        double acc_76644;\n        \n        if (cond_76639) {\n            int64_t last_res_76624;\n            \n            last_res_76624 = color_78230[(int64_t) 0];\n            \n            int64_t min_res_76625;\n            \n            min_res_76625 = color_78229[(int64_t) 0];\n            \n            int64_t max_res_76626;\n            \n            max",
                   "_res_76626 = color_78228[(int64_t) 0];\n            \n            double defunc_1_f_res_76627;\n            \n            defunc_1_f_res_76627 = color_78227[(int64_t) 0];\n            \n            double x_76645;\n            double x_76646;\n            double x_76647;\n            double x_76648;\n            double x_76649;\n            double redout_76947;\n            double redout_76948;\n            double redout_76949;\n            double redout_76950;\n            double redout_76951;\n            \n            redout_76947 = acc_76629;\n            redout_76948 = acc_76630;\n            redout_76949 = acc_76631;\n            redout_76950 = acc_76632;\n            redout_76951 = acc_76633;\n            for (int64_t i_76952 = 0; i_76952 < residual_input_76447;\n                 i_76952++) {\n                int64_t index_primexp_77007 = add64(binop_x_76594, i_76952);\n                double x_76666;\n                \n                x_76666 = ((__local double *) color_78226)[ltid_y_76619 *\n                                                           tile_sizze_76012 +\n                                                           i_76952];\n                \n                bool cond_76667 = sle64(last_res_76624, index_primexp_77007);\n                int64_t defunc_0_f_res_76668;\n                \n                if (cond_76667) {\n                    defunc_0_f_res_76668 = (int64_t) 0;\n                } else {\n                    int64_t i_76669 = add64(max_res_76626, index_primexp_77007);\n                    int64_t defunc_0_add_arg_76670;\n                    \n                    defunc_0_add_arg_76670 = ((__global\n                                               int64_t *) mem_77650)[gtid_76621 *\n                                                                     n_65378 +\n                                                                     i_76669];\n                    \n                    int64_t defunc_1_add_res_76671 = add64((int64_t) 1,\n                                                 ",
                   "          defunc_0_add_arg_76670);\n                    \n                    defunc_0_f_res_76668 = defunc_1_add_res_76671;\n                }\n                \n                int64_t binop_p_76672 = sub64(defunc_0_f_res_76668,\n                                              min_res_76625);\n                double defunc_0_f_res_76673 = sitofp_i64_f64(binop_p_76672);\n                double abs_res_76674 = fabs(defunc_0_f_res_76673);\n                double tmp1_76675 = abs_res_76674 / defunc_1_f_res_76627;\n                double x_76676 = tmp1_76675 * tmp1_76675;\n                double y_76677 = tmp1_76675 * x_76676;\n                double tmp2_76678 = 1.0 - y_76677;\n                double x_76679 = tmp2_76678 * tmp2_76678;\n                double tmp3_76680 = tmp2_76678 * x_76679;\n                double w_j_76681 = x_76666 * tmp3_76680;\n                double xw_j_76682 = defunc_0_f_res_76673 * w_j_76681;\n                double x2w_j_76683 = defunc_0_f_res_76673 * xw_j_76682;\n                double x3w_j_76684 = defunc_0_f_res_76673 * x2w_j_76683;\n                double x4w_j_76685 = defunc_0_f_res_76673 * x3w_j_76684;\n                double defunc_1_op_res_76660 = w_j_76681 + redout_76947;\n                double defunc_1_op_res_76661 = xw_j_76682 + redout_76948;\n                double defunc_1_op_res_76662 = x2w_j_76683 + redout_76949;\n                double defunc_1_op_res_76663 = x3w_j_76684 + redout_76950;\n                double defunc_1_op_res_76664 = x4w_j_76685 + redout_76951;\n                double redout_tmp_79294 = defunc_1_op_res_76660;\n                double redout_tmp_79295 = defunc_1_op_res_76661;\n                double redout_tmp_79296 = defunc_1_op_res_76662;\n                double redout_tmp_79297 = defunc_1_op_res_76663;\n                double redout_tmp_79298 = defunc_1_op_res_76664;\n                \n                redout_76947 = redout_tmp_79294;\n                redout_76948 = redout_tmp_79295;\n                redout_76949 = redout_tmp_79296;\n        ",
                   "        redout_76950 = redout_tmp_79297;\n                redout_76951 = redout_tmp_79298;\n            }\n            x_76645 = redout_76947;\n            x_76646 = redout_76948;\n            x_76647 = redout_76949;\n            x_76648 = redout_76950;\n            x_76649 = redout_76951;\n            acc_76640 = x_76645;\n            acc_76641 = x_76646;\n            acc_76642 = x_76647;\n            acc_76643 = x_76648;\n            acc_76644 = x_76649;\n        } else {\n            acc_76640 = acc_76629;\n            acc_76641 = acc_76630;\n            acc_76642 = acc_76631;\n            acc_76643 = acc_76632;\n            acc_76644 = acc_76633;\n        }\n        color_78225[(int64_t) 0] = acc_76640;\n        color_78224[(int64_t) 0] = acc_76641;\n        color_78223[(int64_t) 0] = acc_76642;\n        color_78222[(int64_t) 0] = acc_76643;\n        color_78221[(int64_t) 0] = acc_76644;\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        double tmp_79299;\n        \n        tmp_79299 = color_78225[(int64_t) 0];\n        color_78216[(int64_t) 0] = tmp_79299;\n        \n        double tmp_79300;\n        \n        tmp_79300 = color_78224[(int64_t) 0];\n        color_78217[(int64_t) 0] = tmp_79300;\n        \n        double tmp_79301;\n        \n        tmp_79301 = color_78223[(int64_t) 0];\n        color_78218[(int64_t) 0] = tmp_79301;\n        \n        double tmp_79302;\n        \n        tmp_79302 = color_78222[(int64_t) 0];\n        color_78219[(int64_t) 0] = tmp_79302;\n        \n        double tmp_79303;\n        \n        tmp_79303 = color_78221[(int64_t) 0];\n        color_78220[(int64_t) 0] = tmp_79303;\n    }\n    \n    int64_t ltid_y_76705 = sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n    int64_t ltid_x_76703 = sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n    int32_t ltid_flat_76704 = local_tid_79243;\n    \n    if (slt64(ltid_y_76705, tile_sizze_76012) && slt64(ltid_x_76703,\n                                                       tile_sizze_76012)) {\n        int64_t gtid_76707 = binop_x_76037 + ltid_y",
                   "_76705;\n        int64_t gtid_76709 = binop_x_76039 + ltid_x_76703;\n        bool binop_x_76715 = slt64(gtid_76707, m_65377);\n        bool binop_y_76716 = slt64(gtid_76709, n_m_65386);\n        bool cond_76717 = binop_x_76715 && binop_y_76716;\n        double postlude_76718;\n        double postlude_76719;\n        \n        if (cond_76717) {\n            double defunc_2_reduce_res_76710;\n            \n            defunc_2_reduce_res_76710 = color_78216[(int64_t) 0];\n            \n            double defunc_2_reduce_res_76711;\n            \n            defunc_2_reduce_res_76711 = color_78217[(int64_t) 0];\n            \n            double defunc_2_reduce_res_76712;\n            \n            defunc_2_reduce_res_76712 = color_78218[(int64_t) 0];\n            \n            double defunc_2_reduce_res_76713;\n            \n            defunc_2_reduce_res_76713 = color_78219[(int64_t) 0];\n            \n            double defunc_2_reduce_res_76714;\n            \n            defunc_2_reduce_res_76714 = color_78220[(int64_t) 0];\n            \n            int64_t last_res_76720;\n            \n            last_res_76720 = color_78230[(int64_t) 0];\n            \n            int64_t min_res_76721;\n            \n            min_res_76721 = color_78229[(int64_t) 0];\n            \n            int64_t max_res_76722;\n            \n            max_res_76722 = color_78228[(int64_t) 0];\n            \n            double defunc_1_f_res_76723;\n            \n            defunc_1_f_res_76723 = color_78227[(int64_t) 0];\n            \n            double x_76725 = defunc_2_reduce_res_76712 *\n                   defunc_2_reduce_res_76714;\n            double y_76726 = defunc_2_reduce_res_76713 *\n                   defunc_2_reduce_res_76713;\n            double a12_76727 = x_76725 - y_76726;\n            double x_76728 = defunc_2_reduce_res_76712 *\n                   defunc_2_reduce_res_76713;\n            double y_76729 = defunc_2_reduce_res_76711 *\n                   defunc_2_reduce_res_76714;\n            double b12_76730 = x_76",
                   "728 - y_76729;\n            double x_76731 = defunc_2_reduce_res_76711 *\n                   defunc_2_reduce_res_76713;\n            double y_76732 = defunc_2_reduce_res_76712 *\n                   defunc_2_reduce_res_76712;\n            double c12_76733 = x_76731 - y_76732;\n            double x_76734 = defunc_2_reduce_res_76710 *\n                   defunc_2_reduce_res_76714;\n            double b2_76735 = x_76734 - y_76732;\n            double x_76736 = defunc_2_reduce_res_76711 *\n                   defunc_2_reduce_res_76712;\n            double y_76737 = defunc_2_reduce_res_76710 *\n                   defunc_2_reduce_res_76713;\n            double c2_76738 = x_76736 - y_76737;\n            double x_76739 = defunc_2_reduce_res_76710 * a12_76727;\n            double y_76740 = defunc_2_reduce_res_76711 * b12_76730;\n            double x_76741 = x_76739 + y_76740;\n            double y_76742 = defunc_2_reduce_res_76712 * c12_76733;\n            double y_76743 = x_76741 + y_76742;\n            double det_76744 = 1.0 / y_76743;\n            double a12_76745 = a12_76727 * det_76744;\n            double b12_76746 = b12_76730 * det_76744;\n            double c12_76747 = c12_76733 * det_76744;\n            double b2_76748 = b2_76735 * det_76744;\n            double c2_76749 = c2_76738 * det_76744;\n            double defunc_2_reduce_res_76750;\n            double defunc_2_reduce_res_76751;\n            double redout_76953;\n            double redout_76954;\n            \n            redout_76953 = 0.0;\n            redout_76954 = 0.0;\n            for (int64_t i_76955 = 0; i_76955 < q_65380; i_76955++) {\n                double x_76759;\n                \n                x_76759 = ((__global double *) mem_77674)[gtid_76707 * q_65380 +\n                                                          i_76955];\n                \n                bool cond_76760 = sle64(last_res_76720, i_76955);\n                int64_t defunc_0_f_res_76761;\n                \n                if (cond_76760) {\n                    defunc_",
                   "0_f_res_76761 = (int64_t) 0;\n                } else {\n                    int64_t i_76762 = add64(max_res_76722, i_76955);\n                    int64_t defunc_0_add_arg_76763;\n                    \n                    defunc_0_add_arg_76763 = ((__global\n                                               int64_t *) mem_77650)[gtid_76707 *\n                                                                     n_65378 +\n                                                                     i_76762];\n                    \n                    int64_t defunc_1_add_res_76764 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_76763);\n                    \n                    defunc_0_f_res_76761 = defunc_1_add_res_76764;\n                }\n                \n                int64_t binop_p_76765 = sub64(defunc_0_f_res_76761,\n                                              min_res_76721);\n                double defunc_0_f_res_76766 = sitofp_i64_f64(binop_p_76765);\n                double abs_res_76767 = fabs(defunc_0_f_res_76766);\n                double tmp1_76768 = abs_res_76767 / defunc_1_f_res_76723;\n                double x_76769 = tmp1_76768 * tmp1_76768;\n                double y_76770 = tmp1_76768 * x_76769;\n                double tmp2_76771 = 1.0 - y_76770;\n                double x_76772 = tmp2_76771 * tmp2_76771;\n                double tmp3_76773 = tmp2_76771 * x_76772;\n                double tmp4_76774 = x_76759 * tmp3_76773;\n                double defunc_1_f_res_76775 = defunc_0_f_res_76766 * tmp4_76774;\n                double defunc_1_f_res_76776 = defunc_0_f_res_76766 *\n                       defunc_1_f_res_76775;\n                double defunc_0_f_res_76777;\n                \n                if (cond_76760) {\n                    defunc_0_f_res_76777 = 0.0;\n                } else {\n                    int64_t i_76778 = add64(max_res_76722, i_76955);\n                    double defunc_0_add_arg_76779;\n                    \n                 ",
                   "   defunc_0_add_arg_76779 = ((__global\n                                               double *) mem_77646)[gtid_76707 *\n                                                                    n_65378 +\n                                                                    i_76778];\n                    defunc_0_f_res_76777 = defunc_0_add_arg_76779;\n                }\n                \n                double x_76780 = a12_76745 * tmp4_76774;\n                double y_76781 = b12_76746 * defunc_1_f_res_76775;\n                double x_76782 = x_76780 + y_76781;\n                double y_76783 = c12_76747 * defunc_1_f_res_76776;\n                double x_76784 = x_76782 + y_76783;\n                double defunc_9_fit_fun_res_76785 = defunc_0_f_res_76777 *\n                       x_76784;\n                double x_76786 = b12_76746 * tmp4_76774;\n                double y_76787 = b2_76748 * defunc_1_f_res_76775;\n                double x_76788 = x_76786 + y_76787;\n                double y_76789 = c2_76749 * defunc_1_f_res_76776;\n                double x_76790 = x_76788 + y_76789;\n                double defunc_9_slope_fun_res_76791 = defunc_0_f_res_76777 *\n                       x_76790;\n                double defunc_1_op_res_76754 = defunc_9_fit_fun_res_76785 +\n                       redout_76953;\n                double defunc_1_op_res_76757 = defunc_9_slope_fun_res_76791 +\n                       redout_76954;\n                double redout_tmp_79304 = defunc_1_op_res_76754;\n                double redout_tmp_79305 = defunc_1_op_res_76757;\n                \n                redout_76953 = redout_tmp_79304;\n                redout_76954 = redout_tmp_79305;\n            }\n            defunc_2_reduce_res_76750 = redout_76953;\n            defunc_2_reduce_res_76751 = redout_76954;\n            postlude_76718 = defunc_2_reduce_res_76750;\n            postlude_76719 = defunc_2_reduce_res_76751;\n        } else {\n            postlude_76718 = 0.0;\n            postlude_76719 = 0.0;\n        }\n        color_78",
                   "222[(int64_t) 0] = postlude_76718;\n        color_78221[(int64_t) 0] = postlude_76719;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t thread_out_index_79306 = gid_x_76009 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n    int64_t thread_out_index_79307 = gid_y_76010 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n    \n    if (slt64(thread_out_index_79306, m_65377) && slt64(thread_out_index_79307,\n                                                        n_m_65386)) {\n        double tmp_79308;\n        \n        tmp_79308 = color_78222[(int64_t) 0];\n        ((__global double *) mem_77772)[thread_out_index_79306 * n_m_65386 +\n                                        thread_out_index_79307] = tmp_79308;\n    }\n    \n    int64_t thread_out_index_79309 = gid_x_76009 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79247));\n    int64_t thread_out_index_79310 = gid_y_76010 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79248));\n    \n    if (slt64(thread_out_index_79309, m_65377) && slt64(thread_out_index_79310,\n                                                        n_m_65386)) {\n        double tmp_79311;\n        \n        tmp_79311 = color_78221[(int64_t) 0];\n        ((__global double *) mem_77776)[thread_out_index_79309 * n_m_65386 +\n                                        thread_out_index_79310] = tmp_79311;\n    }\n    \n  error_7:\n    return;\n    #undef tile_sizze_76012\n}\n__kernel void mainzisegred_large_68263(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *sync_arr_mem_78568_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78566_backing_aligned_1,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n         ",
                   "                              int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_68257,\n                                       int64_t groups_per_segment_78552,\n                                       int64_t elements_per_thread_78553,\n                                       int64_t virt_num_groups_78554,\n                                       int64_t threads_per_segment_78556,\n                                       __global unsigned char *mem_77116,\n                                       __global unsigned char *mem_77124,\n                                       __global unsigned char *mem_77148,\n                                       __global unsigned char *mem_77204,\n                                       __global unsigned char *mem_77208,\n                                       __global unsigned char *mem_77213,\n                                       __global\n                                       unsigned char *segred_tmp_mem_78557,\n                                       __global\n                                       unsigned char *mainzicounter_mem_78559)\n{\n    #define segred_group_sizze_68256 (mainzisegred_group_sizze_67336)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict sync_arr_mem_78568_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) sync_arr_mem_78568_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_78566_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78566_backing_aligned_1;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78561;\n    int32_t local_tid_78562;\n    int64_t group_sizze_78565;\n    int32_t wave_sizze_78564;\n    int32_t group_tid_78563;\n    \n    global_tid_78561 = get_global_id(0);\n    local_tid_78562 = get_l",
                   "ocal_id(0);\n    group_sizze_78565 = get_local_size(0);\n    wave_sizze_78564 = LOCKSTEP_WIDTH;\n    group_tid_78563 = get_group_id(0);\n    \n    int32_t phys_tid_68263 = global_tid_78561;\n    __local unsigned char *red_arr_mem_78566;\n    \n    red_arr_mem_78566 = (__local unsigned char *) red_arr_mem_78566_backing_0;\n    \n    __local unsigned char *sync_arr_mem_78568;\n    \n    sync_arr_mem_78568 = (__local unsigned char *) sync_arr_mem_78568_backing_1;\n    \n    int32_t phys_group_id_78570;\n    \n    phys_group_id_78570 = get_group_id(0);\n    for (int32_t i_78571 = 0; i_78571 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_78554) - phys_group_id_78570,\n                   sext_i64_i32(num_groups_68257)); i_78571++) {\n        int32_t virt_group_id_78572 = phys_group_id_78570 + i_78571 *\n                sext_i64_i32(num_groups_68257);\n        int32_t flat_segment_id_78573 = squot32(virt_group_id_78572,\n                                                sext_i64_i32(groups_per_segment_78552));\n        int64_t global_tid_78574 = srem64(sext_i32_i64(virt_group_id_78572) *\n                                          segred_group_sizze_68256 +\n                                          sext_i32_i64(local_tid_78562),\n                                          segred_group_sizze_68256 *\n                                          groups_per_segment_78552);\n        int64_t slice_78575 = n_m_65386;\n        int64_t slice_78576 = m_65377 * slice_78575;\n        int64_t gtid_68260 = squot64(sext_i32_i64(flat_segment_id_78573),\n                                     slice_78575);\n        int64_t remnant_78577 = sext_i32_i64(flat_segment_id_78573) -\n                gtid_68260 * slice_78575;\n        int64_t gtid_68261 = remnant_78577;\n        int64_t remnant_78578 = remnant_78577 - gtid_68261;\n        int64_t gtid_68262;\n        double x_acc_78579;\n        int64_t chunk_sizze_78580 = smin64(elements_per_thread_78553,\n                                           sdiv_up64(q_65380 - global_tid_78574,\n  ",
                   "                                                   threads_per_segment_78556));\n        double x_68264;\n        double x_68265;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_78579 = 0.0;\n        }\n        for (int64_t i_78584 = 0; i_78584 < chunk_sizze_78580; i_78584++) {\n            gtid_68262 = global_tid_78574 + threads_per_segment_78556 * i_78584;\n            // apply map function\n            {\n                int64_t last_res_68267;\n                \n                last_res_68267 = ((__global int64_t *) mem_77116)[gtid_68260 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74714 = mul64(jump_65382, gtid_68261);\n                int64_t index_primexp_74715 = smin64(i_65392, binop_y_74714);\n                double defunc_1_f_res_68275;\n                \n                defunc_1_f_res_68275 = ((__global\n                                         double *) mem_77208)[gtid_68260 *\n                                                              n_m_65386 +\n                                                              gtid_68261];\n                \n                double x_68277;\n                \n                x_68277 = ((__global double *) mem_77148)[gtid_68260 * q_65380 +\n                                                          gtid_68262];\n                \n                bool cond_68278 = sle64(last_res_68267, gtid_68262);\n                int64_t defunc_0_f_res_68279;\n                \n                if (cond_68278) {\n                    defunc_0_f_res_68279 = (int64_t) 0;\n                } else {\n                    int64_t max_res_68274;\n                    \n                    max_res_68274 = ((__global\n                                      int64_t *) mem_77204)[gtid_68260 *\n                                                            n_m_65386 +\n                                ",
                   "                            gtid_68261];\n                    \n                    int64_t i_68280 = add64(gtid_68262, max_res_68274);\n                    int64_t defunc_0_add_arg_68281;\n                    \n                    defunc_0_add_arg_68281 = ((__global\n                                               int64_t *) mem_77124)[gtid_68260 *\n                                                                     n_65378 +\n                                                                     i_68280];\n                    \n                    int64_t defunc_1_add_res_68282 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_68281);\n                    \n                    defunc_0_f_res_68279 = defunc_1_add_res_68282;\n                }\n                \n                int64_t binop_p_68283 = sub64(defunc_0_f_res_68279,\n                                              index_primexp_74715);\n                double defunc_0_f_res_68284 = sitofp_i64_f64(binop_p_68283);\n                double abs_res_68285 = fabs(defunc_0_f_res_68284);\n                double tmp1_68286 = abs_res_68285 / defunc_1_f_res_68275;\n                double x_68287 = tmp1_68286 * tmp1_68286;\n                double y_68288 = tmp1_68286 * x_68287;\n                double tmp2_68289 = 1.0 - y_68288;\n                double x_68290 = tmp2_68289 * tmp2_68289;\n                double tmp3_68291 = tmp2_68289 * x_68290;\n                double w_j_68292 = x_68277 * tmp3_68291;\n                \n                // save map-out results\n                { }\n                // load accumulator\n                {\n                    x_68264 = x_acc_78579;\n                }\n                // load new values\n                {\n                    x_68265 = w_j_68292;\n                }\n                // apply reduction operator\n                {\n                    double defunc_1_op_res_68266 = x_68264 + x_68265;\n                    \n                    // store in accumulator\n     ",
                   "               {\n                        x_acc_78579 = defunc_1_op_res_68266;\n                    }\n                }\n            }\n        }\n        // to reduce current chunk, first store our result in memory\n        {\n            x_68264 = x_acc_78579;\n            ((__local\n              double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562)] =\n                x_68264;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_78585;\n        int32_t skip_waves_78586 = 1;\n        double x_78581;\n        double x_78582;\n        \n        offset_78585 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_78562,\n                      sext_i64_i32(segred_group_sizze_68256))) {\n                x_78581 = ((__local\n                            double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562 +\n                                                         offset_78585)];\n            }\n        }\n        offset_78585 = 1;\n        while (slt32(offset_78585, wave_sizze_78564)) {\n            if (slt32(local_tid_78562 + offset_78585,\n                      sext_i64_i32(segred_group_sizze_68256)) &&\n                ((local_tid_78562 - squot32(local_tid_78562, wave_sizze_78564) *\n                  wave_sizze_78564) & (2 * offset_78585 - 1)) == 0) {\n                // read array element\n                {\n                    x_78582 = ((volatile __local\n                                double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562 +\n                                                             offset_78585)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78583 = x_78581 + x_78582;\n                    \n                    x_78581 = defunc_1_op_res_78583;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_78566",
                   ")[sext_i32_i64(local_tid_78562)] =\n                        x_78581;\n                }\n            }\n            offset_78585 *= 2;\n        }\n        while (slt32(skip_waves_78586,\n                     squot32(sext_i64_i32(segred_group_sizze_68256) +\n                             wave_sizze_78564 - 1, wave_sizze_78564))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_78585 = skip_waves_78586 * wave_sizze_78564;\n            if (slt32(local_tid_78562 + offset_78585,\n                      sext_i64_i32(segred_group_sizze_68256)) &&\n                ((local_tid_78562 - squot32(local_tid_78562, wave_sizze_78564) *\n                  wave_sizze_78564) == 0 && (squot32(local_tid_78562,\n                                                     wave_sizze_78564) & (2 *\n                                                                          skip_waves_78586 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_78582 = ((__local\n                                double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562 +\n                                                             offset_78585)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78583 = x_78581 + x_78582;\n                    \n                    x_78581 = defunc_1_op_res_78583;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562)] =\n                        x_78581;\n                }\n            }\n            skip_waves_78586 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_78562) == (int64_t) 0) {\n                x_acc_78579 = x_78581;\n            }\n        }\n",
                   "        if (groups_per_segment_78552 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_78562 == 0) {\n                    ((__global double *) mem_77213)[gtid_68260 * n_m_65386 +\n                                                    gtid_68261] = x_acc_78579;\n                }\n            }\n        } else {\n            int32_t old_counter_78587;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_78562 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_78557)[sext_i32_i64(virt_group_id_78572)] =\n                        x_acc_78579;\n                    mem_fence_global();\n                    old_counter_78587 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78559)[sext_i32_i64(srem32(flat_segment_id_78573,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_78568)[(int64_t) 0] =\n                        old_counter_78587 == groups_per_segment_78552 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_78588;\n            \n            is_last_group_78588 = ((__local\n                                    bool *) sync_arr_mem_78568)[(int64_t) 0];\n            if (is_last_group_78588) {\n                if (local_tid_78562 == 0) {\n                    old_counter_78587 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78559)[sext_i32_i64(srem32(flat_segment_id_78573,\n                                                         ",
                   "                                            10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_78552));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_78589 =\n                            sdiv_up64(groups_per_segment_78552,\n                                      segred_group_sizze_68256);\n                    \n                    x_68264 = 0.0;\n                    for (int64_t i_78590 = 0; i_78590 < read_per_thread_78589;\n                         i_78590++) {\n                        int64_t group_res_id_78591 =\n                                sext_i32_i64(local_tid_78562) *\n                                read_per_thread_78589 + i_78590;\n                        int64_t index_of_group_res_78592 =\n                                sext_i32_i64(flat_segment_id_78573) *\n                                groups_per_segment_78552 + group_res_id_78591;\n                        \n                        if (slt64(group_res_id_78591,\n                                  groups_per_segment_78552)) {\n                            x_68265 = ((__global\n                                        double *) segred_tmp_mem_78557)[index_of_group_res_78592];\n                            \n                            double defunc_1_op_res_68266 = x_68264 + x_68265;\n                            \n                            x_68264 = defunc_1_op_res_68266;\n                        }\n                    }\n                }\n                ((__local\n                  double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562)] =\n                    x_68264;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_78593;\n                    int32_t skip_waves_78594 = 1;\n                    double x_78581;\n                    double x_78582;\n     ",
                   "               \n                    offset_78593 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_78562,\n                                  sext_i64_i32(segred_group_sizze_68256))) {\n                            x_78581 = ((__local\n                                        double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562 +\n                                                                     offset_78593)];\n                        }\n                    }\n                    offset_78593 = 1;\n                    while (slt32(offset_78593, wave_sizze_78564)) {\n                        if (slt32(local_tid_78562 + offset_78593,\n                                  sext_i64_i32(segred_group_sizze_68256)) &&\n                            ((local_tid_78562 - squot32(local_tid_78562,\n                                                        wave_sizze_78564) *\n                              wave_sizze_78564) & (2 * offset_78593 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_78582 = ((volatile __local\n                                            double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562 +\n                                                                         offset_78593)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78583 = x_78581 +\n                                       x_78582;\n                                \n                                x_78581 = defunc_1_op_res_78583;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562)] =\n   ",
                   "                                 x_78581;\n                            }\n                        }\n                        offset_78593 *= 2;\n                    }\n                    while (slt32(skip_waves_78594,\n                                 squot32(sext_i64_i32(segred_group_sizze_68256) +\n                                         wave_sizze_78564 - 1,\n                                         wave_sizze_78564))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_78593 = skip_waves_78594 * wave_sizze_78564;\n                        if (slt32(local_tid_78562 + offset_78593,\n                                  sext_i64_i32(segred_group_sizze_68256)) &&\n                            ((local_tid_78562 - squot32(local_tid_78562,\n                                                        wave_sizze_78564) *\n                              wave_sizze_78564) == 0 &&\n                             (squot32(local_tid_78562, wave_sizze_78564) & (2 *\n                                                                            skip_waves_78594 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_78582 = ((__local\n                                            double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562 +\n                                                                         offset_78593)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78583 = x_78581 +\n                                       x_78582;\n                                \n                                x_78581 = defunc_1_op_res_78583;\n                            }\n                            // write result of operation\n                            {\n                             ",
                   "   ((__local\n                                  double *) red_arr_mem_78566)[sext_i32_i64(local_tid_78562)] =\n                                    x_78581;\n                            }\n                        }\n                        skip_waves_78594 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_78562 == 0) {\n                            ((__global double *) mem_77213)[gtid_68260 *\n                                                            n_m_65386 +\n                                                            gtid_68261] =\n                                x_78581;\n                        }\n                    }\n                }\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_68256\n}\n__kernel void mainzisegred_large_68313(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *sync_arr_mem_78650_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78648_backing_aligned_1,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_68307,\n                                       int64_t groups_per_segment_78634,\n                                       int64_t elements_per_thread_78635,\n                                       int64_t virt_num_groups_78636,\n                                       int64_t threads_per_segment_78638,\n                                       __global unsigned char *mem_77116,\n                                       __global unsigned char *mem_77120,\n                    ",
                   "                   __global unsigned char *mem_77124,\n                                       __global unsigned char *mem_77148,\n                                       __global unsigned char *mem_77204,\n                                       __global unsigned char *mem_77208,\n                                       __global unsigned char *mem_77218,\n                                       __global unsigned char *mem_77223,\n                                       __global\n                                       unsigned char *segred_tmp_mem_78639,\n                                       __global\n                                       unsigned char *mainzicounter_mem_78641)\n{\n    #define segred_group_sizze_68306 (mainzisegred_group_sizze_67268)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict sync_arr_mem_78650_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) sync_arr_mem_78650_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_78648_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78648_backing_aligned_1;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78643;\n    int32_t local_tid_78644;\n    int64_t group_sizze_78647;\n    int32_t wave_sizze_78646;\n    int32_t group_tid_78645;\n    \n    global_tid_78643 = get_global_id(0);\n    local_tid_78644 = get_local_id(0);\n    group_sizze_78647 = get_local_size(0);\n    wave_sizze_78646 = LOCKSTEP_WIDTH;\n    group_tid_78645 = get_group_id(0);\n    \n    int32_t phys_tid_68313 = global_tid_78643;\n    __local unsigned char *red_arr_mem_78648;\n    \n    red_arr_mem_78648 = (__local unsigned char *) red_arr_mem_78648_backing_0;\n    \n    __local unsigned char *sync_arr_mem_78650;\n    \n    sync_arr_mem_78650 = (__local unsigned char *) sync_arr_mem_78650_",
                   "backing_1;\n    \n    int32_t phys_group_id_78652;\n    \n    phys_group_id_78652 = get_group_id(0);\n    for (int32_t i_78653 = 0; i_78653 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_78636) - phys_group_id_78652,\n                   sext_i64_i32(num_groups_68307)); i_78653++) {\n        int32_t virt_group_id_78654 = phys_group_id_78652 + i_78653 *\n                sext_i64_i32(num_groups_68307);\n        int32_t flat_segment_id_78655 = squot32(virt_group_id_78654,\n                                                sext_i64_i32(groups_per_segment_78634));\n        int64_t global_tid_78656 = srem64(sext_i32_i64(virt_group_id_78654) *\n                                          segred_group_sizze_68306 +\n                                          sext_i32_i64(local_tid_78644),\n                                          segred_group_sizze_68306 *\n                                          groups_per_segment_78634);\n        int64_t slice_78657 = n_m_65386;\n        int64_t slice_78658 = m_65377 * slice_78657;\n        int64_t gtid_68310 = squot64(sext_i32_i64(flat_segment_id_78655),\n                                     slice_78657);\n        int64_t remnant_78659 = sext_i32_i64(flat_segment_id_78655) -\n                gtid_68310 * slice_78657;\n        int64_t gtid_68311 = remnant_78659;\n        int64_t remnant_78660 = remnant_78659 - gtid_68311;\n        int64_t gtid_68312;\n        double x_acc_78661;\n        int64_t chunk_sizze_78662 = smin64(elements_per_thread_78635,\n                                           sdiv_up64(q_65380 - global_tid_78656,\n                                                     threads_per_segment_78638));\n        double x_68314;\n        double x_68315;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_78661 = 0.0;\n        }\n        for (int64_t i_78666 = 0; i_78666 < chunk_sizze_78662; i_78666++) {\n            gtid_68312 = global_tid_78656 + threads_per_segment_78638 * i_78666;\n            // apply map function\n            {\n  ",
                   "              int64_t last_res_68317;\n                \n                last_res_68317 = ((__global int64_t *) mem_77116)[gtid_68310 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74710 = mul64(jump_65382, gtid_68311);\n                int64_t index_primexp_74711 = smin64(i_65392, binop_y_74710);\n                int64_t max_res_68326;\n                \n                max_res_68326 = ((__global int64_t *) mem_77204)[gtid_68310 *\n                                                                 n_m_65386 +\n                                                                 gtid_68311];\n                \n                double defunc_1_f_res_68327;\n                \n                defunc_1_f_res_68327 = ((__global\n                                         double *) mem_77208)[gtid_68310 *\n                                                              n_m_65386 +\n                                                              gtid_68311];\n                \n                double a0_68328;\n                \n                a0_68328 = ((__global double *) mem_77218)[gtid_68310 *\n                                                           n_m_65386 +\n                                                           gtid_68311];\n                \n                double x_68330;\n                \n                x_68330 = ((__global double *) mem_77148)[gtid_68310 * q_65380 +\n                                                          gtid_68312];\n                \n                bool cond_68331 = sle64(last_res_68317, gtid_68312);\n                int64_t defunc_0_f_res_68332;\n                \n                if (cond_68331) {\n                    defunc_0_f_res_68332 = (int64_t) 0;\n                } else {\n                    int64_t i_68333 = add64(gtid_68312, max_res_68326);\n                    int64_t defunc_0_add_arg_68334;\n                  ",
                   "  \n                    defunc_0_add_arg_68334 = ((__global\n                                               int64_t *) mem_77124)[gtid_68310 *\n                                                                     n_65378 +\n                                                                     i_68333];\n                    \n                    int64_t defunc_1_add_res_68335 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_68334);\n                    \n                    defunc_0_f_res_68332 = defunc_1_add_res_68335;\n                }\n                \n                int64_t binop_p_68336 = sub64(defunc_0_f_res_68332,\n                                              index_primexp_74711);\n                double defunc_0_f_res_68337 = sitofp_i64_f64(binop_p_68336);\n                double abs_res_68338 = fabs(defunc_0_f_res_68337);\n                double tmp1_68339 = abs_res_68338 / defunc_1_f_res_68327;\n                double x_68340 = tmp1_68339 * tmp1_68339;\n                double y_68341 = tmp1_68339 * x_68340;\n                double tmp2_68342 = 1.0 - y_68341;\n                double x_68343 = tmp2_68342 * tmp2_68342;\n                double tmp3_68344 = tmp2_68342 * x_68343;\n                double tmp4_68345 = x_68330 * tmp3_68344;\n                double defunc_0_f_res_68346;\n                \n                if (cond_68331) {\n                    defunc_0_f_res_68346 = 0.0;\n                } else {\n                    int64_t i_68347 = add64(gtid_68312, max_res_68326);\n                    double defunc_0_add_arg_68348;\n                    \n                    defunc_0_add_arg_68348 = ((__global\n                                               double *) mem_77120)[gtid_68310 *\n                                                                    n_65378 +\n                                                                    i_68347];\n                    defunc_0_f_res_68346 = defunc_0_add_arg_68348;\n                }\n                \n ",
                   "               double x_68349 = a0_68328 * tmp4_68345;\n                double defunc_9_fit_fun_res_68350 = defunc_0_f_res_68346 *\n                       x_68349;\n                \n                // save map-out results\n                { }\n                // load accumulator\n                {\n                    x_68314 = x_acc_78661;\n                }\n                // load new values\n                {\n                    x_68315 = defunc_9_fit_fun_res_68350;\n                }\n                // apply reduction operator\n                {\n                    double defunc_1_op_res_68316 = x_68314 + x_68315;\n                    \n                    // store in accumulator\n                    {\n                        x_acc_78661 = defunc_1_op_res_68316;\n                    }\n                }\n            }\n        }\n        // to reduce current chunk, first store our result in memory\n        {\n            x_68314 = x_acc_78661;\n            ((__local\n              double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644)] =\n                x_68314;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_78667;\n        int32_t skip_waves_78668 = 1;\n        double x_78663;\n        double x_78664;\n        \n        offset_78667 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_78644,\n                      sext_i64_i32(segred_group_sizze_68306))) {\n                x_78663 = ((__local\n                            double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644 +\n                                                         offset_78667)];\n            }\n        }\n        offset_78667 = 1;\n        while (slt32(offset_78667, wave_sizze_78646)) {\n            if (slt32(local_tid_78644 + offset_78667,\n                      sext_i64_i32(segred_group_sizze_68306)) &&\n                ((local_tid_78644 - squot32(local_tid_78644, wave_sizze_78646) *\n                  wave_sizze_78646) & (2 * offset_786",
                   "67 - 1)) == 0) {\n                // read array element\n                {\n                    x_78664 = ((volatile __local\n                                double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644 +\n                                                             offset_78667)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78665 = x_78663 + x_78664;\n                    \n                    x_78663 = defunc_1_op_res_78665;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644)] =\n                        x_78663;\n                }\n            }\n            offset_78667 *= 2;\n        }\n        while (slt32(skip_waves_78668,\n                     squot32(sext_i64_i32(segred_group_sizze_68306) +\n                             wave_sizze_78646 - 1, wave_sizze_78646))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_78667 = skip_waves_78668 * wave_sizze_78646;\n            if (slt32(local_tid_78644 + offset_78667,\n                      sext_i64_i32(segred_group_sizze_68306)) &&\n                ((local_tid_78644 - squot32(local_tid_78644, wave_sizze_78646) *\n                  wave_sizze_78646) == 0 && (squot32(local_tid_78644,\n                                                     wave_sizze_78646) & (2 *\n                                                                          skip_waves_78668 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_78664 = ((__local\n                                double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644 +\n                                                             offset_78667)];\n                }\n                // apply reduction operation\n             ",
                   "   {\n                    double defunc_1_op_res_78665 = x_78663 + x_78664;\n                    \n                    x_78663 = defunc_1_op_res_78665;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644)] =\n                        x_78663;\n                }\n            }\n            skip_waves_78668 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_78644) == (int64_t) 0) {\n                x_acc_78661 = x_78663;\n            }\n        }\n        if (groups_per_segment_78634 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_78644 == 0) {\n                    ((__global double *) mem_77223)[gtid_68310 * n_m_65386 +\n                                                    gtid_68311] = x_acc_78661;\n                }\n            }\n        } else {\n            int32_t old_counter_78669;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_78644 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_78639)[sext_i32_i64(virt_group_id_78654)] =\n                        x_acc_78661;\n                    mem_fence_global();\n                    old_counter_78669 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78641)[sext_i32_i64(srem32(flat_segment_id_78655,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_78650)[(int64_t) 0] =\n                        old_counter_78669 == groups_per_segment_78634 -\n      ",
                   "                  (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_78670;\n            \n            is_last_group_78670 = ((__local\n                                    bool *) sync_arr_mem_78650)[(int64_t) 0];\n            if (is_last_group_78670) {\n                if (local_tid_78644 == 0) {\n                    old_counter_78669 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78641)[sext_i32_i64(srem32(flat_segment_id_78655,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_78634));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_78671 =\n                            sdiv_up64(groups_per_segment_78634,\n                                      segred_group_sizze_68306);\n                    \n                    x_68314 = 0.0;\n                    for (int64_t i_78672 = 0; i_78672 < read_per_thread_78671;\n                         i_78672++) {\n                        int64_t group_res_id_78673 =\n                                sext_i32_i64(local_tid_78644) *\n                                read_per_thread_78671 + i_78672;\n                        int64_t index_of_group_res_78674 =\n                                sext_i32_i64(flat_segment_id_78655) *\n                                groups_per_segment_78634 + group_res_id_78673;\n                        \n                        if (slt64(group_res_id_78673,\n                                  groups_per_segment_78634)) {\n                            x_68315 = ((__global\n                                        double *) segred_tmp_mem_78639)[index_of_group_res_78",
                   "674];\n                            \n                            double defunc_1_op_res_68316 = x_68314 + x_68315;\n                            \n                            x_68314 = defunc_1_op_res_68316;\n                        }\n                    }\n                }\n                ((__local\n                  double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644)] =\n                    x_68314;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_78675;\n                    int32_t skip_waves_78676 = 1;\n                    double x_78663;\n                    double x_78664;\n                    \n                    offset_78675 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_78644,\n                                  sext_i64_i32(segred_group_sizze_68306))) {\n                            x_78663 = ((__local\n                                        double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644 +\n                                                                     offset_78675)];\n                        }\n                    }\n                    offset_78675 = 1;\n                    while (slt32(offset_78675, wave_sizze_78646)) {\n                        if (slt32(local_tid_78644 + offset_78675,\n                                  sext_i64_i32(segred_group_sizze_68306)) &&\n                            ((local_tid_78644 - squot32(local_tid_78644,\n                                                        wave_sizze_78646) *\n                              wave_sizze_78646) & (2 * offset_78675 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_78664 = ((volatile __local\n                                            double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644 +\n       ",
                   "                                                                  offset_78675)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78665 = x_78663 +\n                                       x_78664;\n                                \n                                x_78663 = defunc_1_op_res_78665;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644)] =\n                                    x_78663;\n                            }\n                        }\n                        offset_78675 *= 2;\n                    }\n                    while (slt32(skip_waves_78676,\n                                 squot32(sext_i64_i32(segred_group_sizze_68306) +\n                                         wave_sizze_78646 - 1,\n                                         wave_sizze_78646))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_78675 = skip_waves_78676 * wave_sizze_78646;\n                        if (slt32(local_tid_78644 + offset_78675,\n                                  sext_i64_i32(segred_group_sizze_68306)) &&\n                            ((local_tid_78644 - squot32(local_tid_78644,\n                                                        wave_sizze_78646) *\n                              wave_sizze_78646) == 0 &&\n                             (squot32(local_tid_78644, wave_sizze_78646) & (2 *\n                                                                            skip_waves_78676 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_78664 = ",
                   "((__local\n                                            double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644 +\n                                                                         offset_78675)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78665 = x_78663 +\n                                       x_78664;\n                                \n                                x_78663 = defunc_1_op_res_78665;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_78648)[sext_i32_i64(local_tid_78644)] =\n                                    x_78663;\n                            }\n                        }\n                        skip_waves_78676 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_78644 == 0) {\n                            ((__global double *) mem_77223)[gtid_68310 *\n                                                            n_m_65386 +\n                                                            gtid_68311] =\n                                x_78663;\n                        }\n                    }\n                }\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_68306\n}\n__kernel void mainzisegred_large_70086(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *sync_arr_mem_78961_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78959_backing_aligned_1,\n                                       __local volatile\n       ",
                   "                                int64_t *red_arr_mem_78957_backing_aligned_2,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78955_backing_aligned_3,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_70078,\n                                       int64_t groups_per_segment_78937,\n                                       int64_t elements_per_thread_78938,\n                                       int64_t virt_num_groups_78939,\n                                       int64_t threads_per_segment_78941,\n                                       __global unsigned char *mem_77350,\n                                       __global unsigned char *mem_77358,\n                                       __global unsigned char *mem_77382,\n                                       __global unsigned char *mem_77469,\n                                       __global unsigned char *mem_77473,\n                                       __global unsigned char *mem_77478,\n                                       __global unsigned char *mem_77482,\n                                       __global unsigned char *mem_77486,\n                                       __global\n                                       unsigned char *segred_tmp_mem_78942,\n                                       __global\n                                       unsigned char *segred_tmp_mem_78944,\n                                       __global\n                                       unsigned char *segred_tmp_mem_78946,\n                                       __global\n                                       unsigned char *mainzicounter_mem_78948)\n{\n    #define segred_group_sizze_70077 (mainzisegred_group_sizze_69082)\n    \n    const int block_dim0 = 0;\n   ",
                   " const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict sync_arr_mem_78961_backing_3 =\n                                   (__local volatile\n                                    unsigned char *) sync_arr_mem_78961_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_78959_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78959_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_78957_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78957_backing_aligned_2;\n    __local volatile unsigned char *restrict red_arr_mem_78955_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78955_backing_aligned_3;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78950;\n    int32_t local_tid_78951;\n    int64_t group_sizze_78954;\n    int32_t wave_sizze_78953;\n    int32_t group_tid_78952;\n    \n    global_tid_78950 = get_global_id(0);\n    local_tid_78951 = get_local_id(0);\n    group_sizze_78954 = get_local_size(0);\n    wave_sizze_78953 = LOCKSTEP_WIDTH;\n    group_tid_78952 = get_group_id(0);\n    \n    int32_t phys_tid_70086 = global_tid_78950;\n    __local unsigned char *red_arr_mem_78955;\n    \n    red_arr_mem_78955 = (__local unsigned char *) red_arr_mem_78955_backing_0;\n    \n    __local unsigned char *red_arr_mem_78957;\n    \n    red_arr_mem_78957 = (__local unsigned char *) red_arr_mem_78957_backing_1;\n    \n    __local unsigned char *red_arr_mem_78959;\n    \n    red_arr_mem_78959 = (__local unsigned char *) red_arr_mem_78959_backing_2;\n    \n    __local unsigned char *sync_arr_mem_78961;\n    \n    sync_arr_mem_78961 = (__local unsigned char *) sync_arr_mem_78961_backing_3;\n    \n    int32_t phys_group_id_78963;\n    \n    phys_group_id_78963 =",
                   " get_group_id(0);\n    for (int32_t i_78964 = 0; i_78964 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_78939) - phys_group_id_78963,\n                   sext_i64_i32(num_groups_70078)); i_78964++) {\n        int32_t virt_group_id_78965 = phys_group_id_78963 + i_78964 *\n                sext_i64_i32(num_groups_70078);\n        int32_t flat_segment_id_78966 = squot32(virt_group_id_78965,\n                                                sext_i64_i32(groups_per_segment_78937));\n        int64_t global_tid_78967 = srem64(sext_i32_i64(virt_group_id_78965) *\n                                          segred_group_sizze_70077 +\n                                          sext_i32_i64(local_tid_78951),\n                                          segred_group_sizze_70077 *\n                                          groups_per_segment_78937);\n        int64_t slice_78968 = n_m_65386;\n        int64_t slice_78969 = m_65377 * slice_78968;\n        int64_t gtid_70083 = squot64(sext_i32_i64(flat_segment_id_78966),\n                                     slice_78968);\n        int64_t remnant_78970 = sext_i32_i64(flat_segment_id_78966) -\n                gtid_70083 * slice_78968;\n        int64_t gtid_70084 = remnant_78970;\n        int64_t remnant_78971 = remnant_78970 - gtid_70084;\n        int64_t gtid_70085;\n        double x_acc_78972;\n        double x_acc_78973;\n        double x_acc_78974;\n        int64_t chunk_sizze_78975 = smin64(elements_per_thread_78938,\n                                           sdiv_up64(q_65380 - global_tid_78967,\n                                                     threads_per_segment_78941));\n        double x_70087;\n        double x_70088;\n        double x_70089;\n        double x_70090;\n        double x_70091;\n        double x_70092;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_78972 = 0.0;\n            x_acc_78973 = 0.0;\n            x_acc_78974 = 0.0;\n        }\n        for (int64_t i_78985 = 0; i_78985 < chunk_sizze_78975; i_78985++",
                   ") {\n            gtid_70085 = global_tid_78967 + threads_per_segment_78941 * i_78985;\n            // apply map function\n            {\n                int64_t last_res_70096;\n                \n                last_res_70096 = ((__global int64_t *) mem_77350)[gtid_70083 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74722 = mul64(jump_65382, gtid_70084);\n                int64_t index_primexp_74723 = smin64(i_65392, binop_y_74722);\n                double defunc_1_f_res_70104;\n                \n                defunc_1_f_res_70104 = ((__global\n                                         double *) mem_77473)[gtid_70083 *\n                                                              n_m_65386 +\n                                                              gtid_70084];\n                \n                double x_70106;\n                \n                x_70106 = ((__global double *) mem_77382)[gtid_70083 * q_65380 +\n                                                          gtid_70085];\n                \n                bool cond_70107 = sle64(last_res_70096, gtid_70085);\n                int64_t defunc_0_f_res_70108;\n                \n                if (cond_70107) {\n                    defunc_0_f_res_70108 = (int64_t) 0;\n                } else {\n                    int64_t max_res_70103;\n                    \n                    max_res_70103 = ((__global\n                                      int64_t *) mem_77469)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084];\n                    \n                    int64_t i_70109 = add64(gtid_70085, max_res_70103);\n                    int64_t defunc_0_add_arg_70110;\n                    \n                    defunc_0_add_arg_70110 = ((__global\n                                            ",
                   "   int64_t *) mem_77358)[gtid_70083 *\n                                                                     n_65378 +\n                                                                     i_70109];\n                    \n                    int64_t defunc_1_add_res_70111 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_70110);\n                    \n                    defunc_0_f_res_70108 = defunc_1_add_res_70111;\n                }\n                \n                int64_t binop_p_70112 = sub64(defunc_0_f_res_70108,\n                                              index_primexp_74723);\n                double defunc_0_f_res_70113 = sitofp_i64_f64(binop_p_70112);\n                double abs_res_70114 = fabs(defunc_0_f_res_70113);\n                double tmp1_70115 = abs_res_70114 / defunc_1_f_res_70104;\n                double x_70116 = tmp1_70115 * tmp1_70115;\n                double y_70117 = tmp1_70115 * x_70116;\n                double tmp2_70118 = 1.0 - y_70117;\n                double x_70119 = tmp2_70118 * tmp2_70118;\n                double tmp3_70120 = tmp2_70118 * x_70119;\n                double w_j_70121 = x_70106 * tmp3_70120;\n                double xw_j_70122 = defunc_0_f_res_70113 * w_j_70121;\n                double x2w_j_70123 = defunc_0_f_res_70113 * xw_j_70122;\n                \n                // save map-out results\n                { }\n                // load accumulator\n                {\n                    x_70087 = x_acc_78972;\n                    x_70088 = x_acc_78973;\n                    x_70089 = x_acc_78974;\n                }\n                // load new values\n                {\n                    x_70090 = w_j_70121;\n                    x_70091 = xw_j_70122;\n                    x_70092 = x2w_j_70123;\n                }\n                // apply reduction operator\n                {\n                    double defunc_1_op_res_70093 = x_70087 + x_70090;\n                    double defunc_1_op_res_70094 = x_70088 + x_7",
                   "0091;\n                    double defunc_1_op_res_70095 = x_70089 + x_70092;\n                    \n                    // store in accumulator\n                    {\n                        x_acc_78972 = defunc_1_op_res_70093;\n                        x_acc_78973 = defunc_1_op_res_70094;\n                        x_acc_78974 = defunc_1_op_res_70095;\n                    }\n                }\n            }\n        }\n        // to reduce current chunk, first store our result in memory\n        {\n            x_70087 = x_acc_78972;\n            x_70088 = x_acc_78973;\n            x_70089 = x_acc_78974;\n            ((__local\n              double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951)] =\n                x_70087;\n            ((__local\n              double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951)] =\n                x_70088;\n            ((__local\n              double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951)] =\n                x_70089;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_78986;\n        int32_t skip_waves_78987 = 1;\n        double x_78976;\n        double x_78977;\n        double x_78978;\n        double x_78979;\n        double x_78980;\n        double x_78981;\n        \n        offset_78986 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_78951,\n                      sext_i64_i32(segred_group_sizze_70077))) {\n                x_78976 = ((__local\n                            double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951 +\n                                                         offset_78986)];\n                x_78977 = ((__local\n                            double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951 +\n                                                         offset_78986)];\n                x_78978 = ((__local\n                            double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951 +\n                                           ",
                   "              offset_78986)];\n            }\n        }\n        offset_78986 = 1;\n        while (slt32(offset_78986, wave_sizze_78953)) {\n            if (slt32(local_tid_78951 + offset_78986,\n                      sext_i64_i32(segred_group_sizze_70077)) &&\n                ((local_tid_78951 - squot32(local_tid_78951, wave_sizze_78953) *\n                  wave_sizze_78953) & (2 * offset_78986 - 1)) == 0) {\n                // read array element\n                {\n                    x_78979 = ((volatile __local\n                                double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951 +\n                                                             offset_78986)];\n                    x_78980 = ((volatile __local\n                                double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951 +\n                                                             offset_78986)];\n                    x_78981 = ((volatile __local\n                                double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951 +\n                                                             offset_78986)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78982 = x_78976 + x_78979;\n                    double defunc_1_op_res_78983 = x_78977 + x_78980;\n                    double defunc_1_op_res_78984 = x_78978 + x_78981;\n                    \n                    x_78976 = defunc_1_op_res_78982;\n                    x_78977 = defunc_1_op_res_78983;\n                    x_78978 = defunc_1_op_res_78984;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951)] =\n                        x_78976;\n                    ((volatile __local\n                      double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951)] =\n                        x_78977;\n                    ",
                   "((volatile __local\n                      double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951)] =\n                        x_78978;\n                }\n            }\n            offset_78986 *= 2;\n        }\n        while (slt32(skip_waves_78987,\n                     squot32(sext_i64_i32(segred_group_sizze_70077) +\n                             wave_sizze_78953 - 1, wave_sizze_78953))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_78986 = skip_waves_78987 * wave_sizze_78953;\n            if (slt32(local_tid_78951 + offset_78986,\n                      sext_i64_i32(segred_group_sizze_70077)) &&\n                ((local_tid_78951 - squot32(local_tid_78951, wave_sizze_78953) *\n                  wave_sizze_78953) == 0 && (squot32(local_tid_78951,\n                                                     wave_sizze_78953) & (2 *\n                                                                          skip_waves_78987 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_78979 = ((__local\n                                double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951 +\n                                                             offset_78986)];\n                    x_78980 = ((__local\n                                double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951 +\n                                                             offset_78986)];\n                    x_78981 = ((__local\n                                double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951 +\n                                                             offset_78986)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78982 = x_78976 + x_78979;\n                    double defunc_1_op_res_78983 = x_78977 + x_78980;\n                    double defunc_1_op_res_78984 = x_7",
                   "8978 + x_78981;\n                    \n                    x_78976 = defunc_1_op_res_78982;\n                    x_78977 = defunc_1_op_res_78983;\n                    x_78978 = defunc_1_op_res_78984;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951)] =\n                        x_78976;\n                    ((__local\n                      double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951)] =\n                        x_78977;\n                    ((__local\n                      double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951)] =\n                        x_78978;\n                }\n            }\n            skip_waves_78987 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_78951) == (int64_t) 0) {\n                x_acc_78972 = x_78976;\n                x_acc_78973 = x_78977;\n                x_acc_78974 = x_78978;\n            }\n        }\n        if (groups_per_segment_78937 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_78951 == 0) {\n                    ((__global double *) mem_77478)[gtid_70083 * n_m_65386 +\n                                                    gtid_70084] = x_acc_78972;\n                    ((__global double *) mem_77482)[gtid_70083 * n_m_65386 +\n                                                    gtid_70084] = x_acc_78973;\n                    ((__global double *) mem_77486)[gtid_70083 * n_m_65386 +\n                                                    gtid_70084] = x_acc_78974;\n                }\n            }\n        } else {\n            int32_t old_counter_78988;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_78951 == 0) {\n                 ",
                   "   ((__global\n                      double *) segred_tmp_mem_78942)[sext_i32_i64(virt_group_id_78965)] =\n                        x_acc_78972;\n                    ((__global\n                      double *) segred_tmp_mem_78944)[sext_i32_i64(virt_group_id_78965)] =\n                        x_acc_78973;\n                    ((__global\n                      double *) segred_tmp_mem_78946)[sext_i32_i64(virt_group_id_78965)] =\n                        x_acc_78974;\n                    mem_fence_global();\n                    old_counter_78988 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78948)[sext_i32_i64(srem32(flat_segment_id_78966,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_78961)[(int64_t) 0] =\n                        old_counter_78988 == groups_per_segment_78937 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_78989;\n            \n            is_last_group_78989 = ((__local\n                                    bool *) sync_arr_mem_78961)[(int64_t) 0];\n            if (is_last_group_78989) {\n                if (local_tid_78951 == 0) {\n                    old_counter_78988 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78948)[sext_i32_i64(srem32(flat_segment_id_78966,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_78937));\n                }\n                // read in the per-group-resul",
                   "ts\n                {\n                    int64_t read_per_thread_78990 =\n                            sdiv_up64(groups_per_segment_78937,\n                                      segred_group_sizze_70077);\n                    \n                    x_70087 = 0.0;\n                    x_70088 = 0.0;\n                    x_70089 = 0.0;\n                    for (int64_t i_78991 = 0; i_78991 < read_per_thread_78990;\n                         i_78991++) {\n                        int64_t group_res_id_78992 =\n                                sext_i32_i64(local_tid_78951) *\n                                read_per_thread_78990 + i_78991;\n                        int64_t index_of_group_res_78993 =\n                                sext_i32_i64(flat_segment_id_78966) *\n                                groups_per_segment_78937 + group_res_id_78992;\n                        \n                        if (slt64(group_res_id_78992,\n                                  groups_per_segment_78937)) {\n                            x_70090 = ((__global\n                                        double *) segred_tmp_mem_78942)[index_of_group_res_78993];\n                            x_70091 = ((__global\n                                        double *) segred_tmp_mem_78944)[index_of_group_res_78993];\n                            x_70092 = ((__global\n                                        double *) segred_tmp_mem_78946)[index_of_group_res_78993];\n                            \n                            double defunc_1_op_res_70093 = x_70087 + x_70090;\n                            double defunc_1_op_res_70094 = x_70088 + x_70091;\n                            double defunc_1_op_res_70095 = x_70089 + x_70092;\n                            \n                            x_70087 = defunc_1_op_res_70093;\n                            x_70088 = defunc_1_op_res_70094;\n                            x_70089 = defunc_1_op_res_70095;\n                        }\n                    }\n                }\n                ((__local\n            ",
                   "      double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951)] =\n                    x_70087;\n                ((__local\n                  double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951)] =\n                    x_70088;\n                ((__local\n                  double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951)] =\n                    x_70089;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_78994;\n                    int32_t skip_waves_78995 = 1;\n                    double x_78976;\n                    double x_78977;\n                    double x_78978;\n                    double x_78979;\n                    double x_78980;\n                    double x_78981;\n                    \n                    offset_78994 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_78951,\n                                  sext_i64_i32(segred_group_sizze_70077))) {\n                            x_78976 = ((__local\n                                        double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951 +\n                                                                     offset_78994)];\n                            x_78977 = ((__local\n                                        double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951 +\n                                                                     offset_78994)];\n                            x_78978 = ((__local\n                                        double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951 +\n                                                                     offset_78994)];\n                        }\n                    }\n                    offset_78994 = 1;\n                    while (slt32(offset_78994, wave_sizze_78953)) {\n                        if (slt32(local_tid_78951 + offset_78994,\n               ",
                   "                   sext_i64_i32(segred_group_sizze_70077)) &&\n                            ((local_tid_78951 - squot32(local_tid_78951,\n                                                        wave_sizze_78953) *\n                              wave_sizze_78953) & (2 * offset_78994 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_78979 = ((volatile __local\n                                            double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951 +\n                                                                         offset_78994)];\n                                x_78980 = ((volatile __local\n                                            double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951 +\n                                                                         offset_78994)];\n                                x_78981 = ((volatile __local\n                                            double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951 +\n                                                                         offset_78994)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78982 = x_78976 +\n                                       x_78979;\n                                double defunc_1_op_res_78983 = x_78977 +\n                                       x_78980;\n                                double defunc_1_op_res_78984 = x_78978 +\n                                       x_78981;\n                                \n                                x_78976 = defunc_1_op_res_78982;\n                                x_78977 = defunc_1_op_res_78983;\n                                x_78978 = defunc_1_op_res_78984;\n                            }\n                            // write result of operation\n                            {\n            ",
                   "                    ((volatile __local\n                                  double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951)] =\n                                    x_78976;\n                                ((volatile __local\n                                  double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951)] =\n                                    x_78977;\n                                ((volatile __local\n                                  double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951)] =\n                                    x_78978;\n                            }\n                        }\n                        offset_78994 *= 2;\n                    }\n                    while (slt32(skip_waves_78995,\n                                 squot32(sext_i64_i32(segred_group_sizze_70077) +\n                                         wave_sizze_78953 - 1,\n                                         wave_sizze_78953))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_78994 = skip_waves_78995 * wave_sizze_78953;\n                        if (slt32(local_tid_78951 + offset_78994,\n                                  sext_i64_i32(segred_group_sizze_70077)) &&\n                            ((local_tid_78951 - squot32(local_tid_78951,\n                                                        wave_sizze_78953) *\n                              wave_sizze_78953) == 0 &&\n                             (squot32(local_tid_78951, wave_sizze_78953) & (2 *\n                                                                            skip_waves_78995 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_78979 = ((__local\n                                            double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951 +\n                                                 ",
                   "                        offset_78994)];\n                                x_78980 = ((__local\n                                            double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951 +\n                                                                         offset_78994)];\n                                x_78981 = ((__local\n                                            double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951 +\n                                                                         offset_78994)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78982 = x_78976 +\n                                       x_78979;\n                                double defunc_1_op_res_78983 = x_78977 +\n                                       x_78980;\n                                double defunc_1_op_res_78984 = x_78978 +\n                                       x_78981;\n                                \n                                x_78976 = defunc_1_op_res_78982;\n                                x_78977 = defunc_1_op_res_78983;\n                                x_78978 = defunc_1_op_res_78984;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_78955)[sext_i32_i64(local_tid_78951)] =\n                                    x_78976;\n                                ((__local\n                                  double *) red_arr_mem_78957)[sext_i32_i64(local_tid_78951)] =\n                                    x_78977;\n                                ((__local\n                                  double *) red_arr_mem_78959)[sext_i32_i64(local_tid_78951)] =\n                                    x_78978;\n                            }\n                        }\n                        skip_waves_78995",
                   " *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_78951 == 0) {\n                            ((__global double *) mem_77478)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084] =\n                                x_78976;\n                            ((__global double *) mem_77482)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084] =\n                                x_78977;\n                            ((__global double *) mem_77486)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084] =\n                                x_78978;\n                        }\n                    }\n                }\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_70077\n}\n__kernel void mainzisegred_large_70156(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *sync_arr_mem_79061_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79059_backing_aligned_1,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79057_backing_aligned_2,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_70149,\n                                       int64_t g",
                   "roups_per_segment_79041,\n                                       int64_t elements_per_thread_79042,\n                                       int64_t virt_num_groups_79043,\n                                       int64_t threads_per_segment_79045,\n                                       __global unsigned char *mem_77350,\n                                       __global unsigned char *mem_77354,\n                                       __global unsigned char *mem_77358,\n                                       __global unsigned char *mem_77382,\n                                       __global unsigned char *mem_77469,\n                                       __global unsigned char *mem_77473,\n                                       __global unsigned char *mem_77491,\n                                       __global unsigned char *mem_77495,\n                                       __global unsigned char *mem_77499,\n                                       __global unsigned char *mem_77504,\n                                       __global unsigned char *mem_77508,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79046,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79048,\n                                       __global\n                                       unsigned char *mainzicounter_mem_79050)\n{\n    #define segred_group_sizze_70148 (mainzisegred_group_sizze_68987)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict sync_arr_mem_79061_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) sync_arr_mem_79061_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_79059_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) ",
                   "red_arr_mem_79059_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_79057_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79057_backing_aligned_2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79052;\n    int32_t local_tid_79053;\n    int64_t group_sizze_79056;\n    int32_t wave_sizze_79055;\n    int32_t group_tid_79054;\n    \n    global_tid_79052 = get_global_id(0);\n    local_tid_79053 = get_local_id(0);\n    group_sizze_79056 = get_local_size(0);\n    wave_sizze_79055 = LOCKSTEP_WIDTH;\n    group_tid_79054 = get_group_id(0);\n    \n    int32_t phys_tid_70156 = global_tid_79052;\n    __local unsigned char *red_arr_mem_79057;\n    \n    red_arr_mem_79057 = (__local unsigned char *) red_arr_mem_79057_backing_0;\n    \n    __local unsigned char *red_arr_mem_79059;\n    \n    red_arr_mem_79059 = (__local unsigned char *) red_arr_mem_79059_backing_1;\n    \n    __local unsigned char *sync_arr_mem_79061;\n    \n    sync_arr_mem_79061 = (__local unsigned char *) sync_arr_mem_79061_backing_2;\n    \n    int32_t phys_group_id_79063;\n    \n    phys_group_id_79063 = get_group_id(0);\n    for (int32_t i_79064 = 0; i_79064 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_79043) - phys_group_id_79063,\n                   sext_i64_i32(num_groups_70149)); i_79064++) {\n        int32_t virt_group_id_79065 = phys_group_id_79063 + i_79064 *\n                sext_i64_i32(num_groups_70149);\n        int32_t flat_segment_id_79066 = squot32(virt_group_id_79065,\n                                                sext_i64_i32(groups_per_segment_79041));\n        int64_t global_tid_79067 = srem64(sext_i32_i64(virt_group_id_79065) *\n                                          segred_group_sizze_70148 +\n                                          sext_i32_i64(local_tid_79053),\n                                          segred_group_sizze_70148 *\n                                          gro",
                   "ups_per_segment_79041);\n        int64_t slice_79068 = n_m_65386;\n        int64_t slice_79069 = m_65377 * slice_79068;\n        int64_t gtid_70153 = squot64(sext_i32_i64(flat_segment_id_79066),\n                                     slice_79068);\n        int64_t remnant_79070 = sext_i32_i64(flat_segment_id_79066) -\n                gtid_70153 * slice_79068;\n        int64_t gtid_70154 = remnant_79070;\n        int64_t remnant_79071 = remnant_79070 - gtid_70154;\n        int64_t gtid_70155;\n        double x_acc_79072;\n        double x_acc_79073;\n        int64_t chunk_sizze_79074 = smin64(elements_per_thread_79042,\n                                           sdiv_up64(q_65380 - global_tid_79067,\n                                                     threads_per_segment_79045));\n        double x_70157;\n        double x_70158;\n        double x_70159;\n        double x_70160;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_79072 = 0.0;\n            x_acc_79073 = 0.0;\n        }\n        for (int64_t i_79081 = 0; i_79081 < chunk_sizze_79074; i_79081++) {\n            gtid_70155 = global_tid_79067 + threads_per_segment_79045 * i_79081;\n            // apply map function\n            {\n                int64_t last_res_70163;\n                \n                last_res_70163 = ((__global int64_t *) mem_77350)[gtid_70153 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74718 = mul64(jump_65382, gtid_70154);\n                int64_t index_primexp_74719 = smin64(i_65392, binop_y_74718);\n                int64_t max_res_70174;\n                \n                max_res_70174 = ((__global int64_t *) mem_77469)[gtid_70153 *\n                                                                 n_m_65386 +\n                                                                 gtid_70154];\n                \n                double de",
                   "func_1_f_res_70175;\n                \n                defunc_1_f_res_70175 = ((__global\n                                         double *) mem_77473)[gtid_70153 *\n                                                              n_m_65386 +\n                                                              gtid_70154];\n                \n                double a11_70176;\n                \n                a11_70176 = ((__global double *) mem_77491)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154];\n                \n                double b11_70177;\n                \n                b11_70177 = ((__global double *) mem_77495)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154];\n                \n                double c11_70178;\n                \n                c11_70178 = ((__global double *) mem_77499)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154];\n                \n                double x_70180;\n                \n                x_70180 = ((__global double *) mem_77382)[gtid_70153 * q_65380 +\n                                                          gtid_70155];\n                \n                bool cond_70181 = sle64(last_res_70163, gtid_70155);\n                int64_t defunc_0_f_res_70182;\n                \n                if (cond_70181) {\n                    defunc_0_f_res_70182 = (int64_t) 0;\n                } else {\n                    int64_t i_70183 = add64(gtid_70155, max_res_70174);\n                    int64_t defunc_0_add_arg_70184;\n                    \n                    defunc_0_add_arg_70184 = ((__global\n                                               int64_t *) mem_77358)[gtid_70153 *\n                                                                  ",
                   "   n_65378 +\n                                                                     i_70183];\n                    \n                    int64_t defunc_1_add_res_70185 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_70184);\n                    \n                    defunc_0_f_res_70182 = defunc_1_add_res_70185;\n                }\n                \n                int64_t binop_p_70186 = sub64(defunc_0_f_res_70182,\n                                              index_primexp_74719);\n                double defunc_0_f_res_70187 = sitofp_i64_f64(binop_p_70186);\n                double abs_res_70188 = fabs(defunc_0_f_res_70187);\n                double tmp1_70189 = abs_res_70188 / defunc_1_f_res_70175;\n                double x_70190 = tmp1_70189 * tmp1_70189;\n                double y_70191 = tmp1_70189 * x_70190;\n                double tmp2_70192 = 1.0 - y_70191;\n                double x_70193 = tmp2_70192 * tmp2_70192;\n                double tmp3_70194 = tmp2_70192 * x_70193;\n                double tmp4_70195 = x_70180 * tmp3_70194;\n                double defunc_1_f_res_70196 = defunc_0_f_res_70187 * tmp4_70195;\n                double defunc_0_f_res_70197;\n                \n                if (cond_70181) {\n                    defunc_0_f_res_70197 = 0.0;\n                } else {\n                    int64_t i_70198 = add64(gtid_70155, max_res_70174);\n                    double defunc_0_add_arg_70199;\n                    \n                    defunc_0_add_arg_70199 = ((__global\n                                               double *) mem_77354)[gtid_70153 *\n                                                                    n_65378 +\n                                                                    i_70198];\n                    defunc_0_f_res_70197 = defunc_0_add_arg_70199;\n                }\n                \n                double x_70200 = a11_70176 * tmp4_70195;\n                double y_70201 = b11_70177 * defunc_1_f_res_70196;\n   ",
                   "             double x_70202 = x_70200 + y_70201;\n                double defunc_9_fit_fun_res_70203 = defunc_0_f_res_70197 *\n                       x_70202;\n                double x_70204 = b11_70177 * tmp4_70195;\n                double y_70205 = c11_70178 * defunc_1_f_res_70196;\n                double x_70206 = x_70204 + y_70205;\n                double defunc_9_slope_fun_res_70207 = defunc_0_f_res_70197 *\n                       x_70206;\n                \n                // save map-out results\n                { }\n                // load accumulator\n                {\n                    x_70157 = x_acc_79072;\n                    x_70158 = x_acc_79073;\n                }\n                // load new values\n                {\n                    x_70159 = defunc_9_fit_fun_res_70203;\n                    x_70160 = defunc_9_slope_fun_res_70207;\n                }\n                // apply reduction operator\n                {\n                    double defunc_1_op_res_70161 = x_70157 + x_70159;\n                    double defunc_1_op_res_70162 = x_70158 + x_70160;\n                    \n                    // store in accumulator\n                    {\n                        x_acc_79072 = defunc_1_op_res_70161;\n                        x_acc_79073 = defunc_1_op_res_70162;\n                    }\n                }\n            }\n        }\n        // to reduce current chunk, first store our result in memory\n        {\n            x_70157 = x_acc_79072;\n            x_70158 = x_acc_79073;\n            ((__local\n              double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053)] =\n                x_70157;\n            ((__local\n              double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053)] =\n                x_70158;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_79082;\n        int32_t skip_waves_79083 = 1;\n        double x_79075;\n        double x_79076;\n        double x_79077;\n        double x_79078;\n        \n        offset_79082 = 0;\n        /",
                   "/ participating threads read initial accumulator\n        {\n            if (slt32(local_tid_79053,\n                      sext_i64_i32(segred_group_sizze_70148))) {\n                x_79075 = ((__local\n                            double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053 +\n                                                         offset_79082)];\n                x_79076 = ((__local\n                            double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053 +\n                                                         offset_79082)];\n            }\n        }\n        offset_79082 = 1;\n        while (slt32(offset_79082, wave_sizze_79055)) {\n            if (slt32(local_tid_79053 + offset_79082,\n                      sext_i64_i32(segred_group_sizze_70148)) &&\n                ((local_tid_79053 - squot32(local_tid_79053, wave_sizze_79055) *\n                  wave_sizze_79055) & (2 * offset_79082 - 1)) == 0) {\n                // read array element\n                {\n                    x_79077 = ((volatile __local\n                                double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053 +\n                                                             offset_79082)];\n                    x_79078 = ((volatile __local\n                                double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053 +\n                                                             offset_79082)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79079 = x_79075 + x_79077;\n                    double defunc_1_op_res_79080 = x_79076 + x_79078;\n                    \n                    x_79075 = defunc_1_op_res_79079;\n                    x_79076 = defunc_1_op_res_79080;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053)] =\n                       ",
                   " x_79075;\n                    ((volatile __local\n                      double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053)] =\n                        x_79076;\n                }\n            }\n            offset_79082 *= 2;\n        }\n        while (slt32(skip_waves_79083,\n                     squot32(sext_i64_i32(segred_group_sizze_70148) +\n                             wave_sizze_79055 - 1, wave_sizze_79055))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_79082 = skip_waves_79083 * wave_sizze_79055;\n            if (slt32(local_tid_79053 + offset_79082,\n                      sext_i64_i32(segred_group_sizze_70148)) &&\n                ((local_tid_79053 - squot32(local_tid_79053, wave_sizze_79055) *\n                  wave_sizze_79055) == 0 && (squot32(local_tid_79053,\n                                                     wave_sizze_79055) & (2 *\n                                                                          skip_waves_79083 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_79077 = ((__local\n                                double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053 +\n                                                             offset_79082)];\n                    x_79078 = ((__local\n                                double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053 +\n                                                             offset_79082)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79079 = x_79075 + x_79077;\n                    double defunc_1_op_res_79080 = x_79076 + x_79078;\n                    \n                    x_79075 = defunc_1_op_res_79079;\n                    x_79076 = defunc_1_op_res_79080;\n                }\n                // write result of operation\n                {\n                    ((__l",
                   "ocal\n                      double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053)] =\n                        x_79075;\n                    ((__local\n                      double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053)] =\n                        x_79076;\n                }\n            }\n            skip_waves_79083 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_79053) == (int64_t) 0) {\n                x_acc_79072 = x_79075;\n                x_acc_79073 = x_79076;\n            }\n        }\n        if (groups_per_segment_79041 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_79053 == 0) {\n                    ((__global double *) mem_77504)[gtid_70153 * n_m_65386 +\n                                                    gtid_70154] = x_acc_79072;\n                    ((__global double *) mem_77508)[gtid_70153 * n_m_65386 +\n                                                    gtid_70154] = x_acc_79073;\n                }\n            }\n        } else {\n            int32_t old_counter_79084;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_79053 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_79046)[sext_i32_i64(virt_group_id_79065)] =\n                        x_acc_79072;\n                    ((__global\n                      double *) segred_tmp_mem_79048)[sext_i32_i64(virt_group_id_79065)] =\n                        x_acc_79073;\n                    mem_fence_global();\n                    old_counter_79084 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79050)[sext_i32_i64(srem32(flat_segment_id_79066,\n                                                                        ",
                   "                             10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_79061)[(int64_t) 0] =\n                        old_counter_79084 == groups_per_segment_79041 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_79085;\n            \n            is_last_group_79085 = ((__local\n                                    bool *) sync_arr_mem_79061)[(int64_t) 0];\n            if (is_last_group_79085) {\n                if (local_tid_79053 == 0) {\n                    old_counter_79084 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79050)[sext_i32_i64(srem32(flat_segment_id_79066,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_79041));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_79086 =\n                            sdiv_up64(groups_per_segment_79041,\n                                      segred_group_sizze_70148);\n                    \n                    x_70157 = 0.0;\n                    x_70158 = 0.0;\n                    for (int64_t i_79087 = 0; i_79087 < read_per_thread_79086;\n                         i_79087++) {\n                        int64_t group_res_id_79088 =\n                                sext_i32_i64(local_tid_79053) *\n                                read_per_thread_79086 + i_79087;\n                        int64_t index_of_group_res_79089 =\n                                sext_i32_i64(flat_segment_id_79066) *\n                                groups_per_segment_79041 + group_res_id_79088;\n   ",
                   "                     \n                        if (slt64(group_res_id_79088,\n                                  groups_per_segment_79041)) {\n                            x_70159 = ((__global\n                                        double *) segred_tmp_mem_79046)[index_of_group_res_79089];\n                            x_70160 = ((__global\n                                        double *) segred_tmp_mem_79048)[index_of_group_res_79089];\n                            \n                            double defunc_1_op_res_70161 = x_70157 + x_70159;\n                            double defunc_1_op_res_70162 = x_70158 + x_70160;\n                            \n                            x_70157 = defunc_1_op_res_70161;\n                            x_70158 = defunc_1_op_res_70162;\n                        }\n                    }\n                }\n                ((__local\n                  double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053)] =\n                    x_70157;\n                ((__local\n                  double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053)] =\n                    x_70158;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_79090;\n                    int32_t skip_waves_79091 = 1;\n                    double x_79075;\n                    double x_79076;\n                    double x_79077;\n                    double x_79078;\n                    \n                    offset_79090 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_79053,\n                                  sext_i64_i32(segred_group_sizze_70148))) {\n                            x_79075 = ((__local\n                                        double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053 +\n                                                                     offset_79090)];\n                            x_790",
                   "76 = ((__local\n                                        double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053 +\n                                                                     offset_79090)];\n                        }\n                    }\n                    offset_79090 = 1;\n                    while (slt32(offset_79090, wave_sizze_79055)) {\n                        if (slt32(local_tid_79053 + offset_79090,\n                                  sext_i64_i32(segred_group_sizze_70148)) &&\n                            ((local_tid_79053 - squot32(local_tid_79053,\n                                                        wave_sizze_79055) *\n                              wave_sizze_79055) & (2 * offset_79090 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_79077 = ((volatile __local\n                                            double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053 +\n                                                                         offset_79090)];\n                                x_79078 = ((volatile __local\n                                            double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053 +\n                                                                         offset_79090)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79079 = x_79075 +\n                                       x_79077;\n                                double defunc_1_op_res_79080 = x_79076 +\n                                       x_79078;\n                                \n                                x_79075 = defunc_1_op_res_79079;\n                                x_79076 = defunc_1_op_res_79080;\n                            }\n                            // write result of operation\n                            {\n                 ",
                   "               ((volatile __local\n                                  double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053)] =\n                                    x_79075;\n                                ((volatile __local\n                                  double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053)] =\n                                    x_79076;\n                            }\n                        }\n                        offset_79090 *= 2;\n                    }\n                    while (slt32(skip_waves_79091,\n                                 squot32(sext_i64_i32(segred_group_sizze_70148) +\n                                         wave_sizze_79055 - 1,\n                                         wave_sizze_79055))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_79090 = skip_waves_79091 * wave_sizze_79055;\n                        if (slt32(local_tid_79053 + offset_79090,\n                                  sext_i64_i32(segred_group_sizze_70148)) &&\n                            ((local_tid_79053 - squot32(local_tid_79053,\n                                                        wave_sizze_79055) *\n                              wave_sizze_79055) == 0 &&\n                             (squot32(local_tid_79053, wave_sizze_79055) & (2 *\n                                                                            skip_waves_79091 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_79077 = ((__local\n                                            double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053 +\n                                                                         offset_79090)];\n                                x_79078 = ((__local\n                                            double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053 +\n ",
                   "                                                                        offset_79090)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79079 = x_79075 +\n                                       x_79077;\n                                double defunc_1_op_res_79080 = x_79076 +\n                                       x_79078;\n                                \n                                x_79075 = defunc_1_op_res_79079;\n                                x_79076 = defunc_1_op_res_79080;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_79057)[sext_i32_i64(local_tid_79053)] =\n                                    x_79075;\n                                ((__local\n                                  double *) red_arr_mem_79059)[sext_i32_i64(local_tid_79053)] =\n                                    x_79076;\n                            }\n                        }\n                        skip_waves_79091 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_79053 == 0) {\n                            ((__global double *) mem_77504)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154] =\n                                x_79075;\n                            ((__global double *) mem_77508)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154] =\n                                x_79076;\n                        }\n                    }\n                }\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FEN",
                   "CE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_70148\n}\n__kernel void mainzisegred_large_72159(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *sync_arr_mem_79414_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79412_backing_aligned_1,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79410_backing_aligned_2,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79408_backing_aligned_3,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79406_backing_aligned_4,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79404_backing_aligned_5,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_72149,\n                                       int64_t groups_per_segment_79382,\n                                       int64_t elements_per_thread_79383,\n                                       int64_t virt_num_groups_79384,\n                                       int64_t threads_per_segment_79386,\n                                       __global unsigned char *mem_77642,\n                                       __global unsigned char *mem_77650,\n                                       __global unsigned char *mem_77674,\n                                       __global unsigned char *mem_77785,\n                                       __global unsigned char *mem_77789,\n                                   ",
                   "    __global unsigned char *mem_77794,\n                                       __global unsigned char *mem_77798,\n                                       __global unsigned char *mem_77802,\n                                       __global unsigned char *mem_77806,\n                                       __global unsigned char *mem_77810,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79387,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79389,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79391,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79393,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79395,\n                                       __global\n                                       unsigned char *mainzicounter_mem_79397)\n{\n    #define segred_group_sizze_72148 (mainzisegred_group_sizze_71073)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict sync_arr_mem_79414_backing_5 =\n                                   (__local volatile\n                                    unsigned char *) sync_arr_mem_79414_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_79412_backing_4 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79412_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_79410_backing_3 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79410_backing_aligned_2;\n    __local volatile unsigned char *restrict red_arr_mem_79408_backing_2 =\n                    ",
                   "               (__local volatile\n                                    unsigned char *) red_arr_mem_79408_backing_aligned_3;\n    __local volatile unsigned char *restrict red_arr_mem_79406_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79406_backing_aligned_4;\n    __local volatile unsigned char *restrict red_arr_mem_79404_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79404_backing_aligned_5;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79399;\n    int32_t local_tid_79400;\n    int64_t group_sizze_79403;\n    int32_t wave_sizze_79402;\n    int32_t group_tid_79401;\n    \n    global_tid_79399 = get_global_id(0);\n    local_tid_79400 = get_local_id(0);\n    group_sizze_79403 = get_local_size(0);\n    wave_sizze_79402 = LOCKSTEP_WIDTH;\n    group_tid_79401 = get_group_id(0);\n    \n    int32_t phys_tid_72159 = global_tid_79399;\n    __local unsigned char *red_arr_mem_79404;\n    \n    red_arr_mem_79404 = (__local unsigned char *) red_arr_mem_79404_backing_0;\n    \n    __local unsigned char *red_arr_mem_79406;\n    \n    red_arr_mem_79406 = (__local unsigned char *) red_arr_mem_79406_backing_1;\n    \n    __local unsigned char *red_arr_mem_79408;\n    \n    red_arr_mem_79408 = (__local unsigned char *) red_arr_mem_79408_backing_2;\n    \n    __local unsigned char *red_arr_mem_79410;\n    \n    red_arr_mem_79410 = (__local unsigned char *) red_arr_mem_79410_backing_3;\n    \n    __local unsigned char *red_arr_mem_79412;\n    \n    red_arr_mem_79412 = (__local unsigned char *) red_arr_mem_79412_backing_4;\n    \n    __local unsigned char *sync_arr_mem_79414;\n    \n    sync_arr_mem_79414 = (__local unsigned char *) sync_arr_mem_79414_backing_5;\n    \n    int32_t phys_group_id_79416;\n    \n    phys_group_id_79416 = get_group_id(0);\n    for (int32_t i_79417 = 0; i_79417 <\n         sdiv_up32(sext_i64_i32(virt_num_gro",
                   "ups_79384) - phys_group_id_79416,\n                   sext_i64_i32(num_groups_72149)); i_79417++) {\n        int32_t virt_group_id_79418 = phys_group_id_79416 + i_79417 *\n                sext_i64_i32(num_groups_72149);\n        int32_t flat_segment_id_79419 = squot32(virt_group_id_79418,\n                                                sext_i64_i32(groups_per_segment_79382));\n        int64_t global_tid_79420 = srem64(sext_i32_i64(virt_group_id_79418) *\n                                          segred_group_sizze_72148 +\n                                          sext_i32_i64(local_tid_79400),\n                                          segred_group_sizze_72148 *\n                                          groups_per_segment_79382);\n        int64_t slice_79421 = n_m_65386;\n        int64_t slice_79422 = m_65377 * slice_79421;\n        int64_t gtid_72156 = squot64(sext_i32_i64(flat_segment_id_79419),\n                                     slice_79421);\n        int64_t remnant_79423 = sext_i32_i64(flat_segment_id_79419) -\n                gtid_72156 * slice_79421;\n        int64_t gtid_72157 = remnant_79423;\n        int64_t remnant_79424 = remnant_79423 - gtid_72157;\n        int64_t gtid_72158;\n        double x_acc_79425;\n        double x_acc_79426;\n        double x_acc_79427;\n        double x_acc_79428;\n        double x_acc_79429;\n        int64_t chunk_sizze_79430 = smin64(elements_per_thread_79383,\n                                           sdiv_up64(q_65380 - global_tid_79420,\n                                                     threads_per_segment_79386));\n        double x_72160;\n        double x_72161;\n        double x_72162;\n        double x_72163;\n        double x_72164;\n        double x_72165;\n        double x_72166;\n        double x_72167;\n        double x_72168;\n        double x_72169;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_79425 = 0.0;\n            x_acc_79426 = 0.0;\n            x_acc_79427 = 0.0;\n            x_acc_79428 = 0.0;\n ",
                   "           x_acc_79429 = 0.0;\n        }\n        for (int64_t i_79446 = 0; i_79446 < chunk_sizze_79430; i_79446++) {\n            gtid_72158 = global_tid_79420 + threads_per_segment_79386 * i_79446;\n            // apply map function\n            {\n                int64_t last_res_72175;\n                \n                last_res_72175 = ((__global int64_t *) mem_77642)[gtid_72156 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74730 = mul64(jump_65382, gtid_72157);\n                int64_t index_primexp_74731 = smin64(i_65392, binop_y_74730);\n                double defunc_1_f_res_72183;\n                \n                defunc_1_f_res_72183 = ((__global\n                                         double *) mem_77789)[gtid_72156 *\n                                                              n_m_65386 +\n                                                              gtid_72157];\n                \n                double x_72185;\n                \n                x_72185 = ((__global double *) mem_77674)[gtid_72156 * q_65380 +\n                                                          gtid_72158];\n                \n                bool cond_72186 = sle64(last_res_72175, gtid_72158);\n                int64_t defunc_0_f_res_72187;\n                \n                if (cond_72186) {\n                    defunc_0_f_res_72187 = (int64_t) 0;\n                } else {\n                    int64_t max_res_72182;\n                    \n                    max_res_72182 = ((__global\n                                      int64_t *) mem_77785)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157];\n                    \n                    int64_t i_72188 = add64(gtid_72158, max_res_72182);\n                    int64_t defunc_0_add_arg_72189;\n         ",
                   "           \n                    defunc_0_add_arg_72189 = ((__global\n                                               int64_t *) mem_77650)[gtid_72156 *\n                                                                     n_65378 +\n                                                                     i_72188];\n                    \n                    int64_t defunc_1_add_res_72190 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_72189);\n                    \n                    defunc_0_f_res_72187 = defunc_1_add_res_72190;\n                }\n                \n                int64_t binop_p_72191 = sub64(defunc_0_f_res_72187,\n                                              index_primexp_74731);\n                double defunc_0_f_res_72192 = sitofp_i64_f64(binop_p_72191);\n                double abs_res_72193 = fabs(defunc_0_f_res_72192);\n                double tmp1_72194 = abs_res_72193 / defunc_1_f_res_72183;\n                double x_72195 = tmp1_72194 * tmp1_72194;\n                double y_72196 = tmp1_72194 * x_72195;\n                double tmp2_72197 = 1.0 - y_72196;\n                double x_72198 = tmp2_72197 * tmp2_72197;\n                double tmp3_72199 = tmp2_72197 * x_72198;\n                double w_j_72200 = x_72185 * tmp3_72199;\n                double xw_j_72201 = defunc_0_f_res_72192 * w_j_72200;\n                double x2w_j_72202 = defunc_0_f_res_72192 * xw_j_72201;\n                double x3w_j_72203 = defunc_0_f_res_72192 * x2w_j_72202;\n                double x4w_j_72204 = defunc_0_f_res_72192 * x3w_j_72203;\n                \n                // save map-out results\n                { }\n                // load accumulator\n                {\n                    x_72160 = x_acc_79425;\n                    x_72161 = x_acc_79426;\n                    x_72162 = x_acc_79427;\n                    x_72163 = x_acc_79428;\n                    x_72164 = x_acc_79429;\n                }\n                // load new values\n              ",
                   "  {\n                    x_72165 = w_j_72200;\n                    x_72166 = xw_j_72201;\n                    x_72167 = x2w_j_72202;\n                    x_72168 = x3w_j_72203;\n                    x_72169 = x4w_j_72204;\n                }\n                // apply reduction operator\n                {\n                    double defunc_1_op_res_72170 = x_72160 + x_72165;\n                    double defunc_1_op_res_72171 = x_72161 + x_72166;\n                    double defunc_1_op_res_72172 = x_72162 + x_72167;\n                    double defunc_1_op_res_72173 = x_72163 + x_72168;\n                    double defunc_1_op_res_72174 = x_72164 + x_72169;\n                    \n                    // store in accumulator\n                    {\n                        x_acc_79425 = defunc_1_op_res_72170;\n                        x_acc_79426 = defunc_1_op_res_72171;\n                        x_acc_79427 = defunc_1_op_res_72172;\n                        x_acc_79428 = defunc_1_op_res_72173;\n                        x_acc_79429 = defunc_1_op_res_72174;\n                    }\n                }\n            }\n        }\n        // to reduce current chunk, first store our result in memory\n        {\n            x_72160 = x_acc_79425;\n            x_72161 = x_acc_79426;\n            x_72162 = x_acc_79427;\n            x_72163 = x_acc_79428;\n            x_72164 = x_acc_79429;\n            ((__local\n              double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400)] =\n                x_72160;\n            ((__local\n              double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400)] =\n                x_72161;\n            ((__local\n              double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400)] =\n                x_72162;\n            ((__local\n              double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400)] =\n                x_72163;\n            ((__local\n              double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400)] =\n                x_72164;\n        }\n        barrier(CLK",
                   "_LOCAL_MEM_FENCE);\n        \n        int32_t offset_79447;\n        int32_t skip_waves_79448 = 1;\n        double x_79431;\n        double x_79432;\n        double x_79433;\n        double x_79434;\n        double x_79435;\n        double x_79436;\n        double x_79437;\n        double x_79438;\n        double x_79439;\n        double x_79440;\n        \n        offset_79447 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_79400,\n                      sext_i64_i32(segred_group_sizze_72148))) {\n                x_79431 = ((__local\n                            double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400 +\n                                                         offset_79447)];\n                x_79432 = ((__local\n                            double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400 +\n                                                         offset_79447)];\n                x_79433 = ((__local\n                            double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400 +\n                                                         offset_79447)];\n                x_79434 = ((__local\n                            double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400 +\n                                                         offset_79447)];\n                x_79435 = ((__local\n                            double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400 +\n                                                         offset_79447)];\n            }\n        }\n        offset_79447 = 1;\n        while (slt32(offset_79447, wave_sizze_79402)) {\n            if (slt32(local_tid_79400 + offset_79447,\n                      sext_i64_i32(segred_group_sizze_72148)) &&\n                ((local_tid_79400 - squot32(local_tid_79400, wave_sizze_79402) *\n                  wave_sizze_79402) & (2 * offset_79447 - 1)) == 0) {\n                // read array element\n                {\n                    x_79436 = ((volatile",
                   " __local\n                                double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                    x_79437 = ((volatile __local\n                                double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                    x_79438 = ((volatile __local\n                                double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                    x_79439 = ((volatile __local\n                                double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                    x_79440 = ((volatile __local\n                                double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79441 = x_79431 + x_79436;\n                    double defunc_1_op_res_79442 = x_79432 + x_79437;\n                    double defunc_1_op_res_79443 = x_79433 + x_79438;\n                    double defunc_1_op_res_79444 = x_79434 + x_79439;\n                    double defunc_1_op_res_79445 = x_79435 + x_79440;\n                    \n                    x_79431 = defunc_1_op_res_79441;\n                    x_79432 = defunc_1_op_res_79442;\n                    x_79433 = defunc_1_op_res_79443;\n                    x_79434 = defunc_1_op_res_79444;\n                    x_79435 = defunc_1_op_res_79445;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400)] =\n                        x_794",
                   "31;\n                    ((volatile __local\n                      double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400)] =\n                        x_79432;\n                    ((volatile __local\n                      double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400)] =\n                        x_79433;\n                    ((volatile __local\n                      double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400)] =\n                        x_79434;\n                    ((volatile __local\n                      double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400)] =\n                        x_79435;\n                }\n            }\n            offset_79447 *= 2;\n        }\n        while (slt32(skip_waves_79448,\n                     squot32(sext_i64_i32(segred_group_sizze_72148) +\n                             wave_sizze_79402 - 1, wave_sizze_79402))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_79447 = skip_waves_79448 * wave_sizze_79402;\n            if (slt32(local_tid_79400 + offset_79447,\n                      sext_i64_i32(segred_group_sizze_72148)) &&\n                ((local_tid_79400 - squot32(local_tid_79400, wave_sizze_79402) *\n                  wave_sizze_79402) == 0 && (squot32(local_tid_79400,\n                                                     wave_sizze_79402) & (2 *\n                                                                          skip_waves_79448 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_79436 = ((__local\n                                double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                    x_79437 = ((__local\n                                double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400 +\n                                                             offset_7",
                   "9447)];\n                    x_79438 = ((__local\n                                double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                    x_79439 = ((__local\n                                double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                    x_79440 = ((__local\n                                double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400 +\n                                                             offset_79447)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79441 = x_79431 + x_79436;\n                    double defunc_1_op_res_79442 = x_79432 + x_79437;\n                    double defunc_1_op_res_79443 = x_79433 + x_79438;\n                    double defunc_1_op_res_79444 = x_79434 + x_79439;\n                    double defunc_1_op_res_79445 = x_79435 + x_79440;\n                    \n                    x_79431 = defunc_1_op_res_79441;\n                    x_79432 = defunc_1_op_res_79442;\n                    x_79433 = defunc_1_op_res_79443;\n                    x_79434 = defunc_1_op_res_79444;\n                    x_79435 = defunc_1_op_res_79445;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400)] =\n                        x_79431;\n                    ((__local\n                      double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400)] =\n                        x_79432;\n                    ((__local\n                      double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400)] =\n                        x_79433;\n                    ((__local\n                      double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400)] =\n            ",
                   "            x_79434;\n                    ((__local\n                      double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400)] =\n                        x_79435;\n                }\n            }\n            skip_waves_79448 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_79400) == (int64_t) 0) {\n                x_acc_79425 = x_79431;\n                x_acc_79426 = x_79432;\n                x_acc_79427 = x_79433;\n                x_acc_79428 = x_79434;\n                x_acc_79429 = x_79435;\n            }\n        }\n        if (groups_per_segment_79382 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_79400 == 0) {\n                    ((__global double *) mem_77794)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79425;\n                    ((__global double *) mem_77798)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79426;\n                    ((__global double *) mem_77802)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79427;\n                    ((__global double *) mem_77806)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79428;\n                    ((__global double *) mem_77810)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79429;\n                }\n            }\n        } else {\n            int32_t old_counter_79449;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_79400 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_79387)[sext_i32_i64(virt_group_id_79418)] =\n                        x_acc_79425;\n                  ",
                   "  ((__global\n                      double *) segred_tmp_mem_79389)[sext_i32_i64(virt_group_id_79418)] =\n                        x_acc_79426;\n                    ((__global\n                      double *) segred_tmp_mem_79391)[sext_i32_i64(virt_group_id_79418)] =\n                        x_acc_79427;\n                    ((__global\n                      double *) segred_tmp_mem_79393)[sext_i32_i64(virt_group_id_79418)] =\n                        x_acc_79428;\n                    ((__global\n                      double *) segred_tmp_mem_79395)[sext_i32_i64(virt_group_id_79418)] =\n                        x_acc_79429;\n                    mem_fence_global();\n                    old_counter_79449 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79397)[sext_i32_i64(srem32(flat_segment_id_79419,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_79414)[(int64_t) 0] =\n                        old_counter_79449 == groups_per_segment_79382 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_79450;\n            \n            is_last_group_79450 = ((__local\n                                    bool *) sync_arr_mem_79414)[(int64_t) 0];\n            if (is_last_group_79450) {\n                if (local_tid_79400 == 0) {\n                    old_counter_79449 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79397)[sext_i32_i64(srem32(flat_segment_id_79419,\n                                                                                                     10240))],\n                                              (int) ((",
                   "int64_t) 0 -\n                                                     groups_per_segment_79382));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_79451 =\n                            sdiv_up64(groups_per_segment_79382,\n                                      segred_group_sizze_72148);\n                    \n                    x_72160 = 0.0;\n                    x_72161 = 0.0;\n                    x_72162 = 0.0;\n                    x_72163 = 0.0;\n                    x_72164 = 0.0;\n                    for (int64_t i_79452 = 0; i_79452 < read_per_thread_79451;\n                         i_79452++) {\n                        int64_t group_res_id_79453 =\n                                sext_i32_i64(local_tid_79400) *\n                                read_per_thread_79451 + i_79452;\n                        int64_t index_of_group_res_79454 =\n                                sext_i32_i64(flat_segment_id_79419) *\n                                groups_per_segment_79382 + group_res_id_79453;\n                        \n                        if (slt64(group_res_id_79453,\n                                  groups_per_segment_79382)) {\n                            x_72165 = ((__global\n                                        double *) segred_tmp_mem_79387)[index_of_group_res_79454];\n                            x_72166 = ((__global\n                                        double *) segred_tmp_mem_79389)[index_of_group_res_79454];\n                            x_72167 = ((__global\n                                        double *) segred_tmp_mem_79391)[index_of_group_res_79454];\n                            x_72168 = ((__global\n                                        double *) segred_tmp_mem_79393)[index_of_group_res_79454];\n                            x_72169 = ((__global\n                                        double *) segred_tmp_mem_79395)[index_of_group_res_79454];\n                            \n                          ",
                   "  double defunc_1_op_res_72170 = x_72160 + x_72165;\n                            double defunc_1_op_res_72171 = x_72161 + x_72166;\n                            double defunc_1_op_res_72172 = x_72162 + x_72167;\n                            double defunc_1_op_res_72173 = x_72163 + x_72168;\n                            double defunc_1_op_res_72174 = x_72164 + x_72169;\n                            \n                            x_72160 = defunc_1_op_res_72170;\n                            x_72161 = defunc_1_op_res_72171;\n                            x_72162 = defunc_1_op_res_72172;\n                            x_72163 = defunc_1_op_res_72173;\n                            x_72164 = defunc_1_op_res_72174;\n                        }\n                    }\n                }\n                ((__local\n                  double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400)] =\n                    x_72160;\n                ((__local\n                  double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400)] =\n                    x_72161;\n                ((__local\n                  double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400)] =\n                    x_72162;\n                ((__local\n                  double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400)] =\n                    x_72163;\n                ((__local\n                  double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400)] =\n                    x_72164;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_79455;\n                    int32_t skip_waves_79456 = 1;\n                    double x_79431;\n                    double x_79432;\n                    double x_79433;\n                    double x_79434;\n                    double x_79435;\n                    double x_79436;\n                    double x_79437;\n                    double x_79438;\n                    double x_79439;\n                    double x_7944",
                   "0;\n                    \n                    offset_79455 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_79400,\n                                  sext_i64_i32(segred_group_sizze_72148))) {\n                            x_79431 = ((__local\n                                        double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400 +\n                                                                     offset_79455)];\n                            x_79432 = ((__local\n                                        double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400 +\n                                                                     offset_79455)];\n                            x_79433 = ((__local\n                                        double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400 +\n                                                                     offset_79455)];\n                            x_79434 = ((__local\n                                        double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400 +\n                                                                     offset_79455)];\n                            x_79435 = ((__local\n                                        double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400 +\n                                                                     offset_79455)];\n                        }\n                    }\n                    offset_79455 = 1;\n                    while (slt32(offset_79455, wave_sizze_79402)) {\n                        if (slt32(local_tid_79400 + offset_79455,\n                                  sext_i64_i32(segred_group_sizze_72148)) &&\n                            ((local_tid_79400 - squot32(local_tid_79400,\n                                                        wave_sizze_79402) *\n                              wave_sizze_79402) & (2 * offset_79455 - 1)) ==\n                            0)",
                   " {\n                            // read array element\n                            {\n                                x_79436 = ((volatile __local\n                                            double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79437 = ((volatile __local\n                                            double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79438 = ((volatile __local\n                                            double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79439 = ((volatile __local\n                                            double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79440 = ((volatile __local\n                                            double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79441 = x_79431 +\n                                       x_79436;\n                                double defunc_1_op_res_79442 = x_79432 +\n                                       x_79437;\n                                double defunc_1_op_res_79443 = x_79433 +\n                                       x_79438;\n                                double defunc_1_op_res_79444 = x_79434 +\n                                       x_79439;\n                                double defunc_",
                   "1_op_res_79445 = x_79435 +\n                                       x_79440;\n                                \n                                x_79431 = defunc_1_op_res_79441;\n                                x_79432 = defunc_1_op_res_79442;\n                                x_79433 = defunc_1_op_res_79443;\n                                x_79434 = defunc_1_op_res_79444;\n                                x_79435 = defunc_1_op_res_79445;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400)] =\n                                    x_79431;\n                                ((volatile __local\n                                  double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400)] =\n                                    x_79432;\n                                ((volatile __local\n                                  double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400)] =\n                                    x_79433;\n                                ((volatile __local\n                                  double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400)] =\n                                    x_79434;\n                                ((volatile __local\n                                  double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400)] =\n                                    x_79435;\n                            }\n                        }\n                        offset_79455 *= 2;\n                    }\n                    while (slt32(skip_waves_79456,\n                                 squot32(sext_i64_i32(segred_group_sizze_72148) +\n                                         wave_sizze_79402 - 1,\n                                         wave_sizze_79402))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_79455 = skip_waves_79456 ",
                   "* wave_sizze_79402;\n                        if (slt32(local_tid_79400 + offset_79455,\n                                  sext_i64_i32(segred_group_sizze_72148)) &&\n                            ((local_tid_79400 - squot32(local_tid_79400,\n                                                        wave_sizze_79402) *\n                              wave_sizze_79402) == 0 &&\n                             (squot32(local_tid_79400, wave_sizze_79402) & (2 *\n                                                                            skip_waves_79456 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_79436 = ((__local\n                                            double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79437 = ((__local\n                                            double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79438 = ((__local\n                                            double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79439 = ((__local\n                                            double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                                x_79440 = ((__local\n                                            double *) red_arr_mem_79412)[sext_i32_i64(local_tid_79400 +\n                                                                         offset_79455)];\n                            }\n    ",
                   "                        // apply reduction operation\n                            {\n                                double defunc_1_op_res_79441 = x_79431 +\n                                       x_79436;\n                                double defunc_1_op_res_79442 = x_79432 +\n                                       x_79437;\n                                double defunc_1_op_res_79443 = x_79433 +\n                                       x_79438;\n                                double defunc_1_op_res_79444 = x_79434 +\n                                       x_79439;\n                                double defunc_1_op_res_79445 = x_79435 +\n                                       x_79440;\n                                \n                                x_79431 = defunc_1_op_res_79441;\n                                x_79432 = defunc_1_op_res_79442;\n                                x_79433 = defunc_1_op_res_79443;\n                                x_79434 = defunc_1_op_res_79444;\n                                x_79435 = defunc_1_op_res_79445;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_79404)[sext_i32_i64(local_tid_79400)] =\n                                    x_79431;\n                                ((__local\n                                  double *) red_arr_mem_79406)[sext_i32_i64(local_tid_79400)] =\n                                    x_79432;\n                                ((__local\n                                  double *) red_arr_mem_79408)[sext_i32_i64(local_tid_79400)] =\n                                    x_79433;\n                                ((__local\n                                  double *) red_arr_mem_79410)[sext_i32_i64(local_tid_79400)] =\n                                    x_79434;\n                                ((__local\n                                  double *) red_arr_mem_79412)[",
                   "sext_i32_i64(local_tid_79400)] =\n                                    x_79435;\n                            }\n                        }\n                        skip_waves_79456 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_79400 == 0) {\n                            ((__global double *) mem_77794)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79431;\n                            ((__global double *) mem_77798)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79432;\n                            ((__global double *) mem_77802)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79433;\n                            ((__global double *) mem_77806)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79434;\n                            ((__global double *) mem_77810)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79435;\n                        }\n                    }\n                }\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_72148\n}\n__kernel void mainzisegred_large_72258(__global int *global_failure,\n                                       __local volatile\n           ",
                   "                            int64_t *sync_arr_mem_79522_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79520_backing_aligned_1,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79518_backing_aligned_2,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_72251,\n                                       int64_t groups_per_segment_79502,\n                                       int64_t elements_per_thread_79503,\n                                       int64_t virt_num_groups_79504,\n                                       int64_t threads_per_segment_79506,\n                                       __global unsigned char *mem_77642,\n                                       __global unsigned char *mem_77646,\n                                       __global unsigned char *mem_77650,\n                                       __global unsigned char *mem_77674,\n                                       __global unsigned char *mem_77785,\n                                       __global unsigned char *mem_77789,\n                                       __global unsigned char *mem_77815,\n                                       __global unsigned char *mem_77819,\n                                       __global unsigned char *mem_77823,\n                                       __global unsigned char *mem_77827,\n                                       __global unsigned char *mem_77831,\n                                       __global unsigned char *mem_77836,\n                                       __global unsigned char *mem_77840,\n                                       __global\n                                       unsigned char ",
                   "*segred_tmp_mem_79507,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79509,\n                                       __global\n                                       unsigned char *mainzicounter_mem_79511)\n{\n    #define segred_group_sizze_72250 (mainzisegred_group_sizze_70946)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict sync_arr_mem_79522_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) sync_arr_mem_79522_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_79520_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79520_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_79518_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79518_backing_aligned_2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79513;\n    int32_t local_tid_79514;\n    int64_t group_sizze_79517;\n    int32_t wave_sizze_79516;\n    int32_t group_tid_79515;\n    \n    global_tid_79513 = get_global_id(0);\n    local_tid_79514 = get_local_id(0);\n    group_sizze_79517 = get_local_size(0);\n    wave_sizze_79516 = LOCKSTEP_WIDTH;\n    group_tid_79515 = get_group_id(0);\n    \n    int32_t phys_tid_72258 = global_tid_79513;\n    __local unsigned char *red_arr_mem_79518;\n    \n    red_arr_mem_79518 = (__local unsigned char *) red_arr_mem_79518_backing_0;\n    \n    __local unsigned char *red_arr_mem_79520;\n    \n    red_arr_mem_79520 = (__local unsigned char *) red_arr_mem_79520_backing_1;\n    \n    __local unsigned char *sync_arr_mem_79522;\n    \n    sync_arr_mem_79522 = (__local unsigned char *) sync_arr_mem_79522_backing_2;\n    \n    int32_t phys_group_id_79524;",
                   "\n    \n    phys_group_id_79524 = get_group_id(0);\n    for (int32_t i_79525 = 0; i_79525 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_79504) - phys_group_id_79524,\n                   sext_i64_i32(num_groups_72251)); i_79525++) {\n        int32_t virt_group_id_79526 = phys_group_id_79524 + i_79525 *\n                sext_i64_i32(num_groups_72251);\n        int32_t flat_segment_id_79527 = squot32(virt_group_id_79526,\n                                                sext_i64_i32(groups_per_segment_79502));\n        int64_t global_tid_79528 = srem64(sext_i32_i64(virt_group_id_79526) *\n                                          segred_group_sizze_72250 +\n                                          sext_i32_i64(local_tid_79514),\n                                          segred_group_sizze_72250 *\n                                          groups_per_segment_79502);\n        int64_t slice_79529 = n_m_65386;\n        int64_t slice_79530 = m_65377 * slice_79529;\n        int64_t gtid_72255 = squot64(sext_i32_i64(flat_segment_id_79527),\n                                     slice_79529);\n        int64_t remnant_79531 = sext_i32_i64(flat_segment_id_79527) -\n                gtid_72255 * slice_79529;\n        int64_t gtid_72256 = remnant_79531;\n        int64_t remnant_79532 = remnant_79531 - gtid_72256;\n        int64_t gtid_72257;\n        double x_acc_79533;\n        double x_acc_79534;\n        int64_t chunk_sizze_79535 = smin64(elements_per_thread_79503,\n                                           sdiv_up64(q_65380 - global_tid_79528,\n                                                     threads_per_segment_79506));\n        double x_72259;\n        double x_72260;\n        double x_72261;\n        double x_72262;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_79533 = 0.0;\n            x_acc_79534 = 0.0;\n        }\n        for (int64_t i_79542 = 0; i_79542 < chunk_sizze_79535; i_79542++) {\n            gtid_72257 = global_tid_79528 + threads_per_segment_79506 * ",
                   "i_79542;\n            // apply map function\n            {\n                int64_t last_res_72265;\n                \n                last_res_72265 = ((__global int64_t *) mem_77642)[gtid_72255 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74726 = mul64(jump_65382, gtid_72256);\n                int64_t index_primexp_74727 = smin64(i_65392, binop_y_74726);\n                int64_t max_res_72278;\n                \n                max_res_72278 = ((__global int64_t *) mem_77785)[gtid_72255 *\n                                                                 n_m_65386 +\n                                                                 gtid_72256];\n                \n                double defunc_1_f_res_72279;\n                \n                defunc_1_f_res_72279 = ((__global\n                                         double *) mem_77789)[gtid_72255 *\n                                                              n_m_65386 +\n                                                              gtid_72256];\n                \n                double a12_72280;\n                \n                a12_72280 = ((__global double *) mem_77815)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gtid_72256];\n                \n                double b12_72281;\n                \n                b12_72281 = ((__global double *) mem_77819)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gtid_72256];\n                \n                double c12_72282;\n                \n                c12_72282 = ((__global double *) mem_77823)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gt",
                   "id_72256];\n                \n                double b2_72283;\n                \n                b2_72283 = ((__global double *) mem_77827)[gtid_72255 *\n                                                           n_m_65386 +\n                                                           gtid_72256];\n                \n                double c2_72284;\n                \n                c2_72284 = ((__global double *) mem_77831)[gtid_72255 *\n                                                           n_m_65386 +\n                                                           gtid_72256];\n                \n                double x_72286;\n                \n                x_72286 = ((__global double *) mem_77674)[gtid_72255 * q_65380 +\n                                                          gtid_72257];\n                \n                bool cond_72287 = sle64(last_res_72265, gtid_72257);\n                int64_t defunc_0_f_res_72288;\n                \n                if (cond_72287) {\n                    defunc_0_f_res_72288 = (int64_t) 0;\n                } else {\n                    int64_t i_72289 = add64(gtid_72257, max_res_72278);\n                    int64_t defunc_0_add_arg_72290;\n                    \n                    defunc_0_add_arg_72290 = ((__global\n                                               int64_t *) mem_77650)[gtid_72255 *\n                                                                     n_65378 +\n                                                                     i_72289];\n                    \n                    int64_t defunc_1_add_res_72291 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_72290);\n                    \n                    defunc_0_f_res_72288 = defunc_1_add_res_72291;\n                }\n                \n                int64_t binop_p_72292 = sub64(defunc_0_f_res_72288,\n                                              index_primexp_74727);\n                double defunc_0_f_res_72293 = sitofp_i64_f64(binop",
                   "_p_72292);\n                double abs_res_72294 = fabs(defunc_0_f_res_72293);\n                double tmp1_72295 = abs_res_72294 / defunc_1_f_res_72279;\n                double x_72296 = tmp1_72295 * tmp1_72295;\n                double y_72297 = tmp1_72295 * x_72296;\n                double tmp2_72298 = 1.0 - y_72297;\n                double x_72299 = tmp2_72298 * tmp2_72298;\n                double tmp3_72300 = tmp2_72298 * x_72299;\n                double tmp4_72301 = x_72286 * tmp3_72300;\n                double defunc_1_f_res_72302 = defunc_0_f_res_72293 * tmp4_72301;\n                double defunc_1_f_res_72303 = defunc_0_f_res_72293 *\n                       defunc_1_f_res_72302;\n                double defunc_0_f_res_72304;\n                \n                if (cond_72287) {\n                    defunc_0_f_res_72304 = 0.0;\n                } else {\n                    int64_t i_72305 = add64(gtid_72257, max_res_72278);\n                    double defunc_0_add_arg_72306;\n                    \n                    defunc_0_add_arg_72306 = ((__global\n                                               double *) mem_77646)[gtid_72255 *\n                                                                    n_65378 +\n                                                                    i_72305];\n                    defunc_0_f_res_72304 = defunc_0_add_arg_72306;\n                }\n                \n                double x_72307 = a12_72280 * tmp4_72301;\n                double y_72308 = b12_72281 * defunc_1_f_res_72302;\n                double x_72309 = x_72307 + y_72308;\n                double y_72310 = c12_72282 * defunc_1_f_res_72303;\n                double x_72311 = x_72309 + y_72310;\n                double defunc_9_fit_fun_res_72312 = defunc_0_f_res_72304 *\n                       x_72311;\n                double x_72313 = b12_72281 * tmp4_72301;\n                double y_72314 = b2_72283 * defunc_1_f_res_72302;\n                double x_72315 = x_72313 + y_72314;\n                double y_72316",
                   " = c2_72284 * defunc_1_f_res_72303;\n                double x_72317 = x_72315 + y_72316;\n                double defunc_9_slope_fun_res_72318 = defunc_0_f_res_72304 *\n                       x_72317;\n                \n                // save map-out results\n                { }\n                // load accumulator\n                {\n                    x_72259 = x_acc_79533;\n                    x_72260 = x_acc_79534;\n                }\n                // load new values\n                {\n                    x_72261 = defunc_9_fit_fun_res_72312;\n                    x_72262 = defunc_9_slope_fun_res_72318;\n                }\n                // apply reduction operator\n                {\n                    double defunc_1_op_res_72263 = x_72259 + x_72261;\n                    double defunc_1_op_res_72264 = x_72260 + x_72262;\n                    \n                    // store in accumulator\n                    {\n                        x_acc_79533 = defunc_1_op_res_72263;\n                        x_acc_79534 = defunc_1_op_res_72264;\n                    }\n                }\n            }\n        }\n        // to reduce current chunk, first store our result in memory\n        {\n            x_72259 = x_acc_79533;\n            x_72260 = x_acc_79534;\n            ((__local\n              double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514)] =\n                x_72259;\n            ((__local\n              double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514)] =\n                x_72260;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_79543;\n        int32_t skip_waves_79544 = 1;\n        double x_79536;\n        double x_79537;\n        double x_79538;\n        double x_79539;\n        \n        offset_79543 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_79514,\n                      sext_i64_i32(segred_group_sizze_72250))) {\n                x_79536 = ((__local\n                            double *) red_arr",
                   "_mem_79518)[sext_i32_i64(local_tid_79514 +\n                                                         offset_79543)];\n                x_79537 = ((__local\n                            double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514 +\n                                                         offset_79543)];\n            }\n        }\n        offset_79543 = 1;\n        while (slt32(offset_79543, wave_sizze_79516)) {\n            if (slt32(local_tid_79514 + offset_79543,\n                      sext_i64_i32(segred_group_sizze_72250)) &&\n                ((local_tid_79514 - squot32(local_tid_79514, wave_sizze_79516) *\n                  wave_sizze_79516) & (2 * offset_79543 - 1)) == 0) {\n                // read array element\n                {\n                    x_79538 = ((volatile __local\n                                double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514 +\n                                                             offset_79543)];\n                    x_79539 = ((volatile __local\n                                double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514 +\n                                                             offset_79543)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79540 = x_79536 + x_79538;\n                    double defunc_1_op_res_79541 = x_79537 + x_79539;\n                    \n                    x_79536 = defunc_1_op_res_79540;\n                    x_79537 = defunc_1_op_res_79541;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514)] =\n                        x_79536;\n                    ((volatile __local\n                      double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514)] =\n                        x_79537;\n                }\n            }\n            offset_79543 *= 2;\n        }\n     ",
                   "   while (slt32(skip_waves_79544,\n                     squot32(sext_i64_i32(segred_group_sizze_72250) +\n                             wave_sizze_79516 - 1, wave_sizze_79516))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_79543 = skip_waves_79544 * wave_sizze_79516;\n            if (slt32(local_tid_79514 + offset_79543,\n                      sext_i64_i32(segred_group_sizze_72250)) &&\n                ((local_tid_79514 - squot32(local_tid_79514, wave_sizze_79516) *\n                  wave_sizze_79516) == 0 && (squot32(local_tid_79514,\n                                                     wave_sizze_79516) & (2 *\n                                                                          skip_waves_79544 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_79538 = ((__local\n                                double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514 +\n                                                             offset_79543)];\n                    x_79539 = ((__local\n                                double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514 +\n                                                             offset_79543)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79540 = x_79536 + x_79538;\n                    double defunc_1_op_res_79541 = x_79537 + x_79539;\n                    \n                    x_79536 = defunc_1_op_res_79540;\n                    x_79537 = defunc_1_op_res_79541;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514)] =\n                        x_79536;\n                    ((__local\n                      double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514)] =\n        ",
                   "                x_79537;\n                }\n            }\n            skip_waves_79544 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_79514) == (int64_t) 0) {\n                x_acc_79533 = x_79536;\n                x_acc_79534 = x_79537;\n            }\n        }\n        if (groups_per_segment_79502 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_79514 == 0) {\n                    ((__global double *) mem_77836)[gtid_72255 * n_m_65386 +\n                                                    gtid_72256] = x_acc_79533;\n                    ((__global double *) mem_77840)[gtid_72255 * n_m_65386 +\n                                                    gtid_72256] = x_acc_79534;\n                }\n            }\n        } else {\n            int32_t old_counter_79545;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_79514 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_79507)[sext_i32_i64(virt_group_id_79526)] =\n                        x_acc_79533;\n                    ((__global\n                      double *) segred_tmp_mem_79509)[sext_i32_i64(virt_group_id_79526)] =\n                        x_acc_79534;\n                    mem_fence_global();\n                    old_counter_79545 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79511)[sext_i32_i64(srem32(flat_segment_id_79527,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_79522)[(int64_t) 0] =\n                        old_counter_79545 == groups_per_segment_79502 -\n    ",
                   "                    (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_79546;\n            \n            is_last_group_79546 = ((__local\n                                    bool *) sync_arr_mem_79522)[(int64_t) 0];\n            if (is_last_group_79546) {\n                if (local_tid_79514 == 0) {\n                    old_counter_79545 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79511)[sext_i32_i64(srem32(flat_segment_id_79527,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_79502));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_79547 =\n                            sdiv_up64(groups_per_segment_79502,\n                                      segred_group_sizze_72250);\n                    \n                    x_72259 = 0.0;\n                    x_72260 = 0.0;\n                    for (int64_t i_79548 = 0; i_79548 < read_per_thread_79547;\n                         i_79548++) {\n                        int64_t group_res_id_79549 =\n                                sext_i32_i64(local_tid_79514) *\n                                read_per_thread_79547 + i_79548;\n                        int64_t index_of_group_res_79550 =\n                                sext_i32_i64(flat_segment_id_79527) *\n                                groups_per_segment_79502 + group_res_id_79549;\n                        \n                        if (slt64(group_res_id_79549,\n                                  groups_per_segment_79502)) {\n                            x_72261 = ((__global\n                                        double *) segred",
                   "_tmp_mem_79507)[index_of_group_res_79550];\n                            x_72262 = ((__global\n                                        double *) segred_tmp_mem_79509)[index_of_group_res_79550];\n                            \n                            double defunc_1_op_res_72263 = x_72259 + x_72261;\n                            double defunc_1_op_res_72264 = x_72260 + x_72262;\n                            \n                            x_72259 = defunc_1_op_res_72263;\n                            x_72260 = defunc_1_op_res_72264;\n                        }\n                    }\n                }\n                ((__local\n                  double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514)] =\n                    x_72259;\n                ((__local\n                  double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514)] =\n                    x_72260;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_79551;\n                    int32_t skip_waves_79552 = 1;\n                    double x_79536;\n                    double x_79537;\n                    double x_79538;\n                    double x_79539;\n                    \n                    offset_79551 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_79514,\n                                  sext_i64_i32(segred_group_sizze_72250))) {\n                            x_79536 = ((__local\n                                        double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514 +\n                                                                     offset_79551)];\n                            x_79537 = ((__local\n                                        double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514 +\n                                                                     offset_79551)];\n                        }\n                  ",
                   "  }\n                    offset_79551 = 1;\n                    while (slt32(offset_79551, wave_sizze_79516)) {\n                        if (slt32(local_tid_79514 + offset_79551,\n                                  sext_i64_i32(segred_group_sizze_72250)) &&\n                            ((local_tid_79514 - squot32(local_tid_79514,\n                                                        wave_sizze_79516) *\n                              wave_sizze_79516) & (2 * offset_79551 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_79538 = ((volatile __local\n                                            double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514 +\n                                                                         offset_79551)];\n                                x_79539 = ((volatile __local\n                                            double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514 +\n                                                                         offset_79551)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79540 = x_79536 +\n                                       x_79538;\n                                double defunc_1_op_res_79541 = x_79537 +\n                                       x_79539;\n                                \n                                x_79536 = defunc_1_op_res_79540;\n                                x_79537 = defunc_1_op_res_79541;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514)] =\n                                    x_79536;\n                                ((volatile __local\n                  ",
                   "                double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514)] =\n                                    x_79537;\n                            }\n                        }\n                        offset_79551 *= 2;\n                    }\n                    while (slt32(skip_waves_79552,\n                                 squot32(sext_i64_i32(segred_group_sizze_72250) +\n                                         wave_sizze_79516 - 1,\n                                         wave_sizze_79516))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_79551 = skip_waves_79552 * wave_sizze_79516;\n                        if (slt32(local_tid_79514 + offset_79551,\n                                  sext_i64_i32(segred_group_sizze_72250)) &&\n                            ((local_tid_79514 - squot32(local_tid_79514,\n                                                        wave_sizze_79516) *\n                              wave_sizze_79516) == 0 &&\n                             (squot32(local_tid_79514, wave_sizze_79516) & (2 *\n                                                                            skip_waves_79552 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_79538 = ((__local\n                                            double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514 +\n                                                                         offset_79551)];\n                                x_79539 = ((__local\n                                            double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514 +\n                                                                         offset_79551)];\n                            }\n                            // apply reduction operation\n                            {\n                                double ",
                   "defunc_1_op_res_79540 = x_79536 +\n                                       x_79538;\n                                double defunc_1_op_res_79541 = x_79537 +\n                                       x_79539;\n                                \n                                x_79536 = defunc_1_op_res_79540;\n                                x_79537 = defunc_1_op_res_79541;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_79518)[sext_i32_i64(local_tid_79514)] =\n                                    x_79536;\n                                ((__local\n                                  double *) red_arr_mem_79520)[sext_i32_i64(local_tid_79514)] =\n                                    x_79537;\n                            }\n                        }\n                        skip_waves_79552 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_79514 == 0) {\n                            ((__global double *) mem_77836)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gtid_72256] =\n                                x_79536;\n                            ((__global double *) mem_77840)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gtid_72256] =\n                                x_79537;\n                        }\n                    }\n                }\n            }\n        }\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_72250\n}\n__kernel void mainzisegred_small_68263(__global int *global_failure,\n                                       __local volatile\n                    ",
                   "                   int64_t *red_arr_mem_78530_backing_aligned_0,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_68257,\n                                       int64_t segment_sizze_nonzzero_78523,\n                                       __global unsigned char *mem_77116,\n                                       __global unsigned char *mem_77124,\n                                       __global unsigned char *mem_77148,\n                                       __global unsigned char *mem_77204,\n                                       __global unsigned char *mem_77208,\n                                       __global unsigned char *mem_77213)\n{\n    #define segred_group_sizze_68256 (mainzisegred_group_sizze_67336)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_78530_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78530_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78525;\n    int32_t local_tid_78526;\n    int64_t group_sizze_78529;\n    int32_t wave_sizze_78528;\n    int32_t group_tid_78527;\n    \n    global_tid_78525 = get_global_id(0);\n    local_tid_78526 = get_local_id(0);\n    group_sizze_78529 = get_local_size(0);\n    wave_sizze_78528 = LOCKSTEP_WIDTH;\n    group_tid_78527 = get_group_id(0);\n    \n    int32_t phys_tid_68263 = global_tid_78525;\n    __local unsigned char *red_arr_mem_78530;\n    \n    red_arr_mem_78530 = (__local unsigned char *) red_arr_mem_78530_backing_0;\n    \n    int32_t phys_group_id_78532;\n    \n    phys_group_id_78532 = get_group_id(0);\n    for (int32_t i_78533 = 0; i_78533 <\n         sdiv_up32(se",
                   "xt_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_68256,\n                                                  segment_sizze_nonzzero_78523))) -\n                   phys_group_id_78532, sext_i64_i32(num_groups_68257));\n         i_78533++) {\n        int32_t virt_group_id_78534 = phys_group_id_78532 + i_78533 *\n                sext_i64_i32(num_groups_68257);\n        int64_t slice_78535 = n_m_65386;\n        int64_t slice_78536 = m_65377 * slice_78535;\n        int64_t gtid_68260 = squot64(squot64(sext_i32_i64(local_tid_78526),\n                                             segment_sizze_nonzzero_78523) +\n                                     sext_i32_i64(virt_group_id_78534) *\n                                     squot64(segred_group_sizze_68256,\n                                             segment_sizze_nonzzero_78523),\n                                     slice_78535);\n        int64_t remnant_78537 = squot64(sext_i32_i64(local_tid_78526),\n                                        segment_sizze_nonzzero_78523) +\n                sext_i32_i64(virt_group_id_78534) *\n                squot64(segred_group_sizze_68256,\n                        segment_sizze_nonzzero_78523) - gtid_68260 *\n                slice_78535;\n        int64_t gtid_68261 = remnant_78537;\n        int64_t remnant_78538 = remnant_78537 - gtid_68261;\n        int64_t gtid_68262 = srem64(sext_i32_i64(local_tid_78526), q_65380);\n        \n        // apply map function if in bounds\n        {\n            if (slt64((int64_t) 0, q_65380) && ((slt64(gtid_68260, m_65377) &&\n                                                 slt64(gtid_68261,\n                                                       n_m_65386)) &&\n                                                slt64(sext_i32_i64(local_tid_78526),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_68256,\n                            ",
                   "                                  segment_sizze_nonzzero_78523)))) {\n                int64_t last_res_68267;\n                \n                last_res_68267 = ((__global int64_t *) mem_77116)[gtid_68260 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74714 = mul64(jump_65382, gtid_68261);\n                int64_t index_primexp_74715 = smin64(i_65392, binop_y_74714);\n                double defunc_1_f_res_68275;\n                \n                defunc_1_f_res_68275 = ((__global\n                                         double *) mem_77208)[gtid_68260 *\n                                                              n_m_65386 +\n                                                              gtid_68261];\n                \n                double x_68277;\n                \n                x_68277 = ((__global double *) mem_77148)[gtid_68260 * q_65380 +\n                                                          gtid_68262];\n                \n                bool cond_68278 = sle64(last_res_68267, gtid_68262);\n                int64_t defunc_0_f_res_68279;\n                \n                if (cond_68278) {\n                    defunc_0_f_res_68279 = (int64_t) 0;\n                } else {\n                    int64_t max_res_68274;\n                    \n                    max_res_68274 = ((__global\n                                      int64_t *) mem_77204)[gtid_68260 *\n                                                            n_m_65386 +\n                                                            gtid_68261];\n                    \n                    int64_t i_68280 = add64(gtid_68262, max_res_68274);\n                    int64_t defunc_0_add_arg_68281;\n                    \n                    defunc_0_add_arg_68281 = ((__global\n                                               int64_t *) mem_77124)[gtid_68260 *\n                          ",
                   "                                           n_65378 +\n                                                                     i_68280];\n                    \n                    int64_t defunc_1_add_res_68282 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_68281);\n                    \n                    defunc_0_f_res_68279 = defunc_1_add_res_68282;\n                }\n                \n                int64_t binop_p_68283 = sub64(defunc_0_f_res_68279,\n                                              index_primexp_74715);\n                double defunc_0_f_res_68284 = sitofp_i64_f64(binop_p_68283);\n                double abs_res_68285 = fabs(defunc_0_f_res_68284);\n                double tmp1_68286 = abs_res_68285 / defunc_1_f_res_68275;\n                double x_68287 = tmp1_68286 * tmp1_68286;\n                double y_68288 = tmp1_68286 * x_68287;\n                double tmp2_68289 = 1.0 - y_68288;\n                double x_68290 = tmp2_68289 * tmp2_68289;\n                double tmp3_68291 = tmp2_68289 * x_68290;\n                double w_j_68292 = x_68277 * tmp3_68291;\n                \n                // save map-out results\n                { }\n                // save results to be reduced\n                {\n                    ((__local\n                      double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)] =\n                        w_j_68292;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)] =\n                    0.0;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (slt64((int64_t) 0, q_65380)) {\n            // perform segmented scan to imitate reduction\n            {\n                double x_68264;\n                double x_68265;\n                double x_78539;\n                double x_78540;\n                bool ltid_in_bounds_78542 = slt64(sext_i32_i64(local_tid_78526),\n                              ",
                   "                    q_65380 *\n                                                  squot64(segred_group_sizze_68256,\n                                                          segment_sizze_nonzzero_78523));\n                int32_t skip_threads_78543;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_78542) {\n                        x_68265 = ((volatile __local\n                                    double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)];\n                        if ((local_tid_78526 - squot32(local_tid_78526, 32) *\n                             32) == 0) {\n                            x_68264 = x_68265;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_78543 = 1;\n                    while (slt32(skip_threads_78543, 32)) {\n                        bool thread_active_78544 = sle32(skip_threads_78543,\n                                                         local_tid_78526 -\n                                                         squot32(local_tid_78526,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_78542;\n                        \n                        if (thread_active_78544) {\n                            // read operands\n                            {\n                                x_68264 = ((volatile __local\n                                            double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526) -\n                                                                         sext_i32_i64(skip_threads_78543)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_78545 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78526),\n           ",
                   "                                   q_65380),\n                                       sext_i32_i64(local_tid_78526) -\n                                       sext_i32_i64(local_tid_78526 -\n                                       skip_threads_78543));\n                            \n                            if (thread_active_78544 && inactive_78545) {\n                                x_68264 = x_68265;\n                            }\n                            if (thread_active_78544) {\n                                if (!inactive_78545) {\n                                    double defunc_1_op_res_68266 = x_68264 +\n                                           x_68265;\n                                    \n                                    x_68264 = defunc_1_op_res_68266;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_78528, skip_threads_78543)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_78544) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)] =\n                                    x_68264;\n                                x_68265 = x_68264;\n                            }\n                        }\n                        if (sle32(wave_sizze_78528, skip_threads_78543)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_78543 *= 2;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // last thread of block 'i' writes its result to offset 'i'\n                {\n                    if ((local_tid_78526 - squot32(local_tid_78526, 32) * 32) ==\n                        31 && ltid_in_bounds_78542) {\n                        ((vol",
                   "atile __local\n                          double *) red_arr_mem_78530)[sext_i32_i64(squot32(local_tid_78526,\n                                                                            32))] =\n                            x_68264;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n                {\n                    int32_t skip_threads_78546;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_78526, 32) == 0 &&\n                            ltid_in_bounds_78542) {\n                            x_78540 = ((volatile __local\n                                        double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)];\n                            if ((local_tid_78526 - squot32(local_tid_78526,\n                                                           32) * 32) == 0) {\n                                x_78539 = x_78540;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_78546 = 1;\n                        while (slt32(skip_threads_78546, 32)) {\n                            bool thread_active_78547 = sle32(skip_threads_78546,\n                                                             local_tid_78526 -\n                                                             squot32(local_tid_78526,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_78526, 32) == 0 &&\n                                  ltid_in_bounds_78542);\n                            \n                            if (thread_active_78547) {\n                                // read operands\n                  ",
                   "              {\n                                    x_78539 = ((volatile __local\n                                                double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526) -\n                                                                             sext_i32_i64(skip_threads_78546)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_78548 =\n                                     slt64(srem64(sext_i32_i64(local_tid_78526 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_78526 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_78526 -\n                                                         skip_threads_78546) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_78547 && inactive_78548) {\n                                    x_78539 = x_78540;\n                                }\n                                if (thread_active_78547) {\n                                    if (!inactive_78548) {\n                                        double defunc_1_op_res_78541 = x_78539 +\n                                               x_78540;\n                                        \n                                        x_78539 = defunc_1_op_res_78541;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_78528, skip_threads_78546)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_78547) {\n                                // write result\n                                {\n                        ",
                   "            ((volatile __local\n                                      double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)] =\n                                        x_78539;\n                                    x_78540 = x_78539;\n                                }\n                            }\n                            if (sle32(wave_sizze_78528, skip_threads_78546)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_78546 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_78549 = squot32(local_tid_78526, 32) == 0 ||\n                     !ltid_in_bounds_78542;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_78549) {\n                            x_68265 = x_68264;\n                            x_68264 = ((__local\n                                        double *) red_arr_mem_78530)[sext_i32_i64(squot32(local_tid_78526,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78550 =\n                             slt64(srem64(sext_i32_i64(local_tid_78526),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_78526) -\n                                   sext_i32_i64(squot32(local_tid_78526, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_78549) {\n                            if (inactive_78550) {\n                                x_68264 =",
                   " x_68265;\n                            }\n                        }\n                        if (!no_carry_in_78549) {\n                            if (!inactive_78550) {\n                                double defunc_1_op_res_68266 = x_68264 +\n                                       x_68265;\n                                \n                                x_68264 = defunc_1_op_res_68266;\n                            }\n                        }\n                    }\n                    // write final result\n                    {\n                        if (!no_carry_in_78549) {\n                            ((__local\n                              double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)] =\n                                x_68264;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // restore correct values for first block\n                {\n                    if (squot32(local_tid_78526, 32) == 0 &&\n                        ltid_in_bounds_78542) {\n                        ((__local\n                          double *) red_arr_mem_78530)[sext_i32_i64(local_tid_78526)] =\n                            x_68265;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // save final values of segments\n        {\n            if (slt64(sext_i32_i64(virt_group_id_78534) *\n                      squot64(segred_group_sizze_68256,\n                              segment_sizze_nonzzero_78523) +\n                      sext_i32_i64(local_tid_78526), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_78526),\n                      squot64(segred_group_sizze_68256,\n                              segment_sizze_nonzzero_78523))) {\n                double tmp_78551;\n                \n                tmp_78551 = ((__local\n                              double *) red_arr_mem_78530)[(sext_i32_i64(local_ti",
                   "d_78526) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78523 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77213)[squot64(sext_i32_i64(virt_group_id_78534) *\n                                               squot64(segred_group_sizze_68256,\n                                                       segment_sizze_nonzzero_78523) +\n                                               sext_i32_i64(local_tid_78526),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78534) *\n                                        squot64(segred_group_sizze_68256,\n                                                segment_sizze_nonzzero_78523) +\n                                        sext_i32_i64(local_tid_78526) -\n                                        squot64(sext_i32_i64(virt_group_id_78534) *\n                                                squot64(segred_group_sizze_68256,\n                                                        segment_sizze_nonzzero_78523) +\n                                                sext_i32_i64(local_tid_78526),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_78551;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_68256\n}\n__kernel void mainzisegred_small_68313(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78612_backing_aligned_0,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                            ",
                   "           int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_68307,\n                                       int64_t segment_sizze_nonzzero_78605,\n                                       __global unsigned char *mem_77116,\n                                       __global unsigned char *mem_77120,\n                                       __global unsigned char *mem_77124,\n                                       __global unsigned char *mem_77148,\n                                       __global unsigned char *mem_77204,\n                                       __global unsigned char *mem_77208,\n                                       __global unsigned char *mem_77218,\n                                       __global unsigned char *mem_77223)\n{\n    #define segred_group_sizze_68306 (mainzisegred_group_sizze_67268)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_78612_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78612_backing_aligned_0;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78607;\n    int32_t local_tid_78608;\n    int64_t group_sizze_78611;\n    int32_t wave_sizze_78610;\n    int32_t group_tid_78609;\n    \n    global_tid_78607 = get_global_id(0);\n    local_tid_78608 = get_local_id(0);\n    group_sizze_78611 = get_local_size(0);\n    wave_sizze_78610 = LOCKSTEP_WIDTH;\n    group_tid_78609 = get_group_id(0);\n    \n    int32_t phys_tid_68313 = global_tid_78607;\n    __local unsigned char *red_arr_mem_78612;\n    \n    red_arr_mem_78612 = (__local unsigned char *) red_arr_mem_78612_backing_0;\n    \n    int32_t phys_group_id_78614;\n    \n    phys_group_id_78614 = get_group_id(0);\n    for (int32_t i_78615 = 0; i_78615 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(se",
                   "gred_group_sizze_68306,\n                                                  segment_sizze_nonzzero_78605))) -\n                   phys_group_id_78614, sext_i64_i32(num_groups_68307));\n         i_78615++) {\n        int32_t virt_group_id_78616 = phys_group_id_78614 + i_78615 *\n                sext_i64_i32(num_groups_68307);\n        int64_t slice_78617 = n_m_65386;\n        int64_t slice_78618 = m_65377 * slice_78617;\n        int64_t gtid_68310 = squot64(squot64(sext_i32_i64(local_tid_78608),\n                                             segment_sizze_nonzzero_78605) +\n                                     sext_i32_i64(virt_group_id_78616) *\n                                     squot64(segred_group_sizze_68306,\n                                             segment_sizze_nonzzero_78605),\n                                     slice_78617);\n        int64_t remnant_78619 = squot64(sext_i32_i64(local_tid_78608),\n                                        segment_sizze_nonzzero_78605) +\n                sext_i32_i64(virt_group_id_78616) *\n                squot64(segred_group_sizze_68306,\n                        segment_sizze_nonzzero_78605) - gtid_68310 *\n                slice_78617;\n        int64_t gtid_68311 = remnant_78619;\n        int64_t remnant_78620 = remnant_78619 - gtid_68311;\n        int64_t gtid_68312 = srem64(sext_i32_i64(local_tid_78608), q_65380);\n        \n        // apply map function if in bounds\n        {\n            if (slt64((int64_t) 0, q_65380) && ((slt64(gtid_68310, m_65377) &&\n                                                 slt64(gtid_68311,\n                                                       n_m_65386)) &&\n                                                slt64(sext_i32_i64(local_tid_78608),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_68306,\n                                                              segment_sizze_nonzzero_78605)))) {\n                int64_t l",
                   "ast_res_68317;\n                \n                last_res_68317 = ((__global int64_t *) mem_77116)[gtid_68310 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74710 = mul64(jump_65382, gtid_68311);\n                int64_t index_primexp_74711 = smin64(i_65392, binop_y_74710);\n                int64_t max_res_68326;\n                \n                max_res_68326 = ((__global int64_t *) mem_77204)[gtid_68310 *\n                                                                 n_m_65386 +\n                                                                 gtid_68311];\n                \n                double defunc_1_f_res_68327;\n                \n                defunc_1_f_res_68327 = ((__global\n                                         double *) mem_77208)[gtid_68310 *\n                                                              n_m_65386 +\n                                                              gtid_68311];\n                \n                double a0_68328;\n                \n                a0_68328 = ((__global double *) mem_77218)[gtid_68310 *\n                                                           n_m_65386 +\n                                                           gtid_68311];\n                \n                double x_68330;\n                \n                x_68330 = ((__global double *) mem_77148)[gtid_68310 * q_65380 +\n                                                          gtid_68312];\n                \n                bool cond_68331 = sle64(last_res_68317, gtid_68312);\n                int64_t defunc_0_f_res_68332;\n                \n                if (cond_68331) {\n                    defunc_0_f_res_68332 = (int64_t) 0;\n                } else {\n                    int64_t i_68333 = add64(gtid_68312, max_res_68326);\n                    int64_t defunc_0_add_arg_68334;\n                    \n                    ",
                   "defunc_0_add_arg_68334 = ((__global\n                                               int64_t *) mem_77124)[gtid_68310 *\n                                                                     n_65378 +\n                                                                     i_68333];\n                    \n                    int64_t defunc_1_add_res_68335 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_68334);\n                    \n                    defunc_0_f_res_68332 = defunc_1_add_res_68335;\n                }\n                \n                int64_t binop_p_68336 = sub64(defunc_0_f_res_68332,\n                                              index_primexp_74711);\n                double defunc_0_f_res_68337 = sitofp_i64_f64(binop_p_68336);\n                double abs_res_68338 = fabs(defunc_0_f_res_68337);\n                double tmp1_68339 = abs_res_68338 / defunc_1_f_res_68327;\n                double x_68340 = tmp1_68339 * tmp1_68339;\n                double y_68341 = tmp1_68339 * x_68340;\n                double tmp2_68342 = 1.0 - y_68341;\n                double x_68343 = tmp2_68342 * tmp2_68342;\n                double tmp3_68344 = tmp2_68342 * x_68343;\n                double tmp4_68345 = x_68330 * tmp3_68344;\n                double defunc_0_f_res_68346;\n                \n                if (cond_68331) {\n                    defunc_0_f_res_68346 = 0.0;\n                } else {\n                    int64_t i_68347 = add64(gtid_68312, max_res_68326);\n                    double defunc_0_add_arg_68348;\n                    \n                    defunc_0_add_arg_68348 = ((__global\n                                               double *) mem_77120)[gtid_68310 *\n                                                                    n_65378 +\n                                                                    i_68347];\n                    defunc_0_f_res_68346 = defunc_0_add_arg_68348;\n                }\n                \n                double x",
                   "_68349 = a0_68328 * tmp4_68345;\n                double defunc_9_fit_fun_res_68350 = defunc_0_f_res_68346 *\n                       x_68349;\n                \n                // save map-out results\n                { }\n                // save results to be reduced\n                {\n                    ((__local\n                      double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)] =\n                        defunc_9_fit_fun_res_68350;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)] =\n                    0.0;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (slt64((int64_t) 0, q_65380)) {\n            // perform segmented scan to imitate reduction\n            {\n                double x_68314;\n                double x_68315;\n                double x_78621;\n                double x_78622;\n                bool ltid_in_bounds_78624 = slt64(sext_i32_i64(local_tid_78608),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_68306,\n                                                          segment_sizze_nonzzero_78605));\n                int32_t skip_threads_78625;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_78624) {\n                        x_68315 = ((volatile __local\n                                    double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)];\n                        if ((local_tid_78608 - squot32(local_tid_78608, 32) *\n                             32) == 0) {\n                            x_68314 = x_68315;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_78625 = 1;\n                    while (slt32(skip_threads_78625, 32)) {\n                    ",
                   "    bool thread_active_78626 = sle32(skip_threads_78625,\n                                                         local_tid_78608 -\n                                                         squot32(local_tid_78608,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_78624;\n                        \n                        if (thread_active_78626) {\n                            // read operands\n                            {\n                                x_68314 = ((volatile __local\n                                            double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608) -\n                                                                         sext_i32_i64(skip_threads_78625)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_78627 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78608),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_78608) -\n                                       sext_i32_i64(local_tid_78608 -\n                                       skip_threads_78625));\n                            \n                            if (thread_active_78626 && inactive_78627) {\n                                x_68314 = x_68315;\n                            }\n                            if (thread_active_78626) {\n                                if (!inactive_78627) {\n                                    double defunc_1_op_res_68316 = x_68314 +\n                                           x_68315;\n                                    \n                                    x_68314 = defunc_1_op_res_68316;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_78610, skip_threads_78625)) {\n                           ",
                   " barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_78626) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)] =\n                                    x_68314;\n                                x_68315 = x_68314;\n                            }\n                        }\n                        if (sle32(wave_sizze_78610, skip_threads_78625)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_78625 *= 2;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // last thread of block 'i' writes its result to offset 'i'\n                {\n                    if ((local_tid_78608 - squot32(local_tid_78608, 32) * 32) ==\n                        31 && ltid_in_bounds_78624) {\n                        ((volatile __local\n                          double *) red_arr_mem_78612)[sext_i32_i64(squot32(local_tid_78608,\n                                                                            32))] =\n                            x_68314;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n                {\n                    int32_t skip_threads_78628;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_78608, 32) == 0 &&\n                            ltid_in_bounds_78624) {\n                            x_78622 = ((volatile __local\n                                        double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)];\n                            if ((local_tid_78608 - squot32(local_tid_78608,\n                                           ",
                   "                32) * 32) == 0) {\n                                x_78621 = x_78622;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_78628 = 1;\n                        while (slt32(skip_threads_78628, 32)) {\n                            bool thread_active_78629 = sle32(skip_threads_78628,\n                                                             local_tid_78608 -\n                                                             squot32(local_tid_78608,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_78608, 32) == 0 &&\n                                  ltid_in_bounds_78624);\n                            \n                            if (thread_active_78629) {\n                                // read operands\n                                {\n                                    x_78621 = ((volatile __local\n                                                double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608) -\n                                                                             sext_i32_i64(skip_threads_78628)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_78630 =\n                                     slt64(srem64(sext_i32_i64(local_tid_78608 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_78608 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_78608 -\n                                                         skip_threads_78628) *\n                           ",
                   "                32 + 32 - 1));\n                                \n                                if (thread_active_78629 && inactive_78630) {\n                                    x_78621 = x_78622;\n                                }\n                                if (thread_active_78629) {\n                                    if (!inactive_78630) {\n                                        double defunc_1_op_res_78623 = x_78621 +\n                                               x_78622;\n                                        \n                                        x_78621 = defunc_1_op_res_78623;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_78610, skip_threads_78628)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_78629) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)] =\n                                        x_78621;\n                                    x_78622 = x_78621;\n                                }\n                            }\n                            if (sle32(wave_sizze_78610, skip_threads_78628)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_78628 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_78631 = squot32(local_tid_78608, 32) == 0 ||\n                     !ltid_in_bounds_78624;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_",
                   "in_78631) {\n                            x_68315 = x_68314;\n                            x_68314 = ((__local\n                                        double *) red_arr_mem_78612)[sext_i32_i64(squot32(local_tid_78608,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78632 =\n                             slt64(srem64(sext_i32_i64(local_tid_78608),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_78608) -\n                                   sext_i32_i64(squot32(local_tid_78608, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_78631) {\n                            if (inactive_78632) {\n                                x_68314 = x_68315;\n                            }\n                        }\n                        if (!no_carry_in_78631) {\n                            if (!inactive_78632) {\n                                double defunc_1_op_res_68316 = x_68314 +\n                                       x_68315;\n                                \n                                x_68314 = defunc_1_op_res_68316;\n                            }\n                        }\n                    }\n                    // write final result\n                    {\n                        if (!no_carry_in_78631) {\n                            ((__local\n                              double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)] =\n                                x_68314;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // restore correct values for first block\n                {\n                    if (squot3",
                   "2(local_tid_78608, 32) == 0 &&\n                        ltid_in_bounds_78624) {\n                        ((__local\n                          double *) red_arr_mem_78612)[sext_i32_i64(local_tid_78608)] =\n                            x_68315;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // save final values of segments\n        {\n            if (slt64(sext_i32_i64(virt_group_id_78616) *\n                      squot64(segred_group_sizze_68306,\n                              segment_sizze_nonzzero_78605) +\n                      sext_i32_i64(local_tid_78608), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_78608),\n                      squot64(segred_group_sizze_68306,\n                              segment_sizze_nonzzero_78605))) {\n                double tmp_78633;\n                \n                tmp_78633 = ((__local\n                              double *) red_arr_mem_78612)[(sext_i32_i64(local_tid_78608) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78605 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77223)[squot64(sext_i32_i64(virt_group_id_78616) *\n                                               squot64(segred_group_sizze_68306,\n                                                       segment_sizze_nonzzero_78605) +\n                                               sext_i32_i64(local_tid_78608),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78616) *\n                                        squot64(segred_group_sizze_68306,\n                                                segment_sizze_nonzzero_78605) +\n                                        sext_i32_i64(local_t",
                   "id_78608) -\n                                        squot64(sext_i32_i64(virt_group_id_78616) *\n                                                squot64(segred_group_sizze_68306,\n                                                        segment_sizze_nonzzero_78605) +\n                                                sext_i32_i64(local_tid_78608),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_78633;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_68306\n}\n__kernel void mainzisegred_small_70086(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78907_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78905_backing_aligned_1,\n                                       __local volatile\n                                       int64_t *red_arr_mem_78903_backing_aligned_2,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_70078,\n                                       int64_t segment_sizze_nonzzero_78896,\n                                       __global unsigned char *mem_77350,\n                                       __global unsigned char *mem_77358,\n                                       __global unsigned char *mem_77382,\n                                       __global unsigned char *mem_77469,\n                                       __global unsigned char *mem_77473,\n                                       __global unsigned char *mem_77478,\n                                       __global unsi",
                   "gned char *mem_77482,\n                                       __global unsigned char *mem_77486)\n{\n    #define segred_group_sizze_70077 (mainzisegred_group_sizze_69082)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_78907_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78907_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_78905_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78905_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_78903_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_78903_backing_aligned_2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78898;\n    int32_t local_tid_78899;\n    int64_t group_sizze_78902;\n    int32_t wave_sizze_78901;\n    int32_t group_tid_78900;\n    \n    global_tid_78898 = get_global_id(0);\n    local_tid_78899 = get_local_id(0);\n    group_sizze_78902 = get_local_size(0);\n    wave_sizze_78901 = LOCKSTEP_WIDTH;\n    group_tid_78900 = get_group_id(0);\n    \n    int32_t phys_tid_70086 = global_tid_78898;\n    __local unsigned char *red_arr_mem_78903;\n    \n    red_arr_mem_78903 = (__local unsigned char *) red_arr_mem_78903_backing_0;\n    \n    __local unsigned char *red_arr_mem_78905;\n    \n    red_arr_mem_78905 = (__local unsigned char *) red_arr_mem_78905_backing_1;\n    \n    __local unsigned char *red_arr_mem_78907;\n    \n    red_arr_mem_78907 = (__local unsigned char *) red_arr_mem_78907_backing_2;\n    \n    int32_t phys_group_id_78909;\n    \n    phys_group_id_78909 = get_group_id(0);\n    for (int32_t i_78910 = 0; i_78910 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                               ",
                   "           squot64(segred_group_sizze_70077,\n                                                  segment_sizze_nonzzero_78896))) -\n                   phys_group_id_78909, sext_i64_i32(num_groups_70078));\n         i_78910++) {\n        int32_t virt_group_id_78911 = phys_group_id_78909 + i_78910 *\n                sext_i64_i32(num_groups_70078);\n        int64_t slice_78912 = n_m_65386;\n        int64_t slice_78913 = m_65377 * slice_78912;\n        int64_t gtid_70083 = squot64(squot64(sext_i32_i64(local_tid_78899),\n                                             segment_sizze_nonzzero_78896) +\n                                     sext_i32_i64(virt_group_id_78911) *\n                                     squot64(segred_group_sizze_70077,\n                                             segment_sizze_nonzzero_78896),\n                                     slice_78912);\n        int64_t remnant_78914 = squot64(sext_i32_i64(local_tid_78899),\n                                        segment_sizze_nonzzero_78896) +\n                sext_i32_i64(virt_group_id_78911) *\n                squot64(segred_group_sizze_70077,\n                        segment_sizze_nonzzero_78896) - gtid_70083 *\n                slice_78912;\n        int64_t gtid_70084 = remnant_78914;\n        int64_t remnant_78915 = remnant_78914 - gtid_70084;\n        int64_t gtid_70085 = srem64(sext_i32_i64(local_tid_78899), q_65380);\n        \n        // apply map function if in bounds\n        {\n            if (slt64((int64_t) 0, q_65380) && ((slt64(gtid_70083, m_65377) &&\n                                                 slt64(gtid_70084,\n                                                       n_m_65386)) &&\n                                                slt64(sext_i32_i64(local_tid_78899),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_70077,\n                                                              segment_sizze_nonzzero_78896)))) {\n    ",
                   "            int64_t last_res_70096;\n                \n                last_res_70096 = ((__global int64_t *) mem_77350)[gtid_70083 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74722 = mul64(jump_65382, gtid_70084);\n                int64_t index_primexp_74723 = smin64(i_65392, binop_y_74722);\n                double defunc_1_f_res_70104;\n                \n                defunc_1_f_res_70104 = ((__global\n                                         double *) mem_77473)[gtid_70083 *\n                                                              n_m_65386 +\n                                                              gtid_70084];\n                \n                double x_70106;\n                \n                x_70106 = ((__global double *) mem_77382)[gtid_70083 * q_65380 +\n                                                          gtid_70085];\n                \n                bool cond_70107 = sle64(last_res_70096, gtid_70085);\n                int64_t defunc_0_f_res_70108;\n                \n                if (cond_70107) {\n                    defunc_0_f_res_70108 = (int64_t) 0;\n                } else {\n                    int64_t max_res_70103;\n                    \n                    max_res_70103 = ((__global\n                                      int64_t *) mem_77469)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084];\n                    \n                    int64_t i_70109 = add64(gtid_70085, max_res_70103);\n                    int64_t defunc_0_add_arg_70110;\n                    \n                    defunc_0_add_arg_70110 = ((__global\n                                               int64_t *) mem_77358)[gtid_70083 *\n                                                                     n_65378 +\n                    ",
                   "                                                 i_70109];\n                    \n                    int64_t defunc_1_add_res_70111 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_70110);\n                    \n                    defunc_0_f_res_70108 = defunc_1_add_res_70111;\n                }\n                \n                int64_t binop_p_70112 = sub64(defunc_0_f_res_70108,\n                                              index_primexp_74723);\n                double defunc_0_f_res_70113 = sitofp_i64_f64(binop_p_70112);\n                double abs_res_70114 = fabs(defunc_0_f_res_70113);\n                double tmp1_70115 = abs_res_70114 / defunc_1_f_res_70104;\n                double x_70116 = tmp1_70115 * tmp1_70115;\n                double y_70117 = tmp1_70115 * x_70116;\n                double tmp2_70118 = 1.0 - y_70117;\n                double x_70119 = tmp2_70118 * tmp2_70118;\n                double tmp3_70120 = tmp2_70118 * x_70119;\n                double w_j_70121 = x_70106 * tmp3_70120;\n                double xw_j_70122 = defunc_0_f_res_70113 * w_j_70121;\n                double x2w_j_70123 = defunc_0_f_res_70113 * xw_j_70122;\n                \n                // save map-out results\n                { }\n                // save results to be reduced\n                {\n                    ((__local\n                      double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)] =\n                        w_j_70121;\n                    ((__local\n                      double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)] =\n                        xw_j_70122;\n                    ((__local\n                      double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)] =\n                        x2w_j_70123;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)] =\n                    0.0;\n                ((__local\n                  dou",
                   "ble *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)] =\n                    0.0;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (slt64((int64_t) 0, q_65380)) {\n            // perform segmented scan to imitate reduction\n            {\n                double x_70087;\n                double x_70088;\n                double x_70089;\n                double x_70090;\n                double x_70091;\n                double x_70092;\n                double x_78916;\n                double x_78917;\n                double x_78918;\n                double x_78919;\n                double x_78920;\n                double x_78921;\n                bool ltid_in_bounds_78925 = slt64(sext_i32_i64(local_tid_78899),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_70077,\n                                                          segment_sizze_nonzzero_78896));\n                int32_t skip_threads_78926;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_78925) {\n                        x_70090 = ((volatile __local\n                                    double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)];\n                        x_70091 = ((volatile __local\n                                    double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)];\n                        x_70092 = ((volatile __local\n                                    double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)];\n                        if ((local_tid_78899 - squot32(local_tid_78899, 32) *\n                             32) == 0) {\n                            x_70087 = x_70090;\n                            x_70088 = x_70091;\n                            x_70089 = x_70092;\n                       ",
                   " }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_78926 = 1;\n                    while (slt32(skip_threads_78926, 32)) {\n                        bool thread_active_78927 = sle32(skip_threads_78926,\n                                                         local_tid_78899 -\n                                                         squot32(local_tid_78899,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_78925;\n                        \n                        if (thread_active_78927) {\n                            // read operands\n                            {\n                                x_70087 = ((volatile __local\n                                            double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899) -\n                                                                         sext_i32_i64(skip_threads_78926)];\n                                x_70088 = ((volatile __local\n                                            double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899) -\n                                                                         sext_i32_i64(skip_threads_78926)];\n                                x_70089 = ((volatile __local\n                                            double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899) -\n                                                                         sext_i32_i64(skip_threads_78926)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_78928 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78899),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_78899) -\n                                       sext_i32_i64(lo",
                   "cal_tid_78899 -\n                                       skip_threads_78926));\n                            \n                            if (thread_active_78927 && inactive_78928) {\n                                x_70087 = x_70090;\n                                x_70088 = x_70091;\n                                x_70089 = x_70092;\n                            }\n                            if (thread_active_78927) {\n                                if (!inactive_78928) {\n                                    double defunc_1_op_res_70093 = x_70087 +\n                                           x_70090;\n                                    double defunc_1_op_res_70094 = x_70088 +\n                                           x_70091;\n                                    double defunc_1_op_res_70095 = x_70089 +\n                                           x_70092;\n                                    \n                                    x_70087 = defunc_1_op_res_70093;\n                                    x_70088 = defunc_1_op_res_70094;\n                                    x_70089 = defunc_1_op_res_70095;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_78901, skip_threads_78926)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_78927) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)] =\n                                    x_70087;\n                                x_70090 = x_70087;\n                                ((volatile __local\n                                  double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)] =\n                                    x_70088;\n                                x_70091 = x_70088;\n                                ((vol",
                   "atile __local\n                                  double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)] =\n                                    x_70089;\n                                x_70092 = x_70089;\n                            }\n                        }\n                        if (sle32(wave_sizze_78901, skip_threads_78926)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_78926 *= 2;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // last thread of block 'i' writes its result to offset 'i'\n                {\n                    if ((local_tid_78899 - squot32(local_tid_78899, 32) * 32) ==\n                        31 && ltid_in_bounds_78925) {\n                        ((volatile __local\n                          double *) red_arr_mem_78903)[sext_i32_i64(squot32(local_tid_78899,\n                                                                            32))] =\n                            x_70087;\n                        ((volatile __local\n                          double *) red_arr_mem_78905)[sext_i32_i64(squot32(local_tid_78899,\n                                                                            32))] =\n                            x_70088;\n                        ((volatile __local\n                          double *) red_arr_mem_78907)[sext_i32_i64(squot32(local_tid_78899,\n                                                                            32))] =\n                            x_70089;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n                {\n                    int32_t skip_threads_78929;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_78899, 32) == 0 &&\n                            ltid_i",
                   "n_bounds_78925) {\n                            x_78919 = ((volatile __local\n                                        double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)];\n                            x_78920 = ((volatile __local\n                                        double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)];\n                            x_78921 = ((volatile __local\n                                        double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)];\n                            if ((local_tid_78899 - squot32(local_tid_78899,\n                                                           32) * 32) == 0) {\n                                x_78916 = x_78919;\n                                x_78917 = x_78920;\n                                x_78918 = x_78921;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_78929 = 1;\n                        while (slt32(skip_threads_78929, 32)) {\n                            bool thread_active_78930 = sle32(skip_threads_78929,\n                                                             local_tid_78899 -\n                                                             squot32(local_tid_78899,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_78899, 32) == 0 &&\n                                  ltid_in_bounds_78925);\n                            \n                            if (thread_active_78930) {\n                                // read operands\n                                {\n                                    x_78916 = ((volatile __local\n                                                double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899) -\n                                                                ",
                   "             sext_i32_i64(skip_threads_78929)];\n                                    x_78917 = ((volatile __local\n                                                double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899) -\n                                                                             sext_i32_i64(skip_threads_78929)];\n                                    x_78918 = ((volatile __local\n                                                double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899) -\n                                                                             sext_i32_i64(skip_threads_78929)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_78931 =\n                                     slt64(srem64(sext_i32_i64(local_tid_78899 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_78899 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_78899 -\n                                                         skip_threads_78929) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_78930 && inactive_78931) {\n                                    x_78916 = x_78919;\n                                    x_78917 = x_78920;\n                                    x_78918 = x_78921;\n                                }\n                                if (thread_active_78930) {\n                                    if (!inactive_78931) {\n                                        double defunc_1_op_res_78922 = x_78916 +\n                                               x_78919;\n                                        double defunc_1_op_res_78923 = x_78917 +\n                                       ",
                   "        x_78920;\n                                        double defunc_1_op_res_78924 = x_78918 +\n                                               x_78921;\n                                        \n                                        x_78916 = defunc_1_op_res_78922;\n                                        x_78917 = defunc_1_op_res_78923;\n                                        x_78918 = defunc_1_op_res_78924;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_78901, skip_threads_78929)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_78930) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)] =\n                                        x_78916;\n                                    x_78919 = x_78916;\n                                    ((volatile __local\n                                      double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)] =\n                                        x_78917;\n                                    x_78920 = x_78917;\n                                    ((volatile __local\n                                      double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)] =\n                                        x_78918;\n                                    x_78921 = x_78918;\n                                }\n                            }\n                            if (sle32(wave_sizze_78901, skip_threads_78929)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_78929 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);",
                   "\n                \n                bool no_carry_in_78932 = squot32(local_tid_78899, 32) == 0 ||\n                     !ltid_in_bounds_78925;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_78932) {\n                            x_70090 = x_70087;\n                            x_70091 = x_70088;\n                            x_70092 = x_70089;\n                            x_70087 = ((__local\n                                        double *) red_arr_mem_78903)[sext_i32_i64(squot32(local_tid_78899,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_70088 = ((__local\n                                        double *) red_arr_mem_78905)[sext_i32_i64(squot32(local_tid_78899,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_70089 = ((__local\n                                        double *) red_arr_mem_78907)[sext_i32_i64(squot32(local_tid_78899,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78933 =\n                             slt64(srem64(sext_i32_i64(local_tid_78899),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_78899) -\n                                   sext_i32_i64(squot32(local_tid_78899, 32) *\n                                   32 - 1));\n                        \n           ",
                   "             if (!no_carry_in_78932) {\n                            if (inactive_78933) {\n                                x_70087 = x_70090;\n                                x_70088 = x_70091;\n                                x_70089 = x_70092;\n                            }\n                        }\n                        if (!no_carry_in_78932) {\n                            if (!inactive_78933) {\n                                double defunc_1_op_res_70093 = x_70087 +\n                                       x_70090;\n                                double defunc_1_op_res_70094 = x_70088 +\n                                       x_70091;\n                                double defunc_1_op_res_70095 = x_70089 +\n                                       x_70092;\n                                \n                                x_70087 = defunc_1_op_res_70093;\n                                x_70088 = defunc_1_op_res_70094;\n                                x_70089 = defunc_1_op_res_70095;\n                            }\n                        }\n                    }\n                    // write final result\n                    {\n                        if (!no_carry_in_78932) {\n                            ((__local\n                              double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)] =\n                                x_70087;\n                            ((__local\n                              double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)] =\n                                x_70088;\n                            ((__local\n                              double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)] =\n                                x_70089;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // restore correct values for first block\n                {\n                    if (squot32(local_tid_78899, 32) == 0 &&\n                        ltid_in_bounds_78925) {\n        ",
                   "                ((__local\n                          double *) red_arr_mem_78903)[sext_i32_i64(local_tid_78899)] =\n                            x_70090;\n                        ((__local\n                          double *) red_arr_mem_78905)[sext_i32_i64(local_tid_78899)] =\n                            x_70091;\n                        ((__local\n                          double *) red_arr_mem_78907)[sext_i32_i64(local_tid_78899)] =\n                            x_70092;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // save final values of segments\n        {\n            if (slt64(sext_i32_i64(virt_group_id_78911) *\n                      squot64(segred_group_sizze_70077,\n                              segment_sizze_nonzzero_78896) +\n                      sext_i32_i64(local_tid_78899), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_78899),\n                      squot64(segred_group_sizze_70077,\n                              segment_sizze_nonzzero_78896))) {\n                double tmp_78934;\n                \n                tmp_78934 = ((__local\n                              double *) red_arr_mem_78903)[(sext_i32_i64(local_tid_78899) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78896 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77478)[squot64(sext_i32_i64(virt_group_id_78911) *\n                                               squot64(segred_group_sizze_70077,\n                                                       segment_sizze_nonzzero_78896) +\n                                               sext_i32_i64(local_tid_78899),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_g",
                   "roup_id_78911) *\n                                        squot64(segred_group_sizze_70077,\n                                                segment_sizze_nonzzero_78896) +\n                                        sext_i32_i64(local_tid_78899) -\n                                        squot64(sext_i32_i64(virt_group_id_78911) *\n                                                squot64(segred_group_sizze_70077,\n                                                        segment_sizze_nonzzero_78896) +\n                                                sext_i32_i64(local_tid_78899),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_78934;\n                \n                double tmp_78935;\n                \n                tmp_78935 = ((__local\n                              double *) red_arr_mem_78905)[(sext_i32_i64(local_tid_78899) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78896 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77482)[squot64(sext_i32_i64(virt_group_id_78911) *\n                                               squot64(segred_group_sizze_70077,\n                                                       segment_sizze_nonzzero_78896) +\n                                               sext_i32_i64(local_tid_78899),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78911) *\n                                        squot64(segred_group_sizze_70077,\n                                                segment_sizze_nonzzero_78896) +\n                                        sext_i32_i64(local_tid_78899) -\n                                        squot64(sext_i32_i64(virt_group_id_78911) *\n                                                squot64(segred_group",
                   "_sizze_70077,\n                                                        segment_sizze_nonzzero_78896) +\n                                                sext_i32_i64(local_tid_78899),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_78935;\n                \n                double tmp_78936;\n                \n                tmp_78936 = ((__local\n                              double *) red_arr_mem_78907)[(sext_i32_i64(local_tid_78899) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78896 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77486)[squot64(sext_i32_i64(virt_group_id_78911) *\n                                               squot64(segred_group_sizze_70077,\n                                                       segment_sizze_nonzzero_78896) +\n                                               sext_i32_i64(local_tid_78899),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78911) *\n                                        squot64(segred_group_sizze_70077,\n                                                segment_sizze_nonzzero_78896) +\n                                        sext_i32_i64(local_tid_78899) -\n                                        squot64(sext_i32_i64(virt_group_id_78911) *\n                                                squot64(segred_group_sizze_70077,\n                                                        segment_sizze_nonzzero_78896) +\n                                                sext_i32_i64(local_tid_78899),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_78936;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOC",
                   "AL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_70077\n}\n__kernel void mainzisegred_small_70156(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79015_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79013_backing_aligned_1,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_70149,\n                                       int64_t segment_sizze_nonzzero_79006,\n                                       __global unsigned char *mem_77350,\n                                       __global unsigned char *mem_77354,\n                                       __global unsigned char *mem_77358,\n                                       __global unsigned char *mem_77382,\n                                       __global unsigned char *mem_77469,\n                                       __global unsigned char *mem_77473,\n                                       __global unsigned char *mem_77491,\n                                       __global unsigned char *mem_77495,\n                                       __global unsigned char *mem_77499,\n                                       __global unsigned char *mem_77504,\n                                       __global unsigned char *mem_77508)\n{\n    #define segred_group_sizze_70148 (mainzisegred_group_sizze_68987)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_79015_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79015_backing_aligned_",
                   "0;\n    __local volatile unsigned char *restrict red_arr_mem_79013_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79013_backing_aligned_1;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79008;\n    int32_t local_tid_79009;\n    int64_t group_sizze_79012;\n    int32_t wave_sizze_79011;\n    int32_t group_tid_79010;\n    \n    global_tid_79008 = get_global_id(0);\n    local_tid_79009 = get_local_id(0);\n    group_sizze_79012 = get_local_size(0);\n    wave_sizze_79011 = LOCKSTEP_WIDTH;\n    group_tid_79010 = get_group_id(0);\n    \n    int32_t phys_tid_70156 = global_tid_79008;\n    __local unsigned char *red_arr_mem_79013;\n    \n    red_arr_mem_79013 = (__local unsigned char *) red_arr_mem_79013_backing_0;\n    \n    __local unsigned char *red_arr_mem_79015;\n    \n    red_arr_mem_79015 = (__local unsigned char *) red_arr_mem_79015_backing_1;\n    \n    int32_t phys_group_id_79017;\n    \n    phys_group_id_79017 = get_group_id(0);\n    for (int32_t i_79018 = 0; i_79018 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_70148,\n                                                  segment_sizze_nonzzero_79006))) -\n                   phys_group_id_79017, sext_i64_i32(num_groups_70149));\n         i_79018++) {\n        int32_t virt_group_id_79019 = phys_group_id_79017 + i_79018 *\n                sext_i64_i32(num_groups_70149);\n        int64_t slice_79020 = n_m_65386;\n        int64_t slice_79021 = m_65377 * slice_79020;\n        int64_t gtid_70153 = squot64(squot64(sext_i32_i64(local_tid_79009),\n                                             segment_sizze_nonzzero_79006) +\n                                     sext_i32_i64(virt_group_id_79019) *\n                                     squot64(segred_group_sizze_70148,\n                                             segment_sizze_nonzzero_79006),\n                      ",
                   "               slice_79020);\n        int64_t remnant_79022 = squot64(sext_i32_i64(local_tid_79009),\n                                        segment_sizze_nonzzero_79006) +\n                sext_i32_i64(virt_group_id_79019) *\n                squot64(segred_group_sizze_70148,\n                        segment_sizze_nonzzero_79006) - gtid_70153 *\n                slice_79020;\n        int64_t gtid_70154 = remnant_79022;\n        int64_t remnant_79023 = remnant_79022 - gtid_70154;\n        int64_t gtid_70155 = srem64(sext_i32_i64(local_tid_79009), q_65380);\n        \n        // apply map function if in bounds\n        {\n            if (slt64((int64_t) 0, q_65380) && ((slt64(gtid_70153, m_65377) &&\n                                                 slt64(gtid_70154,\n                                                       n_m_65386)) &&\n                                                slt64(sext_i32_i64(local_tid_79009),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_70148,\n                                                              segment_sizze_nonzzero_79006)))) {\n                int64_t last_res_70163;\n                \n                last_res_70163 = ((__global int64_t *) mem_77350)[gtid_70153 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74718 = mul64(jump_65382, gtid_70154);\n                int64_t index_primexp_74719 = smin64(i_65392, binop_y_74718);\n                int64_t max_res_70174;\n                \n                max_res_70174 = ((__global int64_t *) mem_77469)[gtid_70153 *\n                                                                 n_m_65386 +\n                                                                 gtid_70154];\n                \n                double defunc_1_f_res_70175;\n                \n             ",
                   "   defunc_1_f_res_70175 = ((__global\n                                         double *) mem_77473)[gtid_70153 *\n                                                              n_m_65386 +\n                                                              gtid_70154];\n                \n                double a11_70176;\n                \n                a11_70176 = ((__global double *) mem_77491)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154];\n                \n                double b11_70177;\n                \n                b11_70177 = ((__global double *) mem_77495)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154];\n                \n                double c11_70178;\n                \n                c11_70178 = ((__global double *) mem_77499)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154];\n                \n                double x_70180;\n                \n                x_70180 = ((__global double *) mem_77382)[gtid_70153 * q_65380 +\n                                                          gtid_70155];\n                \n                bool cond_70181 = sle64(last_res_70163, gtid_70155);\n                int64_t defunc_0_f_res_70182;\n                \n                if (cond_70181) {\n                    defunc_0_f_res_70182 = (int64_t) 0;\n                } else {\n                    int64_t i_70183 = add64(gtid_70155, max_res_70174);\n                    int64_t defunc_0_add_arg_70184;\n                    \n                    defunc_0_add_arg_70184 = ((__global\n                                               int64_t *) mem_77358)[gtid_70153 *\n                                                                     n_65378 +\n                                     ",
                   "                                i_70183];\n                    \n                    int64_t defunc_1_add_res_70185 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_70184);\n                    \n                    defunc_0_f_res_70182 = defunc_1_add_res_70185;\n                }\n                \n                int64_t binop_p_70186 = sub64(defunc_0_f_res_70182,\n                                              index_primexp_74719);\n                double defunc_0_f_res_70187 = sitofp_i64_f64(binop_p_70186);\n                double abs_res_70188 = fabs(defunc_0_f_res_70187);\n                double tmp1_70189 = abs_res_70188 / defunc_1_f_res_70175;\n                double x_70190 = tmp1_70189 * tmp1_70189;\n                double y_70191 = tmp1_70189 * x_70190;\n                double tmp2_70192 = 1.0 - y_70191;\n                double x_70193 = tmp2_70192 * tmp2_70192;\n                double tmp3_70194 = tmp2_70192 * x_70193;\n                double tmp4_70195 = x_70180 * tmp3_70194;\n                double defunc_1_f_res_70196 = defunc_0_f_res_70187 * tmp4_70195;\n                double defunc_0_f_res_70197;\n                \n                if (cond_70181) {\n                    defunc_0_f_res_70197 = 0.0;\n                } else {\n                    int64_t i_70198 = add64(gtid_70155, max_res_70174);\n                    double defunc_0_add_arg_70199;\n                    \n                    defunc_0_add_arg_70199 = ((__global\n                                               double *) mem_77354)[gtid_70153 *\n                                                                    n_65378 +\n                                                                    i_70198];\n                    defunc_0_f_res_70197 = defunc_0_add_arg_70199;\n                }\n                \n                double x_70200 = a11_70176 * tmp4_70195;\n                double y_70201 = b11_70177 * defunc_1_f_res_70196;\n                double x_70202 = x_70200 + y_70201;\n ",
                   "               double defunc_9_fit_fun_res_70203 = defunc_0_f_res_70197 *\n                       x_70202;\n                double x_70204 = b11_70177 * tmp4_70195;\n                double y_70205 = c11_70178 * defunc_1_f_res_70196;\n                double x_70206 = x_70204 + y_70205;\n                double defunc_9_slope_fun_res_70207 = defunc_0_f_res_70197 *\n                       x_70206;\n                \n                // save map-out results\n                { }\n                // save results to be reduced\n                {\n                    ((__local\n                      double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)] =\n                        defunc_9_fit_fun_res_70203;\n                    ((__local\n                      double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)] =\n                        defunc_9_slope_fun_res_70207;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)] =\n                    0.0;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (slt64((int64_t) 0, q_65380)) {\n            // perform segmented scan to imitate reduction\n            {\n                double x_70157;\n                double x_70158;\n                double x_70159;\n                double x_70160;\n                double x_79024;\n                double x_79025;\n                double x_79026;\n                double x_79027;\n                bool ltid_in_bounds_79030 = slt64(sext_i32_i64(local_tid_79009),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_70148,\n                                                          segment_sizze_nonzzero_79006));\n                int32_t skip_threads_79031;\n                \n                // read",
                   " input for in-block scan\n                {\n                    if (ltid_in_bounds_79030) {\n                        x_70159 = ((volatile __local\n                                    double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)];\n                        x_70160 = ((volatile __local\n                                    double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)];\n                        if ((local_tid_79009 - squot32(local_tid_79009, 32) *\n                             32) == 0) {\n                            x_70157 = x_70159;\n                            x_70158 = x_70160;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_79031 = 1;\n                    while (slt32(skip_threads_79031, 32)) {\n                        bool thread_active_79032 = sle32(skip_threads_79031,\n                                                         local_tid_79009 -\n                                                         squot32(local_tid_79009,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_79030;\n                        \n                        if (thread_active_79032) {\n                            // read operands\n                            {\n                                x_70157 = ((volatile __local\n                                            double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009) -\n                                                                         sext_i32_i64(skip_threads_79031)];\n                                x_70158 = ((volatile __local\n                                            double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009) -\n                                                                         sext_i32_i64(skip_threads_79031)];\n                            }\n                        }\n                        //",
                   " perform operation\n                        {\n                            bool inactive_79033 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79009),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_79009) -\n                                       sext_i32_i64(local_tid_79009 -\n                                       skip_threads_79031));\n                            \n                            if (thread_active_79032 && inactive_79033) {\n                                x_70157 = x_70159;\n                                x_70158 = x_70160;\n                            }\n                            if (thread_active_79032) {\n                                if (!inactive_79033) {\n                                    double defunc_1_op_res_70161 = x_70157 +\n                                           x_70159;\n                                    double defunc_1_op_res_70162 = x_70158 +\n                                           x_70160;\n                                    \n                                    x_70157 = defunc_1_op_res_70161;\n                                    x_70158 = defunc_1_op_res_70162;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_79011, skip_threads_79031)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79032) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)] =\n                                    x_70157;\n                                x_70159 = x_70157;\n                                ((volatile __local\n                                  double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)] =\n                             ",
                   "       x_70158;\n                                x_70160 = x_70158;\n                            }\n                        }\n                        if (sle32(wave_sizze_79011, skip_threads_79031)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79031 *= 2;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // last thread of block 'i' writes its result to offset 'i'\n                {\n                    if ((local_tid_79009 - squot32(local_tid_79009, 32) * 32) ==\n                        31 && ltid_in_bounds_79030) {\n                        ((volatile __local\n                          double *) red_arr_mem_79013)[sext_i32_i64(squot32(local_tid_79009,\n                                                                            32))] =\n                            x_70157;\n                        ((volatile __local\n                          double *) red_arr_mem_79015)[sext_i32_i64(squot32(local_tid_79009,\n                                                                            32))] =\n                            x_70158;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n                {\n                    int32_t skip_threads_79034;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_79009, 32) == 0 &&\n                            ltid_in_bounds_79030) {\n                            x_79026 = ((volatile __local\n                                        double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)];\n                            x_79027 = ((volatile __local\n                                        double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)];\n                            if ((local_tid_79009 - squot32(loc",
                   "al_tid_79009,\n                                                           32) * 32) == 0) {\n                                x_79024 = x_79026;\n                                x_79025 = x_79027;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_79034 = 1;\n                        while (slt32(skip_threads_79034, 32)) {\n                            bool thread_active_79035 = sle32(skip_threads_79034,\n                                                             local_tid_79009 -\n                                                             squot32(local_tid_79009,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_79009, 32) == 0 &&\n                                  ltid_in_bounds_79030);\n                            \n                            if (thread_active_79035) {\n                                // read operands\n                                {\n                                    x_79024 = ((volatile __local\n                                                double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009) -\n                                                                             sext_i32_i64(skip_threads_79034)];\n                                    x_79025 = ((volatile __local\n                                                double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009) -\n                                                                             sext_i32_i64(skip_threads_79034)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_79036 =\n                                     slt64(srem64(sext_i32_i64(local_tid_7",
                   "9009 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_79009 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_79009 -\n                                                         skip_threads_79034) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_79035 && inactive_79036) {\n                                    x_79024 = x_79026;\n                                    x_79025 = x_79027;\n                                }\n                                if (thread_active_79035) {\n                                    if (!inactive_79036) {\n                                        double defunc_1_op_res_79028 = x_79024 +\n                                               x_79026;\n                                        double defunc_1_op_res_79029 = x_79025 +\n                                               x_79027;\n                                        \n                                        x_79024 = defunc_1_op_res_79028;\n                                        x_79025 = defunc_1_op_res_79029;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_79011, skip_threads_79034)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_79035) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)] =\n                                        x_79024;\n                                    x_79026 = x_79024;\n                                    ((volatile __local\n                  ",
                   "                    double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)] =\n                                        x_79025;\n                                    x_79027 = x_79025;\n                                }\n                            }\n                            if (sle32(wave_sizze_79011, skip_threads_79034)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_79034 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_79037 = squot32(local_tid_79009, 32) == 0 ||\n                     !ltid_in_bounds_79030;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_79037) {\n                            x_70159 = x_70157;\n                            x_70160 = x_70158;\n                            x_70157 = ((__local\n                                        double *) red_arr_mem_79013)[sext_i32_i64(squot32(local_tid_79009,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_70158 = ((__local\n                                        double *) red_arr_mem_79015)[sext_i32_i64(squot32(local_tid_79009,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79038 =\n                             slt64(srem64(sext_i32_i64(local_tid_79009),\n                                          q_65380),\n                        ",
                   "           sext_i32_i64(local_tid_79009) -\n                                   sext_i32_i64(squot32(local_tid_79009, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_79037) {\n                            if (inactive_79038) {\n                                x_70157 = x_70159;\n                                x_70158 = x_70160;\n                            }\n                        }\n                        if (!no_carry_in_79037) {\n                            if (!inactive_79038) {\n                                double defunc_1_op_res_70161 = x_70157 +\n                                       x_70159;\n                                double defunc_1_op_res_70162 = x_70158 +\n                                       x_70160;\n                                \n                                x_70157 = defunc_1_op_res_70161;\n                                x_70158 = defunc_1_op_res_70162;\n                            }\n                        }\n                    }\n                    // write final result\n                    {\n                        if (!no_carry_in_79037) {\n                            ((__local\n                              double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)] =\n                                x_70157;\n                            ((__local\n                              double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)] =\n                                x_70158;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // restore correct values for first block\n                {\n                    if (squot32(local_tid_79009, 32) == 0 &&\n                        ltid_in_bounds_79030) {\n                        ((__local\n                          double *) red_arr_mem_79013)[sext_i32_i64(local_tid_79009)] =\n                            x_70159;\n                        ((__local\n                    ",
                   "      double *) red_arr_mem_79015)[sext_i32_i64(local_tid_79009)] =\n                            x_70160;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // save final values of segments\n        {\n            if (slt64(sext_i32_i64(virt_group_id_79019) *\n                      squot64(segred_group_sizze_70148,\n                              segment_sizze_nonzzero_79006) +\n                      sext_i32_i64(local_tid_79009), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_79009),\n                      squot64(segred_group_sizze_70148,\n                              segment_sizze_nonzzero_79006))) {\n                double tmp_79039;\n                \n                tmp_79039 = ((__local\n                              double *) red_arr_mem_79013)[(sext_i32_i64(local_tid_79009) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79006 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77504)[squot64(sext_i32_i64(virt_group_id_79019) *\n                                               squot64(segred_group_sizze_70148,\n                                                       segment_sizze_nonzzero_79006) +\n                                               sext_i32_i64(local_tid_79009),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79019) *\n                                        squot64(segred_group_sizze_70148,\n                                                segment_sizze_nonzzero_79006) +\n                                        sext_i32_i64(local_tid_79009) -\n                                        squot64(sext_i32_i64(virt_group_id_79019) *\n                                     ",
                   "           squot64(segred_group_sizze_70148,\n                                                        segment_sizze_nonzzero_79006) +\n                                                sext_i32_i64(local_tid_79009),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79039;\n                \n                double tmp_79040;\n                \n                tmp_79040 = ((__local\n                              double *) red_arr_mem_79015)[(sext_i32_i64(local_tid_79009) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79006 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77508)[squot64(sext_i32_i64(virt_group_id_79019) *\n                                               squot64(segred_group_sizze_70148,\n                                                       segment_sizze_nonzzero_79006) +\n                                               sext_i32_i64(local_tid_79009),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79019) *\n                                        squot64(segred_group_sizze_70148,\n                                                segment_sizze_nonzzero_79006) +\n                                        sext_i32_i64(local_tid_79009) -\n                                        squot64(sext_i32_i64(virt_group_id_79019) *\n                                                squot64(segred_group_sizze_70148,\n                                                        segment_sizze_nonzzero_79006) +\n                                                sext_i32_i64(local_tid_79009),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79040;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier",
                   "(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_70148\n}\n__kernel void mainzisegred_small_72159(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79344_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79342_backing_aligned_1,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79340_backing_aligned_2,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79338_backing_aligned_3,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79336_backing_aligned_4,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_72149,\n                                       int64_t segment_sizze_nonzzero_79329,\n                                       __global unsigned char *mem_77642,\n                                       __global unsigned char *mem_77650,\n                                       __global unsigned char *mem_77674,\n                                       __global unsigned char *mem_77785,\n                                       __global unsigned char *mem_77789,\n                                       __global unsigned char *mem_77794,\n                                       __global unsigned char *mem_77798,\n                                       __global unsigned char *mem_77802,\n                                       __global unsigned char *mem_77806,\n                                       __global unsigned char *mem_77810)\n{\n",
                   "    #define segred_group_sizze_72148 (mainzisegred_group_sizze_71073)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_79344_backing_4 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79344_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_79342_backing_3 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79342_backing_aligned_1;\n    __local volatile unsigned char *restrict red_arr_mem_79340_backing_2 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79340_backing_aligned_2;\n    __local volatile unsigned char *restrict red_arr_mem_79338_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79338_backing_aligned_3;\n    __local volatile unsigned char *restrict red_arr_mem_79336_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79336_backing_aligned_4;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79331;\n    int32_t local_tid_79332;\n    int64_t group_sizze_79335;\n    int32_t wave_sizze_79334;\n    int32_t group_tid_79333;\n    \n    global_tid_79331 = get_global_id(0);\n    local_tid_79332 = get_local_id(0);\n    group_sizze_79335 = get_local_size(0);\n    wave_sizze_79334 = LOCKSTEP_WIDTH;\n    group_tid_79333 = get_group_id(0);\n    \n    int32_t phys_tid_72159 = global_tid_79331;\n    __local unsigned char *red_arr_mem_79336;\n    \n    red_arr_mem_79336 = (__local unsigned char *) red_arr_mem_79336_backing_0;\n    \n    __local unsigned char *red_arr_mem_79338;\n    \n    red_arr_mem_79338 = (__local unsigned char *) red_arr_mem_79338_backing_1;\n    \n    __local ",
                   "unsigned char *red_arr_mem_79340;\n    \n    red_arr_mem_79340 = (__local unsigned char *) red_arr_mem_79340_backing_2;\n    \n    __local unsigned char *red_arr_mem_79342;\n    \n    red_arr_mem_79342 = (__local unsigned char *) red_arr_mem_79342_backing_3;\n    \n    __local unsigned char *red_arr_mem_79344;\n    \n    red_arr_mem_79344 = (__local unsigned char *) red_arr_mem_79344_backing_4;\n    \n    int32_t phys_group_id_79346;\n    \n    phys_group_id_79346 = get_group_id(0);\n    for (int32_t i_79347 = 0; i_79347 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_72148,\n                                                  segment_sizze_nonzzero_79329))) -\n                   phys_group_id_79346, sext_i64_i32(num_groups_72149));\n         i_79347++) {\n        int32_t virt_group_id_79348 = phys_group_id_79346 + i_79347 *\n                sext_i64_i32(num_groups_72149);\n        int64_t slice_79349 = n_m_65386;\n        int64_t slice_79350 = m_65377 * slice_79349;\n        int64_t gtid_72156 = squot64(squot64(sext_i32_i64(local_tid_79332),\n                                             segment_sizze_nonzzero_79329) +\n                                     sext_i32_i64(virt_group_id_79348) *\n                                     squot64(segred_group_sizze_72148,\n                                             segment_sizze_nonzzero_79329),\n                                     slice_79349);\n        int64_t remnant_79351 = squot64(sext_i32_i64(local_tid_79332),\n                                        segment_sizze_nonzzero_79329) +\n                sext_i32_i64(virt_group_id_79348) *\n                squot64(segred_group_sizze_72148,\n                        segment_sizze_nonzzero_79329) - gtid_72156 *\n                slice_79349;\n        int64_t gtid_72157 = remnant_79351;\n        int64_t remnant_79352 = remnant_79351 - gtid_72157;\n        int64_t gtid_72158 = srem64(sext_i32_i64(local_tid_79332), q_65380);\n        ",
                   "\n        // apply map function if in bounds\n        {\n            if (slt64((int64_t) 0, q_65380) && ((slt64(gtid_72156, m_65377) &&\n                                                 slt64(gtid_72157,\n                                                       n_m_65386)) &&\n                                                slt64(sext_i32_i64(local_tid_79332),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_72148,\n                                                              segment_sizze_nonzzero_79329)))) {\n                int64_t last_res_72175;\n                \n                last_res_72175 = ((__global int64_t *) mem_77642)[gtid_72156 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74730 = mul64(jump_65382, gtid_72157);\n                int64_t index_primexp_74731 = smin64(i_65392, binop_y_74730);\n                double defunc_1_f_res_72183;\n                \n                defunc_1_f_res_72183 = ((__global\n                                         double *) mem_77789)[gtid_72156 *\n                                                              n_m_65386 +\n                                                              gtid_72157];\n                \n                double x_72185;\n                \n                x_72185 = ((__global double *) mem_77674)[gtid_72156 * q_65380 +\n                                                          gtid_72158];\n                \n                bool cond_72186 = sle64(last_res_72175, gtid_72158);\n                int64_t defunc_0_f_res_72187;\n                \n                if (cond_72186) {\n                    defunc_0_f_res_72187 = (int64_t) 0;\n                } else {\n                    int64_t max_res_72182;\n                    \n                    max_res_72182 = ((__global\n             ",
                   "                         int64_t *) mem_77785)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157];\n                    \n                    int64_t i_72188 = add64(gtid_72158, max_res_72182);\n                    int64_t defunc_0_add_arg_72189;\n                    \n                    defunc_0_add_arg_72189 = ((__global\n                                               int64_t *) mem_77650)[gtid_72156 *\n                                                                     n_65378 +\n                                                                     i_72188];\n                    \n                    int64_t defunc_1_add_res_72190 = add64((int64_t) 1,\n                                                           defunc_0_add_arg_72189);\n                    \n                    defunc_0_f_res_72187 = defunc_1_add_res_72190;\n                }\n                \n                int64_t binop_p_72191 = sub64(defunc_0_f_res_72187,\n                                              index_primexp_74731);\n                double defunc_0_f_res_72192 = sitofp_i64_f64(binop_p_72191);\n                double abs_res_72193 = fabs(defunc_0_f_res_72192);\n                double tmp1_72194 = abs_res_72193 / defunc_1_f_res_72183;\n                double x_72195 = tmp1_72194 * tmp1_72194;\n                double y_72196 = tmp1_72194 * x_72195;\n                double tmp2_72197 = 1.0 - y_72196;\n                double x_72198 = tmp2_72197 * tmp2_72197;\n                double tmp3_72199 = tmp2_72197 * x_72198;\n                double w_j_72200 = x_72185 * tmp3_72199;\n                double xw_j_72201 = defunc_0_f_res_72192 * w_j_72200;\n                double x2w_j_72202 = defunc_0_f_res_72192 * xw_j_72201;\n                double x3w_j_72203 = defunc_0_f_res_72192 * x2w_j_72202;\n                double x4w_j_72204 = defunc_0_f_res_72192 * x3w_j_72203;\n                \n                // save map-out resul",
                   "ts\n                { }\n                // save results to be reduced\n                {\n                    ((__local\n                      double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)] =\n                        w_j_72200;\n                    ((__local\n                      double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)] =\n                        xw_j_72201;\n                    ((__local\n                      double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)] =\n                        x2w_j_72202;\n                    ((__local\n                      double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)] =\n                        x3w_j_72203;\n                    ((__local\n                      double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)] =\n                        x4w_j_72204;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)] =\n                    0.0;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (slt64((int64_t) 0, q_65380)) {\n            // perform segmented scan to imitate reduction\n            {\n                double x_72160;\n                double x_72161;\n                double x_72162;\n                double x_72163;\n                double x_72164;\n                double x_72165;\n                double x_72166;\n                double x_72167;\n                double x_72168;\n ",
                   "               double x_72169;\n                double x_79353;\n                double x_79354;\n                double x_79355;\n                double x_79356;\n                double x_79357;\n                double x_79358;\n                double x_79359;\n                double x_79360;\n                double x_79361;\n                double x_79362;\n                bool ltid_in_bounds_79368 = slt64(sext_i32_i64(local_tid_79332),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_72148,\n                                                          segment_sizze_nonzzero_79329));\n                int32_t skip_threads_79369;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_79368) {\n                        x_72165 = ((volatile __local\n                                    double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)];\n                        x_72166 = ((volatile __local\n                                    double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)];\n                        x_72167 = ((volatile __local\n                                    double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)];\n                        x_72168 = ((volatile __local\n                                    double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)];\n                        x_72169 = ((volatile __local\n                                    double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)];\n                        if ((local_tid_79332 - squot32(local_tid_79332, 32) *\n                             32) == 0) {\n                            x_72160 = x_72165;\n                            x_72161 = x_72166;\n                            x_72162 = x_72167;\n                            x_72163 = x_72168;\n                            x_72164 = x_72169;\n                        }\n                    }\n       ",
                   "         }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_79369 = 1;\n                    while (slt32(skip_threads_79369, 32)) {\n                        bool thread_active_79370 = sle32(skip_threads_79369,\n                                                         local_tid_79332 -\n                                                         squot32(local_tid_79332,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_79368;\n                        \n                        if (thread_active_79370) {\n                            // read operands\n                            {\n                                x_72160 = ((volatile __local\n                                            double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332) -\n                                                                         sext_i32_i64(skip_threads_79369)];\n                                x_72161 = ((volatile __local\n                                            double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332) -\n                                                                         sext_i32_i64(skip_threads_79369)];\n                                x_72162 = ((volatile __local\n                                            double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332) -\n                                                                         sext_i32_i64(skip_threads_79369)];\n                                x_72163 = ((volatile __local\n                                            double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332) -\n                                                                         sext_i32_i64(skip_threads_79369)];\n                                x_72164 = ((volatile __local\n                                            double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332) -\n                           ",
                   "                                              sext_i32_i64(skip_threads_79369)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79371 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79332),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_79332) -\n                                       sext_i32_i64(local_tid_79332 -\n                                       skip_threads_79369));\n                            \n                            if (thread_active_79370 && inactive_79371) {\n                                x_72160 = x_72165;\n                                x_72161 = x_72166;\n                                x_72162 = x_72167;\n                                x_72163 = x_72168;\n                                x_72164 = x_72169;\n                            }\n                            if (thread_active_79370) {\n                                if (!inactive_79371) {\n                                    double defunc_1_op_res_72170 = x_72160 +\n                                           x_72165;\n                                    double defunc_1_op_res_72171 = x_72161 +\n                                           x_72166;\n                                    double defunc_1_op_res_72172 = x_72162 +\n                                           x_72167;\n                                    double defunc_1_op_res_72173 = x_72163 +\n                                           x_72168;\n                                    double defunc_1_op_res_72174 = x_72164 +\n                                           x_72169;\n                                    \n                                    x_72160 = defunc_1_op_res_72170;\n                                    x_72161 = defunc_1_op_res_72171;\n                                    x_72162 = defunc_1_op_res_72172;\n                     ",
                   "               x_72163 = defunc_1_op_res_72173;\n                                    x_72164 = defunc_1_op_res_72174;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_79334, skip_threads_79369)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79370) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)] =\n                                    x_72160;\n                                x_72165 = x_72160;\n                                ((volatile __local\n                                  double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)] =\n                                    x_72161;\n                                x_72166 = x_72161;\n                                ((volatile __local\n                                  double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)] =\n                                    x_72162;\n                                x_72167 = x_72162;\n                                ((volatile __local\n                                  double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)] =\n                                    x_72163;\n                                x_72168 = x_72163;\n                                ((volatile __local\n                                  double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)] =\n                                    x_72164;\n                                x_72169 = x_72164;\n                            }\n                        }\n                        if (sle32(wave_sizze_79334, skip_threads_79369)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79369 *= 2;\n                    }\n        ",
                   "        }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // last thread of block 'i' writes its result to offset 'i'\n                {\n                    if ((local_tid_79332 - squot32(local_tid_79332, 32) * 32) ==\n                        31 && ltid_in_bounds_79368) {\n                        ((volatile __local\n                          double *) red_arr_mem_79336)[sext_i32_i64(squot32(local_tid_79332,\n                                                                            32))] =\n                            x_72160;\n                        ((volatile __local\n                          double *) red_arr_mem_79338)[sext_i32_i64(squot32(local_tid_79332,\n                                                                            32))] =\n                            x_72161;\n                        ((volatile __local\n                          double *) red_arr_mem_79340)[sext_i32_i64(squot32(local_tid_79332,\n                                                                            32))] =\n                            x_72162;\n                        ((volatile __local\n                          double *) red_arr_mem_79342)[sext_i32_i64(squot32(local_tid_79332,\n                                                                            32))] =\n                            x_72163;\n                        ((volatile __local\n                          double *) red_arr_mem_79344)[sext_i32_i64(squot32(local_tid_79332,\n                                                                            32))] =\n                            x_72164;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n                {\n                    int32_t skip_threads_79372;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_79332, 32) == 0 &&\n                    ",
                   "        ltid_in_bounds_79368) {\n                            x_79358 = ((volatile __local\n                                        double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)];\n                            x_79359 = ((volatile __local\n                                        double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)];\n                            x_79360 = ((volatile __local\n                                        double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)];\n                            x_79361 = ((volatile __local\n                                        double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)];\n                            x_79362 = ((volatile __local\n                                        double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)];\n                            if ((local_tid_79332 - squot32(local_tid_79332,\n                                                           32) * 32) == 0) {\n                                x_79353 = x_79358;\n                                x_79354 = x_79359;\n                                x_79355 = x_79360;\n                                x_79356 = x_79361;\n                                x_79357 = x_79362;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_79372 = 1;\n                        while (slt32(skip_threads_79372, 32)) {\n                            bool thread_active_79373 = sle32(skip_threads_79372,\n                                                             local_tid_79332 -\n                                                             squot32(local_tid_79332,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_79332, 32) == 0 &&\n                              ",
                   "    ltid_in_bounds_79368);\n                            \n                            if (thread_active_79373) {\n                                // read operands\n                                {\n                                    x_79353 = ((volatile __local\n                                                double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332) -\n                                                                             sext_i32_i64(skip_threads_79372)];\n                                    x_79354 = ((volatile __local\n                                                double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332) -\n                                                                             sext_i32_i64(skip_threads_79372)];\n                                    x_79355 = ((volatile __local\n                                                double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332) -\n                                                                             sext_i32_i64(skip_threads_79372)];\n                                    x_79356 = ((volatile __local\n                                                double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332) -\n                                                                             sext_i32_i64(skip_threads_79372)];\n                                    x_79357 = ((volatile __local\n                                                double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332) -\n                                                                             sext_i32_i64(skip_threads_79372)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_79374 =\n                                     slt64(srem64(sext_i32_i64(local_tid_79332 *\n                                                  32 + 32 - 1), q_65380),\n                        ",
                   "                   sext_i32_i64(local_tid_79332 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_79332 -\n                                                         skip_threads_79372) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_79373 && inactive_79374) {\n                                    x_79353 = x_79358;\n                                    x_79354 = x_79359;\n                                    x_79355 = x_79360;\n                                    x_79356 = x_79361;\n                                    x_79357 = x_79362;\n                                }\n                                if (thread_active_79373) {\n                                    if (!inactive_79374) {\n                                        double defunc_1_op_res_79363 = x_79353 +\n                                               x_79358;\n                                        double defunc_1_op_res_79364 = x_79354 +\n                                               x_79359;\n                                        double defunc_1_op_res_79365 = x_79355 +\n                                               x_79360;\n                                        double defunc_1_op_res_79366 = x_79356 +\n                                               x_79361;\n                                        double defunc_1_op_res_79367 = x_79357 +\n                                               x_79362;\n                                        \n                                        x_79353 = defunc_1_op_res_79363;\n                                        x_79354 = defunc_1_op_res_79364;\n                                        x_79355 = defunc_1_op_res_79365;\n                                        x_79356 = defunc_1_op_res_79366;\n                                        x_79357 = defunc_1_op_res_79367;\n                                    }\n              ",
                   "                  }\n                            }\n                            if (sle32(wave_sizze_79334, skip_threads_79372)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_79373) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)] =\n                                        x_79353;\n                                    x_79358 = x_79353;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)] =\n                                        x_79354;\n                                    x_79359 = x_79354;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)] =\n                                        x_79355;\n                                    x_79360 = x_79355;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)] =\n                                        x_79356;\n                                    x_79361 = x_79356;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)] =\n                                        x_79357;\n                                    x_79362 = x_79357;\n                                }\n                            }\n                            if (sle32(wave_sizze_79334, skip_threads_79372)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_79372 *= 2;\n                        }\n                    }\n           ",
                   "     }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_79375 = squot32(local_tid_79332, 32) == 0 ||\n                     !ltid_in_bounds_79368;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_79375) {\n                            x_72165 = x_72160;\n                            x_72166 = x_72161;\n                            x_72167 = x_72162;\n                            x_72168 = x_72163;\n                            x_72169 = x_72164;\n                            x_72160 = ((__local\n                                        double *) red_arr_mem_79336)[sext_i32_i64(squot32(local_tid_79332,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_72161 = ((__local\n                                        double *) red_arr_mem_79338)[sext_i32_i64(squot32(local_tid_79332,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_72162 = ((__local\n                                        double *) red_arr_mem_79340)[sext_i32_i64(squot32(local_tid_79332,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_72163 = ((__local\n                                        double *) red_arr_mem_79342)[sext_i32_i64(squot32(local_tid_79332,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            ",
                   "x_72164 = ((__local\n                                        double *) red_arr_mem_79344)[sext_i32_i64(squot32(local_tid_79332,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79376 =\n                             slt64(srem64(sext_i32_i64(local_tid_79332),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_79332) -\n                                   sext_i32_i64(squot32(local_tid_79332, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_79375) {\n                            if (inactive_79376) {\n                                x_72160 = x_72165;\n                                x_72161 = x_72166;\n                                x_72162 = x_72167;\n                                x_72163 = x_72168;\n                                x_72164 = x_72169;\n                            }\n                        }\n                        if (!no_carry_in_79375) {\n                            if (!inactive_79376) {\n                                double defunc_1_op_res_72170 = x_72160 +\n                                       x_72165;\n                                double defunc_1_op_res_72171 = x_72161 +\n                                       x_72166;\n                                double defunc_1_op_res_72172 = x_72162 +\n                                       x_72167;\n                                double defunc_1_op_res_72173 = x_72163 +\n                                       x_72168;\n                                double defunc_1_op_res_72174 = x_72164 +\n                                       x_72169;\n                                \n                                x_72160 = def",
                   "unc_1_op_res_72170;\n                                x_72161 = defunc_1_op_res_72171;\n                                x_72162 = defunc_1_op_res_72172;\n                                x_72163 = defunc_1_op_res_72173;\n                                x_72164 = defunc_1_op_res_72174;\n                            }\n                        }\n                    }\n                    // write final result\n                    {\n                        if (!no_carry_in_79375) {\n                            ((__local\n                              double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)] =\n                                x_72160;\n                            ((__local\n                              double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)] =\n                                x_72161;\n                            ((__local\n                              double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)] =\n                                x_72162;\n                            ((__local\n                              double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)] =\n                                x_72163;\n                            ((__local\n                              double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)] =\n                                x_72164;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // restore correct values for first block\n                {\n                    if (squot32(local_tid_79332, 32) == 0 &&\n                        ltid_in_bounds_79368) {\n                        ((__local\n                          double *) red_arr_mem_79336)[sext_i32_i64(local_tid_79332)] =\n                            x_72165;\n                        ((__local\n                          double *) red_arr_mem_79338)[sext_i32_i64(local_tid_79332)] =\n                            x_72166;\n                        ((__local\n                        ",
                   "  double *) red_arr_mem_79340)[sext_i32_i64(local_tid_79332)] =\n                            x_72167;\n                        ((__local\n                          double *) red_arr_mem_79342)[sext_i32_i64(local_tid_79332)] =\n                            x_72168;\n                        ((__local\n                          double *) red_arr_mem_79344)[sext_i32_i64(local_tid_79332)] =\n                            x_72169;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // save final values of segments\n        {\n            if (slt64(sext_i32_i64(virt_group_id_79348) *\n                      squot64(segred_group_sizze_72148,\n                              segment_sizze_nonzzero_79329) +\n                      sext_i32_i64(local_tid_79332), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_79332),\n                      squot64(segred_group_sizze_72148,\n                              segment_sizze_nonzzero_79329))) {\n                double tmp_79377;\n                \n                tmp_79377 = ((__local\n                              double *) red_arr_mem_79336)[(sext_i32_i64(local_tid_79332) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79329 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77794)[squot64(sext_i32_i64(virt_group_id_79348) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79329) +\n                                               sext_i32_i64(local_tid_79332),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79348) *\n                                 ",
                   "       squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79329) +\n                                        sext_i32_i64(local_tid_79332) -\n                                        squot64(sext_i32_i64(virt_group_id_79348) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79329) +\n                                                sext_i32_i64(local_tid_79332),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79377;\n                \n                double tmp_79378;\n                \n                tmp_79378 = ((__local\n                              double *) red_arr_mem_79338)[(sext_i32_i64(local_tid_79332) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79329 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77798)[squot64(sext_i32_i64(virt_group_id_79348) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79329) +\n                                               sext_i32_i64(local_tid_79332),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79348) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79329) +\n                                        sext_i32_i64(local_tid_79332) -\n                                        squot64(sext_i32_i64(virt_group_id_79348) *\n                                                squot64(segred_group_sizze_72148,\n                                    ",
                   "                    segment_sizze_nonzzero_79329) +\n                                                sext_i32_i64(local_tid_79332),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79378;\n                \n                double tmp_79379;\n                \n                tmp_79379 = ((__local\n                              double *) red_arr_mem_79340)[(sext_i32_i64(local_tid_79332) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79329 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77802)[squot64(sext_i32_i64(virt_group_id_79348) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79329) +\n                                               sext_i32_i64(local_tid_79332),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79348) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79329) +\n                                        sext_i32_i64(local_tid_79332) -\n                                        squot64(sext_i32_i64(virt_group_id_79348) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79329) +\n                                                sext_i32_i64(local_tid_79332),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79379;\n                \n                double tmp_79380;\n                \n                tmp_79380 = ((__local\n                              double *) red_arr_mem_",
                   "79342)[(sext_i32_i64(local_tid_79332) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79329 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77806)[squot64(sext_i32_i64(virt_group_id_79348) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79329) +\n                                               sext_i32_i64(local_tid_79332),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79348) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79329) +\n                                        sext_i32_i64(local_tid_79332) -\n                                        squot64(sext_i32_i64(virt_group_id_79348) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79329) +\n                                                sext_i32_i64(local_tid_79332),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79380;\n                \n                double tmp_79381;\n                \n                tmp_79381 = ((__local\n                              double *) red_arr_mem_79344)[(sext_i32_i64(local_tid_79332) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79329 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77810)[squot64(sext_i32_i64(virt_group_id_79348) *\n       ",
                   "                                        squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79329) +\n                                               sext_i32_i64(local_tid_79332),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79348) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79329) +\n                                        sext_i32_i64(local_tid_79332) -\n                                        squot64(sext_i32_i64(virt_group_id_79348) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79329) +\n                                                sext_i32_i64(local_tid_79332),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79381;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_72148\n}\n__kernel void mainzisegred_small_72258(__global int *global_failure,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79476_backing_aligned_0,\n                                       __local volatile\n                                       int64_t *red_arr_mem_79474_backing_aligned_1,\n                                       int64_t m_65377, int64_t n_65378,\n                                       int64_t q_65380, int64_t jump_65382,\n                                       int64_t n_m_65386, int64_t i_65392,\n                                       int64_t num_groups_72251,\n                                       int64_t segment_sizze_nonzzero_79467,\n                                    ",
                   "   __global unsigned char *mem_77642,\n                                       __global unsigned char *mem_77646,\n                                       __global unsigned char *mem_77650,\n                                       __global unsigned char *mem_77674,\n                                       __global unsigned char *mem_77785,\n                                       __global unsigned char *mem_77789,\n                                       __global unsigned char *mem_77815,\n                                       __global unsigned char *mem_77819,\n                                       __global unsigned char *mem_77823,\n                                       __global unsigned char *mem_77827,\n                                       __global unsigned char *mem_77831,\n                                       __global unsigned char *mem_77836,\n                                       __global unsigned char *mem_77840)\n{\n    #define segred_group_sizze_72250 (mainzisegred_group_sizze_70946)\n    \n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    __local volatile unsigned char *restrict red_arr_mem_79476_backing_1 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79476_backing_aligned_0;\n    __local volatile unsigned char *restrict red_arr_mem_79474_backing_0 =\n                                   (__local volatile\n                                    unsigned char *) red_arr_mem_79474_backing_aligned_1;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79469;\n    int32_t local_tid_79470;\n    int64_t group_sizze_79473;\n    int32_t wave_sizze_79472;\n    int32_t group_tid_79471;\n    \n    global_tid_79469 = get_global_id(0);\n    local_tid_79470 = get_local_id(0);\n    group_sizze_79473 = get_local_size(0);\n    wave_sizze_79472 = LOCKSTEP_WIDTH;\n    group_tid_79471 = get_group_id(0);\n    \n    int32_t phys_tid_72258 = global_tid_79469;\n    __lo",
                   "cal unsigned char *red_arr_mem_79474;\n    \n    red_arr_mem_79474 = (__local unsigned char *) red_arr_mem_79474_backing_0;\n    \n    __local unsigned char *red_arr_mem_79476;\n    \n    red_arr_mem_79476 = (__local unsigned char *) red_arr_mem_79476_backing_1;\n    \n    int32_t phys_group_id_79478;\n    \n    phys_group_id_79478 = get_group_id(0);\n    for (int32_t i_79479 = 0; i_79479 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_72250,\n                                                  segment_sizze_nonzzero_79467))) -\n                   phys_group_id_79478, sext_i64_i32(num_groups_72251));\n         i_79479++) {\n        int32_t virt_group_id_79480 = phys_group_id_79478 + i_79479 *\n                sext_i64_i32(num_groups_72251);\n        int64_t slice_79481 = n_m_65386;\n        int64_t slice_79482 = m_65377 * slice_79481;\n        int64_t gtid_72255 = squot64(squot64(sext_i32_i64(local_tid_79470),\n                                             segment_sizze_nonzzero_79467) +\n                                     sext_i32_i64(virt_group_id_79480) *\n                                     squot64(segred_group_sizze_72250,\n                                             segment_sizze_nonzzero_79467),\n                                     slice_79481);\n        int64_t remnant_79483 = squot64(sext_i32_i64(local_tid_79470),\n                                        segment_sizze_nonzzero_79467) +\n                sext_i32_i64(virt_group_id_79480) *\n                squot64(segred_group_sizze_72250,\n                        segment_sizze_nonzzero_79467) - gtid_72255 *\n                slice_79481;\n        int64_t gtid_72256 = remnant_79483;\n        int64_t remnant_79484 = remnant_79483 - gtid_72256;\n        int64_t gtid_72257 = srem64(sext_i32_i64(local_tid_79470), q_65380);\n        \n        // apply map function if in bounds\n        {\n            if (slt64((int64_t) 0, q_65380) && ((slt64(gtid_72255, m_65377) &",
                   "&\n                                                 slt64(gtid_72256,\n                                                       n_m_65386)) &&\n                                                slt64(sext_i32_i64(local_tid_79470),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_72250,\n                                                              segment_sizze_nonzzero_79467)))) {\n                int64_t last_res_72265;\n                \n                last_res_72265 = ((__global int64_t *) mem_77642)[gtid_72255 *\n                                                                  n_65378 +\n                                                                  i_65392];\n                \n                int64_t binop_y_74726 = mul64(jump_65382, gtid_72256);\n                int64_t index_primexp_74727 = smin64(i_65392, binop_y_74726);\n                int64_t max_res_72278;\n                \n                max_res_72278 = ((__global int64_t *) mem_77785)[gtid_72255 *\n                                                                 n_m_65386 +\n                                                                 gtid_72256];\n                \n                double defunc_1_f_res_72279;\n                \n                defunc_1_f_res_72279 = ((__global\n                                         double *) mem_77789)[gtid_72255 *\n                                                              n_m_65386 +\n                                                              gtid_72256];\n                \n                double a12_72280;\n                \n                a12_72280 = ((__global double *) mem_77815)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gtid_72256];\n                \n                double b12_72281;\n                \n                b12_72281 = ((__global double *) mem_77819)[gtid_72255 *\n    ",
                   "                                                        n_m_65386 +\n                                                            gtid_72256];\n                \n                double c12_72282;\n                \n                c12_72282 = ((__global double *) mem_77823)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gtid_72256];\n                \n                double b2_72283;\n                \n                b2_72283 = ((__global double *) mem_77827)[gtid_72255 *\n                                                           n_m_65386 +\n                                                           gtid_72256];\n                \n                double c2_72284;\n                \n                c2_72284 = ((__global double *) mem_77831)[gtid_72255 *\n                                                           n_m_65386 +\n                                                           gtid_72256];\n                \n                double x_72286;\n                \n                x_72286 = ((__global double *) mem_77674)[gtid_72255 * q_65380 +\n                                                          gtid_72257];\n                \n                bool cond_72287 = sle64(last_res_72265, gtid_72257);\n                int64_t defunc_0_f_res_72288;\n                \n                if (cond_72287) {\n                    defunc_0_f_res_72288 = (int64_t) 0;\n                } else {\n                    int64_t i_72289 = add64(gtid_72257, max_res_72278);\n                    int64_t defunc_0_add_arg_72290;\n                    \n                    defunc_0_add_arg_72290 = ((__global\n                                               int64_t *) mem_77650)[gtid_72255 *\n                                                                     n_65378 +\n                                                                     i_72289];\n                    \n                    int64_t defunc_1_add_res_72291 = add64((int64",
                   "_t) 1,\n                                                           defunc_0_add_arg_72290);\n                    \n                    defunc_0_f_res_72288 = defunc_1_add_res_72291;\n                }\n                \n                int64_t binop_p_72292 = sub64(defunc_0_f_res_72288,\n                                              index_primexp_74727);\n                double defunc_0_f_res_72293 = sitofp_i64_f64(binop_p_72292);\n                double abs_res_72294 = fabs(defunc_0_f_res_72293);\n                double tmp1_72295 = abs_res_72294 / defunc_1_f_res_72279;\n                double x_72296 = tmp1_72295 * tmp1_72295;\n                double y_72297 = tmp1_72295 * x_72296;\n                double tmp2_72298 = 1.0 - y_72297;\n                double x_72299 = tmp2_72298 * tmp2_72298;\n                double tmp3_72300 = tmp2_72298 * x_72299;\n                double tmp4_72301 = x_72286 * tmp3_72300;\n                double defunc_1_f_res_72302 = defunc_0_f_res_72293 * tmp4_72301;\n                double defunc_1_f_res_72303 = defunc_0_f_res_72293 *\n                       defunc_1_f_res_72302;\n                double defunc_0_f_res_72304;\n                \n                if (cond_72287) {\n                    defunc_0_f_res_72304 = 0.0;\n                } else {\n                    int64_t i_72305 = add64(gtid_72257, max_res_72278);\n                    double defunc_0_add_arg_72306;\n                    \n                    defunc_0_add_arg_72306 = ((__global\n                                               double *) mem_77646)[gtid_72255 *\n                                                                    n_65378 +\n                                                                    i_72305];\n                    defunc_0_f_res_72304 = defunc_0_add_arg_72306;\n                }\n                \n                double x_72307 = a12_72280 * tmp4_72301;\n                double y_72308 = b12_72281 * defunc_1_f_res_72302;\n                double x_72309 = x_72307 + y_72308;\n               ",
                   " double y_72310 = c12_72282 * defunc_1_f_res_72303;\n                double x_72311 = x_72309 + y_72310;\n                double defunc_9_fit_fun_res_72312 = defunc_0_f_res_72304 *\n                       x_72311;\n                double x_72313 = b12_72281 * tmp4_72301;\n                double y_72314 = b2_72283 * defunc_1_f_res_72302;\n                double x_72315 = x_72313 + y_72314;\n                double y_72316 = c2_72284 * defunc_1_f_res_72303;\n                double x_72317 = x_72315 + y_72316;\n                double defunc_9_slope_fun_res_72318 = defunc_0_f_res_72304 *\n                       x_72317;\n                \n                // save map-out results\n                { }\n                // save results to be reduced\n                {\n                    ((__local\n                      double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470)] =\n                        defunc_9_fit_fun_res_72312;\n                    ((__local\n                      double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)] =\n                        defunc_9_slope_fun_res_72318;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)] =\n                    0.0;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (slt64((int64_t) 0, q_65380)) {\n            // perform segmented scan to imitate reduction\n            {\n                double x_72259;\n                double x_72260;\n                double x_72261;\n                double x_72262;\n                double x_79485;\n                double x_79486;\n                double x_79487;\n                double x_79488;\n                bool ltid_in_bounds_79491 = slt64(sext_i32_i64(local_tid_79470),\n                                                  q_65380 *\n                                    ",
                   "              squot64(segred_group_sizze_72250,\n                                                          segment_sizze_nonzzero_79467));\n                int32_t skip_threads_79492;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_79491) {\n                        x_72261 = ((volatile __local\n                                    double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470)];\n                        x_72262 = ((volatile __local\n                                    double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)];\n                        if ((local_tid_79470 - squot32(local_tid_79470, 32) *\n                             32) == 0) {\n                            x_72259 = x_72261;\n                            x_72260 = x_72262;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_79492 = 1;\n                    while (slt32(skip_threads_79492, 32)) {\n                        bool thread_active_79493 = sle32(skip_threads_79492,\n                                                         local_tid_79470 -\n                                                         squot32(local_tid_79470,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_79491;\n                        \n                        if (thread_active_79493) {\n                            // read operands\n                            {\n                                x_72259 = ((volatile __local\n                                            double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470) -\n                                                                         sext_i32_i64(skip_threads_79492)];\n                                x_72260 = ((volatile __local\n                                            double *) red_arr_mem_79476)[",
                   "sext_i32_i64(local_tid_79470) -\n                                                                         sext_i32_i64(skip_threads_79492)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79494 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79470),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_79470) -\n                                       sext_i32_i64(local_tid_79470 -\n                                       skip_threads_79492));\n                            \n                            if (thread_active_79493 && inactive_79494) {\n                                x_72259 = x_72261;\n                                x_72260 = x_72262;\n                            }\n                            if (thread_active_79493) {\n                                if (!inactive_79494) {\n                                    double defunc_1_op_res_72263 = x_72259 +\n                                           x_72261;\n                                    double defunc_1_op_res_72264 = x_72260 +\n                                           x_72262;\n                                    \n                                    x_72259 = defunc_1_op_res_72263;\n                                    x_72260 = defunc_1_op_res_72264;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_79472, skip_threads_79492)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79493) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470)] =\n                                    x_72259;\n     ",
                   "                           x_72261 = x_72259;\n                                ((volatile __local\n                                  double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)] =\n                                    x_72260;\n                                x_72262 = x_72260;\n                            }\n                        }\n                        if (sle32(wave_sizze_79472, skip_threads_79492)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79492 *= 2;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // last thread of block 'i' writes its result to offset 'i'\n                {\n                    if ((local_tid_79470 - squot32(local_tid_79470, 32) * 32) ==\n                        31 && ltid_in_bounds_79491) {\n                        ((volatile __local\n                          double *) red_arr_mem_79474)[sext_i32_i64(squot32(local_tid_79470,\n                                                                            32))] =\n                            x_72259;\n                        ((volatile __local\n                          double *) red_arr_mem_79476)[sext_i32_i64(squot32(local_tid_79470,\n                                                                            32))] =\n                            x_72260;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // scan the first block, after which offset 'i' contains carry-in for block 'i+1'\n                {\n                    int32_t skip_threads_79495;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_79470, 32) == 0 &&\n                            ltid_in_bounds_79491) {\n                            x_79487 = ((volatile __local\n                                        double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470)]",
                   ";\n                            x_79488 = ((volatile __local\n                                        double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)];\n                            if ((local_tid_79470 - squot32(local_tid_79470,\n                                                           32) * 32) == 0) {\n                                x_79485 = x_79487;\n                                x_79486 = x_79488;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_79495 = 1;\n                        while (slt32(skip_threads_79495, 32)) {\n                            bool thread_active_79496 = sle32(skip_threads_79495,\n                                                             local_tid_79470 -\n                                                             squot32(local_tid_79470,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_79470, 32) == 0 &&\n                                  ltid_in_bounds_79491);\n                            \n                            if (thread_active_79496) {\n                                // read operands\n                                {\n                                    x_79485 = ((volatile __local\n                                                double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470) -\n                                                                             sext_i32_i64(skip_threads_79495)];\n                                    x_79486 = ((volatile __local\n                                                double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470) -\n                                                                             sext_i32_i64(skip_threads_79495)];\n                                }\n               ",
                   "             }\n                            // perform operation\n                            {\n                                bool inactive_79497 =\n                                     slt64(srem64(sext_i32_i64(local_tid_79470 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_79470 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_79470 -\n                                                         skip_threads_79495) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_79496 && inactive_79497) {\n                                    x_79485 = x_79487;\n                                    x_79486 = x_79488;\n                                }\n                                if (thread_active_79496) {\n                                    if (!inactive_79497) {\n                                        double defunc_1_op_res_79489 = x_79485 +\n                                               x_79487;\n                                        double defunc_1_op_res_79490 = x_79486 +\n                                               x_79488;\n                                        \n                                        x_79485 = defunc_1_op_res_79489;\n                                        x_79486 = defunc_1_op_res_79490;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_79472, skip_threads_79495)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_79496) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr",
                   "_mem_79474)[sext_i32_i64(local_tid_79470)] =\n                                        x_79485;\n                                    x_79487 = x_79485;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)] =\n                                        x_79486;\n                                    x_79488 = x_79486;\n                                }\n                            }\n                            if (sle32(wave_sizze_79472, skip_threads_79495)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_79495 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_79498 = squot32(local_tid_79470, 32) == 0 ||\n                     !ltid_in_bounds_79491;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_79498) {\n                            x_72261 = x_72259;\n                            x_72262 = x_72260;\n                            x_72259 = ((__local\n                                        double *) red_arr_mem_79474)[sext_i32_i64(squot32(local_tid_79470,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_72260 = ((__local\n                                        double *) red_arr_mem_79476)[sext_i32_i64(squot32(local_tid_79470,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform opera",
                   "tion\n                    {\n                        bool inactive_79499 =\n                             slt64(srem64(sext_i32_i64(local_tid_79470),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_79470) -\n                                   sext_i32_i64(squot32(local_tid_79470, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_79498) {\n                            if (inactive_79499) {\n                                x_72259 = x_72261;\n                                x_72260 = x_72262;\n                            }\n                        }\n                        if (!no_carry_in_79498) {\n                            if (!inactive_79499) {\n                                double defunc_1_op_res_72263 = x_72259 +\n                                       x_72261;\n                                double defunc_1_op_res_72264 = x_72260 +\n                                       x_72262;\n                                \n                                x_72259 = defunc_1_op_res_72263;\n                                x_72260 = defunc_1_op_res_72264;\n                            }\n                        }\n                    }\n                    // write final result\n                    {\n                        if (!no_carry_in_79498) {\n                            ((__local\n                              double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470)] =\n                                x_72259;\n                            ((__local\n                              double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)] =\n                                x_72260;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // restore correct values for first block\n                {\n                    if (squot32(local_tid_79470, 32) == 0 &&\n                        ltid_in_bounds_",
                   "79491) {\n                        ((__local\n                          double *) red_arr_mem_79474)[sext_i32_i64(local_tid_79470)] =\n                            x_72261;\n                        ((__local\n                          double *) red_arr_mem_79476)[sext_i32_i64(local_tid_79470)] =\n                            x_72262;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // save final values of segments\n        {\n            if (slt64(sext_i32_i64(virt_group_id_79480) *\n                      squot64(segred_group_sizze_72250,\n                              segment_sizze_nonzzero_79467) +\n                      sext_i32_i64(local_tid_79470), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_79470),\n                      squot64(segred_group_sizze_72250,\n                              segment_sizze_nonzzero_79467))) {\n                double tmp_79500;\n                \n                tmp_79500 = ((__local\n                              double *) red_arr_mem_79474)[(sext_i32_i64(local_tid_79470) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79467 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77836)[squot64(sext_i32_i64(virt_group_id_79480) *\n                                               squot64(segred_group_sizze_72250,\n                                                       segment_sizze_nonzzero_79467) +\n                                               sext_i32_i64(local_tid_79470),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79480) *\n                                        squot64(segred_group_sizze_72250,\n                                                seg",
                   "ment_sizze_nonzzero_79467) +\n                                        sext_i32_i64(local_tid_79470) -\n                                        squot64(sext_i32_i64(virt_group_id_79480) *\n                                                squot64(segred_group_sizze_72250,\n                                                        segment_sizze_nonzzero_79467) +\n                                                sext_i32_i64(local_tid_79470),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79500;\n                \n                double tmp_79501;\n                \n                tmp_79501 = ((__local\n                              double *) red_arr_mem_79476)[(sext_i32_i64(local_tid_79470) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79467 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77840)[squot64(sext_i32_i64(virt_group_id_79480) *\n                                               squot64(segred_group_sizze_72250,\n                                                       segment_sizze_nonzzero_79467) +\n                                               sext_i32_i64(local_tid_79470),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79480) *\n                                        squot64(segred_group_sizze_72250,\n                                                segment_sizze_nonzzero_79467) +\n                                        sext_i32_i64(local_tid_79470) -\n                                        squot64(sext_i32_i64(virt_group_id_79480) *\n                                                squot64(segred_group_sizze_72250,\n                                                        segment_sizze_nonzzero_79467) +\n                                        ",
                   "        sext_i32_i64(local_tid_79470),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79501;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n    }\n    \n  error_1:\n    return;\n    #undef segred_group_sizze_72250\n}\n",
                   NULL};
static const char *tuning_param_names[] =
                  {"builtin#replicate_f64.group_size_78315",
                   "builtin#replicate_i64.group_size_78429",
                   "main.segmap_group_size_66731",
                   "main.segmap_group_size_67323",
                   "main.segmap_group_size_67381",
                   "main.segmap_group_size_67695",
                   "main.segmap_group_size_67720",
                   "main.segmap_group_size_67746",
                   "main.segmap_group_size_67772",
                   "main.segmap_group_size_68358",
                   "main.segmap_group_size_69060",
                   "main.segmap_group_size_69135",
                   "main.segmap_group_size_69486",
                   "main.segmap_group_size_69511",
                   "main.segmap_group_size_69537",
                   "main.segmap_group_size_69563",
                   "main.segmap_group_size_70217",
                   "main.segmap_group_size_71032",
                   "main.segmap_group_size_71134",
                   "main.segmap_group_size_71525",
                   "main.segmap_group_size_71550",
                   "main.segmap_group_size_71576",
                   "main.segmap_group_size_71602",
                   "main.segmap_group_size_72510",
                   "main.segmap_group_size_72535",
                   "main.segmap_group_size_72561",
                   "main.segmap_group_size_72587",
                   "main.segmap_group_size_73177",
                   "main.segmap_group_size_73202",
                   "main.segmap_group_size_73228",
                   "main.segmap_group_size_73254",
                   "main.segmap_group_size_73934",
                   "main.segmap_group_size_73959",
                   "main.segmap_group_size_73985",
                   "main.segmap_group_size_74011",
                   "main.segmap_group_size_74466",
                   "main.segmap_num_groups_66733",
                   "main.segmap_num_groups_68360",
                   "main.segmap_num_groups_70219",
                   "main.segred_group_size_67268",
                   "main.segred_group_size_67336",
                   "main.segred_group_size_68987",
                   "main.segred_group_size_69082",
                   "main.segred_group_size_70946",
                   "main.segred_group_size_71073",
                   "main.segred_num_groups_67270",
                   "main.segred_num_groups_67338",
                   "main.segred_num_groups_68989",
                   "main.segred_num_groups_69084",
                   "main.segred_num_groups_70948",
                   "main.segred_num_groups_71075",
                   "main.segscan_group_size_67858",
                   "main.segscan_group_size_69649",
                   "main.segscan_group_size_71688",
                   "main.segscan_group_size_72673",
                   "main.segscan_group_size_73340",
                   "main.segscan_group_size_74097",
                   "main.segscan_num_groups_67860",
                   "main.segscan_num_groups_69651",
                   "main.segscan_num_groups_71690",
                   "main.segscan_num_groups_72675",
                   "main.segscan_num_groups_73342",
                   "main.segscan_num_groups_74099", "main.suff_outer_par_0",
                   "main.suff_outer_par_1", "main.suff_outer_par_2",
                   "main.suff_outer_par_3", "main.suff_outer_par_4",
                   "main.suff_outer_par_5", "main.tile_size_74786",
                   "main.tile_size_75340", "main.tile_size_76011"};
static const char *tuning_param_vars[] =
                  {"builtinzhreplicate_f64zigroup_sizze_78315",
                   "builtinzhreplicate_i64zigroup_sizze_78429",
                   "mainzisegmap_group_sizze_66731",
                   "mainzisegmap_group_sizze_67323",
                   "mainzisegmap_group_sizze_67381",
                   "mainzisegmap_group_sizze_67695",
                   "mainzisegmap_group_sizze_67720",
                   "mainzisegmap_group_sizze_67746",
                   "mainzisegmap_group_sizze_67772",
                   "mainzisegmap_group_sizze_68358",
                   "mainzisegmap_group_sizze_69060",
                   "mainzisegmap_group_sizze_69135",
                   "mainzisegmap_group_sizze_69486",
                   "mainzisegmap_group_sizze_69511",
                   "mainzisegmap_group_sizze_69537",
                   "mainzisegmap_group_sizze_69563",
                   "mainzisegmap_group_sizze_70217",
                   "mainzisegmap_group_sizze_71032",
                   "mainzisegmap_group_sizze_71134",
                   "mainzisegmap_group_sizze_71525",
                   "mainzisegmap_group_sizze_71550",
                   "mainzisegmap_group_sizze_71576",
                   "mainzisegmap_group_sizze_71602",
                   "mainzisegmap_group_sizze_72510",
                   "mainzisegmap_group_sizze_72535",
                   "mainzisegmap_group_sizze_72561",
                   "mainzisegmap_group_sizze_72587",
                   "mainzisegmap_group_sizze_73177",
                   "mainzisegmap_group_sizze_73202",
                   "mainzisegmap_group_sizze_73228",
                   "mainzisegmap_group_sizze_73254",
                   "mainzisegmap_group_sizze_73934",
                   "mainzisegmap_group_sizze_73959",
                   "mainzisegmap_group_sizze_73985",
                   "mainzisegmap_group_sizze_74011",
                   "mainzisegmap_group_sizze_74466",
                   "mainzisegmap_num_groups_66733",
                   "mainzisegmap_num_groups_68360",
                   "mainzisegmap_num_groups_70219",
                   "mainzisegred_group_sizze_67268",
                   "mainzisegred_group_sizze_67336",
                   "mainzisegred_group_sizze_68987",
                   "mainzisegred_group_sizze_69082",
                   "mainzisegred_group_sizze_70946",
                   "mainzisegred_group_sizze_71073",
                   "mainzisegred_num_groups_67270",
                   "mainzisegred_num_groups_67338",
                   "mainzisegred_num_groups_68989",
                   "mainzisegred_num_groups_69084",
                   "mainzisegred_num_groups_70948",
                   "mainzisegred_num_groups_71075",
                   "mainzisegscan_group_sizze_67858",
                   "mainzisegscan_group_sizze_69649",
                   "mainzisegscan_group_sizze_71688",
                   "mainzisegscan_group_sizze_72673",
                   "mainzisegscan_group_sizze_73340",
                   "mainzisegscan_group_sizze_74097",
                   "mainzisegscan_num_groups_67860",
                   "mainzisegscan_num_groups_69651",
                   "mainzisegscan_num_groups_71690",
                   "mainzisegscan_num_groups_72675",
                   "mainzisegscan_num_groups_73342",
                   "mainzisegscan_num_groups_74099", "mainzisuff_outer_par_0",
                   "mainzisuff_outer_par_1", "mainzisuff_outer_par_2",
                   "mainzisuff_outer_par_3", "mainzisuff_outer_par_4",
                   "mainzisuff_outer_par_5", "mainzitile_sizze_74786",
                   "mainzitile_sizze_75340", "mainzitile_sizze_76011"};
static const char *tuning_param_classes[] = {"group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "num_groups", "num_groups",
                                             "num_groups", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "num_groups",
                                             "num_groups", "num_groups",
                                             "num_groups", "num_groups",
                                             "num_groups", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "group_size",
                                             "group_size", "num_groups",
                                             "num_groups", "num_groups",
                                             "num_groups", "num_groups",
                                             "num_groups", "threshold(def,)",
                                             "threshold(def, !main.suff_outer_par_0)",
                                             "threshold(def,)",
                                             "threshold(def, !main.suff_outer_par_2)",
                                             "threshold(def,)",
                                             "threshold(def, !main.suff_outer_par_4)",
                                             "tile_size", "tile_size",
                                             "tile_size"};
struct tuning_params {
    int64_t *builtinzhreplicate_f64zigroup_sizze_78315;
    int64_t *builtinzhreplicate_i64zigroup_sizze_78429;
    int64_t *mainzisegmap_group_sizze_66731;
    int64_t *mainzisegmap_group_sizze_67323;
    int64_t *mainzisegmap_group_sizze_67381;
    int64_t *mainzisegmap_group_sizze_67695;
    int64_t *mainzisegmap_group_sizze_67720;
    int64_t *mainzisegmap_group_sizze_67746;
    int64_t *mainzisegmap_group_sizze_67772;
    int64_t *mainzisegmap_group_sizze_68358;
    int64_t *mainzisegmap_group_sizze_69060;
    int64_t *mainzisegmap_group_sizze_69135;
    int64_t *mainzisegmap_group_sizze_69486;
    int64_t *mainzisegmap_group_sizze_69511;
    int64_t *mainzisegmap_group_sizze_69537;
    int64_t *mainzisegmap_group_sizze_69563;
    int64_t *mainzisegmap_group_sizze_70217;
    int64_t *mainzisegmap_group_sizze_71032;
    int64_t *mainzisegmap_group_sizze_71134;
    int64_t *mainzisegmap_group_sizze_71525;
    int64_t *mainzisegmap_group_sizze_71550;
    int64_t *mainzisegmap_group_sizze_71576;
    int64_t *mainzisegmap_group_sizze_71602;
    int64_t *mainzisegmap_group_sizze_72510;
    int64_t *mainzisegmap_group_sizze_72535;
    int64_t *mainzisegmap_group_sizze_72561;
    int64_t *mainzisegmap_group_sizze_72587;
    int64_t *mainzisegmap_group_sizze_73177;
    int64_t *mainzisegmap_group_sizze_73202;
    int64_t *mainzisegmap_group_sizze_73228;
    int64_t *mainzisegmap_group_sizze_73254;
    int64_t *mainzisegmap_group_sizze_73934;
    int64_t *mainzisegmap_group_sizze_73959;
    int64_t *mainzisegmap_group_sizze_73985;
    int64_t *mainzisegmap_group_sizze_74011;
    int64_t *mainzisegmap_group_sizze_74466;
    int64_t *mainzisegmap_num_groups_66733;
    int64_t *mainzisegmap_num_groups_68360;
    int64_t *mainzisegmap_num_groups_70219;
    int64_t *mainzisegred_group_sizze_67268;
    int64_t *mainzisegred_group_sizze_67336;
    int64_t *mainzisegred_group_sizze_68987;
    int64_t *mainzisegred_group_sizze_69082;
    int64_t *mainzisegred_group_sizze_70946;
    int64_t *mainzisegred_group_sizze_71073;
    int64_t *mainzisegred_num_groups_67270;
    int64_t *mainzisegred_num_groups_67338;
    int64_t *mainzisegred_num_groups_68989;
    int64_t *mainzisegred_num_groups_69084;
    int64_t *mainzisegred_num_groups_70948;
    int64_t *mainzisegred_num_groups_71075;
    int64_t *mainzisegscan_group_sizze_67858;
    int64_t *mainzisegscan_group_sizze_69649;
    int64_t *mainzisegscan_group_sizze_71688;
    int64_t *mainzisegscan_group_sizze_72673;
    int64_t *mainzisegscan_group_sizze_73340;
    int64_t *mainzisegscan_group_sizze_74097;
    int64_t *mainzisegscan_num_groups_67860;
    int64_t *mainzisegscan_num_groups_69651;
    int64_t *mainzisegscan_num_groups_71690;
    int64_t *mainzisegscan_num_groups_72675;
    int64_t *mainzisegscan_num_groups_73342;
    int64_t *mainzisegscan_num_groups_74099;
    int64_t *mainzisuff_outer_par_0;
    int64_t *mainzisuff_outer_par_1;
    int64_t *mainzisuff_outer_par_2;
    int64_t *mainzisuff_outer_par_3;
    int64_t *mainzisuff_outer_par_4;
    int64_t *mainzisuff_outer_par_5;
    int64_t *mainzitile_sizze_74786;
    int64_t *mainzitile_sizze_75340;
    int64_t *mainzitile_sizze_76011;
};
struct futhark_context_config {
    int in_use;
    struct opencl_config opencl;
    int64_t tuning_params[72];
    int num_build_opts;
    const char **build_opts;
};
struct futhark_context_config *futhark_context_config_new(void)
{
    struct futhark_context_config *cfg =
                                  (struct futhark_context_config *) malloc(sizeof(struct futhark_context_config));
    
    if (cfg == NULL)
        return NULL;
    cfg->in_use = 0;
    cfg->num_build_opts = 0;
    cfg->build_opts = (const char **) malloc(sizeof(const char *));
    cfg->build_opts[0] = NULL;
    cfg->tuning_params[0] = 0;
    cfg->tuning_params[1] = 0;
    cfg->tuning_params[2] = 0;
    cfg->tuning_params[3] = 0;
    cfg->tuning_params[4] = 0;
    cfg->tuning_params[5] = 0;
    cfg->tuning_params[6] = 0;
    cfg->tuning_params[7] = 0;
    cfg->tuning_params[8] = 0;
    cfg->tuning_params[9] = 0;
    cfg->tuning_params[10] = 0;
    cfg->tuning_params[11] = 0;
    cfg->tuning_params[12] = 0;
    cfg->tuning_params[13] = 0;
    cfg->tuning_params[14] = 0;
    cfg->tuning_params[15] = 0;
    cfg->tuning_params[16] = 0;
    cfg->tuning_params[17] = 0;
    cfg->tuning_params[18] = 0;
    cfg->tuning_params[19] = 0;
    cfg->tuning_params[20] = 0;
    cfg->tuning_params[21] = 0;
    cfg->tuning_params[22] = 0;
    cfg->tuning_params[23] = 0;
    cfg->tuning_params[24] = 0;
    cfg->tuning_params[25] = 0;
    cfg->tuning_params[26] = 0;
    cfg->tuning_params[27] = 0;
    cfg->tuning_params[28] = 0;
    cfg->tuning_params[29] = 0;
    cfg->tuning_params[30] = 0;
    cfg->tuning_params[31] = 0;
    cfg->tuning_params[32] = 0;
    cfg->tuning_params[33] = 0;
    cfg->tuning_params[34] = 0;
    cfg->tuning_params[35] = 0;
    cfg->tuning_params[36] = 0;
    cfg->tuning_params[37] = 0;
    cfg->tuning_params[38] = 0;
    cfg->tuning_params[39] = 0;
    cfg->tuning_params[40] = 0;
    cfg->tuning_params[41] = 0;
    cfg->tuning_params[42] = 0;
    cfg->tuning_params[43] = 0;
    cfg->tuning_params[44] = 0;
    cfg->tuning_params[45] = 0;
    cfg->tuning_params[46] = 0;
    cfg->tuning_params[47] = 0;
    cfg->tuning_params[48] = 0;
    cfg->tuning_params[49] = 0;
    cfg->tuning_params[50] = 0;
    cfg->tuning_params[51] = 0;
    cfg->tuning_params[52] = 0;
    cfg->tuning_params[53] = 0;
    cfg->tuning_params[54] = 0;
    cfg->tuning_params[55] = 0;
    cfg->tuning_params[56] = 0;
    cfg->tuning_params[57] = 0;
    cfg->tuning_params[58] = 0;
    cfg->tuning_params[59] = 0;
    cfg->tuning_params[60] = 0;
    cfg->tuning_params[61] = 0;
    cfg->tuning_params[62] = 0;
    cfg->tuning_params[63] = 0;
    cfg->tuning_params[64] = 0;
    cfg->tuning_params[65] = 0;
    cfg->tuning_params[66] = 0;
    cfg->tuning_params[67] = 0;
    cfg->tuning_params[68] = 0;
    cfg->tuning_params[69] = 0;
    cfg->tuning_params[70] = 0;
    cfg->tuning_params[71] = 0;
    opencl_config_init(&cfg->opencl, 72, tuning_param_names, tuning_param_vars,
                       cfg->tuning_params, tuning_param_classes);
    return cfg;
}
void futhark_context_config_free(struct futhark_context_config *cfg)
{
    assert(!cfg->in_use);
    free(cfg->build_opts);
    free(cfg);
}
void futhark_context_config_add_build_option(struct futhark_context_config *cfg,
                                             const char *opt)
{
    cfg->build_opts[cfg->num_build_opts] = opt;
    cfg->num_build_opts++;
    cfg->build_opts = (const char **) realloc(cfg->build_opts,
                                              (cfg->num_build_opts + 1) *
                                              sizeof(const char *));
    cfg->build_opts[cfg->num_build_opts] = NULL;
}
void futhark_context_config_set_debugging(struct futhark_context_config *cfg,
                                          int flag)
{
    cfg->opencl.profiling = cfg->opencl.logging = cfg->opencl.debugging = flag;
}
void futhark_context_config_set_profiling(struct futhark_context_config *cfg,
                                          int flag)
{
    cfg->opencl.profiling = flag;
}
void futhark_context_config_set_logging(struct futhark_context_config *cfg,
                                        int flag)
{
    cfg->opencl.logging = flag;
}
void futhark_context_config_set_device(struct futhark_context_config *cfg, const
                                       char *s)
{
    set_preferred_device(&cfg->opencl, s);
}
void futhark_context_config_set_platform(struct futhark_context_config *cfg,
                                         const char *s)
{
    set_preferred_platform(&cfg->opencl, s);
}
void futhark_context_config_select_device_interactively(struct futhark_context_config *cfg)
{
    select_device_interactively(&cfg->opencl);
}
void futhark_context_config_list_devices(struct futhark_context_config *cfg)
{
    (void) cfg;
    list_devices();
}
void futhark_context_config_dump_program_to(struct futhark_context_config *cfg,
                                            const char *path)
{
    cfg->opencl.dump_program_to = path;
}
void futhark_context_config_load_program_from(struct futhark_context_config *cfg,
                                              const char *path)
{
    cfg->opencl.load_program_from = path;
}
void futhark_context_config_dump_binary_to(struct futhark_context_config *cfg,
                                           const char *path)
{
    cfg->opencl.dump_binary_to = path;
}
void futhark_context_config_load_binary_from(struct futhark_context_config *cfg,
                                             const char *path)
{
    cfg->opencl.load_binary_from = path;
}
void futhark_context_config_set_default_group_size(struct futhark_context_config *cfg,
                                                   int size)
{
    cfg->opencl.default_group_size = size;
    cfg->opencl.default_group_size_changed = 1;
}
void futhark_context_config_set_default_num_groups(struct futhark_context_config *cfg,
                                                   int num)
{
    cfg->opencl.default_num_groups = num;
}
void futhark_context_config_set_default_tile_size(struct futhark_context_config *cfg,
                                                  int size)
{
    cfg->opencl.default_tile_size = size;
    cfg->opencl.default_tile_size_changed = 1;
}
void futhark_context_config_set_default_reg_tile_size(struct futhark_context_config *cfg,
                                                      int size)
{
    cfg->opencl.default_reg_tile_size = size;
}
void futhark_context_config_set_default_threshold(struct futhark_context_config *cfg,
                                                  int size)
{
    cfg->opencl.default_threshold = size;
}
int futhark_context_config_set_tuning_param(struct futhark_context_config *cfg,
                                            const char *param_name,
                                            size_t new_value)
{
    for (int i = 0; i < 72; i++) {
        if (strcmp(param_name, tuning_param_names[i]) == 0) {
            cfg->tuning_params[i] = new_value;
            return 0;
        }
    }
    if (strcmp(param_name, "default_group_size") == 0) {
        cfg->opencl.default_group_size = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_num_groups") == 0) {
        cfg->opencl.default_num_groups = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_threshold") == 0) {
        cfg->opencl.default_threshold = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_tile_size") == 0) {
        cfg->opencl.default_tile_size = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_reg_tile_size") == 0) {
        cfg->opencl.default_reg_tile_size = new_value;
        return 0;
    }
    return 1;
}
struct futhark_context {
    struct futhark_context_config *cfg;
    int detail_memory;
    int debugging;
    int profiling;
    int profiling_paused;
    int logging;
    lock_t lock;
    char *error;
    FILE *log;
    int64_t peak_mem_usage_device;
    int64_t cur_mem_usage_device;
    int64_t peak_mem_usage_default;
    int64_t cur_mem_usage_default;
    struct {
        int dummy;
    } constants;
    struct memblock_device mainzicounter_mem_78559;
    struct memblock_device mainzicounter_mem_78641;
    struct memblock_device mainzicounter_mem_78948;
    struct memblock_device mainzicounter_mem_79050;
    struct memblock_device mainzicounter_mem_79397;
    struct memblock_device mainzicounter_mem_79511;
    int total_runs;
    long total_runtime;
    cl_kernel builtinzhreplicate_f64zireplicate_78312;
    cl_kernel builtinzhreplicate_i64zireplicate_78426;
    cl_kernel gpu_map_transpose_f64;
    cl_kernel gpu_map_transpose_f64_low_height;
    cl_kernel gpu_map_transpose_f64_low_width;
    cl_kernel gpu_map_transpose_f64_small;
    cl_kernel mainziscan_stage1_67884;
    cl_kernel mainziscan_stage1_69675;
    cl_kernel mainziscan_stage1_71714;
    cl_kernel mainziscan_stage1_72699;
    cl_kernel mainziscan_stage1_73366;
    cl_kernel mainziscan_stage1_74123;
    cl_kernel mainziscan_stage2_67884;
    cl_kernel mainziscan_stage2_69675;
    cl_kernel mainziscan_stage2_71714;
    cl_kernel mainziscan_stage2_72699;
    cl_kernel mainziscan_stage2_73366;
    cl_kernel mainziscan_stage2_74123;
    cl_kernel mainziscan_stage3_67884;
    cl_kernel mainziscan_stage3_69675;
    cl_kernel mainziscan_stage3_71714;
    cl_kernel mainziscan_stage3_72699;
    cl_kernel mainziscan_stage3_73366;
    cl_kernel mainziscan_stage3_74123;
    cl_kernel mainzisegmap_66915;
    cl_kernel mainzisegmap_67937;
    cl_kernel mainzisegmap_67956;
    cl_kernel mainzisegmap_67968;
    cl_kernel mainzisegmap_67988;
    cl_kernel mainzisegmap_68159;
    cl_kernel mainzisegmap_68300;
    cl_kernel mainzisegmap_68572;
    cl_kernel mainzisegmap_69728;
    cl_kernel mainzisegmap_69747;
    cl_kernel mainzisegmap_69759;
    cl_kernel mainzisegmap_69779;
    cl_kernel mainzisegmap_69980;
    cl_kernel mainzisegmap_70133;
    cl_kernel mainzisegmap_70463;
    cl_kernel mainzisegmap_71767;
    cl_kernel mainzisegmap_71786;
    cl_kernel mainzisegmap_71798;
    cl_kernel mainzisegmap_71818;
    cl_kernel mainzisegmap_72051;
    cl_kernel mainzisegmap_72216;
    cl_kernel mainzisegmap_72752;
    cl_kernel mainzisegmap_72771;
    cl_kernel mainzisegmap_72783;
    cl_kernel mainzisegmap_72803;
    cl_kernel mainzisegmap_73419;
    cl_kernel mainzisegmap_73438;
    cl_kernel mainzisegmap_73450;
    cl_kernel mainzisegmap_73470;
    cl_kernel mainzisegmap_74176;
    cl_kernel mainzisegmap_74195;
    cl_kernel mainzisegmap_74207;
    cl_kernel mainzisegmap_74227;
    cl_kernel mainzisegmap_74589;
    cl_kernel mainzisegmap_intragroup_72819;
    cl_kernel mainzisegmap_intragroup_73487;
    cl_kernel mainzisegmap_intragroup_74244;
    cl_kernel mainzisegmap_intragroup_74792;
    cl_kernel mainzisegmap_intragroup_75346;
    cl_kernel mainzisegmap_intragroup_76017;
    cl_kernel mainzisegred_large_68263;
    cl_kernel mainzisegred_large_68313;
    cl_kernel mainzisegred_large_70086;
    cl_kernel mainzisegred_large_70156;
    cl_kernel mainzisegred_large_72159;
    cl_kernel mainzisegred_large_72258;
    cl_kernel mainzisegred_small_68263;
    cl_kernel mainzisegred_small_68313;
    cl_kernel mainzisegred_small_70086;
    cl_kernel mainzisegred_small_70156;
    cl_kernel mainzisegred_small_72159;
    cl_kernel mainzisegred_small_72258;
    int64_t copy_dev_to_dev_total_runtime;
    int copy_dev_to_dev_runs;
    int64_t copy_dev_to_host_total_runtime;
    int copy_dev_to_host_runs;
    int64_t copy_host_to_dev_total_runtime;
    int copy_host_to_dev_runs;
    int64_t copy_scalar_to_dev_total_runtime;
    int copy_scalar_to_dev_runs;
    int64_t copy_scalar_from_dev_total_runtime;
    int copy_scalar_from_dev_runs;
    int64_t builtinzhreplicate_f64zireplicate_78312_total_runtime;
    int builtinzhreplicate_f64zireplicate_78312_runs;
    int64_t builtinzhreplicate_i64zireplicate_78426_total_runtime;
    int builtinzhreplicate_i64zireplicate_78426_runs;
    int64_t gpu_map_transpose_f64_total_runtime;
    int gpu_map_transpose_f64_runs;
    int64_t gpu_map_transpose_f64_low_height_total_runtime;
    int gpu_map_transpose_f64_low_height_runs;
    int64_t gpu_map_transpose_f64_low_width_total_runtime;
    int gpu_map_transpose_f64_low_width_runs;
    int64_t gpu_map_transpose_f64_small_total_runtime;
    int gpu_map_transpose_f64_small_runs;
    int64_t mainziscan_stage1_67884_total_runtime;
    int mainziscan_stage1_67884_runs;
    int64_t mainziscan_stage1_69675_total_runtime;
    int mainziscan_stage1_69675_runs;
    int64_t mainziscan_stage1_71714_total_runtime;
    int mainziscan_stage1_71714_runs;
    int64_t mainziscan_stage1_72699_total_runtime;
    int mainziscan_stage1_72699_runs;
    int64_t mainziscan_stage1_73366_total_runtime;
    int mainziscan_stage1_73366_runs;
    int64_t mainziscan_stage1_74123_total_runtime;
    int mainziscan_stage1_74123_runs;
    int64_t mainziscan_stage2_67884_total_runtime;
    int mainziscan_stage2_67884_runs;
    int64_t mainziscan_stage2_69675_total_runtime;
    int mainziscan_stage2_69675_runs;
    int64_t mainziscan_stage2_71714_total_runtime;
    int mainziscan_stage2_71714_runs;
    int64_t mainziscan_stage2_72699_total_runtime;
    int mainziscan_stage2_72699_runs;
    int64_t mainziscan_stage2_73366_total_runtime;
    int mainziscan_stage2_73366_runs;
    int64_t mainziscan_stage2_74123_total_runtime;
    int mainziscan_stage2_74123_runs;
    int64_t mainziscan_stage3_67884_total_runtime;
    int mainziscan_stage3_67884_runs;
    int64_t mainziscan_stage3_69675_total_runtime;
    int mainziscan_stage3_69675_runs;
    int64_t mainziscan_stage3_71714_total_runtime;
    int mainziscan_stage3_71714_runs;
    int64_t mainziscan_stage3_72699_total_runtime;
    int mainziscan_stage3_72699_runs;
    int64_t mainziscan_stage3_73366_total_runtime;
    int mainziscan_stage3_73366_runs;
    int64_t mainziscan_stage3_74123_total_runtime;
    int mainziscan_stage3_74123_runs;
    int64_t mainzisegmap_66915_total_runtime;
    int mainzisegmap_66915_runs;
    int64_t mainzisegmap_67937_total_runtime;
    int mainzisegmap_67937_runs;
    int64_t mainzisegmap_67956_total_runtime;
    int mainzisegmap_67956_runs;
    int64_t mainzisegmap_67968_total_runtime;
    int mainzisegmap_67968_runs;
    int64_t mainzisegmap_67988_total_runtime;
    int mainzisegmap_67988_runs;
    int64_t mainzisegmap_68159_total_runtime;
    int mainzisegmap_68159_runs;
    int64_t mainzisegmap_68300_total_runtime;
    int mainzisegmap_68300_runs;
    int64_t mainzisegmap_68572_total_runtime;
    int mainzisegmap_68572_runs;
    int64_t mainzisegmap_69728_total_runtime;
    int mainzisegmap_69728_runs;
    int64_t mainzisegmap_69747_total_runtime;
    int mainzisegmap_69747_runs;
    int64_t mainzisegmap_69759_total_runtime;
    int mainzisegmap_69759_runs;
    int64_t mainzisegmap_69779_total_runtime;
    int mainzisegmap_69779_runs;
    int64_t mainzisegmap_69980_total_runtime;
    int mainzisegmap_69980_runs;
    int64_t mainzisegmap_70133_total_runtime;
    int mainzisegmap_70133_runs;
    int64_t mainzisegmap_70463_total_runtime;
    int mainzisegmap_70463_runs;
    int64_t mainzisegmap_71767_total_runtime;
    int mainzisegmap_71767_runs;
    int64_t mainzisegmap_71786_total_runtime;
    int mainzisegmap_71786_runs;
    int64_t mainzisegmap_71798_total_runtime;
    int mainzisegmap_71798_runs;
    int64_t mainzisegmap_71818_total_runtime;
    int mainzisegmap_71818_runs;
    int64_t mainzisegmap_72051_total_runtime;
    int mainzisegmap_72051_runs;
    int64_t mainzisegmap_72216_total_runtime;
    int mainzisegmap_72216_runs;
    int64_t mainzisegmap_72752_total_runtime;
    int mainzisegmap_72752_runs;
    int64_t mainzisegmap_72771_total_runtime;
    int mainzisegmap_72771_runs;
    int64_t mainzisegmap_72783_total_runtime;
    int mainzisegmap_72783_runs;
    int64_t mainzisegmap_72803_total_runtime;
    int mainzisegmap_72803_runs;
    int64_t mainzisegmap_73419_total_runtime;
    int mainzisegmap_73419_runs;
    int64_t mainzisegmap_73438_total_runtime;
    int mainzisegmap_73438_runs;
    int64_t mainzisegmap_73450_total_runtime;
    int mainzisegmap_73450_runs;
    int64_t mainzisegmap_73470_total_runtime;
    int mainzisegmap_73470_runs;
    int64_t mainzisegmap_74176_total_runtime;
    int mainzisegmap_74176_runs;
    int64_t mainzisegmap_74195_total_runtime;
    int mainzisegmap_74195_runs;
    int64_t mainzisegmap_74207_total_runtime;
    int mainzisegmap_74207_runs;
    int64_t mainzisegmap_74227_total_runtime;
    int mainzisegmap_74227_runs;
    int64_t mainzisegmap_74589_total_runtime;
    int mainzisegmap_74589_runs;
    int64_t mainzisegmap_intragroup_72819_total_runtime;
    int mainzisegmap_intragroup_72819_runs;
    int64_t mainzisegmap_intragroup_73487_total_runtime;
    int mainzisegmap_intragroup_73487_runs;
    int64_t mainzisegmap_intragroup_74244_total_runtime;
    int mainzisegmap_intragroup_74244_runs;
    int64_t mainzisegmap_intragroup_74792_total_runtime;
    int mainzisegmap_intragroup_74792_runs;
    int64_t mainzisegmap_intragroup_75346_total_runtime;
    int mainzisegmap_intragroup_75346_runs;
    int64_t mainzisegmap_intragroup_76017_total_runtime;
    int mainzisegmap_intragroup_76017_runs;
    int64_t mainzisegred_large_68263_total_runtime;
    int mainzisegred_large_68263_runs;
    int64_t mainzisegred_large_68313_total_runtime;
    int mainzisegred_large_68313_runs;
    int64_t mainzisegred_large_70086_total_runtime;
    int mainzisegred_large_70086_runs;
    int64_t mainzisegred_large_70156_total_runtime;
    int mainzisegred_large_70156_runs;
    int64_t mainzisegred_large_72159_total_runtime;
    int mainzisegred_large_72159_runs;
    int64_t mainzisegred_large_72258_total_runtime;
    int mainzisegred_large_72258_runs;
    int64_t mainzisegred_small_68263_total_runtime;
    int mainzisegred_small_68263_runs;
    int64_t mainzisegred_small_68313_total_runtime;
    int mainzisegred_small_68313_runs;
    int64_t mainzisegred_small_70086_total_runtime;
    int mainzisegred_small_70086_runs;
    int64_t mainzisegred_small_70156_total_runtime;
    int mainzisegred_small_70156_runs;
    int64_t mainzisegred_small_72159_total_runtime;
    int mainzisegred_small_72159_runs;
    int64_t mainzisegred_small_72258_total_runtime;
    int mainzisegred_small_72258_runs;
    cl_mem global_failure;
    cl_mem global_failure_args;
    struct opencl_context opencl;
    struct tuning_params tuning_params;
    cl_int failure_is_an_option;
};
void post_opencl_setup(struct opencl_context *ctx,
                       struct opencl_device_option *option)
{
    if ((ctx->lockstep_width == 0 && strstr(option->platform_name,
                                            "NVIDIA CUDA") != NULL) &&
        (option->device_type & CL_DEVICE_TYPE_GPU) == CL_DEVICE_TYPE_GPU) {
        ctx->lockstep_width = 32;
    }
    if ((ctx->lockstep_width == 0 && strstr(option->platform_name,
                                            "AMD Accelerated Parallel Processing") !=
         NULL) && (option->device_type & CL_DEVICE_TYPE_GPU) ==
        CL_DEVICE_TYPE_GPU) {
        ctx->lockstep_width = 32;
    }
    if ((ctx->lockstep_width == 0 && strstr(option->platform_name, "") !=
         NULL) && (option->device_type & CL_DEVICE_TYPE_GPU) ==
        CL_DEVICE_TYPE_GPU) {
        ctx->lockstep_width = 1;
    }
    if ((ctx->cfg.default_num_groups == 0 && strstr(option->platform_name,
                                                    "") != NULL) &&
        (option->device_type & CL_DEVICE_TYPE_GPU) == CL_DEVICE_TYPE_GPU) {
        size_t MAX_COMPUTE_UNITS_val = 0;
        
        clGetDeviceInfo(ctx->device, CL_DEVICE_MAX_COMPUTE_UNITS,
                        sizeof(MAX_COMPUTE_UNITS_val), &MAX_COMPUTE_UNITS_val,
                        NULL);
        ctx->cfg.default_num_groups = 4 * MAX_COMPUTE_UNITS_val;
    }
    if ((ctx->cfg.default_group_size == 0 && strstr(option->platform_name,
                                                    "") != NULL) &&
        (option->device_type & CL_DEVICE_TYPE_GPU) == CL_DEVICE_TYPE_GPU) {
        ctx->cfg.default_group_size = 256;
    }
    if ((ctx->cfg.default_tile_size == 0 && strstr(option->platform_name, "") !=
         NULL) && (option->device_type & CL_DEVICE_TYPE_GPU) ==
        CL_DEVICE_TYPE_GPU) {
        ctx->cfg.default_tile_size = 32;
    }
    if ((ctx->cfg.default_reg_tile_size == 0 && strstr(option->platform_name,
                                                       "") != NULL) &&
        (option->device_type & CL_DEVICE_TYPE_GPU) == CL_DEVICE_TYPE_GPU) {
        ctx->cfg.default_reg_tile_size = 2;
    }
    if ((ctx->cfg.default_threshold == 0 && strstr(option->platform_name, "") !=
         NULL) && (option->device_type & CL_DEVICE_TYPE_GPU) ==
        CL_DEVICE_TYPE_GPU) {
        ctx->cfg.default_threshold = 32768;
    }
    if ((ctx->lockstep_width == 0 && strstr(option->platform_name, "") !=
         NULL) && (option->device_type & CL_DEVICE_TYPE_CPU) ==
        CL_DEVICE_TYPE_CPU) {
        ctx->lockstep_width = 1;
    }
    if ((ctx->cfg.default_num_groups == 0 && strstr(option->platform_name,
                                                    "") != NULL) &&
        (option->device_type & CL_DEVICE_TYPE_CPU) == CL_DEVICE_TYPE_CPU) {
        size_t MAX_COMPUTE_UNITS_val = 0;
        
        clGetDeviceInfo(ctx->device, CL_DEVICE_MAX_COMPUTE_UNITS,
                        sizeof(MAX_COMPUTE_UNITS_val), &MAX_COMPUTE_UNITS_val,
                        NULL);
        ctx->cfg.default_num_groups = MAX_COMPUTE_UNITS_val;
    }
    if ((ctx->cfg.default_group_size == 0 && strstr(option->platform_name,
                                                    "") != NULL) &&
        (option->device_type & CL_DEVICE_TYPE_CPU) == CL_DEVICE_TYPE_CPU) {
        ctx->cfg.default_group_size = 32;
    }
    if ((ctx->cfg.default_tile_size == 0 && strstr(option->platform_name, "") !=
         NULL) && (option->device_type & CL_DEVICE_TYPE_CPU) ==
        CL_DEVICE_TYPE_CPU) {
        ctx->cfg.default_tile_size = 4;
    }
    if ((ctx->cfg.default_reg_tile_size == 0 && strstr(option->platform_name,
                                                       "") != NULL) &&
        (option->device_type & CL_DEVICE_TYPE_CPU) == CL_DEVICE_TYPE_CPU) {
        ctx->cfg.default_reg_tile_size = 1;
    }
    if ((ctx->cfg.default_threshold == 0 && strstr(option->platform_name, "") !=
         NULL) && (option->device_type & CL_DEVICE_TYPE_CPU) ==
        CL_DEVICE_TYPE_CPU) {
        size_t MAX_COMPUTE_UNITS_val = 0;
        
        clGetDeviceInfo(ctx->device, CL_DEVICE_MAX_COMPUTE_UNITS,
                        sizeof(MAX_COMPUTE_UNITS_val), &MAX_COMPUTE_UNITS_val,
                        NULL);
        ctx->cfg.default_threshold = MAX_COMPUTE_UNITS_val;
    }
}
static void init_context_early(struct futhark_context_config *cfg,
                               struct futhark_context *ctx)
{
    ctx->opencl.cfg = cfg->opencl;
    ctx->detail_memory = cfg->opencl.debugging;
    ctx->debugging = cfg->opencl.debugging;
    ctx->profiling = cfg->opencl.profiling;
    ctx->profiling_paused = 0;
    ctx->logging = cfg->opencl.logging;
    ctx->error = NULL;
    ctx->log = stderr;
    ctx->opencl.profiling_records_capacity = 200;
    ctx->opencl.profiling_records_used = 0;
    ctx->opencl.profiling_records =
        malloc(ctx->opencl.profiling_records_capacity *
        sizeof(struct profiling_record));
    create_lock(&ctx->lock);
    ctx->failure_is_an_option = 0;
    ctx->peak_mem_usage_device = 0;
    ctx->cur_mem_usage_device = 0;
    ctx->peak_mem_usage_default = 0;
    ctx->cur_mem_usage_default = 0;
    ctx->total_runs = 0;
    ctx->total_runtime = 0;
    ctx->copy_dev_to_dev_total_runtime = 0;
    ctx->copy_dev_to_dev_runs = 0;
    ctx->copy_dev_to_host_total_runtime = 0;
    ctx->copy_dev_to_host_runs = 0;
    ctx->copy_host_to_dev_total_runtime = 0;
    ctx->copy_host_to_dev_runs = 0;
    ctx->copy_scalar_to_dev_total_runtime = 0;
    ctx->copy_scalar_to_dev_runs = 0;
    ctx->copy_scalar_from_dev_total_runtime = 0;
    ctx->copy_scalar_from_dev_runs = 0;
    ctx->builtinzhreplicate_f64zireplicate_78312_total_runtime = 0;
    ctx->builtinzhreplicate_f64zireplicate_78312_runs = 0;
    ctx->builtinzhreplicate_i64zireplicate_78426_total_runtime = 0;
    ctx->builtinzhreplicate_i64zireplicate_78426_runs = 0;
    ctx->gpu_map_transpose_f64_total_runtime = 0;
    ctx->gpu_map_transpose_f64_runs = 0;
    ctx->gpu_map_transpose_f64_low_height_total_runtime = 0;
    ctx->gpu_map_transpose_f64_low_height_runs = 0;
    ctx->gpu_map_transpose_f64_low_width_total_runtime = 0;
    ctx->gpu_map_transpose_f64_low_width_runs = 0;
    ctx->gpu_map_transpose_f64_small_total_runtime = 0;
    ctx->gpu_map_transpose_f64_small_runs = 0;
    ctx->mainziscan_stage1_67884_total_runtime = 0;
    ctx->mainziscan_stage1_67884_runs = 0;
    ctx->mainziscan_stage1_69675_total_runtime = 0;
    ctx->mainziscan_stage1_69675_runs = 0;
    ctx->mainziscan_stage1_71714_total_runtime = 0;
    ctx->mainziscan_stage1_71714_runs = 0;
    ctx->mainziscan_stage1_72699_total_runtime = 0;
    ctx->mainziscan_stage1_72699_runs = 0;
    ctx->mainziscan_stage1_73366_total_runtime = 0;
    ctx->mainziscan_stage1_73366_runs = 0;
    ctx->mainziscan_stage1_74123_total_runtime = 0;
    ctx->mainziscan_stage1_74123_runs = 0;
    ctx->mainziscan_stage2_67884_total_runtime = 0;
    ctx->mainziscan_stage2_67884_runs = 0;
    ctx->mainziscan_stage2_69675_total_runtime = 0;
    ctx->mainziscan_stage2_69675_runs = 0;
    ctx->mainziscan_stage2_71714_total_runtime = 0;
    ctx->mainziscan_stage2_71714_runs = 0;
    ctx->mainziscan_stage2_72699_total_runtime = 0;
    ctx->mainziscan_stage2_72699_runs = 0;
    ctx->mainziscan_stage2_73366_total_runtime = 0;
    ctx->mainziscan_stage2_73366_runs = 0;
    ctx->mainziscan_stage2_74123_total_runtime = 0;
    ctx->mainziscan_stage2_74123_runs = 0;
    ctx->mainziscan_stage3_67884_total_runtime = 0;
    ctx->mainziscan_stage3_67884_runs = 0;
    ctx->mainziscan_stage3_69675_total_runtime = 0;
    ctx->mainziscan_stage3_69675_runs = 0;
    ctx->mainziscan_stage3_71714_total_runtime = 0;
    ctx->mainziscan_stage3_71714_runs = 0;
    ctx->mainziscan_stage3_72699_total_runtime = 0;
    ctx->mainziscan_stage3_72699_runs = 0;
    ctx->mainziscan_stage3_73366_total_runtime = 0;
    ctx->mainziscan_stage3_73366_runs = 0;
    ctx->mainziscan_stage3_74123_total_runtime = 0;
    ctx->mainziscan_stage3_74123_runs = 0;
    ctx->mainzisegmap_66915_total_runtime = 0;
    ctx->mainzisegmap_66915_runs = 0;
    ctx->mainzisegmap_67937_total_runtime = 0;
    ctx->mainzisegmap_67937_runs = 0;
    ctx->mainzisegmap_67956_total_runtime = 0;
    ctx->mainzisegmap_67956_runs = 0;
    ctx->mainzisegmap_67968_total_runtime = 0;
    ctx->mainzisegmap_67968_runs = 0;
    ctx->mainzisegmap_67988_total_runtime = 0;
    ctx->mainzisegmap_67988_runs = 0;
    ctx->mainzisegmap_68159_total_runtime = 0;
    ctx->mainzisegmap_68159_runs = 0;
    ctx->mainzisegmap_68300_total_runtime = 0;
    ctx->mainzisegmap_68300_runs = 0;
    ctx->mainzisegmap_68572_total_runtime = 0;
    ctx->mainzisegmap_68572_runs = 0;
    ctx->mainzisegmap_69728_total_runtime = 0;
    ctx->mainzisegmap_69728_runs = 0;
    ctx->mainzisegmap_69747_total_runtime = 0;
    ctx->mainzisegmap_69747_runs = 0;
    ctx->mainzisegmap_69759_total_runtime = 0;
    ctx->mainzisegmap_69759_runs = 0;
    ctx->mainzisegmap_69779_total_runtime = 0;
    ctx->mainzisegmap_69779_runs = 0;
    ctx->mainzisegmap_69980_total_runtime = 0;
    ctx->mainzisegmap_69980_runs = 0;
    ctx->mainzisegmap_70133_total_runtime = 0;
    ctx->mainzisegmap_70133_runs = 0;
    ctx->mainzisegmap_70463_total_runtime = 0;
    ctx->mainzisegmap_70463_runs = 0;
    ctx->mainzisegmap_71767_total_runtime = 0;
    ctx->mainzisegmap_71767_runs = 0;
    ctx->mainzisegmap_71786_total_runtime = 0;
    ctx->mainzisegmap_71786_runs = 0;
    ctx->mainzisegmap_71798_total_runtime = 0;
    ctx->mainzisegmap_71798_runs = 0;
    ctx->mainzisegmap_71818_total_runtime = 0;
    ctx->mainzisegmap_71818_runs = 0;
    ctx->mainzisegmap_72051_total_runtime = 0;
    ctx->mainzisegmap_72051_runs = 0;
    ctx->mainzisegmap_72216_total_runtime = 0;
    ctx->mainzisegmap_72216_runs = 0;
    ctx->mainzisegmap_72752_total_runtime = 0;
    ctx->mainzisegmap_72752_runs = 0;
    ctx->mainzisegmap_72771_total_runtime = 0;
    ctx->mainzisegmap_72771_runs = 0;
    ctx->mainzisegmap_72783_total_runtime = 0;
    ctx->mainzisegmap_72783_runs = 0;
    ctx->mainzisegmap_72803_total_runtime = 0;
    ctx->mainzisegmap_72803_runs = 0;
    ctx->mainzisegmap_73419_total_runtime = 0;
    ctx->mainzisegmap_73419_runs = 0;
    ctx->mainzisegmap_73438_total_runtime = 0;
    ctx->mainzisegmap_73438_runs = 0;
    ctx->mainzisegmap_73450_total_runtime = 0;
    ctx->mainzisegmap_73450_runs = 0;
    ctx->mainzisegmap_73470_total_runtime = 0;
    ctx->mainzisegmap_73470_runs = 0;
    ctx->mainzisegmap_74176_total_runtime = 0;
    ctx->mainzisegmap_74176_runs = 0;
    ctx->mainzisegmap_74195_total_runtime = 0;
    ctx->mainzisegmap_74195_runs = 0;
    ctx->mainzisegmap_74207_total_runtime = 0;
    ctx->mainzisegmap_74207_runs = 0;
    ctx->mainzisegmap_74227_total_runtime = 0;
    ctx->mainzisegmap_74227_runs = 0;
    ctx->mainzisegmap_74589_total_runtime = 0;
    ctx->mainzisegmap_74589_runs = 0;
    ctx->mainzisegmap_intragroup_72819_total_runtime = 0;
    ctx->mainzisegmap_intragroup_72819_runs = 0;
    ctx->mainzisegmap_intragroup_73487_total_runtime = 0;
    ctx->mainzisegmap_intragroup_73487_runs = 0;
    ctx->mainzisegmap_intragroup_74244_total_runtime = 0;
    ctx->mainzisegmap_intragroup_74244_runs = 0;
    ctx->mainzisegmap_intragroup_74792_total_runtime = 0;
    ctx->mainzisegmap_intragroup_74792_runs = 0;
    ctx->mainzisegmap_intragroup_75346_total_runtime = 0;
    ctx->mainzisegmap_intragroup_75346_runs = 0;
    ctx->mainzisegmap_intragroup_76017_total_runtime = 0;
    ctx->mainzisegmap_intragroup_76017_runs = 0;
    ctx->mainzisegred_large_68263_total_runtime = 0;
    ctx->mainzisegred_large_68263_runs = 0;
    ctx->mainzisegred_large_68313_total_runtime = 0;
    ctx->mainzisegred_large_68313_runs = 0;
    ctx->mainzisegred_large_70086_total_runtime = 0;
    ctx->mainzisegred_large_70086_runs = 0;
    ctx->mainzisegred_large_70156_total_runtime = 0;
    ctx->mainzisegred_large_70156_runs = 0;
    ctx->mainzisegred_large_72159_total_runtime = 0;
    ctx->mainzisegred_large_72159_runs = 0;
    ctx->mainzisegred_large_72258_total_runtime = 0;
    ctx->mainzisegred_large_72258_runs = 0;
    ctx->mainzisegred_small_68263_total_runtime = 0;
    ctx->mainzisegred_small_68263_runs = 0;
    ctx->mainzisegred_small_68313_total_runtime = 0;
    ctx->mainzisegred_small_68313_runs = 0;
    ctx->mainzisegred_small_70086_total_runtime = 0;
    ctx->mainzisegred_small_70086_runs = 0;
    ctx->mainzisegred_small_70156_total_runtime = 0;
    ctx->mainzisegred_small_70156_runs = 0;
    ctx->mainzisegred_small_72159_total_runtime = 0;
    ctx->mainzisegred_small_72159_runs = 0;
    ctx->mainzisegred_small_72258_total_runtime = 0;
    ctx->mainzisegred_small_72258_runs = 0;
}
static int init_context_late(struct futhark_context_config *cfg,
                             struct futhark_context *ctx, cl_program prog)
{
    cl_int error;
    cl_int no_error = -1;
    
    ctx->global_failure = clCreateBuffer(ctx->opencl.ctx, CL_MEM_READ_WRITE |
                                         CL_MEM_COPY_HOST_PTR, sizeof(cl_int),
                                         &no_error, &error);
    OPENCL_SUCCEED_OR_RETURN(error);
    // The +1 is to avoid zero-byte allocations.
    ctx->global_failure_args = clCreateBuffer(ctx->opencl.ctx,
                                              CL_MEM_READ_WRITE,
                                              sizeof(int64_t) * (2 + 1), NULL,
                                              &error);
    OPENCL_SUCCEED_OR_RETURN(error);
    {
        ctx->builtinzhreplicate_f64zireplicate_78312 = clCreateKernel(prog,
                                                                      "builtinzhreplicate_f64zireplicate_78312",
                                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "builtin#replicate_f64.replicate_78312");
    }
    {
        ctx->builtinzhreplicate_i64zireplicate_78426 = clCreateKernel(prog,
                                                                      "builtinzhreplicate_i64zireplicate_78426",
                                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "builtin#replicate_i64.replicate_78426");
    }
    {
        ctx->gpu_map_transpose_f64 = clCreateKernel(prog,
                                                    "gpu_map_transpose_f64",
                                                    &error);
        OPENCL_SUCCEED_FATAL(error);
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "gpu_map_transpose_f64");
    }
    {
        ctx->gpu_map_transpose_f64_low_height = clCreateKernel(prog,
                                                               "gpu_map_transpose_f64_low_height",
                                                               &error);
        OPENCL_SUCCEED_FATAL(error);
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "gpu_map_transpose_f64_low_height");
    }
    {
        ctx->gpu_map_transpose_f64_low_width = clCreateKernel(prog,
                                                              "gpu_map_transpose_f64_low_width",
                                                              &error);
        OPENCL_SUCCEED_FATAL(error);
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "gpu_map_transpose_f64_low_width");
    }
    {
        ctx->gpu_map_transpose_f64_small = clCreateKernel(prog,
                                                          "gpu_map_transpose_f64_small",
                                                          &error);
        OPENCL_SUCCEED_FATAL(error);
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "gpu_map_transpose_f64_small");
    }
    {
        ctx->mainziscan_stage1_67884 = clCreateKernel(prog,
                                                      "mainziscan_stage1_67884",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage1_67884, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage1_67884");
    }
    {
        ctx->mainziscan_stage1_69675 = clCreateKernel(prog,
                                                      "mainziscan_stage1_69675",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage1_69675, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage1_69675");
    }
    {
        ctx->mainziscan_stage1_71714 = clCreateKernel(prog,
                                                      "mainziscan_stage1_71714",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage1_71714, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage1_71714");
    }
    {
        ctx->mainziscan_stage1_72699 = clCreateKernel(prog,
                                                      "mainziscan_stage1_72699",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage1_72699, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage1_72699");
    }
    {
        ctx->mainziscan_stage1_73366 = clCreateKernel(prog,
                                                      "mainziscan_stage1_73366",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage1_73366, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage1_73366");
    }
    {
        ctx->mainziscan_stage1_74123 = clCreateKernel(prog,
                                                      "mainziscan_stage1_74123",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage1_74123, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage1_74123");
    }
    {
        ctx->mainziscan_stage2_67884 = clCreateKernel(prog,
                                                      "mainziscan_stage2_67884",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage2_67884, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage2_67884");
    }
    {
        ctx->mainziscan_stage2_69675 = clCreateKernel(prog,
                                                      "mainziscan_stage2_69675",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage2_69675, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage2_69675");
    }
    {
        ctx->mainziscan_stage2_71714 = clCreateKernel(prog,
                                                      "mainziscan_stage2_71714",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage2_71714, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage2_71714");
    }
    {
        ctx->mainziscan_stage2_72699 = clCreateKernel(prog,
                                                      "mainziscan_stage2_72699",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage2_72699, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage2_72699");
    }
    {
        ctx->mainziscan_stage2_73366 = clCreateKernel(prog,
                                                      "mainziscan_stage2_73366",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage2_73366, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage2_73366");
    }
    {
        ctx->mainziscan_stage2_74123 = clCreateKernel(prog,
                                                      "mainziscan_stage2_74123",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage2_74123, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage2_74123");
    }
    {
        ctx->mainziscan_stage3_67884 = clCreateKernel(prog,
                                                      "mainziscan_stage3_67884",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage3_67884, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage3_67884");
    }
    {
        ctx->mainziscan_stage3_69675 = clCreateKernel(prog,
                                                      "mainziscan_stage3_69675",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage3_69675, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage3_69675");
    }
    {
        ctx->mainziscan_stage3_71714 = clCreateKernel(prog,
                                                      "mainziscan_stage3_71714",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage3_71714, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage3_71714");
    }
    {
        ctx->mainziscan_stage3_72699 = clCreateKernel(prog,
                                                      "mainziscan_stage3_72699",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage3_72699, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage3_72699");
    }
    {
        ctx->mainziscan_stage3_73366 = clCreateKernel(prog,
                                                      "mainziscan_stage3_73366",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage3_73366, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage3_73366");
    }
    {
        ctx->mainziscan_stage3_74123 = clCreateKernel(prog,
                                                      "mainziscan_stage3_74123",
                                                      &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainziscan_stage3_74123, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.scan_stage3_74123");
    }
    {
        ctx->mainzisegmap_66915 = clCreateKernel(prog, "mainzisegmap_66915",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_66915, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_66915, 2,
                                            sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_66915");
    }
    {
        ctx->mainzisegmap_67937 = clCreateKernel(prog, "mainzisegmap_67937",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_67937, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_67937");
    }
    {
        ctx->mainzisegmap_67956 = clCreateKernel(prog, "mainzisegmap_67956",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_67956, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_67956");
    }
    {
        ctx->mainzisegmap_67968 = clCreateKernel(prog, "mainzisegmap_67968",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_67968, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_67968");
    }
    {
        ctx->mainzisegmap_67988 = clCreateKernel(prog, "mainzisegmap_67988",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_67988, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_67988");
    }
    {
        ctx->mainzisegmap_68159 = clCreateKernel(prog, "mainzisegmap_68159",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_68159, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_68159, 2,
                                            sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_68159");
    }
    {
        ctx->mainzisegmap_68300 = clCreateKernel(prog, "mainzisegmap_68300",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_68300, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_68300");
    }
    {
        ctx->mainzisegmap_68572 = clCreateKernel(prog, "mainzisegmap_68572",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_68572, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_68572, 2,
                                            sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_68572");
    }
    {
        ctx->mainzisegmap_69728 = clCreateKernel(prog, "mainzisegmap_69728",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_69728, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_69728");
    }
    {
        ctx->mainzisegmap_69747 = clCreateKernel(prog, "mainzisegmap_69747",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_69747, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_69747");
    }
    {
        ctx->mainzisegmap_69759 = clCreateKernel(prog, "mainzisegmap_69759",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_69759, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_69759");
    }
    {
        ctx->mainzisegmap_69779 = clCreateKernel(prog, "mainzisegmap_69779",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_69779, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_69779");
    }
    {
        ctx->mainzisegmap_69980 = clCreateKernel(prog, "mainzisegmap_69980",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_69980, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_69980, 2,
                                            sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_69980");
    }
    {
        ctx->mainzisegmap_70133 = clCreateKernel(prog, "mainzisegmap_70133",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_70133, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_70133");
    }
    {
        ctx->mainzisegmap_70463 = clCreateKernel(prog, "mainzisegmap_70463",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_70463, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_70463, 2,
                                            sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_70463");
    }
    {
        ctx->mainzisegmap_71767 = clCreateKernel(prog, "mainzisegmap_71767",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_71767, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_71767");
    }
    {
        ctx->mainzisegmap_71786 = clCreateKernel(prog, "mainzisegmap_71786",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_71786, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_71786");
    }
    {
        ctx->mainzisegmap_71798 = clCreateKernel(prog, "mainzisegmap_71798",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_71798, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_71798");
    }
    {
        ctx->mainzisegmap_71818 = clCreateKernel(prog, "mainzisegmap_71818",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_71818, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_71818");
    }
    {
        ctx->mainzisegmap_72051 = clCreateKernel(prog, "mainzisegmap_72051",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_72051, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_72051, 2,
                                            sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_72051");
    }
    {
        ctx->mainzisegmap_72216 = clCreateKernel(prog, "mainzisegmap_72216",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_72216, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_72216");
    }
    {
        ctx->mainzisegmap_72752 = clCreateKernel(prog, "mainzisegmap_72752",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_72752, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_72752");
    }
    {
        ctx->mainzisegmap_72771 = clCreateKernel(prog, "mainzisegmap_72771",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_72771, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_72771");
    }
    {
        ctx->mainzisegmap_72783 = clCreateKernel(prog, "mainzisegmap_72783",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_72783, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_72783");
    }
    {
        ctx->mainzisegmap_72803 = clCreateKernel(prog, "mainzisegmap_72803",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_72803, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_72803");
    }
    {
        ctx->mainzisegmap_73419 = clCreateKernel(prog, "mainzisegmap_73419",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_73419, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_73419");
    }
    {
        ctx->mainzisegmap_73438 = clCreateKernel(prog, "mainzisegmap_73438",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_73438, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_73438");
    }
    {
        ctx->mainzisegmap_73450 = clCreateKernel(prog, "mainzisegmap_73450",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_73450, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_73450");
    }
    {
        ctx->mainzisegmap_73470 = clCreateKernel(prog, "mainzisegmap_73470",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_73470, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_73470");
    }
    {
        ctx->mainzisegmap_74176 = clCreateKernel(prog, "mainzisegmap_74176",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_74176, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_74176");
    }
    {
        ctx->mainzisegmap_74195 = clCreateKernel(prog, "mainzisegmap_74195",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_74195, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_74195");
    }
    {
        ctx->mainzisegmap_74207 = clCreateKernel(prog, "mainzisegmap_74207",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_74207, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_74207");
    }
    {
        ctx->mainzisegmap_74227 = clCreateKernel(prog, "mainzisegmap_74227",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_74227, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_74227");
    }
    {
        ctx->mainzisegmap_74589 = clCreateKernel(prog, "mainzisegmap_74589",
                                                 &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_74589, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_74589, 2,
                                            sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n", "main.segmap_74589");
    }
    {
        ctx->mainzisegmap_intragroup_72819 = clCreateKernel(prog,
                                                            "mainzisegmap_intragroup_72819",
                                                            &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                            0, sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                            2, sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segmap_intragroup_72819");
    }
    {
        ctx->mainzisegmap_intragroup_73487 = clCreateKernel(prog,
                                                            "mainzisegmap_intragroup_73487",
                                                            &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                            0, sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                            2, sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segmap_intragroup_73487");
    }
    {
        ctx->mainzisegmap_intragroup_74244 = clCreateKernel(prog,
                                                            "mainzisegmap_intragroup_74244",
                                                            &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                            0, sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                            2, sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segmap_intragroup_74244");
    }
    {
        ctx->mainzisegmap_intragroup_74792 = clCreateKernel(prog,
                                                            "mainzisegmap_intragroup_74792",
                                                            &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                            0, sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                            2, sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segmap_intragroup_74792");
    }
    {
        ctx->mainzisegmap_intragroup_75346 = clCreateKernel(prog,
                                                            "mainzisegmap_intragroup_75346",
                                                            &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                            0, sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                            2, sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segmap_intragroup_75346");
    }
    {
        ctx->mainzisegmap_intragroup_76017 = clCreateKernel(prog,
                                                            "mainzisegmap_intragroup_76017",
                                                            &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                            0, sizeof(cl_mem),
                                            &ctx->global_failure));
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                            2, sizeof(cl_mem),
                                            &ctx->global_failure_args));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segmap_intragroup_76017");
    }
    {
        ctx->mainzisegred_large_68263 = clCreateKernel(prog,
                                                       "mainzisegred_large_68263",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_large_68263, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_large_68263");
    }
    {
        ctx->mainzisegred_large_68313 = clCreateKernel(prog,
                                                       "mainzisegred_large_68313",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_large_68313, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_large_68313");
    }
    {
        ctx->mainzisegred_large_70086 = clCreateKernel(prog,
                                                       "mainzisegred_large_70086",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_large_70086, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_large_70086");
    }
    {
        ctx->mainzisegred_large_70156 = clCreateKernel(prog,
                                                       "mainzisegred_large_70156",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_large_70156, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_large_70156");
    }
    {
        ctx->mainzisegred_large_72159 = clCreateKernel(prog,
                                                       "mainzisegred_large_72159",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_large_72159, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_large_72159");
    }
    {
        ctx->mainzisegred_large_72258 = clCreateKernel(prog,
                                                       "mainzisegred_large_72258",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_large_72258, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_large_72258");
    }
    {
        ctx->mainzisegred_small_68263 = clCreateKernel(prog,
                                                       "mainzisegred_small_68263",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_small_68263, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_small_68263");
    }
    {
        ctx->mainzisegred_small_68313 = clCreateKernel(prog,
                                                       "mainzisegred_small_68313",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_small_68313, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_small_68313");
    }
    {
        ctx->mainzisegred_small_70086 = clCreateKernel(prog,
                                                       "mainzisegred_small_70086",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_small_70086, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_small_70086");
    }
    {
        ctx->mainzisegred_small_70156 = clCreateKernel(prog,
                                                       "mainzisegred_small_70156",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_small_70156, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_small_70156");
    }
    {
        ctx->mainzisegred_small_72159 = clCreateKernel(prog,
                                                       "mainzisegred_small_72159",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_small_72159, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_small_72159");
    }
    {
        ctx->mainzisegred_small_72258 = clCreateKernel(prog,
                                                       "mainzisegred_small_72258",
                                                       &error);
        OPENCL_SUCCEED_FATAL(error);
        OPENCL_SUCCEED_FATAL(clSetKernelArg(ctx->mainzisegred_small_72258, 0,
                                            sizeof(cl_mem),
                                            &ctx->global_failure));
        if (ctx->debugging)
            fprintf(ctx->log, "Created kernel %s.\n",
                    "main.segred_small_72258");
    }
    {
        cl_int success;
        
        ctx->mainzicounter_mem_78559.references = NULL;
        ctx->mainzicounter_mem_78559.size = 0;
        ctx->mainzicounter_mem_78559.mem = clCreateBuffer(ctx->opencl.ctx,
                                                          CL_MEM_READ_WRITE,
                                                          (10240 >
                                                           0 ? 10240 : 1) *
                                                          sizeof(int32_t), NULL,
                                                          &success);
        OPENCL_SUCCEED_OR_RETURN(success);
        if (10240 > 0)
            OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                          ctx->mainzicounter_mem_78559.mem,
                                                          CL_TRUE, 0, 10240 *
                                                          sizeof(int32_t),
                                                          mainzicounter_mem_realtype_80060,
                                                          0, NULL, NULL));
    }
    {
        cl_int success;
        
        ctx->mainzicounter_mem_78641.references = NULL;
        ctx->mainzicounter_mem_78641.size = 0;
        ctx->mainzicounter_mem_78641.mem = clCreateBuffer(ctx->opencl.ctx,
                                                          CL_MEM_READ_WRITE,
                                                          (10240 >
                                                           0 ? 10240 : 1) *
                                                          sizeof(int32_t), NULL,
                                                          &success);
        OPENCL_SUCCEED_OR_RETURN(success);
        if (10240 > 0)
            OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                          ctx->mainzicounter_mem_78641.mem,
                                                          CL_TRUE, 0, 10240 *
                                                          sizeof(int32_t),
                                                          mainzicounter_mem_realtype_80076,
                                                          0, NULL, NULL));
    }
    {
        cl_int success;
        
        ctx->mainzicounter_mem_78948.references = NULL;
        ctx->mainzicounter_mem_78948.size = 0;
        ctx->mainzicounter_mem_78948.mem = clCreateBuffer(ctx->opencl.ctx,
                                                          CL_MEM_READ_WRITE,
                                                          (10240 >
                                                           0 ? 10240 : 1) *
                                                          sizeof(int32_t), NULL,
                                                          &success);
        OPENCL_SUCCEED_OR_RETURN(success);
        if (10240 > 0)
            OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                          ctx->mainzicounter_mem_78948.mem,
                                                          CL_TRUE, 0, 10240 *
                                                          sizeof(int32_t),
                                                          mainzicounter_mem_realtype_80137,
                                                          0, NULL, NULL));
    }
    {
        cl_int success;
        
        ctx->mainzicounter_mem_79050.references = NULL;
        ctx->mainzicounter_mem_79050.size = 0;
        ctx->mainzicounter_mem_79050.mem = clCreateBuffer(ctx->opencl.ctx,
                                                          CL_MEM_READ_WRITE,
                                                          (10240 >
                                                           0 ? 10240 : 1) *
                                                          sizeof(int32_t), NULL,
                                                          &success);
        OPENCL_SUCCEED_OR_RETURN(success);
        if (10240 > 0)
            OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                          ctx->mainzicounter_mem_79050.mem,
                                                          CL_TRUE, 0, 10240 *
                                                          sizeof(int32_t),
                                                          mainzicounter_mem_realtype_80153,
                                                          0, NULL, NULL));
    }
    {
        cl_int success;
        
        ctx->mainzicounter_mem_79397.references = NULL;
        ctx->mainzicounter_mem_79397.size = 0;
        ctx->mainzicounter_mem_79397.mem = clCreateBuffer(ctx->opencl.ctx,
                                                          CL_MEM_READ_WRITE,
                                                          (10240 >
                                                           0 ? 10240 : 1) *
                                                          sizeof(int32_t), NULL,
                                                          &success);
        OPENCL_SUCCEED_OR_RETURN(success);
        if (10240 > 0)
            OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                          ctx->mainzicounter_mem_79397.mem,
                                                          CL_TRUE, 0, 10240 *
                                                          sizeof(int32_t),
                                                          mainzicounter_mem_realtype_80214,
                                                          0, NULL, NULL));
    }
    {
        cl_int success;
        
        ctx->mainzicounter_mem_79511.references = NULL;
        ctx->mainzicounter_mem_79511.size = 0;
        ctx->mainzicounter_mem_79511.mem = clCreateBuffer(ctx->opencl.ctx,
                                                          CL_MEM_READ_WRITE,
                                                          (10240 >
                                                           0 ? 10240 : 1) *
                                                          sizeof(int32_t), NULL,
                                                          &success);
        OPENCL_SUCCEED_OR_RETURN(success);
        if (10240 > 0)
            OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                          ctx->mainzicounter_mem_79511.mem,
                                                          CL_TRUE, 0, 10240 *
                                                          sizeof(int32_t),
                                                          mainzicounter_mem_realtype_80230,
                                                          0, NULL, NULL));
    }
    ctx->tuning_params.builtinzhreplicate_f64zigroup_sizze_78315 =
        &cfg->tuning_params[0];
    ctx->tuning_params.builtinzhreplicate_i64zigroup_sizze_78429 =
        &cfg->tuning_params[1];
    ctx->tuning_params.mainzisegmap_group_sizze_66731 = &cfg->tuning_params[2];
    ctx->tuning_params.mainzisegmap_group_sizze_67323 = &cfg->tuning_params[3];
    ctx->tuning_params.mainzisegmap_group_sizze_67381 = &cfg->tuning_params[4];
    ctx->tuning_params.mainzisegmap_group_sizze_67695 = &cfg->tuning_params[5];
    ctx->tuning_params.mainzisegmap_group_sizze_67720 = &cfg->tuning_params[6];
    ctx->tuning_params.mainzisegmap_group_sizze_67746 = &cfg->tuning_params[7];
    ctx->tuning_params.mainzisegmap_group_sizze_67772 = &cfg->tuning_params[8];
    ctx->tuning_params.mainzisegmap_group_sizze_68358 = &cfg->tuning_params[9];
    ctx->tuning_params.mainzisegmap_group_sizze_69060 = &cfg->tuning_params[10];
    ctx->tuning_params.mainzisegmap_group_sizze_69135 = &cfg->tuning_params[11];
    ctx->tuning_params.mainzisegmap_group_sizze_69486 = &cfg->tuning_params[12];
    ctx->tuning_params.mainzisegmap_group_sizze_69511 = &cfg->tuning_params[13];
    ctx->tuning_params.mainzisegmap_group_sizze_69537 = &cfg->tuning_params[14];
    ctx->tuning_params.mainzisegmap_group_sizze_69563 = &cfg->tuning_params[15];
    ctx->tuning_params.mainzisegmap_group_sizze_70217 = &cfg->tuning_params[16];
    ctx->tuning_params.mainzisegmap_group_sizze_71032 = &cfg->tuning_params[17];
    ctx->tuning_params.mainzisegmap_group_sizze_71134 = &cfg->tuning_params[18];
    ctx->tuning_params.mainzisegmap_group_sizze_71525 = &cfg->tuning_params[19];
    ctx->tuning_params.mainzisegmap_group_sizze_71550 = &cfg->tuning_params[20];
    ctx->tuning_params.mainzisegmap_group_sizze_71576 = &cfg->tuning_params[21];
    ctx->tuning_params.mainzisegmap_group_sizze_71602 = &cfg->tuning_params[22];
    ctx->tuning_params.mainzisegmap_group_sizze_72510 = &cfg->tuning_params[23];
    ctx->tuning_params.mainzisegmap_group_sizze_72535 = &cfg->tuning_params[24];
    ctx->tuning_params.mainzisegmap_group_sizze_72561 = &cfg->tuning_params[25];
    ctx->tuning_params.mainzisegmap_group_sizze_72587 = &cfg->tuning_params[26];
    ctx->tuning_params.mainzisegmap_group_sizze_73177 = &cfg->tuning_params[27];
    ctx->tuning_params.mainzisegmap_group_sizze_73202 = &cfg->tuning_params[28];
    ctx->tuning_params.mainzisegmap_group_sizze_73228 = &cfg->tuning_params[29];
    ctx->tuning_params.mainzisegmap_group_sizze_73254 = &cfg->tuning_params[30];
    ctx->tuning_params.mainzisegmap_group_sizze_73934 = &cfg->tuning_params[31];
    ctx->tuning_params.mainzisegmap_group_sizze_73959 = &cfg->tuning_params[32];
    ctx->tuning_params.mainzisegmap_group_sizze_73985 = &cfg->tuning_params[33];
    ctx->tuning_params.mainzisegmap_group_sizze_74011 = &cfg->tuning_params[34];
    ctx->tuning_params.mainzisegmap_group_sizze_74466 = &cfg->tuning_params[35];
    ctx->tuning_params.mainzisegmap_num_groups_66733 = &cfg->tuning_params[36];
    ctx->tuning_params.mainzisegmap_num_groups_68360 = &cfg->tuning_params[37];
    ctx->tuning_params.mainzisegmap_num_groups_70219 = &cfg->tuning_params[38];
    ctx->tuning_params.mainzisegred_group_sizze_67268 = &cfg->tuning_params[39];
    ctx->tuning_params.mainzisegred_group_sizze_67336 = &cfg->tuning_params[40];
    ctx->tuning_params.mainzisegred_group_sizze_68987 = &cfg->tuning_params[41];
    ctx->tuning_params.mainzisegred_group_sizze_69082 = &cfg->tuning_params[42];
    ctx->tuning_params.mainzisegred_group_sizze_70946 = &cfg->tuning_params[43];
    ctx->tuning_params.mainzisegred_group_sizze_71073 = &cfg->tuning_params[44];
    ctx->tuning_params.mainzisegred_num_groups_67270 = &cfg->tuning_params[45];
    ctx->tuning_params.mainzisegred_num_groups_67338 = &cfg->tuning_params[46];
    ctx->tuning_params.mainzisegred_num_groups_68989 = &cfg->tuning_params[47];
    ctx->tuning_params.mainzisegred_num_groups_69084 = &cfg->tuning_params[48];
    ctx->tuning_params.mainzisegred_num_groups_70948 = &cfg->tuning_params[49];
    ctx->tuning_params.mainzisegred_num_groups_71075 = &cfg->tuning_params[50];
    ctx->tuning_params.mainzisegscan_group_sizze_67858 =
        &cfg->tuning_params[51];
    ctx->tuning_params.mainzisegscan_group_sizze_69649 =
        &cfg->tuning_params[52];
    ctx->tuning_params.mainzisegscan_group_sizze_71688 =
        &cfg->tuning_params[53];
    ctx->tuning_params.mainzisegscan_group_sizze_72673 =
        &cfg->tuning_params[54];
    ctx->tuning_params.mainzisegscan_group_sizze_73340 =
        &cfg->tuning_params[55];
    ctx->tuning_params.mainzisegscan_group_sizze_74097 =
        &cfg->tuning_params[56];
    ctx->tuning_params.mainzisegscan_num_groups_67860 = &cfg->tuning_params[57];
    ctx->tuning_params.mainzisegscan_num_groups_69651 = &cfg->tuning_params[58];
    ctx->tuning_params.mainzisegscan_num_groups_71690 = &cfg->tuning_params[59];
    ctx->tuning_params.mainzisegscan_num_groups_72675 = &cfg->tuning_params[60];
    ctx->tuning_params.mainzisegscan_num_groups_73342 = &cfg->tuning_params[61];
    ctx->tuning_params.mainzisegscan_num_groups_74099 = &cfg->tuning_params[62];
    ctx->tuning_params.mainzisuff_outer_par_0 = &cfg->tuning_params[63];
    ctx->tuning_params.mainzisuff_outer_par_1 = &cfg->tuning_params[64];
    ctx->tuning_params.mainzisuff_outer_par_2 = &cfg->tuning_params[65];
    ctx->tuning_params.mainzisuff_outer_par_3 = &cfg->tuning_params[66];
    ctx->tuning_params.mainzisuff_outer_par_4 = &cfg->tuning_params[67];
    ctx->tuning_params.mainzisuff_outer_par_5 = &cfg->tuning_params[68];
    ctx->tuning_params.mainzitile_sizze_74786 = &cfg->tuning_params[69];
    ctx->tuning_params.mainzitile_sizze_75340 = &cfg->tuning_params[70];
    ctx->tuning_params.mainzitile_sizze_76011 = &cfg->tuning_params[71];
    init_constants(ctx);
    // Clear the free list of any deallocations that occurred while initialising constants.
    OPENCL_SUCCEED_OR_RETURN(opencl_free_all(&ctx->opencl));
    // The program will be properly freed after all the kernels have also been freed.
    OPENCL_SUCCEED_OR_RETURN(clReleaseProgram(prog));
    return futhark_context_sync(ctx);
}
struct futhark_context *futhark_context_new(struct futhark_context_config *cfg)
{
    assert(!cfg->in_use);
    
    struct futhark_context *ctx =
                           (struct futhark_context *) malloc(sizeof(struct futhark_context));
    
    if (ctx == NULL)
        return NULL;
    ctx->cfg = cfg;
    ctx->cfg->in_use = 1;
    
    int required_types = 0;
    
    required_types |= OPENCL_F64;
    init_context_early(cfg, ctx);
    
    cl_program prog = setup_opencl(&ctx->opencl, opencl_program, required_types,
                                   cfg->build_opts);
    
    init_context_late(cfg, ctx, prog);
    return ctx;
}
struct futhark_context *futhark_context_new_with_command_queue(struct futhark_context_config *cfg,
                                                               cl_command_queue queue)
{
    assert(!cfg->in_use);
    
    struct futhark_context *ctx =
                           (struct futhark_context *) malloc(sizeof(struct futhark_context));
    
    if (ctx == NULL)
        return NULL;
    ctx->cfg = cfg;
    ctx->cfg->in_use = 1;
    
    int required_types = 0;
    
    required_types |= OPENCL_F64;
    init_context_early(cfg, ctx);
    
    cl_program prog = setup_opencl_with_command_queue(&ctx->opencl, queue,
                                                      opencl_program,
                                                      required_types,
                                                      cfg->build_opts);
    
    init_context_late(cfg, ctx, prog);
    return ctx;
}
void futhark_context_free(struct futhark_context *ctx)
{
    free_constants(ctx);
    free_lock(&ctx->lock);
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->builtinzhreplicate_f64zireplicate_78312));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->builtinzhreplicate_i64zireplicate_78426));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->gpu_map_transpose_f64));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->gpu_map_transpose_f64_low_height));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->gpu_map_transpose_f64_low_width));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->gpu_map_transpose_f64_small));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage1_67884));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage1_69675));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage1_71714));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage1_72699));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage1_73366));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage1_74123));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage2_67884));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage2_69675));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage2_71714));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage2_72699));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage2_73366));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage2_74123));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage3_67884));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage3_69675));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage3_71714));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage3_72699));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage3_73366));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainziscan_stage3_74123));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_66915));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_67937));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_67956));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_67968));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_67988));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_68159));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_68300));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_68572));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_69728));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_69747));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_69759));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_69779));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_69980));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_70133));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_70463));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_71767));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_71786));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_71798));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_71818));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_72051));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_72216));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_72752));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_72771));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_72783));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_72803));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_73419));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_73438));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_73450));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_73470));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_74176));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_74195));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_74207));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_74227));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_74589));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_intragroup_72819));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_intragroup_73487));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_intragroup_74244));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_intragroup_74792));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_intragroup_75346));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegmap_intragroup_76017));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_large_68263));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_large_68313));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_large_70086));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_large_70156));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_large_72159));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_large_72258));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_small_68263));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_small_68313));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_small_70086));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_small_70156));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_small_72159));
    OPENCL_SUCCEED_FATAL(clReleaseKernel(ctx->mainzisegred_small_72258));
    teardown_opencl(&ctx->opencl);
    ctx->cfg->in_use = 0;
    free(ctx);
}
int futhark_context_sync(struct futhark_context *ctx)
{
    cl_int failure_idx = -1;
    
    if (ctx->failure_is_an_option) {
        OPENCL_SUCCEED_OR_RETURN(clEnqueueReadBuffer(ctx->opencl.queue,
                                                     ctx->global_failure,
                                                     CL_FALSE, 0,
                                                     sizeof(cl_int),
                                                     &failure_idx, 0, NULL,
                                                     ctx->profiling_paused ||
                                                     !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                               &ctx->copy_scalar_from_dev_runs,
                                                                                               &ctx->copy_scalar_from_dev_total_runtime)));
        ctx->failure_is_an_option = 0;
    }
    OPENCL_SUCCEED_OR_RETURN(clFinish(ctx->opencl.queue));
    if (failure_idx >= 0) {
        cl_int no_failure = -1;
        
        OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                      ctx->global_failure,
                                                      CL_TRUE, 0,
                                                      sizeof(cl_int),
                                                      &no_failure, 0, NULL,
                                                      NULL));
        
        int64_t args[2 + 1];
        
        OPENCL_SUCCEED_OR_RETURN(clEnqueueReadBuffer(ctx->opencl.queue,
                                                     ctx->global_failure_args,
                                                     CL_TRUE, 0, sizeof(args),
                                                     &args, 0, NULL,
                                                     ctx->profiling_paused ||
                                                     !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                               &ctx->copy_dev_to_host_runs,
                                                                                               &ctx->copy_dev_to_host_total_runtime)));
        switch (failure_idx) {
            
          case 0:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 1:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 2:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 3:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 4:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 5:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 6:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 7:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 8:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 9:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 10:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 11:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 12:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 13:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 14:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 15:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 16:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 17:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 18:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 19:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 20:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 21:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 22:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 23:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 24:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 25:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 26:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 27:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 28:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 29:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 30:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 31:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 32:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 33:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 34:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 35:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 36:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 37:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 38:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 39:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 40:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 41:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 42:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 43:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 44:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 45:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 46:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 47:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 48:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 49:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 50:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 51:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 52:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 53:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 54:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 55:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:450:26-36\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 56:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:460:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 57:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:461:35-48\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:443:3-470:10\n   #5  loess.fut:503:15-61\n   #6  loess.fut:590:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:589:5-591:26\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 58:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:485:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 59:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:484:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:480:3-488:25\n   #4  loess.fut:504:16-51\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 60:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:536:27-33\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  loess.fut:609:13-59\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:608:5-610:29\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
            
          case 61:
            {
                ctx->error =
                    msgprintf("Index [%lld] out of bounds for array of shape [%lld].\n-> #0  loess.fut:537:27-37\n   #1  loess.fut:549:13-50\n   #2  /prelude/soacs.fut:59:3-10\n   #3  /prelude/array.fut:195:3-17\n   #4  utils.fut:6:3-16\n   #5  loess.fut:546:3-550:9\n   #6  loess.fut:609:13-59\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:608:5-610:29\n   #10 loess.fut:573:1-612:26\n",
                              args[0], args[1]);
                break;
            }
        }
        return 1;
    }
    return 0;
}
cl_command_queue futhark_context_get_command_queue(struct futhark_context *ctx)
{
    return ctx->opencl.queue;
}
static int memblock_unref_device(struct futhark_context *ctx,
                                 struct memblock_device *block, const
                                 char *desc)
{
    if (block->references != NULL) {
        *block->references -= 1;
        if (ctx->detail_memory)
            fprintf(ctx->log,
                    "Unreferencing block %s (allocated as %s) in %s: %d references remaining.\n",
                    desc, block->desc, "space 'device'", *block->references);
        if (*block->references == 0) {
            ctx->cur_mem_usage_device -= block->size;
            OPENCL_SUCCEED_OR_RETURN(opencl_free(&ctx->opencl, block->mem,
                                                 desc));
            free(block->references);
            if (ctx->detail_memory)
                fprintf(ctx->log,
                        "%lld bytes freed (now allocated: %lld bytes)\n",
                        (long long) block->size,
                        (long long) ctx->cur_mem_usage_device);
        }
        block->references = NULL;
    }
    return 0;
}
static int memblock_alloc_device(struct futhark_context *ctx,
                                 struct memblock_device *block, int64_t size,
                                 const char *desc)
{
    if (size < 0)
        futhark_panic(1,
                      "Negative allocation of %lld bytes attempted for %s in %s.\n",
                      (long long) size, desc, "space 'device'",
                      ctx->cur_mem_usage_device);
    
    int ret = memblock_unref_device(ctx, block, desc);
    
    ctx->cur_mem_usage_device += size;
    if (ctx->detail_memory)
        fprintf(ctx->log,
                "Allocating %lld bytes for %s in %s (then allocated: %lld bytes)",
                (long long) size, desc, "space 'device'",
                (long long) ctx->cur_mem_usage_device);
    if (ctx->cur_mem_usage_device > ctx->peak_mem_usage_device) {
        ctx->peak_mem_usage_device = ctx->cur_mem_usage_device;
        if (ctx->detail_memory)
            fprintf(ctx->log, " (new peak).\n");
    } else if (ctx->detail_memory)
        fprintf(ctx->log, ".\n");
    OPENCL_SUCCEED_OR_RETURN(opencl_alloc(&ctx->opencl, (size_t) size, desc,
                                          &block->mem));
    block->references = (int *) malloc(sizeof(int));
    *block->references = 1;
    block->size = size;
    block->desc = desc;
    return ret;
}
static int memblock_set_device(struct futhark_context *ctx,
                               struct memblock_device *lhs,
                               struct memblock_device *rhs, const
                               char *lhs_desc)
{
    int ret = memblock_unref_device(ctx, lhs, lhs_desc);
    
    if (rhs->references != NULL)
        (*rhs->references)++;
    *lhs = *rhs;
    return ret;
}
static int memblock_unref(struct futhark_context *ctx, struct memblock *block,
                          const char *desc)
{
    if (block->references != NULL) {
        *block->references -= 1;
        if (ctx->detail_memory)
            fprintf(ctx->log,
                    "Unreferencing block %s (allocated as %s) in %s: %d references remaining.\n",
                    desc, block->desc, "default space", *block->references);
        if (*block->references == 0) {
            ctx->cur_mem_usage_default -= block->size;
            free(block->mem);
            free(block->references);
            if (ctx->detail_memory)
                fprintf(ctx->log,
                        "%lld bytes freed (now allocated: %lld bytes)\n",
                        (long long) block->size,
                        (long long) ctx->cur_mem_usage_default);
        }
        block->references = NULL;
    }
    return 0;
}
static int memblock_alloc(struct futhark_context *ctx, struct memblock *block,
                          int64_t size, const char *desc)
{
    if (size < 0)
        futhark_panic(1,
                      "Negative allocation of %lld bytes attempted for %s in %s.\n",
                      (long long) size, desc, "default space",
                      ctx->cur_mem_usage_default);
    
    int ret = memblock_unref(ctx, block, desc);
    
    ctx->cur_mem_usage_default += size;
    if (ctx->detail_memory)
        fprintf(ctx->log,
                "Allocating %lld bytes for %s in %s (then allocated: %lld bytes)",
                (long long) size, desc, "default space",
                (long long) ctx->cur_mem_usage_default);
    if (ctx->cur_mem_usage_default > ctx->peak_mem_usage_default) {
        ctx->peak_mem_usage_default = ctx->cur_mem_usage_default;
        if (ctx->detail_memory)
            fprintf(ctx->log, " (new peak).\n");
    } else if (ctx->detail_memory)
        fprintf(ctx->log, ".\n");
    block->mem = (unsigned char *) malloc((size_t) size);
    block->references = (int *) malloc(sizeof(int));
    *block->references = 1;
    block->size = size;
    block->desc = desc;
    return ret;
}
static int memblock_set(struct futhark_context *ctx, struct memblock *lhs,
                        struct memblock *rhs, const char *lhs_desc)
{
    int ret = memblock_unref(ctx, lhs, lhs_desc);
    
    if (rhs->references != NULL)
        (*rhs->references)++;
    *lhs = *rhs;
    return ret;
}
int futhark_get_tuning_param_count(void)
{
    return sizeof(tuning_param_names) / sizeof(tuning_param_names[0]);
}
const char *futhark_get_tuning_param_name(int i)
{
    return tuning_param_names[i];
}
const char *futhark_get_tuning_param_class(int i)
{
    return tuning_param_classes[i];
}
char *futhark_context_report(struct futhark_context *ctx)
{
    if (futhark_context_sync(ctx) != 0)
        return NULL;
    
    struct str_builder builder;
    
    str_builder_init(&builder);
    if (ctx->detail_memory || ctx->profiling || ctx->logging) {
        str_builder(&builder,
                    "Peak memory usage for space 'device': %lld bytes.\n",
                    (long long) ctx->peak_mem_usage_device);
        { }
    }
    if (ctx->profiling) {
        OPENCL_SUCCEED_FATAL(opencl_tally_profiling_records(&ctx->opencl));
        str_builder(&builder,
                    "copy_dev_to_dev                       ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->copy_dev_to_dev_runs,
                    (long) ctx->copy_dev_to_dev_total_runtime /
                    (ctx->copy_dev_to_dev_runs !=
                     0 ? ctx->copy_dev_to_dev_runs : 1),
                    (long) ctx->copy_dev_to_dev_total_runtime);
        ctx->total_runtime += ctx->copy_dev_to_dev_total_runtime;
        ctx->total_runs += ctx->copy_dev_to_dev_runs;
        str_builder(&builder,
                    "copy_dev_to_host                      ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->copy_dev_to_host_runs,
                    (long) ctx->copy_dev_to_host_total_runtime /
                    (ctx->copy_dev_to_host_runs !=
                     0 ? ctx->copy_dev_to_host_runs : 1),
                    (long) ctx->copy_dev_to_host_total_runtime);
        ctx->total_runtime += ctx->copy_dev_to_host_total_runtime;
        ctx->total_runs += ctx->copy_dev_to_host_runs;
        str_builder(&builder,
                    "copy_host_to_dev                      ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->copy_host_to_dev_runs,
                    (long) ctx->copy_host_to_dev_total_runtime /
                    (ctx->copy_host_to_dev_runs !=
                     0 ? ctx->copy_host_to_dev_runs : 1),
                    (long) ctx->copy_host_to_dev_total_runtime);
        ctx->total_runtime += ctx->copy_host_to_dev_total_runtime;
        ctx->total_runs += ctx->copy_host_to_dev_runs;
        str_builder(&builder,
                    "copy_scalar_to_dev                    ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->copy_scalar_to_dev_runs,
                    (long) ctx->copy_scalar_to_dev_total_runtime /
                    (ctx->copy_scalar_to_dev_runs !=
                     0 ? ctx->copy_scalar_to_dev_runs : 1),
                    (long) ctx->copy_scalar_to_dev_total_runtime);
        ctx->total_runtime += ctx->copy_scalar_to_dev_total_runtime;
        ctx->total_runs += ctx->copy_scalar_to_dev_runs;
        str_builder(&builder,
                    "copy_scalar_from_dev                  ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->copy_scalar_from_dev_runs,
                    (long) ctx->copy_scalar_from_dev_total_runtime /
                    (ctx->copy_scalar_from_dev_runs !=
                     0 ? ctx->copy_scalar_from_dev_runs : 1),
                    (long) ctx->copy_scalar_from_dev_total_runtime);
        ctx->total_runtime += ctx->copy_scalar_from_dev_total_runtime;
        ctx->total_runs += ctx->copy_scalar_from_dev_runs;
        str_builder(&builder,
                    "builtin#replicate_f64.replicate_78312 ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->builtinzhreplicate_f64zireplicate_78312_runs,
                    (long) ctx->builtinzhreplicate_f64zireplicate_78312_total_runtime /
                    (ctx->builtinzhreplicate_f64zireplicate_78312_runs !=
                     0 ? ctx->builtinzhreplicate_f64zireplicate_78312_runs : 1),
                    (long) ctx->builtinzhreplicate_f64zireplicate_78312_total_runtime);
        ctx->total_runtime +=
            ctx->builtinzhreplicate_f64zireplicate_78312_total_runtime;
        ctx->total_runs += ctx->builtinzhreplicate_f64zireplicate_78312_runs;
        str_builder(&builder,
                    "builtin#replicate_i64.replicate_78426 ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->builtinzhreplicate_i64zireplicate_78426_runs,
                    (long) ctx->builtinzhreplicate_i64zireplicate_78426_total_runtime /
                    (ctx->builtinzhreplicate_i64zireplicate_78426_runs !=
                     0 ? ctx->builtinzhreplicate_i64zireplicate_78426_runs : 1),
                    (long) ctx->builtinzhreplicate_i64zireplicate_78426_total_runtime);
        ctx->total_runtime +=
            ctx->builtinzhreplicate_i64zireplicate_78426_total_runtime;
        ctx->total_runs += ctx->builtinzhreplicate_i64zireplicate_78426_runs;
        str_builder(&builder,
                    "gpu_map_transpose_f64                 ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->gpu_map_transpose_f64_runs,
                    (long) ctx->gpu_map_transpose_f64_total_runtime /
                    (ctx->gpu_map_transpose_f64_runs !=
                     0 ? ctx->gpu_map_transpose_f64_runs : 1),
                    (long) ctx->gpu_map_transpose_f64_total_runtime);
        ctx->total_runtime += ctx->gpu_map_transpose_f64_total_runtime;
        ctx->total_runs += ctx->gpu_map_transpose_f64_runs;
        str_builder(&builder,
                    "gpu_map_transpose_f64_low_height      ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->gpu_map_transpose_f64_low_height_runs,
                    (long) ctx->gpu_map_transpose_f64_low_height_total_runtime /
                    (ctx->gpu_map_transpose_f64_low_height_runs !=
                     0 ? ctx->gpu_map_transpose_f64_low_height_runs : 1),
                    (long) ctx->gpu_map_transpose_f64_low_height_total_runtime);
        ctx->total_runtime +=
            ctx->gpu_map_transpose_f64_low_height_total_runtime;
        ctx->total_runs += ctx->gpu_map_transpose_f64_low_height_runs;
        str_builder(&builder,
                    "gpu_map_transpose_f64_low_width       ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->gpu_map_transpose_f64_low_width_runs,
                    (long) ctx->gpu_map_transpose_f64_low_width_total_runtime /
                    (ctx->gpu_map_transpose_f64_low_width_runs !=
                     0 ? ctx->gpu_map_transpose_f64_low_width_runs : 1),
                    (long) ctx->gpu_map_transpose_f64_low_width_total_runtime);
        ctx->total_runtime +=
            ctx->gpu_map_transpose_f64_low_width_total_runtime;
        ctx->total_runs += ctx->gpu_map_transpose_f64_low_width_runs;
        str_builder(&builder,
                    "gpu_map_transpose_f64_small           ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->gpu_map_transpose_f64_small_runs,
                    (long) ctx->gpu_map_transpose_f64_small_total_runtime /
                    (ctx->gpu_map_transpose_f64_small_runs !=
                     0 ? ctx->gpu_map_transpose_f64_small_runs : 1),
                    (long) ctx->gpu_map_transpose_f64_small_total_runtime);
        ctx->total_runtime += ctx->gpu_map_transpose_f64_small_total_runtime;
        ctx->total_runs += ctx->gpu_map_transpose_f64_small_runs;
        str_builder(&builder,
                    "main.scan_stage1_67884                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage1_67884_runs,
                    (long) ctx->mainziscan_stage1_67884_total_runtime /
                    (ctx->mainziscan_stage1_67884_runs !=
                     0 ? ctx->mainziscan_stage1_67884_runs : 1),
                    (long) ctx->mainziscan_stage1_67884_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage1_67884_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage1_67884_runs;
        str_builder(&builder,
                    "main.scan_stage1_69675                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage1_69675_runs,
                    (long) ctx->mainziscan_stage1_69675_total_runtime /
                    (ctx->mainziscan_stage1_69675_runs !=
                     0 ? ctx->mainziscan_stage1_69675_runs : 1),
                    (long) ctx->mainziscan_stage1_69675_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage1_69675_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage1_69675_runs;
        str_builder(&builder,
                    "main.scan_stage1_71714                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage1_71714_runs,
                    (long) ctx->mainziscan_stage1_71714_total_runtime /
                    (ctx->mainziscan_stage1_71714_runs !=
                     0 ? ctx->mainziscan_stage1_71714_runs : 1),
                    (long) ctx->mainziscan_stage1_71714_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage1_71714_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage1_71714_runs;
        str_builder(&builder,
                    "main.scan_stage1_72699                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage1_72699_runs,
                    (long) ctx->mainziscan_stage1_72699_total_runtime /
                    (ctx->mainziscan_stage1_72699_runs !=
                     0 ? ctx->mainziscan_stage1_72699_runs : 1),
                    (long) ctx->mainziscan_stage1_72699_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage1_72699_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage1_72699_runs;
        str_builder(&builder,
                    "main.scan_stage1_73366                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage1_73366_runs,
                    (long) ctx->mainziscan_stage1_73366_total_runtime /
                    (ctx->mainziscan_stage1_73366_runs !=
                     0 ? ctx->mainziscan_stage1_73366_runs : 1),
                    (long) ctx->mainziscan_stage1_73366_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage1_73366_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage1_73366_runs;
        str_builder(&builder,
                    "main.scan_stage1_74123                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage1_74123_runs,
                    (long) ctx->mainziscan_stage1_74123_total_runtime /
                    (ctx->mainziscan_stage1_74123_runs !=
                     0 ? ctx->mainziscan_stage1_74123_runs : 1),
                    (long) ctx->mainziscan_stage1_74123_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage1_74123_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage1_74123_runs;
        str_builder(&builder,
                    "main.scan_stage2_67884                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage2_67884_runs,
                    (long) ctx->mainziscan_stage2_67884_total_runtime /
                    (ctx->mainziscan_stage2_67884_runs !=
                     0 ? ctx->mainziscan_stage2_67884_runs : 1),
                    (long) ctx->mainziscan_stage2_67884_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage2_67884_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage2_67884_runs;
        str_builder(&builder,
                    "main.scan_stage2_69675                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage2_69675_runs,
                    (long) ctx->mainziscan_stage2_69675_total_runtime /
                    (ctx->mainziscan_stage2_69675_runs !=
                     0 ? ctx->mainziscan_stage2_69675_runs : 1),
                    (long) ctx->mainziscan_stage2_69675_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage2_69675_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage2_69675_runs;
        str_builder(&builder,
                    "main.scan_stage2_71714                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage2_71714_runs,
                    (long) ctx->mainziscan_stage2_71714_total_runtime /
                    (ctx->mainziscan_stage2_71714_runs !=
                     0 ? ctx->mainziscan_stage2_71714_runs : 1),
                    (long) ctx->mainziscan_stage2_71714_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage2_71714_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage2_71714_runs;
        str_builder(&builder,
                    "main.scan_stage2_72699                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage2_72699_runs,
                    (long) ctx->mainziscan_stage2_72699_total_runtime /
                    (ctx->mainziscan_stage2_72699_runs !=
                     0 ? ctx->mainziscan_stage2_72699_runs : 1),
                    (long) ctx->mainziscan_stage2_72699_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage2_72699_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage2_72699_runs;
        str_builder(&builder,
                    "main.scan_stage2_73366                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage2_73366_runs,
                    (long) ctx->mainziscan_stage2_73366_total_runtime /
                    (ctx->mainziscan_stage2_73366_runs !=
                     0 ? ctx->mainziscan_stage2_73366_runs : 1),
                    (long) ctx->mainziscan_stage2_73366_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage2_73366_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage2_73366_runs;
        str_builder(&builder,
                    "main.scan_stage2_74123                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage2_74123_runs,
                    (long) ctx->mainziscan_stage2_74123_total_runtime /
                    (ctx->mainziscan_stage2_74123_runs !=
                     0 ? ctx->mainziscan_stage2_74123_runs : 1),
                    (long) ctx->mainziscan_stage2_74123_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage2_74123_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage2_74123_runs;
        str_builder(&builder,
                    "main.scan_stage3_67884                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage3_67884_runs,
                    (long) ctx->mainziscan_stage3_67884_total_runtime /
                    (ctx->mainziscan_stage3_67884_runs !=
                     0 ? ctx->mainziscan_stage3_67884_runs : 1),
                    (long) ctx->mainziscan_stage3_67884_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage3_67884_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage3_67884_runs;
        str_builder(&builder,
                    "main.scan_stage3_69675                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage3_69675_runs,
                    (long) ctx->mainziscan_stage3_69675_total_runtime /
                    (ctx->mainziscan_stage3_69675_runs !=
                     0 ? ctx->mainziscan_stage3_69675_runs : 1),
                    (long) ctx->mainziscan_stage3_69675_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage3_69675_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage3_69675_runs;
        str_builder(&builder,
                    "main.scan_stage3_71714                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage3_71714_runs,
                    (long) ctx->mainziscan_stage3_71714_total_runtime /
                    (ctx->mainziscan_stage3_71714_runs !=
                     0 ? ctx->mainziscan_stage3_71714_runs : 1),
                    (long) ctx->mainziscan_stage3_71714_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage3_71714_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage3_71714_runs;
        str_builder(&builder,
                    "main.scan_stage3_72699                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage3_72699_runs,
                    (long) ctx->mainziscan_stage3_72699_total_runtime /
                    (ctx->mainziscan_stage3_72699_runs !=
                     0 ? ctx->mainziscan_stage3_72699_runs : 1),
                    (long) ctx->mainziscan_stage3_72699_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage3_72699_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage3_72699_runs;
        str_builder(&builder,
                    "main.scan_stage3_73366                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage3_73366_runs,
                    (long) ctx->mainziscan_stage3_73366_total_runtime /
                    (ctx->mainziscan_stage3_73366_runs !=
                     0 ? ctx->mainziscan_stage3_73366_runs : 1),
                    (long) ctx->mainziscan_stage3_73366_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage3_73366_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage3_73366_runs;
        str_builder(&builder,
                    "main.scan_stage3_74123                ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainziscan_stage3_74123_runs,
                    (long) ctx->mainziscan_stage3_74123_total_runtime /
                    (ctx->mainziscan_stage3_74123_runs !=
                     0 ? ctx->mainziscan_stage3_74123_runs : 1),
                    (long) ctx->mainziscan_stage3_74123_total_runtime);
        ctx->total_runtime += ctx->mainziscan_stage3_74123_total_runtime;
        ctx->total_runs += ctx->mainziscan_stage3_74123_runs;
        str_builder(&builder,
                    "main.segmap_66915                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_66915_runs,
                    (long) ctx->mainzisegmap_66915_total_runtime /
                    (ctx->mainzisegmap_66915_runs !=
                     0 ? ctx->mainzisegmap_66915_runs : 1),
                    (long) ctx->mainzisegmap_66915_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_66915_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_66915_runs;
        str_builder(&builder,
                    "main.segmap_67937                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_67937_runs,
                    (long) ctx->mainzisegmap_67937_total_runtime /
                    (ctx->mainzisegmap_67937_runs !=
                     0 ? ctx->mainzisegmap_67937_runs : 1),
                    (long) ctx->mainzisegmap_67937_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_67937_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_67937_runs;
        str_builder(&builder,
                    "main.segmap_67956                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_67956_runs,
                    (long) ctx->mainzisegmap_67956_total_runtime /
                    (ctx->mainzisegmap_67956_runs !=
                     0 ? ctx->mainzisegmap_67956_runs : 1),
                    (long) ctx->mainzisegmap_67956_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_67956_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_67956_runs;
        str_builder(&builder,
                    "main.segmap_67968                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_67968_runs,
                    (long) ctx->mainzisegmap_67968_total_runtime /
                    (ctx->mainzisegmap_67968_runs !=
                     0 ? ctx->mainzisegmap_67968_runs : 1),
                    (long) ctx->mainzisegmap_67968_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_67968_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_67968_runs;
        str_builder(&builder,
                    "main.segmap_67988                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_67988_runs,
                    (long) ctx->mainzisegmap_67988_total_runtime /
                    (ctx->mainzisegmap_67988_runs !=
                     0 ? ctx->mainzisegmap_67988_runs : 1),
                    (long) ctx->mainzisegmap_67988_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_67988_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_67988_runs;
        str_builder(&builder,
                    "main.segmap_68159                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_68159_runs,
                    (long) ctx->mainzisegmap_68159_total_runtime /
                    (ctx->mainzisegmap_68159_runs !=
                     0 ? ctx->mainzisegmap_68159_runs : 1),
                    (long) ctx->mainzisegmap_68159_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_68159_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_68159_runs;
        str_builder(&builder,
                    "main.segmap_68300                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_68300_runs,
                    (long) ctx->mainzisegmap_68300_total_runtime /
                    (ctx->mainzisegmap_68300_runs !=
                     0 ? ctx->mainzisegmap_68300_runs : 1),
                    (long) ctx->mainzisegmap_68300_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_68300_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_68300_runs;
        str_builder(&builder,
                    "main.segmap_68572                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_68572_runs,
                    (long) ctx->mainzisegmap_68572_total_runtime /
                    (ctx->mainzisegmap_68572_runs !=
                     0 ? ctx->mainzisegmap_68572_runs : 1),
                    (long) ctx->mainzisegmap_68572_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_68572_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_68572_runs;
        str_builder(&builder,
                    "main.segmap_69728                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_69728_runs,
                    (long) ctx->mainzisegmap_69728_total_runtime /
                    (ctx->mainzisegmap_69728_runs !=
                     0 ? ctx->mainzisegmap_69728_runs : 1),
                    (long) ctx->mainzisegmap_69728_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_69728_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_69728_runs;
        str_builder(&builder,
                    "main.segmap_69747                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_69747_runs,
                    (long) ctx->mainzisegmap_69747_total_runtime /
                    (ctx->mainzisegmap_69747_runs !=
                     0 ? ctx->mainzisegmap_69747_runs : 1),
                    (long) ctx->mainzisegmap_69747_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_69747_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_69747_runs;
        str_builder(&builder,
                    "main.segmap_69759                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_69759_runs,
                    (long) ctx->mainzisegmap_69759_total_runtime /
                    (ctx->mainzisegmap_69759_runs !=
                     0 ? ctx->mainzisegmap_69759_runs : 1),
                    (long) ctx->mainzisegmap_69759_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_69759_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_69759_runs;
        str_builder(&builder,
                    "main.segmap_69779                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_69779_runs,
                    (long) ctx->mainzisegmap_69779_total_runtime /
                    (ctx->mainzisegmap_69779_runs !=
                     0 ? ctx->mainzisegmap_69779_runs : 1),
                    (long) ctx->mainzisegmap_69779_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_69779_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_69779_runs;
        str_builder(&builder,
                    "main.segmap_69980                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_69980_runs,
                    (long) ctx->mainzisegmap_69980_total_runtime /
                    (ctx->mainzisegmap_69980_runs !=
                     0 ? ctx->mainzisegmap_69980_runs : 1),
                    (long) ctx->mainzisegmap_69980_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_69980_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_69980_runs;
        str_builder(&builder,
                    "main.segmap_70133                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_70133_runs,
                    (long) ctx->mainzisegmap_70133_total_runtime /
                    (ctx->mainzisegmap_70133_runs !=
                     0 ? ctx->mainzisegmap_70133_runs : 1),
                    (long) ctx->mainzisegmap_70133_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_70133_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_70133_runs;
        str_builder(&builder,
                    "main.segmap_70463                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_70463_runs,
                    (long) ctx->mainzisegmap_70463_total_runtime /
                    (ctx->mainzisegmap_70463_runs !=
                     0 ? ctx->mainzisegmap_70463_runs : 1),
                    (long) ctx->mainzisegmap_70463_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_70463_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_70463_runs;
        str_builder(&builder,
                    "main.segmap_71767                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_71767_runs,
                    (long) ctx->mainzisegmap_71767_total_runtime /
                    (ctx->mainzisegmap_71767_runs !=
                     0 ? ctx->mainzisegmap_71767_runs : 1),
                    (long) ctx->mainzisegmap_71767_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_71767_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_71767_runs;
        str_builder(&builder,
                    "main.segmap_71786                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_71786_runs,
                    (long) ctx->mainzisegmap_71786_total_runtime /
                    (ctx->mainzisegmap_71786_runs !=
                     0 ? ctx->mainzisegmap_71786_runs : 1),
                    (long) ctx->mainzisegmap_71786_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_71786_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_71786_runs;
        str_builder(&builder,
                    "main.segmap_71798                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_71798_runs,
                    (long) ctx->mainzisegmap_71798_total_runtime /
                    (ctx->mainzisegmap_71798_runs !=
                     0 ? ctx->mainzisegmap_71798_runs : 1),
                    (long) ctx->mainzisegmap_71798_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_71798_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_71798_runs;
        str_builder(&builder,
                    "main.segmap_71818                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_71818_runs,
                    (long) ctx->mainzisegmap_71818_total_runtime /
                    (ctx->mainzisegmap_71818_runs !=
                     0 ? ctx->mainzisegmap_71818_runs : 1),
                    (long) ctx->mainzisegmap_71818_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_71818_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_71818_runs;
        str_builder(&builder,
                    "main.segmap_72051                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_72051_runs,
                    (long) ctx->mainzisegmap_72051_total_runtime /
                    (ctx->mainzisegmap_72051_runs !=
                     0 ? ctx->mainzisegmap_72051_runs : 1),
                    (long) ctx->mainzisegmap_72051_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_72051_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_72051_runs;
        str_builder(&builder,
                    "main.segmap_72216                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_72216_runs,
                    (long) ctx->mainzisegmap_72216_total_runtime /
                    (ctx->mainzisegmap_72216_runs !=
                     0 ? ctx->mainzisegmap_72216_runs : 1),
                    (long) ctx->mainzisegmap_72216_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_72216_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_72216_runs;
        str_builder(&builder,
                    "main.segmap_72752                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_72752_runs,
                    (long) ctx->mainzisegmap_72752_total_runtime /
                    (ctx->mainzisegmap_72752_runs !=
                     0 ? ctx->mainzisegmap_72752_runs : 1),
                    (long) ctx->mainzisegmap_72752_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_72752_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_72752_runs;
        str_builder(&builder,
                    "main.segmap_72771                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_72771_runs,
                    (long) ctx->mainzisegmap_72771_total_runtime /
                    (ctx->mainzisegmap_72771_runs !=
                     0 ? ctx->mainzisegmap_72771_runs : 1),
                    (long) ctx->mainzisegmap_72771_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_72771_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_72771_runs;
        str_builder(&builder,
                    "main.segmap_72783                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_72783_runs,
                    (long) ctx->mainzisegmap_72783_total_runtime /
                    (ctx->mainzisegmap_72783_runs !=
                     0 ? ctx->mainzisegmap_72783_runs : 1),
                    (long) ctx->mainzisegmap_72783_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_72783_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_72783_runs;
        str_builder(&builder,
                    "main.segmap_72803                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_72803_runs,
                    (long) ctx->mainzisegmap_72803_total_runtime /
                    (ctx->mainzisegmap_72803_runs !=
                     0 ? ctx->mainzisegmap_72803_runs : 1),
                    (long) ctx->mainzisegmap_72803_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_72803_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_72803_runs;
        str_builder(&builder,
                    "main.segmap_73419                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_73419_runs,
                    (long) ctx->mainzisegmap_73419_total_runtime /
                    (ctx->mainzisegmap_73419_runs !=
                     0 ? ctx->mainzisegmap_73419_runs : 1),
                    (long) ctx->mainzisegmap_73419_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_73419_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_73419_runs;
        str_builder(&builder,
                    "main.segmap_73438                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_73438_runs,
                    (long) ctx->mainzisegmap_73438_total_runtime /
                    (ctx->mainzisegmap_73438_runs !=
                     0 ? ctx->mainzisegmap_73438_runs : 1),
                    (long) ctx->mainzisegmap_73438_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_73438_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_73438_runs;
        str_builder(&builder,
                    "main.segmap_73450                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_73450_runs,
                    (long) ctx->mainzisegmap_73450_total_runtime /
                    (ctx->mainzisegmap_73450_runs !=
                     0 ? ctx->mainzisegmap_73450_runs : 1),
                    (long) ctx->mainzisegmap_73450_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_73450_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_73450_runs;
        str_builder(&builder,
                    "main.segmap_73470                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_73470_runs,
                    (long) ctx->mainzisegmap_73470_total_runtime /
                    (ctx->mainzisegmap_73470_runs !=
                     0 ? ctx->mainzisegmap_73470_runs : 1),
                    (long) ctx->mainzisegmap_73470_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_73470_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_73470_runs;
        str_builder(&builder,
                    "main.segmap_74176                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_74176_runs,
                    (long) ctx->mainzisegmap_74176_total_runtime /
                    (ctx->mainzisegmap_74176_runs !=
                     0 ? ctx->mainzisegmap_74176_runs : 1),
                    (long) ctx->mainzisegmap_74176_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_74176_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_74176_runs;
        str_builder(&builder,
                    "main.segmap_74195                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_74195_runs,
                    (long) ctx->mainzisegmap_74195_total_runtime /
                    (ctx->mainzisegmap_74195_runs !=
                     0 ? ctx->mainzisegmap_74195_runs : 1),
                    (long) ctx->mainzisegmap_74195_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_74195_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_74195_runs;
        str_builder(&builder,
                    "main.segmap_74207                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_74207_runs,
                    (long) ctx->mainzisegmap_74207_total_runtime /
                    (ctx->mainzisegmap_74207_runs !=
                     0 ? ctx->mainzisegmap_74207_runs : 1),
                    (long) ctx->mainzisegmap_74207_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_74207_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_74207_runs;
        str_builder(&builder,
                    "main.segmap_74227                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_74227_runs,
                    (long) ctx->mainzisegmap_74227_total_runtime /
                    (ctx->mainzisegmap_74227_runs !=
                     0 ? ctx->mainzisegmap_74227_runs : 1),
                    (long) ctx->mainzisegmap_74227_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_74227_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_74227_runs;
        str_builder(&builder,
                    "main.segmap_74589                     ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_74589_runs,
                    (long) ctx->mainzisegmap_74589_total_runtime /
                    (ctx->mainzisegmap_74589_runs !=
                     0 ? ctx->mainzisegmap_74589_runs : 1),
                    (long) ctx->mainzisegmap_74589_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_74589_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_74589_runs;
        str_builder(&builder,
                    "main.segmap_intragroup_72819          ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_intragroup_72819_runs,
                    (long) ctx->mainzisegmap_intragroup_72819_total_runtime /
                    (ctx->mainzisegmap_intragroup_72819_runs !=
                     0 ? ctx->mainzisegmap_intragroup_72819_runs : 1),
                    (long) ctx->mainzisegmap_intragroup_72819_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_intragroup_72819_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_intragroup_72819_runs;
        str_builder(&builder,
                    "main.segmap_intragroup_73487          ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_intragroup_73487_runs,
                    (long) ctx->mainzisegmap_intragroup_73487_total_runtime /
                    (ctx->mainzisegmap_intragroup_73487_runs !=
                     0 ? ctx->mainzisegmap_intragroup_73487_runs : 1),
                    (long) ctx->mainzisegmap_intragroup_73487_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_intragroup_73487_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_intragroup_73487_runs;
        str_builder(&builder,
                    "main.segmap_intragroup_74244          ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_intragroup_74244_runs,
                    (long) ctx->mainzisegmap_intragroup_74244_total_runtime /
                    (ctx->mainzisegmap_intragroup_74244_runs !=
                     0 ? ctx->mainzisegmap_intragroup_74244_runs : 1),
                    (long) ctx->mainzisegmap_intragroup_74244_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_intragroup_74244_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_intragroup_74244_runs;
        str_builder(&builder,
                    "main.segmap_intragroup_74792          ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_intragroup_74792_runs,
                    (long) ctx->mainzisegmap_intragroup_74792_total_runtime /
                    (ctx->mainzisegmap_intragroup_74792_runs !=
                     0 ? ctx->mainzisegmap_intragroup_74792_runs : 1),
                    (long) ctx->mainzisegmap_intragroup_74792_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_intragroup_74792_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_intragroup_74792_runs;
        str_builder(&builder,
                    "main.segmap_intragroup_75346          ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_intragroup_75346_runs,
                    (long) ctx->mainzisegmap_intragroup_75346_total_runtime /
                    (ctx->mainzisegmap_intragroup_75346_runs !=
                     0 ? ctx->mainzisegmap_intragroup_75346_runs : 1),
                    (long) ctx->mainzisegmap_intragroup_75346_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_intragroup_75346_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_intragroup_75346_runs;
        str_builder(&builder,
                    "main.segmap_intragroup_76017          ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegmap_intragroup_76017_runs,
                    (long) ctx->mainzisegmap_intragroup_76017_total_runtime /
                    (ctx->mainzisegmap_intragroup_76017_runs !=
                     0 ? ctx->mainzisegmap_intragroup_76017_runs : 1),
                    (long) ctx->mainzisegmap_intragroup_76017_total_runtime);
        ctx->total_runtime += ctx->mainzisegmap_intragroup_76017_total_runtime;
        ctx->total_runs += ctx->mainzisegmap_intragroup_76017_runs;
        str_builder(&builder,
                    "main.segred_large_68263               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_large_68263_runs,
                    (long) ctx->mainzisegred_large_68263_total_runtime /
                    (ctx->mainzisegred_large_68263_runs !=
                     0 ? ctx->mainzisegred_large_68263_runs : 1),
                    (long) ctx->mainzisegred_large_68263_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_large_68263_total_runtime;
        ctx->total_runs += ctx->mainzisegred_large_68263_runs;
        str_builder(&builder,
                    "main.segred_large_68313               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_large_68313_runs,
                    (long) ctx->mainzisegred_large_68313_total_runtime /
                    (ctx->mainzisegred_large_68313_runs !=
                     0 ? ctx->mainzisegred_large_68313_runs : 1),
                    (long) ctx->mainzisegred_large_68313_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_large_68313_total_runtime;
        ctx->total_runs += ctx->mainzisegred_large_68313_runs;
        str_builder(&builder,
                    "main.segred_large_70086               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_large_70086_runs,
                    (long) ctx->mainzisegred_large_70086_total_runtime /
                    (ctx->mainzisegred_large_70086_runs !=
                     0 ? ctx->mainzisegred_large_70086_runs : 1),
                    (long) ctx->mainzisegred_large_70086_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_large_70086_total_runtime;
        ctx->total_runs += ctx->mainzisegred_large_70086_runs;
        str_builder(&builder,
                    "main.segred_large_70156               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_large_70156_runs,
                    (long) ctx->mainzisegred_large_70156_total_runtime /
                    (ctx->mainzisegred_large_70156_runs !=
                     0 ? ctx->mainzisegred_large_70156_runs : 1),
                    (long) ctx->mainzisegred_large_70156_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_large_70156_total_runtime;
        ctx->total_runs += ctx->mainzisegred_large_70156_runs;
        str_builder(&builder,
                    "main.segred_large_72159               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_large_72159_runs,
                    (long) ctx->mainzisegred_large_72159_total_runtime /
                    (ctx->mainzisegred_large_72159_runs !=
                     0 ? ctx->mainzisegred_large_72159_runs : 1),
                    (long) ctx->mainzisegred_large_72159_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_large_72159_total_runtime;
        ctx->total_runs += ctx->mainzisegred_large_72159_runs;
        str_builder(&builder,
                    "main.segred_large_72258               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_large_72258_runs,
                    (long) ctx->mainzisegred_large_72258_total_runtime /
                    (ctx->mainzisegred_large_72258_runs !=
                     0 ? ctx->mainzisegred_large_72258_runs : 1),
                    (long) ctx->mainzisegred_large_72258_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_large_72258_total_runtime;
        ctx->total_runs += ctx->mainzisegred_large_72258_runs;
        str_builder(&builder,
                    "main.segred_small_68263               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_small_68263_runs,
                    (long) ctx->mainzisegred_small_68263_total_runtime /
                    (ctx->mainzisegred_small_68263_runs !=
                     0 ? ctx->mainzisegred_small_68263_runs : 1),
                    (long) ctx->mainzisegred_small_68263_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_small_68263_total_runtime;
        ctx->total_runs += ctx->mainzisegred_small_68263_runs;
        str_builder(&builder,
                    "main.segred_small_68313               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_small_68313_runs,
                    (long) ctx->mainzisegred_small_68313_total_runtime /
                    (ctx->mainzisegred_small_68313_runs !=
                     0 ? ctx->mainzisegred_small_68313_runs : 1),
                    (long) ctx->mainzisegred_small_68313_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_small_68313_total_runtime;
        ctx->total_runs += ctx->mainzisegred_small_68313_runs;
        str_builder(&builder,
                    "main.segred_small_70086               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_small_70086_runs,
                    (long) ctx->mainzisegred_small_70086_total_runtime /
                    (ctx->mainzisegred_small_70086_runs !=
                     0 ? ctx->mainzisegred_small_70086_runs : 1),
                    (long) ctx->mainzisegred_small_70086_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_small_70086_total_runtime;
        ctx->total_runs += ctx->mainzisegred_small_70086_runs;
        str_builder(&builder,
                    "main.segred_small_70156               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_small_70156_runs,
                    (long) ctx->mainzisegred_small_70156_total_runtime /
                    (ctx->mainzisegred_small_70156_runs !=
                     0 ? ctx->mainzisegred_small_70156_runs : 1),
                    (long) ctx->mainzisegred_small_70156_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_small_70156_total_runtime;
        ctx->total_runs += ctx->mainzisegred_small_70156_runs;
        str_builder(&builder,
                    "main.segred_small_72159               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_small_72159_runs,
                    (long) ctx->mainzisegred_small_72159_total_runtime /
                    (ctx->mainzisegred_small_72159_runs !=
                     0 ? ctx->mainzisegred_small_72159_runs : 1),
                    (long) ctx->mainzisegred_small_72159_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_small_72159_total_runtime;
        ctx->total_runs += ctx->mainzisegred_small_72159_runs;
        str_builder(&builder,
                    "main.segred_small_72258               ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegred_small_72258_runs,
                    (long) ctx->mainzisegred_small_72258_total_runtime /
                    (ctx->mainzisegred_small_72258_runs !=
                     0 ? ctx->mainzisegred_small_72258_runs : 1),
                    (long) ctx->mainzisegred_small_72258_total_runtime);
        ctx->total_runtime += ctx->mainzisegred_small_72258_total_runtime;
        ctx->total_runs += ctx->mainzisegred_small_72258_runs;
        str_builder(&builder, "%d operations with cumulative runtime: %6ldus\n",
                    ctx->total_runs, ctx->total_runtime);
    }
    return builder.str;
}
char *futhark_context_get_error(struct futhark_context *ctx)
{
    char *error = ctx->error;
    
    ctx->error = NULL;
    return error;
}
void futhark_context_set_logging_file(struct futhark_context *ctx, FILE *f)
{
    ctx->log = f;
}
void futhark_context_pause_profiling(struct futhark_context *ctx)
{
    ctx->profiling_paused = 1;
}
void futhark_context_unpause_profiling(struct futhark_context *ctx)
{
    ctx->profiling_paused = 0;
}
int futhark_context_clear_caches(struct futhark_context *ctx)
{
    lock_lock(&ctx->lock);
    ctx->peak_mem_usage_device = 0;
    ctx->peak_mem_usage_default = 0;
    if (ctx->error == NULL)
        ctx->error = OPENCL_SUCCEED_NONFATAL(opencl_free_all(&ctx->opencl));
    lock_unlock(&ctx->lock);
    return ctx->error != NULL;
}

static int futrts_builtinzhgpu_map_transpose_f64(struct futhark_context *ctx,
                                                 struct memblock_device destmem_0,
                                                 int32_t destoffset_1,
                                                 struct memblock_device srcmem_2,
                                                 int32_t srcoffset_3,
                                                 int32_t num_arrays_4,
                                                 int32_t x_elems_5,
                                                 int32_t y_elems_6);
static int futrts_builtinzhreplicate_f64(struct futhark_context *ctx,
                                         struct memblock_device mem_78308,
                                         int32_t num_elems_78309,
                                         double val_78310);
static int futrts_builtinzhreplicate_i64(struct futhark_context *ctx,
                                         struct memblock_device mem_78422,
                                         int32_t num_elems_78423,
                                         int64_t val_78424);
static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock_device *mem_out_p_80004,
                             struct memblock_device Y_mem_77010,
                             int64_t m_65377, int64_t n_65378, int64_t q_65380,
                             int64_t degree_65381, int64_t jump_65382,
                             int64_t jump_threshold_65383,
                             int64_t q_threshold_65384);

static int init_constants(struct futhark_context *ctx)
{
    (void) ctx;
    
    int err = 0;
    
    
  cleanup:
    return err;
}
static int free_constants(struct futhark_context *ctx)
{
    (void) ctx;
    return 0;
}
struct futhark_f64_2d {
    struct memblock_device mem;
    int64_t shape[2];
};
struct futhark_f64_2d *futhark_new_f64_2d(struct futhark_context *ctx, const
                                          double *data, int64_t dim0,
                                          int64_t dim1)
{
    struct futhark_f64_2d *bad = NULL;
    struct futhark_f64_2d *arr =
                          (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    arr->mem.references = NULL;
    if (memblock_alloc_device(ctx, &arr->mem, dim0 * dim1 * 8, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    if ((size_t) (dim0 * dim1) * 8 > 0)
        OPENCL_SUCCEED_OR_RETURN(clEnqueueWriteBuffer(ctx->opencl.queue,
                                                      arr->mem.mem, CL_TRUE,
                                                      (size_t) 0,
                                                      (size_t) ((size_t) (dim0 *
                                                                          dim1) *
                                                                8), data + 0, 0,
                                                      NULL,
                                                      ctx->profiling_paused ||
                                                      !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                &ctx->copy_dev_to_host_runs,
                                                                                                &ctx->copy_dev_to_host_total_runtime)));
    lock_unlock(&ctx->lock);
    return arr;
}
struct futhark_f64_2d *futhark_new_raw_f64_2d(struct futhark_context *ctx, const
                                              cl_mem data, int64_t offset,
                                              int64_t dim0, int64_t dim1)
{
    struct futhark_f64_2d *bad = NULL;
    struct futhark_f64_2d *arr =
                          (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    arr->mem.references = NULL;
    if (memblock_alloc_device(ctx, &arr->mem, dim0 * dim1 * 8, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    if ((size_t) (dim0 * dim1) * 8 > 0) {
        OPENCL_SUCCEED_OR_RETURN(clEnqueueCopyBuffer(ctx->opencl.queue, data,
                                                     arr->mem.mem,
                                                     (size_t) offset,
                                                     (size_t) 0,
                                                     (size_t) ((size_t) (dim0 *
                                                                         dim1) *
                                                               8), 0, NULL,
                                                     ctx->profiling_paused ||
                                                     !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                               &ctx->copy_dev_to_dev_runs,
                                                                                               &ctx->copy_dev_to_dev_total_runtime)));
        if (ctx->debugging)
            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
    }
    lock_unlock(&ctx->lock);
    return arr;
}
int futhark_free_f64_2d(struct futhark_context *ctx, struct futhark_f64_2d *arr)
{
    lock_lock(&ctx->lock);
    if (memblock_unref_device(ctx, &arr->mem, "arr->mem") != 0)
        return 1;
    lock_unlock(&ctx->lock);
    free(arr);
    return 0;
}
int futhark_values_f64_2d(struct futhark_context *ctx,
                          struct futhark_f64_2d *arr, double *data)
{
    lock_lock(&ctx->lock);
    if ((size_t) (arr->shape[0] * arr->shape[1]) * 8 > 0) {
        OPENCL_SUCCEED_OR_RETURN(clEnqueueReadBuffer(ctx->opencl.queue,
                                                     arr->mem.mem,
                                                     ctx->failure_is_an_option ? CL_FALSE : CL_TRUE,
                                                     (size_t) 0,
                                                     (size_t) ((size_t) (arr->shape[0] *
                                                                         arr->shape[1]) *
                                                               8), data + 0, 0,
                                                     NULL,
                                                     ctx->profiling_paused ||
                                                     !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                               &ctx->copy_host_to_dev_runs,
                                                                                               &ctx->copy_host_to_dev_total_runtime)));
        if (ctx->failure_is_an_option && futhark_context_sync(ctx) != 0)
            return 1;
    }
    lock_unlock(&ctx->lock);
    return 0;
}
cl_mem futhark_values_raw_f64_2d(struct futhark_context *ctx,
                                 struct futhark_f64_2d *arr)
{
    (void) ctx;
    return arr->mem.mem;
}
const int64_t *futhark_shape_f64_2d(struct futhark_context *ctx,
                                    struct futhark_f64_2d *arr)
{
    (void) ctx;
    return arr->shape;
}

static int futrts_builtinzhgpu_map_transpose_f64(struct futhark_context *ctx,
                                                 struct memblock_device destmem_0,
                                                 int32_t destoffset_1,
                                                 struct memblock_device srcmem_2,
                                                 int32_t srcoffset_3,
                                                 int32_t num_arrays_4,
                                                 int32_t x_elems_5,
                                                 int32_t y_elems_6)
{
    (void) ctx;
    
    int err = 0;
    
    if (!(num_arrays_4 == 0 || (x_elems_5 == 0 || y_elems_6 == 0))) {
        int32_t muly_8 = squot32(16, x_elems_5);
        int32_t mulx_7 = squot32(16, y_elems_6);
        
        if (num_arrays_4 == 1 && (x_elems_5 == 1 || y_elems_6 == 1)) {
            if (sext_i32_i64(x_elems_5 * y_elems_6 * 8) > 0) {
                OPENCL_SUCCEED_OR_RETURN(clEnqueueCopyBuffer(ctx->opencl.queue,
                                                             srcmem_2.mem,
                                                             destmem_0.mem,
                                                             (size_t) sext_i32_i64(srcoffset_3),
                                                             (size_t) sext_i32_i64(destoffset_1),
                                                             (size_t) sext_i32_i64(x_elems_5 *
                                                             y_elems_6 * 8), 0,
                                                             NULL,
                                                             ctx->profiling_paused ||
                                                             !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                       &ctx->copy_dev_to_dev_runs,
                                                                                                       &ctx->copy_dev_to_dev_total_runtime)));
                if (ctx->debugging)
                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
            }
        } else {
            if (sle32(x_elems_5, 8) && slt32(16, y_elems_6)) {
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        0,
                                                        (size_t) (int64_t) 2176,
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        1, sizeof(destoffset_1),
                                                        &destoffset_1));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        2, sizeof(srcoffset_3),
                                                        &srcoffset_3));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        3, sizeof(num_arrays_4),
                                                        &num_arrays_4));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        4, sizeof(x_elems_5),
                                                        &x_elems_5));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        5, sizeof(y_elems_6),
                                                        &y_elems_6));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        6, sizeof(mulx_7),
                                                        &mulx_7));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        7, sizeof(muly_8),
                                                        &muly_8));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        8,
                                                        sizeof(destmem_0.mem),
                                                        &destmem_0.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_width,
                                                        9, sizeof(srcmem_2.mem),
                                                        &srcmem_2.mem));
                if (1 * ((size_t) sdiv_up32(x_elems_5, 16) * (size_t) 16) *
                    ((size_t) sdiv_up32(sdiv_up32(y_elems_6, muly_8), 16) *
                     (size_t) 16) * ((size_t) num_arrays_4 * (size_t) 1) != 0) {
                    const size_t global_work_sizze_79974[3] =
                                 {(size_t) sdiv_up32(x_elems_5, 16) *
                                  (size_t) 16,
                                  (size_t) sdiv_up32(sdiv_up32(y_elems_6,
                                                               muly_8), 16) *
                                  (size_t) 16, (size_t) num_arrays_4 *
                                  (size_t) 1};
                    const size_t local_work_sizze_79978[3] = {(size_t) 16,
                                                              (size_t) 16,
                                                              (size_t) 1};
                    int64_t time_start_79975 = 0, time_end_79976 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu, %zu, %zu] and local work size [%zu, %zu, %zu]; local memory: %d bytes.\n",
                                "gpu_map_transpose_f64_low_width",
                                global_work_sizze_79974[0],
                                global_work_sizze_79974[1],
                                global_work_sizze_79974[2],
                                local_work_sizze_79978[0],
                                local_work_sizze_79978[1],
                                local_work_sizze_79978[2], (int) (0 +
                                                                  (int64_t) 2176));
                        time_start_79975 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->gpu_map_transpose_f64_low_width,
                                                                    3, NULL,
                                                                    global_work_sizze_79974,
                                                                    local_work_sizze_79978,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->gpu_map_transpose_f64_low_width_runs,
                                                                                                              &ctx->gpu_map_transpose_f64_low_width_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_79976 = get_wall_time();
                        
                        long time_diff_79977 = time_end_79976 -
                             time_start_79975;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "gpu_map_transpose_f64_low_width",
                                time_diff_79977);
                    }
                }
            } else {
                if (sle32(y_elems_6, 8) && slt32(16, x_elems_5)) {
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            0,
                                                            (size_t) (int64_t) 2176,
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            1,
                                                            sizeof(destoffset_1),
                                                            &destoffset_1));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            2,
                                                            sizeof(srcoffset_3),
                                                            &srcoffset_3));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            3,
                                                            sizeof(num_arrays_4),
                                                            &num_arrays_4));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            4,
                                                            sizeof(x_elems_5),
                                                            &x_elems_5));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            5,
                                                            sizeof(y_elems_6),
                                                            &y_elems_6));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            6, sizeof(mulx_7),
                                                            &mulx_7));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            7, sizeof(muly_8),
                                                            &muly_8));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            8,
                                                            sizeof(destmem_0.mem),
                                                            &destmem_0.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_low_height,
                                                            9,
                                                            sizeof(srcmem_2.mem),
                                                            &srcmem_2.mem));
                    if (1 * ((size_t) sdiv_up32(sdiv_up32(x_elems_5, mulx_7),
                                                16) * (size_t) 16) *
                        ((size_t) sdiv_up32(y_elems_6, 16) * (size_t) 16) *
                        ((size_t) num_arrays_4 * (size_t) 1) != 0) {
                        const size_t global_work_sizze_79979[3] =
                                     {(size_t) sdiv_up32(sdiv_up32(x_elems_5,
                                                                   mulx_7),
                                                         16) * (size_t) 16,
                                      (size_t) sdiv_up32(y_elems_6, 16) *
                                      (size_t) 16, (size_t) num_arrays_4 *
                                      (size_t) 1};
                        const size_t local_work_sizze_79983[3] = {(size_t) 16,
                                                                  (size_t) 16,
                                                                  (size_t) 1};
                        int64_t time_start_79980 = 0, time_end_79981 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu, %zu, %zu] and local work size [%zu, %zu, %zu]; local memory: %d bytes.\n",
                                    "gpu_map_transpose_f64_low_height",
                                    global_work_sizze_79979[0],
                                    global_work_sizze_79979[1],
                                    global_work_sizze_79979[2],
                                    local_work_sizze_79983[0],
                                    local_work_sizze_79983[1],
                                    local_work_sizze_79983[2], (int) (0 +
                                                                      (int64_t) 2176));
                            time_start_79980 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->gpu_map_transpose_f64_low_height,
                                                                        3, NULL,
                                                                        global_work_sizze_79979,
                                                                        local_work_sizze_79983,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->gpu_map_transpose_f64_low_height_runs,
                                                                                                                  &ctx->gpu_map_transpose_f64_low_height_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_79981 = get_wall_time();
                            
                            long time_diff_79982 = time_end_79981 -
                                 time_start_79980;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "gpu_map_transpose_f64_low_height",
                                    time_diff_79982);
                        }
                    }
                } else {
                    if (sle32(x_elems_5, 8) && sle32(y_elems_6, 8)) {
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                0,
                                                                (size_t) (int64_t) 1,
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                1,
                                                                sizeof(destoffset_1),
                                                                &destoffset_1));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                2,
                                                                sizeof(srcoffset_3),
                                                                &srcoffset_3));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                3,
                                                                sizeof(num_arrays_4),
                                                                &num_arrays_4));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                4,
                                                                sizeof(x_elems_5),
                                                                &x_elems_5));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                5,
                                                                sizeof(y_elems_6),
                                                                &y_elems_6));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                6,
                                                                sizeof(mulx_7),
                                                                &mulx_7));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                7,
                                                                sizeof(muly_8),
                                                                &muly_8));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                8,
                                                                sizeof(destmem_0.mem),
                                                                &destmem_0.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64_small,
                                                                9,
                                                                sizeof(srcmem_2.mem),
                                                                &srcmem_2.mem));
                        if (1 * ((size_t) sdiv_up32(num_arrays_4 * x_elems_5 *
                                                    y_elems_6, 256) *
                                 (size_t) 256) != 0) {
                            const size_t global_work_sizze_79984[1] =
                                         {(size_t) sdiv_up32(num_arrays_4 *
                                                             x_elems_5 *
                                                             y_elems_6, 256) *
                                         (size_t) 256};
                            const size_t local_work_sizze_79988[1] =
                                         {(size_t) 256};
                            int64_t time_start_79985 = 0, time_end_79986 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "gpu_map_transpose_f64_small",
                                        global_work_sizze_79984[0],
                                        local_work_sizze_79988[0], (int) (0 +
                                                                          (int64_t) 1));
                                time_start_79985 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->gpu_map_transpose_f64_small,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_79984,
                                                                            local_work_sizze_79988,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->gpu_map_transpose_f64_small_runs,
                                                                                                                      &ctx->gpu_map_transpose_f64_small_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_79986 = get_wall_time();
                                
                                long time_diff_79987 = time_end_79986 -
                                     time_start_79985;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "gpu_map_transpose_f64_small",
                                        time_diff_79987);
                            }
                        }
                    } else {
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                0,
                                                                (size_t) (int64_t) 8448,
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                1,
                                                                sizeof(destoffset_1),
                                                                &destoffset_1));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                2,
                                                                sizeof(srcoffset_3),
                                                                &srcoffset_3));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                3,
                                                                sizeof(num_arrays_4),
                                                                &num_arrays_4));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                4,
                                                                sizeof(x_elems_5),
                                                                &x_elems_5));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                5,
                                                                sizeof(y_elems_6),
                                                                &y_elems_6));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                6,
                                                                sizeof(mulx_7),
                                                                &mulx_7));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                7,
                                                                sizeof(muly_8),
                                                                &muly_8));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                8,
                                                                sizeof(destmem_0.mem),
                                                                &destmem_0.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->gpu_map_transpose_f64,
                                                                9,
                                                                sizeof(srcmem_2.mem),
                                                                &srcmem_2.mem));
                        if (1 * ((size_t) sdiv_up32(x_elems_5, 32) *
                                 (size_t) 32) * ((size_t) sdiv_up32(y_elems_6,
                                                                    32) *
                                                 (size_t) 8) *
                            ((size_t) num_arrays_4 * (size_t) 1) != 0) {
                            const size_t global_work_sizze_79989[3] =
                                         {(size_t) sdiv_up32(x_elems_5, 32) *
                                          (size_t) 32,
                                          (size_t) sdiv_up32(y_elems_6, 32) *
                                          (size_t) 8, (size_t) num_arrays_4 *
                                          (size_t) 1};
                            const size_t local_work_sizze_79993[3] =
                                         {(size_t) 32, (size_t) 8, (size_t) 1};
                            int64_t time_start_79990 = 0, time_end_79991 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu, %zu, %zu] and local work size [%zu, %zu, %zu]; local memory: %d bytes.\n",
                                        "gpu_map_transpose_f64",
                                        global_work_sizze_79989[0],
                                        global_work_sizze_79989[1],
                                        global_work_sizze_79989[2],
                                        local_work_sizze_79993[0],
                                        local_work_sizze_79993[1],
                                        local_work_sizze_79993[2], (int) (0 +
                                                                          (int64_t) 8448));
                                time_start_79990 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->gpu_map_transpose_f64,
                                                                            3,
                                                                            NULL,
                                                                            global_work_sizze_79989,
                                                                            local_work_sizze_79993,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->gpu_map_transpose_f64_runs,
                                                                                                                      &ctx->gpu_map_transpose_f64_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_79991 = get_wall_time();
                                
                                long time_diff_79992 = time_end_79991 -
                                     time_start_79990;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "gpu_map_transpose_f64",
                                        time_diff_79992);
                            }
                        }
                    }
                }
            }
        }
    }
    
  cleanup:
    { }
    return err;
}
static int futrts_builtinzhreplicate_f64(struct futhark_context *ctx,
                                         struct memblock_device mem_78308,
                                         int32_t num_elems_78309,
                                         double val_78310)
{
    (void) ctx;
    
    int err = 0;
    int64_t group_sizze_78315;
    
    group_sizze_78315 =
        *ctx->tuning_params.builtinzhreplicate_f64zigroup_sizze_78315;
    
    int64_t num_groups_78316 = sdiv_up64(num_elems_78309, group_sizze_78315);
    
    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->builtinzhreplicate_f64zireplicate_78312,
                                            0, sizeof(num_elems_78309),
                                            &num_elems_78309));
    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->builtinzhreplicate_f64zireplicate_78312,
                                            1, sizeof(val_78310), &val_78310));
    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->builtinzhreplicate_f64zireplicate_78312,
                                            2, sizeof(mem_78308.mem),
                                            &mem_78308.mem));
    if (1 * ((size_t) num_groups_78316 * (size_t) group_sizze_78315) != 0) {
        const size_t global_work_sizze_79994[1] = {(size_t) num_groups_78316 *
                     (size_t) group_sizze_78315};
        const size_t local_work_sizze_79998[1] = {(size_t) group_sizze_78315};
        int64_t time_start_79995 = 0, time_end_79996 = 0;
        
        if (ctx->debugging) {
            fprintf(ctx->log,
                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                    "builtin#replicate_f64.replicate_78312",
                    global_work_sizze_79994[0], local_work_sizze_79998[0],
                    (int) 0);
            time_start_79995 = get_wall_time();
        }
        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                        ctx->builtinzhreplicate_f64zireplicate_78312,
                                                        1, NULL,
                                                        global_work_sizze_79994,
                                                        local_work_sizze_79998,
                                                        0, NULL,
                                                        ctx->profiling_paused ||
                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                  &ctx->builtinzhreplicate_f64zireplicate_78312_runs,
                                                                                                  &ctx->builtinzhreplicate_f64zireplicate_78312_total_runtime)));
        if (ctx->debugging) {
            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
            time_end_79996 = get_wall_time();
            
            long time_diff_79997 = time_end_79996 - time_start_79995;
            
            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                    "builtin#replicate_f64.replicate_78312", time_diff_79997);
        }
    }
    
  cleanup:
    { }
    return err;
}
static int futrts_builtinzhreplicate_i64(struct futhark_context *ctx,
                                         struct memblock_device mem_78422,
                                         int32_t num_elems_78423,
                                         int64_t val_78424)
{
    (void) ctx;
    
    int err = 0;
    int64_t group_sizze_78429;
    
    group_sizze_78429 =
        *ctx->tuning_params.builtinzhreplicate_i64zigroup_sizze_78429;
    
    int64_t num_groups_78430 = sdiv_up64(num_elems_78423, group_sizze_78429);
    
    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->builtinzhreplicate_i64zireplicate_78426,
                                            0, sizeof(num_elems_78423),
                                            &num_elems_78423));
    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->builtinzhreplicate_i64zireplicate_78426,
                                            1, sizeof(val_78424), &val_78424));
    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->builtinzhreplicate_i64zireplicate_78426,
                                            2, sizeof(mem_78422.mem),
                                            &mem_78422.mem));
    if (1 * ((size_t) num_groups_78430 * (size_t) group_sizze_78429) != 0) {
        const size_t global_work_sizze_79999[1] = {(size_t) num_groups_78430 *
                     (size_t) group_sizze_78429};
        const size_t local_work_sizze_80003[1] = {(size_t) group_sizze_78429};
        int64_t time_start_80000 = 0, time_end_80001 = 0;
        
        if (ctx->debugging) {
            fprintf(ctx->log,
                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                    "builtin#replicate_i64.replicate_78426",
                    global_work_sizze_79999[0], local_work_sizze_80003[0],
                    (int) 0);
            time_start_80000 = get_wall_time();
        }
        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                        ctx->builtinzhreplicate_i64zireplicate_78426,
                                                        1, NULL,
                                                        global_work_sizze_79999,
                                                        local_work_sizze_80003,
                                                        0, NULL,
                                                        ctx->profiling_paused ||
                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                  &ctx->builtinzhreplicate_i64zireplicate_78426_runs,
                                                                                                  &ctx->builtinzhreplicate_i64zireplicate_78426_total_runtime)));
        if (ctx->debugging) {
            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
            time_end_80001 = get_wall_time();
            
            long time_diff_80002 = time_end_80001 - time_start_80000;
            
            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                    "builtin#replicate_i64.replicate_78426", time_diff_80002);
        }
    }
    
  cleanup:
    { }
    return err;
}
static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock_device *mem_out_p_80004,
                             struct memblock_device Y_mem_77010,
                             int64_t m_65377, int64_t n_65378, int64_t q_65380,
                             int64_t degree_65381, int64_t jump_65382,
                             int64_t jump_threshold_65383,
                             int64_t q_threshold_65384)
{
    (void) ctx;
    
    int err = 0;
    struct memblock_device mem_out_78307;
    
    mem_out_78307.references = NULL;
    
    bool cond_65385 = jump_65382 == (int64_t) 1;
    int64_t n_m_65386;
    
    if (cond_65385) {
        n_m_65386 = n_65378;
    } else {
        bool zzero_65387 = jump_65382 == (int64_t) 0;
        bool nonzzero_65388 = !zzero_65387;
        bool nonzzero_cert_65389;
        
        if (!nonzzero_65388) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  loess.fut:580:38-45\n   #1  loess.fut:573:1-612:26\n");
            if (memblock_unref_device(ctx, &mem_out_78307, "mem_out_78307") !=
                0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_65390 = sdiv64(n_65378, jump_65382);
        int64_t n_m_f_res_65391 = add64((int64_t) 1, x_65390);
        
        n_m_65386 = n_m_f_res_65391;
    }
    
    int64_t i_65392 = sub64(n_65378, (int64_t) 1);
    bool x_65393 = sle64((int64_t) 0, i_65392);
    bool y_65394 = slt64(i_65392, n_65378);
    bool bounds_check_65395 = x_65393 && y_65394;
    bool index_certs_65396;
    
    if (!bounds_check_65395) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) i_65392,
                               "] out of bounds for array of shape [",
                               (long long) n_65378, "].",
                               "-> #0  /prelude/array.fut:26:29-34\n   #1  utils.fut:45:13-20\n   #2  loess.fut:585:5-54\n   #3  loess.fut:573:1-612:26\n");
        if (memblock_unref_device(ctx, &mem_out_78307, "mem_out_78307") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_65398 = smin64(n_65378, q_65380);
    bool bounds_invalid_upwards_65399 = slt64(n_m_65386, (int64_t) 0);
    bool valid_65400 = !bounds_invalid_upwards_65399;
    bool range_valid_c_65401;
    
    if (!valid_65400) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (long long) (int64_t) 0, "..",
                               (long long) (int64_t) 1, "..<",
                               (long long) n_m_65386, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  utils.fut:6:3-16\n   #3  loess.fut:443:3-470:10\n   #4  loess.fut:503:15-61\n   #5  loess.fut:590:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:589:5-591:26\n   #9  loess.fut:573:1-612:26\n");
        if (memblock_unref_device(ctx, &mem_out_78307, "mem_out_78307") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_65403 = slt64((int64_t) 1, min_res_65398);
    double i64_res_65404 = sitofp_i64_f64(q_65380);
    bool cond_65405 = slt64(jump_65382, jump_threshold_65383);
    bool cond_f_res_65406 = slt64(q_threshold_65384, q_65380);
    bool x_65407 = !cond_65405;
    bool y_65408 = cond_f_res_65406 && x_65407;
    bool cond_65409 = cond_65405 || y_65408;
    struct memblock_device ext_mem_78030;
    
    ext_mem_78030.references = NULL;
    
    struct memblock_device ext_mem_78029;
    
    ext_mem_78029.references = NULL;
    if (cond_65409) {
        bool match_lit_65412 = (int64_t) 0 == degree_65381;
        int64_t binop_x_77011 = m_65377 * n_m_65386;
        int64_t binop_y_77012 = (int64_t) 8 * binop_x_77011;
        int64_t bytes_77013 = smax64((int64_t) 0, binop_y_77012);
        struct memblock_device ext_mem_77858;
        
        ext_mem_77858.references = NULL;
        
        struct memblock_device ext_mem_77857;
        
        ext_mem_77857.references = NULL;
        if (match_lit_65412) {
            struct memblock_device mem_77014;
            
            mem_77014.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77014, bytes_77013,
                                      "mem_77014")) {
                err = 1;
                goto cleanup;
            }
            if (futrts_builtinzhreplicate_f64(ctx, mem_77014, m_65377 *
                                              n_m_65386, 0.0) != 0) {
                if (memblock_unref_device(ctx, &mem_77014, "mem_77014") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_77857,
                                          "ext_mem_77857") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_77858,
                                          "ext_mem_77858") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78029,
                                          "ext_mem_78029") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78030,
                                          "ext_mem_78030") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_out_78307,
                                          "mem_out_78307") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            
            bool suff_outer_par_66727;
            
            suff_outer_par_66727 = *ctx->tuning_params.mainzisuff_outer_par_0 <=
                m_65377;
            if (ctx->logging)
                fprintf(ctx->log, "Compared %s <= %ld: %s.\n",
                        "main.suff_outer_par_0", (long) m_65377,
                        suff_outer_par_66727 ? "true" : "false");
            
            int64_t segmap_group_sizze_66910;
            
            segmap_group_sizze_66910 =
                *ctx->tuning_params.mainzisegmap_group_sizze_66731;
            
            int64_t num_groups_66911;
            int32_t max_num_groups_78320;
            
            max_num_groups_78320 =
                *ctx->tuning_params.mainzisegmap_num_groups_66733;
            num_groups_66911 = sext_i64_i32(smax64((int64_t) 1,
                                                   smin64(sdiv_up64(m_65377,
                                                                    segmap_group_sizze_66910),
                                                          sext_i32_i64(max_num_groups_78320))));
            
            int64_t nest_sizze_67877 = m_65377 * n_65378;
            int64_t segscan_group_sizze_67878;
            
            segscan_group_sizze_67878 =
                *ctx->tuning_params.mainzisegscan_group_sizze_67858;
            
            int64_t num_groups_67879;
            int32_t max_num_groups_78321;
            
            max_num_groups_78321 =
                *ctx->tuning_params.mainzisegscan_num_groups_67860;
            num_groups_67879 = sext_i64_i32(smax64((int64_t) 1,
                                                   smin64(sdiv_up64(nest_sizze_67877,
                                                                    segscan_group_sizze_67878),
                                                          sext_i32_i64(max_num_groups_78321))));
            
            int64_t segmap_group_sizze_67931;
            
            segmap_group_sizze_67931 =
                *ctx->tuning_params.mainzisegmap_group_sizze_67772;
            
            int64_t segmap_group_sizze_67951;
            
            segmap_group_sizze_67951 =
                *ctx->tuning_params.mainzisegmap_group_sizze_67746;
            
            int64_t segmap_group_sizze_67961;
            
            segmap_group_sizze_67961 =
                *ctx->tuning_params.mainzisegmap_group_sizze_67720;
            
            int64_t nest_sizze_67982 = m_65377 * q_65380;
            int64_t segmap_group_sizze_67983;
            
            segmap_group_sizze_67983 =
                *ctx->tuning_params.mainzisegmap_group_sizze_67695;
            
            bool suff_outer_par_68000;
            
            suff_outer_par_68000 = *ctx->tuning_params.mainzisuff_outer_par_1 <=
                binop_x_77011;
            if (ctx->logging)
                fprintf(ctx->log, "Compared %s <= %ld: %s.\n",
                        "main.suff_outer_par_1", (long) binop_x_77011,
                        suff_outer_par_68000 ? "true" : "false");
            
            int64_t segmap_group_sizze_68152;
            
            segmap_group_sizze_68152 =
                *ctx->tuning_params.mainzisegmap_group_sizze_67381;
            
            int64_t nest_sizze_68255 = q_65380 * binop_x_77011;
            int64_t segred_group_sizze_68256;
            
            segred_group_sizze_68256 =
                *ctx->tuning_params.mainzisegred_group_sizze_67336;
            
            int64_t num_groups_68257;
            int32_t max_num_groups_78322;
            
            max_num_groups_78322 =
                *ctx->tuning_params.mainzisegred_num_groups_67338;
            num_groups_68257 = sext_i64_i32(smax64((int64_t) 1,
                                                   smin64(sdiv_up64(nest_sizze_68255,
                                                                    segred_group_sizze_68256),
                                                          sext_i32_i64(max_num_groups_78322))));
            
            int64_t segmap_group_sizze_68295;
            
            segmap_group_sizze_68295 =
                *ctx->tuning_params.mainzisegmap_group_sizze_67323;
            
            int64_t segred_group_sizze_68306;
            
            segred_group_sizze_68306 =
                *ctx->tuning_params.mainzisegred_group_sizze_67268;
            
            int64_t num_groups_68307;
            int32_t max_num_groups_78323;
            
            max_num_groups_78323 =
                *ctx->tuning_params.mainzisegred_num_groups_67270;
            num_groups_68307 = sext_i64_i32(smax64((int64_t) 1,
                                                   smin64(sdiv_up64(nest_sizze_68255,
                                                                    segred_group_sizze_68306),
                                                          sext_i32_i64(max_num_groups_78323))));
            
            int64_t tile_sizze_74787;
            
            tile_sizze_74787 = *ctx->tuning_params.mainzitile_sizze_74786;
            
            int64_t group_sizze_74788 = tile_sizze_74787 * tile_sizze_74787;
            int64_t bytes_77016 = (int64_t) 8 * nest_sizze_67877;
            int64_t binop_y_77019 = (int64_t) 8 * n_65378;
            int64_t bytes_77020 = smax64((int64_t) 0, binop_y_77019);
            int64_t binop_y_77079 = (int64_t) 8 * q_65380;
            int64_t bytes_77080 = smax64((int64_t) 0, binop_y_77079);
            int64_t binop_y_77094 = (int64_t) 8 * n_m_65386;
            int64_t bytes_77095 = smax64((int64_t) 0, binop_y_77094);
            int64_t bytes_77115 = smax64((int64_t) 0, bytes_77016);
            int64_t binop_y_77132 = (int64_t) 8 * m_65377;
            int64_t bytes_77133 = smax64((int64_t) 0, binop_y_77132);
            int64_t binop_y_77146 = (int64_t) 8 * nest_sizze_67982;
            int64_t bytes_77147 = smax64((int64_t) 0, binop_y_77146);
            int64_t bytes_77152 = (int64_t) 8 * group_sizze_74788;
            int64_t bytes_77171 = smax64((int64_t) 0, bytes_77152);
            int64_t binop_x_78043 = (int64_t) 8 * tile_sizze_74787;
            int64_t sizze_78044 = tile_sizze_74787 * binop_x_78043;
            int64_t binop_x_78109 = (int64_t) 8 * tile_sizze_74787;
            int64_t num_bytes_78110 = tile_sizze_74787 * binop_x_78109;
            int64_t maxSubHelper_78163 = umax64(bytes_77020, bytes_77095);
            int64_t maxSubHelper_78169 = umax64(sizze_78044, num_bytes_78110);
            int64_t num_threads_78238 = segmap_group_sizze_66910 *
                    num_groups_66911;
            int64_t total_sizze_78239 = maxSubHelper_78163 * num_threads_78238;
            int64_t total_sizze_78240 = bytes_77080 * num_threads_78238;
            int64_t total_sizze_78241 = bytes_77020 * num_threads_78238;
            int64_t total_sizze_78242 = bytes_77020 * num_threads_78238;
            int64_t total_sizze_78243 = bytes_77020 * num_threads_78238;
            struct memblock_device ext_mem_77230;
            
            ext_mem_77230.references = NULL;
            
            int32_t local_memory_capacity_78678;
            
            local_memory_capacity_78678 = ctx->opencl.max_local_memory;
            if (sle64((int64_t) 0, sext_i32_i64(local_memory_capacity_78678)) &&
                suff_outer_par_66727) {
                struct memblock_device mem_77017;
                
                mem_77017.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77017, bytes_77016,
                                          "mem_77017")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77017,
                                                          (int64_t) 0,
                                                          Y_mem_77010,
                                                          (int64_t) 0,
                                                          (int64_t) 1, n_65378,
                                                          m_65377) != 0) {
                    if (memblock_unref_device(ctx, &mem_77017, "mem_77017") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77230,
                                              "ext_mem_77230") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77014, "mem_77014") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77857,
                                              "ext_mem_77857") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77858,
                                              "ext_mem_77858") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77111;
                
                mem_77111.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77111, binop_y_77012,
                                          "mem_77111")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device color_78164;
                
                color_78164.references = NULL;
                if (memblock_alloc_device(ctx, &color_78164, total_sizze_78239,
                                          "color_78164")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device color_78165;
                
                color_78165.references = NULL;
                if (memblock_alloc_device(ctx, &color_78165, total_sizze_78240,
                                          "color_78165")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device color_78166;
                
                color_78166.references = NULL;
                if (memblock_alloc_device(ctx, &color_78166, total_sizze_78241,
                                          "color_78166")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device color_78167;
                
                color_78167.references = NULL;
                if (memblock_alloc_device(ctx, &color_78167, total_sizze_78242,
                                          "color_78167")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device color_78168;
                
                color_78168.references = NULL;
                if (memblock_alloc_device(ctx, &color_78168, total_sizze_78243,
                                          "color_78168")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        1,
                                                        sizeof(ctx->failure_is_an_option),
                                                        &ctx->failure_is_an_option));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        3, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        4, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        5, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        6, sizeof(jump_65382),
                                                        &jump_65382));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        7, sizeof(n_m_65386),
                                                        &n_m_65386));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        8, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        9, sizeof(x_65393),
                                                        &x_65393));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        10,
                                                        sizeof(min_res_65398),
                                                        &min_res_65398));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        11,
                                                        sizeof(loop_cond_65403),
                                                        &loop_cond_65403));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        12,
                                                        sizeof(i64_res_65404),
                                                        &i64_res_65404));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        13,
                                                        sizeof(num_groups_66911),
                                                        &num_groups_66911));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        14,
                                                        sizeof(num_threads_78238),
                                                        &num_threads_78238));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        15,
                                                        sizeof(mem_77017.mem),
                                                        &mem_77017.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        16,
                                                        sizeof(mem_77111.mem),
                                                        &mem_77111.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        17,
                                                        sizeof(color_78164.mem),
                                                        &color_78164.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        18,
                                                        sizeof(color_78165.mem),
                                                        &color_78165.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        19,
                                                        sizeof(color_78166.mem),
                                                        &color_78166.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        20,
                                                        sizeof(color_78167.mem),
                                                        &color_78167.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_66915,
                                                        21,
                                                        sizeof(color_78168.mem),
                                                        &color_78168.mem));
                if (1 * ((size_t) num_groups_66911 *
                         (size_t) segmap_group_sizze_66910) != 0) {
                    const size_t global_work_sizze_80005[1] =
                                 {(size_t) num_groups_66911 *
                                 (size_t) segmap_group_sizze_66910};
                    const size_t local_work_sizze_80009[1] =
                                 {(size_t) segmap_group_sizze_66910};
                    int64_t time_start_80006 = 0, time_end_80007 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_66915", global_work_sizze_80005[0],
                                local_work_sizze_80009[0], (int) 0);
                        time_start_80006 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_66915,
                                                                    1, NULL,
                                                                    global_work_sizze_80005,
                                                                    local_work_sizze_80009,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_66915_runs,
                                                                                                              &ctx->mainzisegmap_66915_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80007 = get_wall_time();
                        
                        long time_diff_80008 = time_end_80007 -
                             time_start_80006;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_66915", time_diff_80008);
                    }
                }
                ctx->failure_is_an_option = 1;
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                if (memblock_unref_device(ctx, &mem_77017, "mem_77017") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78164, "color_78164") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78165, "color_78165") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78166, "color_78166") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78167, "color_78167") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78168, "color_78168") !=
                    0)
                    return 1;
                
                struct memblock_device mem_77228;
                
                mem_77228.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77228, bytes_77013,
                                          "mem_77228")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77228,
                                                          (int64_t) 0,
                                                          mem_77111,
                                                          (int64_t) 0,
                                                          (int64_t) 1, m_65377,
                                                          n_m_65386) != 0) {
                    if (memblock_unref_device(ctx, &mem_77228, "mem_77228") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78168,
                                              "color_78168") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78167,
                                              "color_78167") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78166,
                                              "color_78166") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78165,
                                              "color_78165") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78164,
                                              "color_78164") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77111, "mem_77111") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77017, "mem_77017") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77230,
                                              "ext_mem_77230") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77014, "mem_77014") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77857,
                                              "ext_mem_77857") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77858,
                                              "ext_mem_77858") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_unref_device(ctx, &mem_77111, "mem_77111") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_77230, &mem_77228,
                                        "mem_77228") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77228, "mem_77228") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78168, "color_78168") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78167, "color_78167") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78166, "color_78166") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78165, "color_78165") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &color_78164, "color_78164") !=
                    0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77111, "mem_77111") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77017, "mem_77017") != 0)
                    return 1;
            } else {
                struct memblock_device mem_77116;
                
                mem_77116.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77116, bytes_77115,
                                          "mem_77116")) {
                    err = 1;
                    goto cleanup;
                }
                if (slt64((int64_t) 0, m_65377 * n_65378)) {
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegScan");
                    
                    int64_t stage1_max_num_groups_78357;
                    
                    stage1_max_num_groups_78357 = ctx->opencl.max_group_size;
                    
                    int64_t stage1_num_groups_78358 =
                            smin64(stage1_max_num_groups_78357,
                                   num_groups_67879);
                    int32_t num_threads_78359 =
                            sext_i64_i32(stage1_num_groups_78358 *
                            segscan_group_sizze_67878);
                    
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_67884,
                                                            1,
                                                            (size_t) smax64((int64_t) 1,
                                                                            (int64_t) 8 *
                                                                            segscan_group_sizze_67878),
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_67884,
                                                            2, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_67884,
                                                            3, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_67884,
                                                            4,
                                                            sizeof(num_threads_78359),
                                                            &num_threads_78359));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_67884,
                                                            5,
                                                            sizeof(Y_mem_77010.mem),
                                                            &Y_mem_77010.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_67884,
                                                            6,
                                                            sizeof(mem_77116.mem),
                                                            &mem_77116.mem));
                    if (1 * ((size_t) stage1_num_groups_78358 *
                             (size_t) segscan_group_sizze_67878) != 0) {
                        const size_t global_work_sizze_80010[1] =
                                     {(size_t) stage1_num_groups_78358 *
                                     (size_t) segscan_group_sizze_67878};
                        const size_t local_work_sizze_80014[1] =
                                     {(size_t) segscan_group_sizze_67878};
                        int64_t time_start_80011 = 0, time_end_80012 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage1_67884",
                                    global_work_sizze_80010[0],
                                    local_work_sizze_80014[0], (int) (0 +
                                                                      smax64((int64_t) 1,
                                                                             (int64_t) 8 *
                                                                             segscan_group_sizze_67878)));
                            time_start_80011 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage1_67884,
                                                                        1, NULL,
                                                                        global_work_sizze_80010,
                                                                        local_work_sizze_80014,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage1_67884_runs,
                                                                                                                  &ctx->mainziscan_stage1_67884_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80012 = get_wall_time();
                            
                            long time_diff_80013 = time_end_80012 -
                                 time_start_80011;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage1_67884", time_diff_80013);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c", "elems_per_group",
                                (long long) (segscan_group_sizze_67878 *
                                             sdiv_up64(m_65377 * n_65378,
                                                       sext_i32_i64(num_threads_78359))),
                                '\n');
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_67884,
                                                            1,
                                                            (size_t) smax64((int64_t) 1,
                                                                            (int64_t) 8 *
                                                                            stage1_num_groups_78358),
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_67884,
                                                            2, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_67884,
                                                            3, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_67884,
                                                            4,
                                                            sizeof(stage1_num_groups_78358),
                                                            &stage1_num_groups_78358));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_67884,
                                                            5,
                                                            sizeof(num_threads_78359),
                                                            &num_threads_78359));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_67884,
                                                            6,
                                                            sizeof(mem_77116.mem),
                                                            &mem_77116.mem));
                    if (1 * ((size_t) (int64_t) 1 *
                             (size_t) stage1_num_groups_78358) != 0) {
                        const size_t global_work_sizze_80015[1] =
                                     {(size_t) (int64_t) 1 *
                                     (size_t) stage1_num_groups_78358};
                        const size_t local_work_sizze_80019[1] =
                                     {(size_t) stage1_num_groups_78358};
                        int64_t time_start_80016 = 0, time_end_80017 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage2_67884",
                                    global_work_sizze_80015[0],
                                    local_work_sizze_80019[0], (int) (0 +
                                                                      smax64((int64_t) 1,
                                                                             (int64_t) 8 *
                                                                             stage1_num_groups_78358)));
                            time_start_80016 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage2_67884,
                                                                        1, NULL,
                                                                        global_work_sizze_80015,
                                                                        local_work_sizze_80019,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage2_67884_runs,
                                                                                                                  &ctx->mainziscan_stage2_67884_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80017 = get_wall_time();
                            
                            long time_diff_80018 = time_end_80017 -
                                 time_start_80016;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage2_67884", time_diff_80018);
                        }
                    }
                    
                    int32_t required_groups_78410 =
                            sext_i64_i32(sdiv_up64(m_65377 * n_65378,
                                                   segscan_group_sizze_67878));
                    
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_67884,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_67884,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_67884,
                                                            3,
                                                            sizeof(num_groups_67879),
                                                            &num_groups_67879));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_67884,
                                                            4,
                                                            sizeof(num_threads_78359),
                                                            &num_threads_78359));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_67884,
                                                            5,
                                                            sizeof(required_groups_78410),
                                                            &required_groups_78410));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_67884,
                                                            6,
                                                            sizeof(mem_77116.mem),
                                                            &mem_77116.mem));
                    if (1 * ((size_t) num_groups_67879 *
                             (size_t) segscan_group_sizze_67878) != 0) {
                        const size_t global_work_sizze_80020[1] =
                                     {(size_t) num_groups_67879 *
                                     (size_t) segscan_group_sizze_67878};
                        const size_t local_work_sizze_80024[1] =
                                     {(size_t) segscan_group_sizze_67878};
                        int64_t time_start_80021 = 0, time_end_80022 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage3_67884",
                                    global_work_sizze_80020[0],
                                    local_work_sizze_80024[0], (int) 0);
                            time_start_80021 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage3_67884,
                                                                        1, NULL,
                                                                        global_work_sizze_80020,
                                                                        local_work_sizze_80024,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage3_67884_runs,
                                                                                                                  &ctx->mainziscan_stage3_67884_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80022 = get_wall_time();
                            
                            long time_diff_80023 = time_end_80022 -
                                 time_start_80021;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage3_67884", time_diff_80023);
                        }
                    }
                }
                
                struct memblock_device mem_77120;
                
                mem_77120.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77120, bytes_77115,
                                          "mem_77120")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhreplicate_f64(ctx, mem_77120, m_65377 *
                                                  n_65378, 0.0) != 0) {
                    if (memblock_unref_device(ctx, &mem_77120, "mem_77120") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77116, "mem_77116") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77230,
                                              "ext_mem_77230") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77014, "mem_77014") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77857,
                                              "ext_mem_77857") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77858,
                                              "ext_mem_77858") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77124;
                
                mem_77124.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77124, bytes_77115,
                                          "mem_77124")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhreplicate_i64(ctx, mem_77124, m_65377 *
                                                  n_65378, (int64_t) -1) != 0) {
                    if (memblock_unref_device(ctx, &mem_77124, "mem_77124") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77120, "mem_77120") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77116, "mem_77116") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77230,
                                              "ext_mem_77230") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77014, "mem_77014") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77857,
                                              "ext_mem_77857") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77858,
                                              "ext_mem_77858") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                int64_t segmap_usable_groups_67932 = sdiv_up64(nest_sizze_67877,
                                                               segmap_group_sizze_67931);
                
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67937,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67937,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67937,
                                                        3,
                                                        sizeof(Y_mem_77010.mem),
                                                        &Y_mem_77010.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67937,
                                                        4,
                                                        sizeof(mem_77116.mem),
                                                        &mem_77116.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67937,
                                                        5,
                                                        sizeof(mem_77120.mem),
                                                        &mem_77120.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67937,
                                                        6,
                                                        sizeof(mem_77124.mem),
                                                        &mem_77124.mem));
                if (1 * ((size_t) segmap_usable_groups_67932 *
                         (size_t) segmap_group_sizze_67931) != 0) {
                    const size_t global_work_sizze_80025[1] =
                                 {(size_t) segmap_usable_groups_67932 *
                                 (size_t) segmap_group_sizze_67931};
                    const size_t local_work_sizze_80029[1] =
                                 {(size_t) segmap_group_sizze_67931};
                    int64_t time_start_80026 = 0, time_end_80027 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_67937", global_work_sizze_80025[0],
                                local_work_sizze_80029[0], (int) 0);
                        time_start_80026 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_67937,
                                                                    1, NULL,
                                                                    global_work_sizze_80025,
                                                                    local_work_sizze_80029,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_67937_runs,
                                                                                                              &ctx->mainzisegmap_67937_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80027 = get_wall_time();
                        
                        long time_diff_80028 = time_end_80027 -
                             time_start_80026;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_67937", time_diff_80028);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_usable_groups_67952 = sdiv_up64(nest_sizze_67877,
                                                               segmap_group_sizze_67951);
                struct memblock_device mem_77130;
                
                mem_77130.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77130, bytes_77115,
                                          "mem_77130")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67956,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67956,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67956,
                                                        3,
                                                        sizeof(mem_77124.mem),
                                                        &mem_77124.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67956,
                                                        4,
                                                        sizeof(mem_77130.mem),
                                                        &mem_77130.mem));
                if (1 * ((size_t) segmap_usable_groups_67952 *
                         (size_t) segmap_group_sizze_67951) != 0) {
                    const size_t global_work_sizze_80030[1] =
                                 {(size_t) segmap_usable_groups_67952 *
                                 (size_t) segmap_group_sizze_67951};
                    const size_t local_work_sizze_80034[1] =
                                 {(size_t) segmap_group_sizze_67951};
                    int64_t time_start_80031 = 0, time_end_80032 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_67956", global_work_sizze_80030[0],
                                local_work_sizze_80034[0], (int) 0);
                        time_start_80031 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_67956,
                                                                    1, NULL,
                                                                    global_work_sizze_80030,
                                                                    local_work_sizze_80034,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_67956_runs,
                                                                                                              &ctx->mainzisegmap_67956_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80032 = get_wall_time();
                        
                        long time_diff_80033 = time_end_80032 -
                             time_start_80031;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_67956", time_diff_80033);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_usable_groups_67962 = sdiv_up64(m_65377,
                                                               segmap_group_sizze_67961);
                struct memblock_device mem_77134;
                
                mem_77134.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77134, bytes_77133,
                                          "mem_77134")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77137;
                
                mem_77137.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77137, bytes_77133,
                                          "mem_77137")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77140;
                
                mem_77140.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77140, bytes_77133,
                                          "mem_77140")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77143;
                
                mem_77143.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77143, bytes_77133,
                                          "mem_77143")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        3, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        4, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        5,
                                                        sizeof(min_res_65398),
                                                        &min_res_65398));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        6,
                                                        sizeof(i64_res_65404),
                                                        &i64_res_65404));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        7,
                                                        sizeof(mem_77116.mem),
                                                        &mem_77116.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        8,
                                                        sizeof(mem_77134.mem),
                                                        &mem_77134.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        9,
                                                        sizeof(mem_77137.mem),
                                                        &mem_77137.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        10,
                                                        sizeof(mem_77140.mem),
                                                        &mem_77140.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67968,
                                                        11,
                                                        sizeof(mem_77143.mem),
                                                        &mem_77143.mem));
                if (1 * ((size_t) segmap_usable_groups_67962 *
                         (size_t) segmap_group_sizze_67961) != 0) {
                    const size_t global_work_sizze_80035[1] =
                                 {(size_t) segmap_usable_groups_67962 *
                                 (size_t) segmap_group_sizze_67961};
                    const size_t local_work_sizze_80039[1] =
                                 {(size_t) segmap_group_sizze_67961};
                    int64_t time_start_80036 = 0, time_end_80037 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_67968", global_work_sizze_80035[0],
                                local_work_sizze_80039[0], (int) 0);
                        time_start_80036 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_67968,
                                                                    1, NULL,
                                                                    global_work_sizze_80035,
                                                                    local_work_sizze_80039,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_67968_runs,
                                                                                                              &ctx->mainzisegmap_67968_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80037 = get_wall_time();
                        
                        long time_diff_80038 = time_end_80037 -
                             time_start_80036;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_67968", time_diff_80038);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_usable_groups_67984 = sdiv_up64(nest_sizze_67982,
                                                               segmap_group_sizze_67983);
                struct memblock_device mem_77148;
                
                mem_77148.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77148, bytes_77147,
                                          "mem_77148")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67988,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67988,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67988,
                                                        3, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67988,
                                                        4, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67988,
                                                        5,
                                                        sizeof(mem_77116.mem),
                                                        &mem_77116.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_67988,
                                                        6,
                                                        sizeof(mem_77148.mem),
                                                        &mem_77148.mem));
                if (1 * ((size_t) segmap_usable_groups_67984 *
                         (size_t) segmap_group_sizze_67983) != 0) {
                    const size_t global_work_sizze_80040[1] =
                                 {(size_t) segmap_usable_groups_67984 *
                                 (size_t) segmap_group_sizze_67983};
                    const size_t local_work_sizze_80044[1] =
                                 {(size_t) segmap_group_sizze_67983};
                    int64_t time_start_80041 = 0, time_end_80042 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_67988", global_work_sizze_80040[0],
                                local_work_sizze_80044[0], (int) 0);
                        time_start_80041 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_67988,
                                                                    1, NULL,
                                                                    global_work_sizze_80040,
                                                                    local_work_sizze_80044,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_67988_runs,
                                                                                                              &ctx->mainzisegmap_67988_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80042 = get_wall_time();
                        
                        long time_diff_80043 = time_end_80042 -
                             time_start_80041;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_67988", time_diff_80043);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                struct memblock_device ext_mem_77224;
                
                ext_mem_77224.references = NULL;
                
                int32_t local_memory_capacity_78677;
                
                local_memory_capacity_78677 = ctx->opencl.max_local_memory;
                if (sle64(bytes_77171 + srem64((int64_t) 8 - srem64(bytes_77171,
                                                                    (int64_t) 8),
                                               (int64_t) 8),
                          sext_i32_i64(local_memory_capacity_78677)) &&
                    suff_outer_par_68000) {
                    int64_t num_groups_x_74789 = sdiv_up64(m_65377,
                                                           tile_sizze_74787);
                    int64_t num_groups_y_74790 = sdiv_up64(n_m_65386,
                                                           tile_sizze_74787);
                    int64_t num_groups_top_74791 = num_groups_x_74789 *
                            num_groups_y_74790;
                    int64_t num_whole_tiles_74922 = squot64(q_65380,
                                                            tile_sizze_74787);
                    int64_t residual_input_75118 = srem64(q_65380,
                                                          tile_sizze_74787);
                    bool cond_75119 = residual_input_75118 == (int64_t) 0;
                    struct memblock_device mem_77195;
                    
                    mem_77195.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77195, bytes_77013,
                                              "mem_77195")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            1,
                                                            sizeof(ctx->failure_is_an_option),
                                                            &ctx->failure_is_an_option));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            3,
                                                            (size_t) bytes_77171,
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            4, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            5, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            6, sizeof(q_65380),
                                                            &q_65380));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            7,
                                                            sizeof(jump_65382),
                                                            &jump_65382));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            8,
                                                            sizeof(n_m_65386),
                                                            &n_m_65386));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            9, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            10, sizeof(x_65393),
                                                            &x_65393));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            11,
                                                            sizeof(min_res_65398),
                                                            &min_res_65398));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            12,
                                                            sizeof(loop_cond_65403),
                                                            &loop_cond_65403));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            13,
                                                            sizeof(num_groups_x_74789),
                                                            &num_groups_x_74789));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            14,
                                                            sizeof(num_groups_y_74790),
                                                            &num_groups_y_74790));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            15,
                                                            sizeof(num_whole_tiles_74922),
                                                            &num_whole_tiles_74922));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            16,
                                                            sizeof(residual_input_75118),
                                                            &residual_input_75118));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            17,
                                                            sizeof(cond_75119),
                                                            &cond_75119));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            18,
                                                            sizeof(mem_77116.mem),
                                                            &mem_77116.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            19,
                                                            sizeof(mem_77120.mem),
                                                            &mem_77120.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            20,
                                                            sizeof(mem_77124.mem),
                                                            &mem_77124.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            21,
                                                            sizeof(mem_77130.mem),
                                                            &mem_77130.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            22,
                                                            sizeof(mem_77134.mem),
                                                            &mem_77134.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            23,
                                                            sizeof(mem_77137.mem),
                                                            &mem_77137.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            24,
                                                            sizeof(mem_77140.mem),
                                                            &mem_77140.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            25,
                                                            sizeof(mem_77143.mem),
                                                            &mem_77143.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            26,
                                                            sizeof(mem_77148.mem),
                                                            &mem_77148.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74792,
                                                            27,
                                                            sizeof(mem_77195.mem),
                                                            &mem_77195.mem));
                    if (1 * ((size_t) num_groups_top_74791 *
                             (size_t) group_sizze_74788) != 0) {
                        const size_t global_work_sizze_80045[1] =
                                     {(size_t) num_groups_top_74791 *
                                     (size_t) group_sizze_74788};
                        const size_t local_work_sizze_80049[1] =
                                     {(size_t) group_sizze_74788};
                        int64_t time_start_80046 = 0, time_end_80047 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_intragroup_74792",
                                    global_work_sizze_80045[0],
                                    local_work_sizze_80049[0], (int) (0 +
                                                                      bytes_77171));
                            time_start_80046 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_intragroup_74792,
                                                                        1, NULL,
                                                                        global_work_sizze_80045,
                                                                        local_work_sizze_80049,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_intragroup_74792_runs,
                                                                                                                  &ctx->mainzisegmap_intragroup_74792_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80047 = get_wall_time();
                            
                            long time_diff_80048 = time_end_80047 -
                                 time_start_80046;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_intragroup_74792",
                                    time_diff_80048);
                        }
                    }
                    ctx->failure_is_an_option = 1;
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    if (memblock_set_device(ctx, &ext_mem_77224, &mem_77195,
                                            "mem_77195") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77195, "mem_77195") !=
                        0)
                        return 1;
                } else {
                    int64_t segmap_usable_groups_68153 =
                            sdiv_up64(binop_x_77011, segmap_group_sizze_68152);
                    struct memblock_device mem_77200;
                    
                    mem_77200.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77200, bytes_77013,
                                              "mem_77200")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77204;
                    
                    mem_77204.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77204, bytes_77013,
                                              "mem_77204")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77208;
                    
                    mem_77208.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77208, bytes_77013,
                                              "mem_77208")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            1,
                                                            sizeof(ctx->failure_is_an_option),
                                                            &ctx->failure_is_an_option));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            3, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            4, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            5,
                                                            sizeof(jump_65382),
                                                            &jump_65382));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            6,
                                                            sizeof(n_m_65386),
                                                            &n_m_65386));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            7, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            8, sizeof(x_65393),
                                                            &x_65393));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            9,
                                                            sizeof(min_res_65398),
                                                            &min_res_65398));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            10,
                                                            sizeof(loop_cond_65403),
                                                            &loop_cond_65403));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            11,
                                                            sizeof(mem_77124.mem),
                                                            &mem_77124.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            12,
                                                            sizeof(mem_77130.mem),
                                                            &mem_77130.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            13,
                                                            sizeof(mem_77134.mem),
                                                            &mem_77134.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            14,
                                                            sizeof(mem_77137.mem),
                                                            &mem_77137.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            15,
                                                            sizeof(mem_77140.mem),
                                                            &mem_77140.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            16,
                                                            sizeof(mem_77143.mem),
                                                            &mem_77143.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            17,
                                                            sizeof(mem_77200.mem),
                                                            &mem_77200.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            18,
                                                            sizeof(mem_77204.mem),
                                                            &mem_77204.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68159,
                                                            19,
                                                            sizeof(mem_77208.mem),
                                                            &mem_77208.mem));
                    if (1 * ((size_t) segmap_usable_groups_68153 *
                             (size_t) segmap_group_sizze_68152) != 0) {
                        const size_t global_work_sizze_80050[1] =
                                     {(size_t) segmap_usable_groups_68153 *
                                     (size_t) segmap_group_sizze_68152};
                        const size_t local_work_sizze_80054[1] =
                                     {(size_t) segmap_group_sizze_68152};
                        int64_t time_start_80051 = 0, time_end_80052 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_68159",
                                    global_work_sizze_80050[0],
                                    local_work_sizze_80054[0], (int) 0);
                            time_start_80051 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_68159,
                                                                        1, NULL,
                                                                        global_work_sizze_80050,
                                                                        local_work_sizze_80054,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_68159_runs,
                                                                                                                  &ctx->mainzisegmap_68159_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80052 = get_wall_time();
                            
                            long time_diff_80053 = time_end_80052 -
                                 time_start_80051;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_68159", time_diff_80053);
                        }
                    }
                    ctx->failure_is_an_option = 1;
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    if (memblock_unref_device(ctx, &mem_77200, "mem_77200") !=
                        0)
                        return 1;
                    
                    struct memblock_device mem_77213;
                    
                    mem_77213.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77213, bytes_77013,
                                              "mem_77213")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (slt64(q_65380 * (int64_t) 2,
                              segred_group_sizze_68256)) {
                        int64_t segment_sizze_nonzzero_78523 =
                                smax64((int64_t) 1, q_65380);
                        int64_t num_threads_78524 = num_groups_68257 *
                                segred_group_sizze_68256;
                        
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegRed-small");
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                    (long long) (m_65377 * n_m_65386), '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                    (long long) q_65380, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "segments_per_group",
                                    (long long) squot64(segred_group_sizze_68256,
                                                        segment_sizze_nonzzero_78523),
                                    '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "required_groups",
                                    (long long) sext_i64_i32(sdiv_up64(m_65377 *
                                                                       n_m_65386,
                                                                       squot64(segred_group_sizze_68256,
                                                                               segment_sizze_nonzzero_78523))),
                                    '\n');
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                1,
                                                                (size_t) ((int64_t) 8 *
                                                                          segred_group_sizze_68256),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                2,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                3,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                4,
                                                                sizeof(q_65380),
                                                                &q_65380));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                5,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                6,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                7,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                8,
                                                                sizeof(num_groups_68257),
                                                                &num_groups_68257));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                9,
                                                                sizeof(segment_sizze_nonzzero_78523),
                                                                &segment_sizze_nonzzero_78523));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                10,
                                                                sizeof(mem_77116.mem),
                                                                &mem_77116.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                11,
                                                                sizeof(mem_77124.mem),
                                                                &mem_77124.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                12,
                                                                sizeof(mem_77148.mem),
                                                                &mem_77148.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                13,
                                                                sizeof(mem_77204.mem),
                                                                &mem_77204.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                14,
                                                                sizeof(mem_77208.mem),
                                                                &mem_77208.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68263,
                                                                15,
                                                                sizeof(mem_77213.mem),
                                                                &mem_77213.mem));
                        if (1 * ((size_t) num_groups_68257 *
                                 (size_t) segred_group_sizze_68256) != 0) {
                            const size_t global_work_sizze_80055[1] =
                                         {(size_t) num_groups_68257 *
                                         (size_t) segred_group_sizze_68256};
                            const size_t local_work_sizze_80059[1] =
                                         {(size_t) segred_group_sizze_68256};
                            int64_t time_start_80056 = 0, time_end_80057 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segred_small_68263",
                                        global_work_sizze_80055[0],
                                        local_work_sizze_80059[0], (int) (0 +
                                                                          (int64_t) 8 *
                                                                          segred_group_sizze_68256));
                                time_start_80056 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegred_small_68263,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80055,
                                                                            local_work_sizze_80059,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegred_small_68263_runs,
                                                                                                                      &ctx->mainzisegred_small_68263_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80057 = get_wall_time();
                                
                                long time_diff_80058 = time_end_80057 -
                                     time_start_80056;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segred_small_68263",
                                        time_diff_80058);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                    } else {
                        int64_t groups_per_segment_78552 =
                                sdiv_up64(num_groups_68257, smax64((int64_t) 1,
                                                                   m_65377 *
                                                                   n_m_65386));
                        int64_t elements_per_thread_78553 = sdiv_up64(q_65380,
                                                                      segred_group_sizze_68256 *
                                                                      groups_per_segment_78552);
                        int64_t virt_num_groups_78554 =
                                groups_per_segment_78552 * (m_65377 *
                                                            n_m_65386);
                        int64_t num_threads_78555 = num_groups_68257 *
                                segred_group_sizze_68256;
                        int64_t threads_per_segment_78556 =
                                groups_per_segment_78552 *
                                segred_group_sizze_68256;
                        
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegRed-large");
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                    (long long) (m_65377 * n_m_65386), '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                    (long long) q_65380, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "virt_num_groups",
                                    (long long) virt_num_groups_78554, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "num_groups",
                                    (long long) num_groups_68257, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "group_size",
                                    (long long) segred_group_sizze_68256, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "elems_per_thread",
                                    (long long) elements_per_thread_78553,
                                    '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "groups_per_segment",
                                    (long long) groups_per_segment_78552, '\n');
                        
                        struct memblock_device segred_tmp_mem_78557;
                        
                        segred_tmp_mem_78557.references = NULL;
                        if (memblock_alloc_device(ctx, &segred_tmp_mem_78557,
                                                  (int64_t) 8 *
                                                  virt_num_groups_78554,
                                                  "segred_tmp_mem_78557")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mainzicounter_mem_78559 =
                                               ctx->mainzicounter_mem_78559;
                        
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                1, (size_t) 1,
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                2,
                                                                (size_t) ((int64_t) 8 *
                                                                          segred_group_sizze_68256),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                3,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                4,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                5,
                                                                sizeof(q_65380),
                                                                &q_65380));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                6,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                7,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                8,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                9,
                                                                sizeof(num_groups_68257),
                                                                &num_groups_68257));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                10,
                                                                sizeof(groups_per_segment_78552),
                                                                &groups_per_segment_78552));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                11,
                                                                sizeof(elements_per_thread_78553),
                                                                &elements_per_thread_78553));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                12,
                                                                sizeof(virt_num_groups_78554),
                                                                &virt_num_groups_78554));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                13,
                                                                sizeof(threads_per_segment_78556),
                                                                &threads_per_segment_78556));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                14,
                                                                sizeof(mem_77116.mem),
                                                                &mem_77116.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                15,
                                                                sizeof(mem_77124.mem),
                                                                &mem_77124.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                16,
                                                                sizeof(mem_77148.mem),
                                                                &mem_77148.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                17,
                                                                sizeof(mem_77204.mem),
                                                                &mem_77204.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                18,
                                                                sizeof(mem_77208.mem),
                                                                &mem_77208.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                19,
                                                                sizeof(mem_77213.mem),
                                                                &mem_77213.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                20,
                                                                sizeof(segred_tmp_mem_78557.mem),
                                                                &segred_tmp_mem_78557.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68263,
                                                                21,
                                                                sizeof(mainzicounter_mem_78559.mem),
                                                                &mainzicounter_mem_78559.mem));
                        if (1 * ((size_t) num_groups_68257 *
                                 (size_t) segred_group_sizze_68256) != 0) {
                            const size_t global_work_sizze_80061[1] =
                                         {(size_t) num_groups_68257 *
                                         (size_t) segred_group_sizze_68256};
                            const size_t local_work_sizze_80065[1] =
                                         {(size_t) segred_group_sizze_68256};
                            int64_t time_start_80062 = 0, time_end_80063 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segred_large_68263",
                                        global_work_sizze_80061[0],
                                        local_work_sizze_80065[0], (int) (0 +
                                                                          1 +
                                                                          (int64_t) 8 *
                                                                          segred_group_sizze_68256));
                                time_start_80062 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegred_large_68263,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80061,
                                                                            local_work_sizze_80065,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegred_large_68263_runs,
                                                                                                                      &ctx->mainzisegred_large_68263_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80063 = get_wall_time();
                                
                                long time_diff_80064 = time_end_80063 -
                                     time_start_80062;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segred_large_68263",
                                        time_diff_80064);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &segred_tmp_mem_78557,
                                                  "segred_tmp_mem_78557") != 0)
                            return 1;
                    }
                    
                    int64_t segmap_usable_groups_68296 =
                            sdiv_up64(binop_x_77011, segmap_group_sizze_68295);
                    struct memblock_device mem_77218;
                    
                    mem_77218.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77218, bytes_77013,
                                              "mem_77218")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68300,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68300,
                                                            2,
                                                            sizeof(n_m_65386),
                                                            &n_m_65386));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68300,
                                                            3,
                                                            sizeof(mem_77213.mem),
                                                            &mem_77213.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68300,
                                                            4,
                                                            sizeof(mem_77218.mem),
                                                            &mem_77218.mem));
                    if (1 * ((size_t) segmap_usable_groups_68296 *
                             (size_t) segmap_group_sizze_68295) != 0) {
                        const size_t global_work_sizze_80066[1] =
                                     {(size_t) segmap_usable_groups_68296 *
                                     (size_t) segmap_group_sizze_68295};
                        const size_t local_work_sizze_80070[1] =
                                     {(size_t) segmap_group_sizze_68295};
                        int64_t time_start_80067 = 0, time_end_80068 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_68300",
                                    global_work_sizze_80066[0],
                                    local_work_sizze_80070[0], (int) 0);
                            time_start_80067 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_68300,
                                                                        1, NULL,
                                                                        global_work_sizze_80066,
                                                                        local_work_sizze_80070,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_68300_runs,
                                                                                                                  &ctx->mainzisegmap_68300_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80068 = get_wall_time();
                            
                            long time_diff_80069 = time_end_80068 -
                                 time_start_80067;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_68300", time_diff_80069);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    if (memblock_unref_device(ctx, &mem_77213, "mem_77213") !=
                        0)
                        return 1;
                    
                    struct memblock_device mem_77223;
                    
                    mem_77223.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77223, bytes_77013,
                                              "mem_77223")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (slt64(q_65380 * (int64_t) 2,
                              segred_group_sizze_68306)) {
                        int64_t segment_sizze_nonzzero_78605 =
                                smax64((int64_t) 1, q_65380);
                        int64_t num_threads_78606 = num_groups_68307 *
                                segred_group_sizze_68306;
                        
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegRed-small");
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                    (long long) (m_65377 * n_m_65386), '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                    (long long) q_65380, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "segments_per_group",
                                    (long long) squot64(segred_group_sizze_68306,
                                                        segment_sizze_nonzzero_78605),
                                    '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "required_groups",
                                    (long long) sext_i64_i32(sdiv_up64(m_65377 *
                                                                       n_m_65386,
                                                                       squot64(segred_group_sizze_68306,
                                                                               segment_sizze_nonzzero_78605))),
                                    '\n');
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                1,
                                                                (size_t) ((int64_t) 8 *
                                                                          segred_group_sizze_68306),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                2,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                3,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                4,
                                                                sizeof(q_65380),
                                                                &q_65380));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                5,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                6,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                7,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                8,
                                                                sizeof(num_groups_68307),
                                                                &num_groups_68307));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                9,
                                                                sizeof(segment_sizze_nonzzero_78605),
                                                                &segment_sizze_nonzzero_78605));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                10,
                                                                sizeof(mem_77116.mem),
                                                                &mem_77116.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                11,
                                                                sizeof(mem_77120.mem),
                                                                &mem_77120.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                12,
                                                                sizeof(mem_77124.mem),
                                                                &mem_77124.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                13,
                                                                sizeof(mem_77148.mem),
                                                                &mem_77148.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                14,
                                                                sizeof(mem_77204.mem),
                                                                &mem_77204.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                15,
                                                                sizeof(mem_77208.mem),
                                                                &mem_77208.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                16,
                                                                sizeof(mem_77218.mem),
                                                                &mem_77218.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_68313,
                                                                17,
                                                                sizeof(mem_77223.mem),
                                                                &mem_77223.mem));
                        if (1 * ((size_t) num_groups_68307 *
                                 (size_t) segred_group_sizze_68306) != 0) {
                            const size_t global_work_sizze_80071[1] =
                                         {(size_t) num_groups_68307 *
                                         (size_t) segred_group_sizze_68306};
                            const size_t local_work_sizze_80075[1] =
                                         {(size_t) segred_group_sizze_68306};
                            int64_t time_start_80072 = 0, time_end_80073 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segred_small_68313",
                                        global_work_sizze_80071[0],
                                        local_work_sizze_80075[0], (int) (0 +
                                                                          (int64_t) 8 *
                                                                          segred_group_sizze_68306));
                                time_start_80072 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegred_small_68313,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80071,
                                                                            local_work_sizze_80075,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegred_small_68313_runs,
                                                                                                                      &ctx->mainzisegred_small_68313_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80073 = get_wall_time();
                                
                                long time_diff_80074 = time_end_80073 -
                                     time_start_80072;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segred_small_68313",
                                        time_diff_80074);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                    } else {
                        int64_t groups_per_segment_78634 =
                                sdiv_up64(num_groups_68307, smax64((int64_t) 1,
                                                                   m_65377 *
                                                                   n_m_65386));
                        int64_t elements_per_thread_78635 = sdiv_up64(q_65380,
                                                                      segred_group_sizze_68306 *
                                                                      groups_per_segment_78634);
                        int64_t virt_num_groups_78636 =
                                groups_per_segment_78634 * (m_65377 *
                                                            n_m_65386);
                        int64_t num_threads_78637 = num_groups_68307 *
                                segred_group_sizze_68306;
                        int64_t threads_per_segment_78638 =
                                groups_per_segment_78634 *
                                segred_group_sizze_68306;
                        
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegRed-large");
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                    (long long) (m_65377 * n_m_65386), '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                    (long long) q_65380, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "virt_num_groups",
                                    (long long) virt_num_groups_78636, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "num_groups",
                                    (long long) num_groups_68307, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "group_size",
                                    (long long) segred_group_sizze_68306, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "elems_per_thread",
                                    (long long) elements_per_thread_78635,
                                    '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "groups_per_segment",
                                    (long long) groups_per_segment_78634, '\n');
                        
                        struct memblock_device segred_tmp_mem_78639;
                        
                        segred_tmp_mem_78639.references = NULL;
                        if (memblock_alloc_device(ctx, &segred_tmp_mem_78639,
                                                  (int64_t) 8 *
                                                  virt_num_groups_78636,
                                                  "segred_tmp_mem_78639")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mainzicounter_mem_78641 =
                                               ctx->mainzicounter_mem_78641;
                        
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                1, (size_t) 1,
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                2,
                                                                (size_t) ((int64_t) 8 *
                                                                          segred_group_sizze_68306),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                3,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                4,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                5,
                                                                sizeof(q_65380),
                                                                &q_65380));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                6,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                7,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                8,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                9,
                                                                sizeof(num_groups_68307),
                                                                &num_groups_68307));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                10,
                                                                sizeof(groups_per_segment_78634),
                                                                &groups_per_segment_78634));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                11,
                                                                sizeof(elements_per_thread_78635),
                                                                &elements_per_thread_78635));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                12,
                                                                sizeof(virt_num_groups_78636),
                                                                &virt_num_groups_78636));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                13,
                                                                sizeof(threads_per_segment_78638),
                                                                &threads_per_segment_78638));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                14,
                                                                sizeof(mem_77116.mem),
                                                                &mem_77116.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                15,
                                                                sizeof(mem_77120.mem),
                                                                &mem_77120.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                16,
                                                                sizeof(mem_77124.mem),
                                                                &mem_77124.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                17,
                                                                sizeof(mem_77148.mem),
                                                                &mem_77148.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                18,
                                                                sizeof(mem_77204.mem),
                                                                &mem_77204.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                19,
                                                                sizeof(mem_77208.mem),
                                                                &mem_77208.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                20,
                                                                sizeof(mem_77218.mem),
                                                                &mem_77218.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                21,
                                                                sizeof(mem_77223.mem),
                                                                &mem_77223.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                22,
                                                                sizeof(segred_tmp_mem_78639.mem),
                                                                &segred_tmp_mem_78639.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_68313,
                                                                23,
                                                                sizeof(mainzicounter_mem_78641.mem),
                                                                &mainzicounter_mem_78641.mem));
                        if (1 * ((size_t) num_groups_68307 *
                                 (size_t) segred_group_sizze_68306) != 0) {
                            const size_t global_work_sizze_80077[1] =
                                         {(size_t) num_groups_68307 *
                                         (size_t) segred_group_sizze_68306};
                            const size_t local_work_sizze_80081[1] =
                                         {(size_t) segred_group_sizze_68306};
                            int64_t time_start_80078 = 0, time_end_80079 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segred_large_68313",
                                        global_work_sizze_80077[0],
                                        local_work_sizze_80081[0], (int) (0 +
                                                                          1 +
                                                                          (int64_t) 8 *
                                                                          segred_group_sizze_68306));
                                time_start_80078 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegred_large_68313,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80077,
                                                                            local_work_sizze_80081,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegred_large_68313_runs,
                                                                                                                      &ctx->mainzisegred_large_68313_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80079 = get_wall_time();
                                
                                long time_diff_80080 = time_end_80079 -
                                     time_start_80078;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segred_large_68313",
                                        time_diff_80080);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &segred_tmp_mem_78639,
                                                  "segred_tmp_mem_78639") != 0)
                            return 1;
                    }
                    if (memblock_unref_device(ctx, &mem_77204, "mem_77204") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77208, "mem_77208") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77218, "mem_77218") !=
                        0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77224, &mem_77223,
                                            "mem_77223") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77223, "mem_77223") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77218, "mem_77218") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77213, "mem_77213") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77208, "mem_77208") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77204, "mem_77204") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77200, "mem_77200") !=
                        0)
                        return 1;
                }
                if (memblock_unref_device(ctx, &mem_77116, "mem_77116") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77120, "mem_77120") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77124, "mem_77124") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77130, "mem_77130") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77134, "mem_77134") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77137, "mem_77137") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77140, "mem_77140") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77143, "mem_77143") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77148, "mem_77148") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_77230, &ext_mem_77224,
                                        "ext_mem_77224") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_77224,
                                          "ext_mem_77224") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77148, "mem_77148") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77143, "mem_77143") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77140, "mem_77140") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77137, "mem_77137") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77134, "mem_77134") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77130, "mem_77130") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77124, "mem_77124") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77120, "mem_77120") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77116, "mem_77116") != 0)
                    return 1;
            }
            if (memblock_set_device(ctx, &ext_mem_77858, &ext_mem_77230,
                                    "ext_mem_77230") != 0)
                return 1;
            if (memblock_set_device(ctx, &ext_mem_77857, &mem_77014,
                                    "mem_77014") != 0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_77230, "ext_mem_77230") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77014, "mem_77014") != 0)
                return 1;
        } else {
            bool match_lit_65591 = (int64_t) 1 == degree_65381;
            struct memblock_device ext_mem_77856;
            
            ext_mem_77856.references = NULL;
            
            struct memblock_device ext_mem_77855;
            
            ext_mem_77855.references = NULL;
            if (match_lit_65591) {
                bool suff_outer_par_68354;
                
                suff_outer_par_68354 =
                    *ctx->tuning_params.mainzisuff_outer_par_2 <= m_65377;
                if (ctx->logging)
                    fprintf(ctx->log, "Compared %s <= %ld: %s.\n",
                            "main.suff_outer_par_2", (long) m_65377,
                            suff_outer_par_68354 ? "true" : "false");
                
                int64_t segmap_group_sizze_68566;
                
                segmap_group_sizze_68566 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_68358;
                
                int64_t num_groups_68567;
                int32_t max_num_groups_78679;
                
                max_num_groups_78679 =
                    *ctx->tuning_params.mainzisegmap_num_groups_68360;
                num_groups_68567 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(m_65377,
                                                                        segmap_group_sizze_68566),
                                                              sext_i32_i64(max_num_groups_78679))));
                
                int64_t nest_sizze_69668 = m_65377 * n_65378;
                int64_t segscan_group_sizze_69669;
                
                segscan_group_sizze_69669 =
                    *ctx->tuning_params.mainzisegscan_group_sizze_69649;
                
                int64_t num_groups_69670;
                int32_t max_num_groups_78680;
                
                max_num_groups_78680 =
                    *ctx->tuning_params.mainzisegscan_num_groups_69651;
                num_groups_69670 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(nest_sizze_69668,
                                                                        segscan_group_sizze_69669),
                                                              sext_i32_i64(max_num_groups_78680))));
                
                int64_t segmap_group_sizze_69722;
                
                segmap_group_sizze_69722 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_69563;
                
                int64_t segmap_group_sizze_69742;
                
                segmap_group_sizze_69742 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_69537;
                
                int64_t segmap_group_sizze_69752;
                
                segmap_group_sizze_69752 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_69511;
                
                int64_t nest_sizze_69773 = m_65377 * q_65380;
                int64_t segmap_group_sizze_69774;
                
                segmap_group_sizze_69774 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_69486;
                
                bool suff_outer_par_69791;
                
                suff_outer_par_69791 =
                    *ctx->tuning_params.mainzisuff_outer_par_3 <= binop_x_77011;
                if (ctx->logging)
                    fprintf(ctx->log, "Compared %s <= %ld: %s.\n",
                            "main.suff_outer_par_3", (long) binop_x_77011,
                            suff_outer_par_69791 ? "true" : "false");
                
                int64_t segmap_group_sizze_69973;
                
                segmap_group_sizze_69973 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_69135;
                
                int64_t nest_sizze_70076 = q_65380 * binop_x_77011;
                int64_t segred_group_sizze_70077;
                
                segred_group_sizze_70077 =
                    *ctx->tuning_params.mainzisegred_group_sizze_69082;
                
                int64_t num_groups_70078;
                int32_t max_num_groups_78681;
                
                max_num_groups_78681 =
                    *ctx->tuning_params.mainzisegred_num_groups_69084;
                num_groups_70078 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(nest_sizze_70076,
                                                                        segred_group_sizze_70077),
                                                              sext_i32_i64(max_num_groups_78681))));
                
                int64_t segmap_group_sizze_70126;
                
                segmap_group_sizze_70126 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_69060;
                
                int64_t segred_group_sizze_70148;
                
                segred_group_sizze_70148 =
                    *ctx->tuning_params.mainzisegred_group_sizze_68987;
                
                int64_t num_groups_70149;
                int32_t max_num_groups_78682;
                
                max_num_groups_78682 =
                    *ctx->tuning_params.mainzisegred_num_groups_68989;
                num_groups_70149 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(nest_sizze_70076,
                                                                        segred_group_sizze_70148),
                                                              sext_i32_i64(max_num_groups_78682))));
                
                int64_t tile_sizze_75341;
                
                tile_sizze_75341 = *ctx->tuning_params.mainzitile_sizze_75340;
                
                int64_t group_sizze_75342 = tile_sizze_75341 * tile_sizze_75341;
                int64_t bytes_77232 = (int64_t) 8 * nest_sizze_69668;
                int64_t binop_y_77235 = (int64_t) 8 * n_65378;
                int64_t bytes_77236 = smax64((int64_t) 0, binop_y_77235);
                int64_t binop_y_77295 = (int64_t) 8 * q_65380;
                int64_t bytes_77296 = smax64((int64_t) 0, binop_y_77295);
                int64_t binop_y_77310 = (int64_t) 8 * n_m_65386;
                int64_t bytes_77311 = smax64((int64_t) 0, binop_y_77310);
                int64_t bytes_77349 = smax64((int64_t) 0, bytes_77232);
                int64_t binop_y_77366 = (int64_t) 8 * m_65377;
                int64_t bytes_77367 = smax64((int64_t) 0, binop_y_77366);
                int64_t binop_y_77380 = (int64_t) 8 * nest_sizze_69773;
                int64_t bytes_77381 = smax64((int64_t) 0, binop_y_77380);
                int64_t bytes_77386 = (int64_t) 8 * group_sizze_75342;
                int64_t bytes_77413 = smax64((int64_t) 0, bytes_77386);
                int64_t binop_x_78053 = (int64_t) 8 * tile_sizze_75341;
                int64_t sizze_78054 = tile_sizze_75341 * binop_x_78053;
                int64_t binop_x_78115 = (int64_t) 8 * tile_sizze_75341;
                int64_t num_bytes_78116 = tile_sizze_75341 * binop_x_78115;
                int64_t binop_x_78120 = (int64_t) 8 * tile_sizze_75341;
                int64_t num_bytes_78121 = tile_sizze_75341 * binop_x_78120;
                int64_t binop_x_78125 = (int64_t) 8 * tile_sizze_75341;
                int64_t num_bytes_78126 = tile_sizze_75341 * binop_x_78125;
                int64_t maxSubHelper_78177 = umax64(bytes_77236, bytes_77311);
                int64_t maxSubHelper_78184 = umax64(bytes_77386, sizze_78054);
                int64_t maxSubHelper_78185 = umax64(num_bytes_78126,
                                                    maxSubHelper_78184);
                int64_t maxSubHelper_78186 = umax64(bytes_77386, sizze_78054);
                int64_t maxSubHelper_78187 = umax64(num_bytes_78121,
                                                    maxSubHelper_78186);
                int64_t maxSubHelper_78188 = umax64(sizze_78054,
                                                    num_bytes_78116);
                int64_t num_threads_78254 = segmap_group_sizze_68566 *
                        num_groups_68567;
                int64_t total_sizze_78255 = maxSubHelper_78177 *
                        num_threads_78254;
                int64_t total_sizze_78256 = bytes_77311 * num_threads_78254;
                int64_t total_sizze_78257 = bytes_77296 * num_threads_78254;
                int64_t total_sizze_78258 = bytes_77236 * num_threads_78254;
                int64_t total_sizze_78259 = bytes_77236 * num_threads_78254;
                int64_t total_sizze_78260 = bytes_77236 * num_threads_78254;
                struct memblock_device ext_mem_77522;
                
                ext_mem_77522.references = NULL;
                
                struct memblock_device ext_mem_77521;
                
                ext_mem_77521.references = NULL;
                
                int32_t local_memory_capacity_79093;
                
                local_memory_capacity_79093 = ctx->opencl.max_local_memory;
                if (sle64((int64_t) 0,
                          sext_i32_i64(local_memory_capacity_79093)) &&
                    suff_outer_par_68354) {
                    struct memblock_device mem_77233;
                    
                    mem_77233.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77233, bytes_77232,
                                              "mem_77233")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77233,
                                                              (int64_t) 0,
                                                              Y_mem_77010,
                                                              (int64_t) 0,
                                                              (int64_t) 1,
                                                              n_65378,
                                                              m_65377) != 0) {
                        if (memblock_unref_device(ctx, &mem_77233,
                                                  "mem_77233") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77521,
                                                  "ext_mem_77521") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77522,
                                                  "ext_mem_77522") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77342;
                    
                    mem_77342.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77342, binop_y_77012,
                                              "mem_77342")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77345;
                    
                    mem_77345.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77345, binop_y_77012,
                                              "mem_77345")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78178;
                    
                    color_78178.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78178,
                                              total_sizze_78255,
                                              "color_78178")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78179;
                    
                    color_78179.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78179,
                                              total_sizze_78256,
                                              "color_78179")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78180;
                    
                    color_78180.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78180,
                                              total_sizze_78257,
                                              "color_78180")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78181;
                    
                    color_78181.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78181,
                                              total_sizze_78258,
                                              "color_78181")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78182;
                    
                    color_78182.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78182,
                                              total_sizze_78259,
                                              "color_78182")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78183;
                    
                    color_78183.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78183,
                                              total_sizze_78260,
                                              "color_78183")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            1,
                                                            sizeof(ctx->failure_is_an_option),
                                                            &ctx->failure_is_an_option));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            3, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            4, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            5, sizeof(q_65380),
                                                            &q_65380));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            6,
                                                            sizeof(jump_65382),
                                                            &jump_65382));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            7,
                                                            sizeof(n_m_65386),
                                                            &n_m_65386));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            8, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            9, sizeof(x_65393),
                                                            &x_65393));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            10,
                                                            sizeof(min_res_65398),
                                                            &min_res_65398));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            11,
                                                            sizeof(loop_cond_65403),
                                                            &loop_cond_65403));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            12,
                                                            sizeof(i64_res_65404),
                                                            &i64_res_65404));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            13,
                                                            sizeof(num_groups_68567),
                                                            &num_groups_68567));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            14,
                                                            sizeof(num_threads_78254),
                                                            &num_threads_78254));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            15,
                                                            sizeof(mem_77233.mem),
                                                            &mem_77233.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            16,
                                                            sizeof(mem_77342.mem),
                                                            &mem_77342.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            17,
                                                            sizeof(mem_77345.mem),
                                                            &mem_77345.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            18,
                                                            sizeof(color_78178.mem),
                                                            &color_78178.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            19,
                                                            sizeof(color_78179.mem),
                                                            &color_78179.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            20,
                                                            sizeof(color_78180.mem),
                                                            &color_78180.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            21,
                                                            sizeof(color_78181.mem),
                                                            &color_78181.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            22,
                                                            sizeof(color_78182.mem),
                                                            &color_78182.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_68572,
                                                            23,
                                                            sizeof(color_78183.mem),
                                                            &color_78183.mem));
                    if (1 * ((size_t) num_groups_68567 *
                             (size_t) segmap_group_sizze_68566) != 0) {
                        const size_t global_work_sizze_80082[1] =
                                     {(size_t) num_groups_68567 *
                                     (size_t) segmap_group_sizze_68566};
                        const size_t local_work_sizze_80086[1] =
                                     {(size_t) segmap_group_sizze_68566};
                        int64_t time_start_80083 = 0, time_end_80084 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_68572",
                                    global_work_sizze_80082[0],
                                    local_work_sizze_80086[0], (int) 0);
                            time_start_80083 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_68572,
                                                                        1, NULL,
                                                                        global_work_sizze_80082,
                                                                        local_work_sizze_80086,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_68572_runs,
                                                                                                                  &ctx->mainzisegmap_68572_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80084 = get_wall_time();
                            
                            long time_diff_80085 = time_end_80084 -
                                 time_start_80083;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_68572", time_diff_80085);
                        }
                    }
                    ctx->failure_is_an_option = 1;
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    if (memblock_unref_device(ctx, &mem_77233, "mem_77233") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78178,
                                              "color_78178") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78179,
                                              "color_78179") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78180,
                                              "color_78180") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78181,
                                              "color_78181") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78182,
                                              "color_78182") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78183,
                                              "color_78183") != 0)
                        return 1;
                    
                    struct memblock_device mem_77514;
                    
                    mem_77514.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77514, bytes_77013,
                                              "mem_77514")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77514,
                                                              (int64_t) 0,
                                                              mem_77342,
                                                              (int64_t) 0,
                                                              (int64_t) 1,
                                                              m_65377,
                                                              n_m_65386) != 0) {
                        if (memblock_unref_device(ctx, &mem_77514,
                                                  "mem_77514") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78183,
                                                  "color_78183") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78182,
                                                  "color_78182") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78181,
                                                  "color_78181") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78180,
                                                  "color_78180") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78179,
                                                  "color_78179") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78178,
                                                  "color_78178") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77345,
                                                  "mem_77345") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77342,
                                                  "mem_77342") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77233,
                                                  "mem_77233") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77521,
                                                  "ext_mem_77521") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77522,
                                                  "ext_mem_77522") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_unref_device(ctx, &mem_77342, "mem_77342") !=
                        0)
                        return 1;
                    
                    struct memblock_device mem_77519;
                    
                    mem_77519.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77519, bytes_77013,
                                              "mem_77519")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77519,
                                                              (int64_t) 0,
                                                              mem_77345,
                                                              (int64_t) 0,
                                                              (int64_t) 1,
                                                              m_65377,
                                                              n_m_65386) != 0) {
                        if (memblock_unref_device(ctx, &mem_77519,
                                                  "mem_77519") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77514,
                                                  "mem_77514") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78183,
                                                  "color_78183") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78182,
                                                  "color_78182") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78181,
                                                  "color_78181") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78180,
                                                  "color_78180") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78179,
                                                  "color_78179") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78178,
                                                  "color_78178") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77345,
                                                  "mem_77345") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77342,
                                                  "mem_77342") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77233,
                                                  "mem_77233") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77521,
                                                  "ext_mem_77521") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77522,
                                                  "ext_mem_77522") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_unref_device(ctx, &mem_77345, "mem_77345") !=
                        0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77522, &mem_77514,
                                            "mem_77514") != 0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77521, &mem_77519,
                                            "mem_77519") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77519, "mem_77519") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77514, "mem_77514") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78183,
                                              "color_78183") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78182,
                                              "color_78182") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78181,
                                              "color_78181") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78180,
                                              "color_78180") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78179,
                                              "color_78179") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78178,
                                              "color_78178") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77345, "mem_77345") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77342, "mem_77342") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77233, "mem_77233") !=
                        0)
                        return 1;
                } else {
                    struct memblock_device mem_77350;
                    
                    mem_77350.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77350, bytes_77349,
                                              "mem_77350")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (slt64((int64_t) 0, m_65377 * n_65378)) {
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegScan");
                        
                        int64_t stage1_max_num_groups_78722;
                        
                        stage1_max_num_groups_78722 =
                            ctx->opencl.max_group_size;
                        
                        int64_t stage1_num_groups_78723 =
                                smin64(stage1_max_num_groups_78722,
                                       num_groups_69670);
                        int32_t num_threads_78724 =
                                sext_i64_i32(stage1_num_groups_78723 *
                                segscan_group_sizze_69669);
                        
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_69675,
                                                                1,
                                                                (size_t) smax64((int64_t) 1,
                                                                                (int64_t) 8 *
                                                                                segscan_group_sizze_69669),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_69675,
                                                                2,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_69675,
                                                                3,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_69675,
                                                                4,
                                                                sizeof(num_threads_78724),
                                                                &num_threads_78724));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_69675,
                                                                5,
                                                                sizeof(Y_mem_77010.mem),
                                                                &Y_mem_77010.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_69675,
                                                                6,
                                                                sizeof(mem_77350.mem),
                                                                &mem_77350.mem));
                        if (1 * ((size_t) stage1_num_groups_78723 *
                                 (size_t) segscan_group_sizze_69669) != 0) {
                            const size_t global_work_sizze_80087[1] =
                                         {(size_t) stage1_num_groups_78723 *
                                         (size_t) segscan_group_sizze_69669};
                            const size_t local_work_sizze_80091[1] =
                                         {(size_t) segscan_group_sizze_69669};
                            int64_t time_start_80088 = 0, time_end_80089 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.scan_stage1_69675",
                                        global_work_sizze_80087[0],
                                        local_work_sizze_80091[0], (int) (0 +
                                                                          smax64((int64_t) 1,
                                                                                 (int64_t) 8 *
                                                                                 segscan_group_sizze_69669)));
                                time_start_80088 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainziscan_stage1_69675,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80087,
                                                                            local_work_sizze_80091,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainziscan_stage1_69675_runs,
                                                                                                                      &ctx->mainziscan_stage1_69675_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80089 = get_wall_time();
                                
                                long time_diff_80090 = time_end_80089 -
                                     time_start_80088;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.scan_stage1_69675",
                                        time_diff_80090);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "elems_per_group",
                                    (long long) (segscan_group_sizze_69669 *
                                                 sdiv_up64(m_65377 * n_65378,
                                                           sext_i32_i64(num_threads_78724))),
                                    '\n');
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_69675,
                                                                1,
                                                                (size_t) smax64((int64_t) 1,
                                                                                (int64_t) 8 *
                                                                                stage1_num_groups_78723),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_69675,
                                                                2,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_69675,
                                                                3,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_69675,
                                                                4,
                                                                sizeof(stage1_num_groups_78723),
                                                                &stage1_num_groups_78723));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_69675,
                                                                5,
                                                                sizeof(num_threads_78724),
                                                                &num_threads_78724));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_69675,
                                                                6,
                                                                sizeof(mem_77350.mem),
                                                                &mem_77350.mem));
                        if (1 * ((size_t) (int64_t) 1 *
                                 (size_t) stage1_num_groups_78723) != 0) {
                            const size_t global_work_sizze_80092[1] =
                                         {(size_t) (int64_t) 1 *
                                         (size_t) stage1_num_groups_78723};
                            const size_t local_work_sizze_80096[1] =
                                         {(size_t) stage1_num_groups_78723};
                            int64_t time_start_80093 = 0, time_end_80094 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.scan_stage2_69675",
                                        global_work_sizze_80092[0],
                                        local_work_sizze_80096[0], (int) (0 +
                                                                          smax64((int64_t) 1,
                                                                                 (int64_t) 8 *
                                                                                 stage1_num_groups_78723)));
                                time_start_80093 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainziscan_stage2_69675,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80092,
                                                                            local_work_sizze_80096,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainziscan_stage2_69675_runs,
                                                                                                                      &ctx->mainziscan_stage2_69675_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80094 = get_wall_time();
                                
                                long time_diff_80095 = time_end_80094 -
                                     time_start_80093;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.scan_stage2_69675",
                                        time_diff_80095);
                            }
                        }
                        
                        int32_t required_groups_78775 =
                                sext_i64_i32(sdiv_up64(m_65377 * n_65378,
                                                       segscan_group_sizze_69669));
                        
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_69675,
                                                                1,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_69675,
                                                                2,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_69675,
                                                                3,
                                                                sizeof(num_groups_69670),
                                                                &num_groups_69670));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_69675,
                                                                4,
                                                                sizeof(num_threads_78724),
                                                                &num_threads_78724));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_69675,
                                                                5,
                                                                sizeof(required_groups_78775),
                                                                &required_groups_78775));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_69675,
                                                                6,
                                                                sizeof(mem_77350.mem),
                                                                &mem_77350.mem));
                        if (1 * ((size_t) num_groups_69670 *
                                 (size_t) segscan_group_sizze_69669) != 0) {
                            const size_t global_work_sizze_80097[1] =
                                         {(size_t) num_groups_69670 *
                                         (size_t) segscan_group_sizze_69669};
                            const size_t local_work_sizze_80101[1] =
                                         {(size_t) segscan_group_sizze_69669};
                            int64_t time_start_80098 = 0, time_end_80099 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.scan_stage3_69675",
                                        global_work_sizze_80097[0],
                                        local_work_sizze_80101[0], (int) 0);
                                time_start_80098 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainziscan_stage3_69675,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80097,
                                                                            local_work_sizze_80101,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainziscan_stage3_69675_runs,
                                                                                                                      &ctx->mainziscan_stage3_69675_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80099 = get_wall_time();
                                
                                long time_diff_80100 = time_end_80099 -
                                     time_start_80098;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.scan_stage3_69675",
                                        time_diff_80100);
                            }
                        }
                    }
                    
                    struct memblock_device mem_77354;
                    
                    mem_77354.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77354, bytes_77349,
                                              "mem_77354")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhreplicate_f64(ctx, mem_77354, m_65377 *
                                                      n_65378, 0.0) != 0) {
                        if (memblock_unref_device(ctx, &mem_77354,
                                                  "mem_77354") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77350,
                                                  "mem_77350") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77521,
                                                  "ext_mem_77521") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77522,
                                                  "ext_mem_77522") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77358;
                    
                    mem_77358.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77358, bytes_77349,
                                              "mem_77358")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhreplicate_i64(ctx, mem_77358, m_65377 *
                                                      n_65378, (int64_t) -1) !=
                        0) {
                        if (memblock_unref_device(ctx, &mem_77358,
                                                  "mem_77358") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77354,
                                                  "mem_77354") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77350,
                                                  "mem_77350") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77521,
                                                  "ext_mem_77521") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77522,
                                                  "ext_mem_77522") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t segmap_usable_groups_69723 =
                            sdiv_up64(nest_sizze_69668,
                                      segmap_group_sizze_69722);
                    
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69728,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69728,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69728,
                                                            3,
                                                            sizeof(Y_mem_77010.mem),
                                                            &Y_mem_77010.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69728,
                                                            4,
                                                            sizeof(mem_77350.mem),
                                                            &mem_77350.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69728,
                                                            5,
                                                            sizeof(mem_77354.mem),
                                                            &mem_77354.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69728,
                                                            6,
                                                            sizeof(mem_77358.mem),
                                                            &mem_77358.mem));
                    if (1 * ((size_t) segmap_usable_groups_69723 *
                             (size_t) segmap_group_sizze_69722) != 0) {
                        const size_t global_work_sizze_80102[1] =
                                     {(size_t) segmap_usable_groups_69723 *
                                     (size_t) segmap_group_sizze_69722};
                        const size_t local_work_sizze_80106[1] =
                                     {(size_t) segmap_group_sizze_69722};
                        int64_t time_start_80103 = 0, time_end_80104 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_69728",
                                    global_work_sizze_80102[0],
                                    local_work_sizze_80106[0], (int) 0);
                            time_start_80103 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_69728,
                                                                        1, NULL,
                                                                        global_work_sizze_80102,
                                                                        local_work_sizze_80106,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_69728_runs,
                                                                                                                  &ctx->mainzisegmap_69728_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80104 = get_wall_time();
                            
                            long time_diff_80105 = time_end_80104 -
                                 time_start_80103;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_69728", time_diff_80105);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    int64_t segmap_usable_groups_69743 =
                            sdiv_up64(nest_sizze_69668,
                                      segmap_group_sizze_69742);
                    struct memblock_device mem_77364;
                    
                    mem_77364.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77364, bytes_77349,
                                              "mem_77364")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69747,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69747,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69747,
                                                            3,
                                                            sizeof(mem_77358.mem),
                                                            &mem_77358.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69747,
                                                            4,
                                                            sizeof(mem_77364.mem),
                                                            &mem_77364.mem));
                    if (1 * ((size_t) segmap_usable_groups_69743 *
                             (size_t) segmap_group_sizze_69742) != 0) {
                        const size_t global_work_sizze_80107[1] =
                                     {(size_t) segmap_usable_groups_69743 *
                                     (size_t) segmap_group_sizze_69742};
                        const size_t local_work_sizze_80111[1] =
                                     {(size_t) segmap_group_sizze_69742};
                        int64_t time_start_80108 = 0, time_end_80109 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_69747",
                                    global_work_sizze_80107[0],
                                    local_work_sizze_80111[0], (int) 0);
                            time_start_80108 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_69747,
                                                                        1, NULL,
                                                                        global_work_sizze_80107,
                                                                        local_work_sizze_80111,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_69747_runs,
                                                                                                                  &ctx->mainzisegmap_69747_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80109 = get_wall_time();
                            
                            long time_diff_80110 = time_end_80109 -
                                 time_start_80108;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_69747", time_diff_80110);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    int64_t segmap_usable_groups_69753 = sdiv_up64(m_65377,
                                                                   segmap_group_sizze_69752);
                    struct memblock_device mem_77368;
                    
                    mem_77368.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77368, bytes_77367,
                                              "mem_77368")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77371;
                    
                    mem_77371.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77371, bytes_77367,
                                              "mem_77371")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77374;
                    
                    mem_77374.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77374, bytes_77367,
                                              "mem_77374")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77377;
                    
                    mem_77377.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77377, bytes_77367,
                                              "mem_77377")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            3, sizeof(q_65380),
                                                            &q_65380));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            4, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            5,
                                                            sizeof(min_res_65398),
                                                            &min_res_65398));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            6,
                                                            sizeof(i64_res_65404),
                                                            &i64_res_65404));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            7,
                                                            sizeof(mem_77350.mem),
                                                            &mem_77350.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            8,
                                                            sizeof(mem_77368.mem),
                                                            &mem_77368.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            9,
                                                            sizeof(mem_77371.mem),
                                                            &mem_77371.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            10,
                                                            sizeof(mem_77374.mem),
                                                            &mem_77374.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69759,
                                                            11,
                                                            sizeof(mem_77377.mem),
                                                            &mem_77377.mem));
                    if (1 * ((size_t) segmap_usable_groups_69753 *
                             (size_t) segmap_group_sizze_69752) != 0) {
                        const size_t global_work_sizze_80112[1] =
                                     {(size_t) segmap_usable_groups_69753 *
                                     (size_t) segmap_group_sizze_69752};
                        const size_t local_work_sizze_80116[1] =
                                     {(size_t) segmap_group_sizze_69752};
                        int64_t time_start_80113 = 0, time_end_80114 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_69759",
                                    global_work_sizze_80112[0],
                                    local_work_sizze_80116[0], (int) 0);
                            time_start_80113 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_69759,
                                                                        1, NULL,
                                                                        global_work_sizze_80112,
                                                                        local_work_sizze_80116,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_69759_runs,
                                                                                                                  &ctx->mainzisegmap_69759_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80114 = get_wall_time();
                            
                            long time_diff_80115 = time_end_80114 -
                                 time_start_80113;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_69759", time_diff_80115);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    int64_t segmap_usable_groups_69775 =
                            sdiv_up64(nest_sizze_69773,
                                      segmap_group_sizze_69774);
                    struct memblock_device mem_77382;
                    
                    mem_77382.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77382, bytes_77381,
                                              "mem_77382")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69779,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69779,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69779,
                                                            3, sizeof(q_65380),
                                                            &q_65380));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69779,
                                                            4, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69779,
                                                            5,
                                                            sizeof(mem_77350.mem),
                                                            &mem_77350.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69779,
                                                            6,
                                                            sizeof(mem_77382.mem),
                                                            &mem_77382.mem));
                    if (1 * ((size_t) segmap_usable_groups_69775 *
                             (size_t) segmap_group_sizze_69774) != 0) {
                        const size_t global_work_sizze_80117[1] =
                                     {(size_t) segmap_usable_groups_69775 *
                                     (size_t) segmap_group_sizze_69774};
                        const size_t local_work_sizze_80121[1] =
                                     {(size_t) segmap_group_sizze_69774};
                        int64_t time_start_80118 = 0, time_end_80119 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_69779",
                                    global_work_sizze_80117[0],
                                    local_work_sizze_80121[0], (int) 0);
                            time_start_80118 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_69779,
                                                                        1, NULL,
                                                                        global_work_sizze_80117,
                                                                        local_work_sizze_80121,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_69779_runs,
                                                                                                                  &ctx->mainzisegmap_69779_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80119 = get_wall_time();
                            
                            long time_diff_80120 = time_end_80119 -
                                 time_start_80118;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_69779", time_diff_80120);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    struct memblock_device ext_mem_77510;
                    
                    ext_mem_77510.references = NULL;
                    
                    struct memblock_device ext_mem_77509;
                    
                    ext_mem_77509.references = NULL;
                    
                    int32_t local_memory_capacity_79092;
                    
                    local_memory_capacity_79092 = ctx->opencl.max_local_memory;
                    if (sle64(bytes_77413 + srem64((int64_t) 8 -
                                                   srem64(bytes_77413,
                                                          (int64_t) 8),
                                                   (int64_t) 8),
                              sext_i32_i64(local_memory_capacity_79092)) &&
                        suff_outer_par_69791) {
                        int64_t num_groups_x_75343 = sdiv_up64(m_65377,
                                                               tile_sizze_75341);
                        int64_t num_groups_y_75344 = sdiv_up64(n_m_65386,
                                                               tile_sizze_75341);
                        int64_t num_groups_top_75345 = num_groups_x_75343 *
                                num_groups_y_75344;
                        int64_t num_whole_tiles_75476 = squot64(q_65380,
                                                                tile_sizze_75341);
                        int64_t residual_input_75724 = srem64(q_65380,
                                                              tile_sizze_75341);
                        bool cond_75725 = residual_input_75724 == (int64_t) 0;
                        struct memblock_device mem_77456;
                        
                        mem_77456.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77456, bytes_77013,
                                                  "mem_77456")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77460;
                        
                        mem_77460.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77460, bytes_77013,
                                                  "mem_77460")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegMap");
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                1,
                                                                sizeof(ctx->failure_is_an_option),
                                                                &ctx->failure_is_an_option));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                3,
                                                                (size_t) bytes_77413,
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                4,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                5,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                6,
                                                                sizeof(q_65380),
                                                                &q_65380));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                7,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                8,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                9,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                10,
                                                                sizeof(x_65393),
                                                                &x_65393));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                11,
                                                                sizeof(min_res_65398),
                                                                &min_res_65398));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                12,
                                                                sizeof(loop_cond_65403),
                                                                &loop_cond_65403));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                13,
                                                                sizeof(num_groups_x_75343),
                                                                &num_groups_x_75343));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                14,
                                                                sizeof(num_groups_y_75344),
                                                                &num_groups_y_75344));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                15,
                                                                sizeof(num_whole_tiles_75476),
                                                                &num_whole_tiles_75476));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                16,
                                                                sizeof(residual_input_75724),
                                                                &residual_input_75724));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                17,
                                                                sizeof(cond_75725),
                                                                &cond_75725));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                18,
                                                                sizeof(mem_77350.mem),
                                                                &mem_77350.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                19,
                                                                sizeof(mem_77354.mem),
                                                                &mem_77354.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                20,
                                                                sizeof(mem_77358.mem),
                                                                &mem_77358.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                21,
                                                                sizeof(mem_77364.mem),
                                                                &mem_77364.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                22,
                                                                sizeof(mem_77368.mem),
                                                                &mem_77368.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                23,
                                                                sizeof(mem_77371.mem),
                                                                &mem_77371.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                24,
                                                                sizeof(mem_77374.mem),
                                                                &mem_77374.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                25,
                                                                sizeof(mem_77377.mem),
                                                                &mem_77377.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                26,
                                                                sizeof(mem_77382.mem),
                                                                &mem_77382.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                27,
                                                                sizeof(mem_77456.mem),
                                                                &mem_77456.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_75346,
                                                                28,
                                                                sizeof(mem_77460.mem),
                                                                &mem_77460.mem));
                        if (1 * ((size_t) num_groups_top_75345 *
                                 (size_t) group_sizze_75342) != 0) {
                            const size_t global_work_sizze_80122[1] =
                                         {(size_t) num_groups_top_75345 *
                                         (size_t) group_sizze_75342};
                            const size_t local_work_sizze_80126[1] =
                                         {(size_t) group_sizze_75342};
                            int64_t time_start_80123 = 0, time_end_80124 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segmap_intragroup_75346",
                                        global_work_sizze_80122[0],
                                        local_work_sizze_80126[0], (int) (0 +
                                                                          bytes_77413));
                                time_start_80123 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegmap_intragroup_75346,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80122,
                                                                            local_work_sizze_80126,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegmap_intragroup_75346_runs,
                                                                                                                      &ctx->mainzisegmap_intragroup_75346_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80124 = get_wall_time();
                                
                                long time_diff_80125 = time_end_80124 -
                                     time_start_80123;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segmap_intragroup_75346",
                                        time_diff_80125);
                            }
                        }
                        ctx->failure_is_an_option = 1;
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_set_device(ctx, &ext_mem_77510, &mem_77456,
                                                "mem_77456") != 0)
                            return 1;
                        if (memblock_set_device(ctx, &ext_mem_77509, &mem_77460,
                                                "mem_77460") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77460,
                                                  "mem_77460") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77456,
                                                  "mem_77456") != 0)
                            return 1;
                    } else {
                        int64_t segmap_usable_groups_69974 =
                                sdiv_up64(binop_x_77011,
                                          segmap_group_sizze_69973);
                        struct memblock_device mem_77465;
                        
                        mem_77465.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77465, bytes_77013,
                                                  "mem_77465")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77469;
                        
                        mem_77469.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77469, bytes_77013,
                                                  "mem_77469")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77473;
                        
                        mem_77473.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77473, bytes_77013,
                                                  "mem_77473")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegMap");
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                1,
                                                                sizeof(ctx->failure_is_an_option),
                                                                &ctx->failure_is_an_option));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                3,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                4,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                5,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                6,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                7,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                8,
                                                                sizeof(x_65393),
                                                                &x_65393));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                9,
                                                                sizeof(min_res_65398),
                                                                &min_res_65398));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                10,
                                                                sizeof(loop_cond_65403),
                                                                &loop_cond_65403));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                11,
                                                                sizeof(mem_77358.mem),
                                                                &mem_77358.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                12,
                                                                sizeof(mem_77364.mem),
                                                                &mem_77364.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                13,
                                                                sizeof(mem_77368.mem),
                                                                &mem_77368.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                14,
                                                                sizeof(mem_77371.mem),
                                                                &mem_77371.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                15,
                                                                sizeof(mem_77374.mem),
                                                                &mem_77374.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                16,
                                                                sizeof(mem_77377.mem),
                                                                &mem_77377.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                17,
                                                                sizeof(mem_77465.mem),
                                                                &mem_77465.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                18,
                                                                sizeof(mem_77469.mem),
                                                                &mem_77469.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_69980,
                                                                19,
                                                                sizeof(mem_77473.mem),
                                                                &mem_77473.mem));
                        if (1 * ((size_t) segmap_usable_groups_69974 *
                                 (size_t) segmap_group_sizze_69973) != 0) {
                            const size_t global_work_sizze_80127[1] =
                                         {(size_t) segmap_usable_groups_69974 *
                                         (size_t) segmap_group_sizze_69973};
                            const size_t local_work_sizze_80131[1] =
                                         {(size_t) segmap_group_sizze_69973};
                            int64_t time_start_80128 = 0, time_end_80129 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segmap_69980",
                                        global_work_sizze_80127[0],
                                        local_work_sizze_80131[0], (int) 0);
                                time_start_80128 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegmap_69980,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80127,
                                                                            local_work_sizze_80131,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegmap_69980_runs,
                                                                                                                      &ctx->mainzisegmap_69980_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80129 = get_wall_time();
                                
                                long time_diff_80130 = time_end_80129 -
                                     time_start_80128;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segmap_69980", time_diff_80130);
                            }
                        }
                        ctx->failure_is_an_option = 1;
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &mem_77465,
                                                  "mem_77465") != 0)
                            return 1;
                        
                        struct memblock_device mem_77478;
                        
                        mem_77478.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77478, bytes_77013,
                                                  "mem_77478")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77482;
                        
                        mem_77482.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77482, bytes_77013,
                                                  "mem_77482")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77486;
                        
                        mem_77486.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77486, bytes_77013,
                                                  "mem_77486")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (slt64(q_65380 * (int64_t) 2,
                                  segred_group_sizze_70077)) {
                            int64_t segment_sizze_nonzzero_78896 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_78897 = num_groups_70078 *
                                    segred_group_sizze_70077;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-small");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "segments_per_group",
                                        (long long) squot64(segred_group_sizze_70077,
                                                            segment_sizze_nonzzero_78896),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "required_groups",
                                        (long long) sext_i64_i32(sdiv_up64(m_65377 *
                                                                           n_m_65386,
                                                                           squot64(segred_group_sizze_70077,
                                                                                   segment_sizze_nonzzero_78896))),
                                        '\n');
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    1,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70077),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70077),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    3,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70077),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    4,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    5,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    6,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    7,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    8,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    9,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    10,
                                                                    sizeof(num_groups_70078),
                                                                    &num_groups_70078));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    11,
                                                                    sizeof(segment_sizze_nonzzero_78896),
                                                                    &segment_sizze_nonzzero_78896));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    12,
                                                                    sizeof(mem_77350.mem),
                                                                    &mem_77350.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    13,
                                                                    sizeof(mem_77358.mem),
                                                                    &mem_77358.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    14,
                                                                    sizeof(mem_77382.mem),
                                                                    &mem_77382.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    15,
                                                                    sizeof(mem_77469.mem),
                                                                    &mem_77469.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    16,
                                                                    sizeof(mem_77473.mem),
                                                                    &mem_77473.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    17,
                                                                    sizeof(mem_77478.mem),
                                                                    &mem_77478.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    18,
                                                                    sizeof(mem_77482.mem),
                                                                    &mem_77482.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70086,
                                                                    19,
                                                                    sizeof(mem_77486.mem),
                                                                    &mem_77486.mem));
                            if (1 * ((size_t) num_groups_70078 *
                                     (size_t) segred_group_sizze_70077) != 0) {
                                const size_t global_work_sizze_80132[1] =
                                             {(size_t) num_groups_70078 *
                                             (size_t) segred_group_sizze_70077};
                                const size_t local_work_sizze_80136[1] =
                                             {(size_t) segred_group_sizze_70077};
                                int64_t time_start_80133 = 0, time_end_80134 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_small_70086",
                                            global_work_sizze_80132[0],
                                            local_work_sizze_80136[0],
                                            (int) (0 + (int64_t) 8 *
                                                   segred_group_sizze_70077 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_70077 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_70077));
                                    time_start_80133 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_small_70086,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80132,
                                                                                local_work_sizze_80136,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_small_70086_runs,
                                                                                                                          &ctx->mainzisegred_small_70086_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80134 = get_wall_time();
                                    
                                    long time_diff_80135 = time_end_80134 -
                                         time_start_80133;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_small_70086",
                                            time_diff_80135);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_78937 =
                                    sdiv_up64(num_groups_70078,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_78938 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_70077 *
                                              groups_per_segment_78937);
                            int64_t virt_num_groups_78939 =
                                    groups_per_segment_78937 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_78940 = num_groups_70078 *
                                    segred_group_sizze_70077;
                            int64_t threads_per_segment_78941 =
                                    groups_per_segment_78937 *
                                    segred_group_sizze_70077;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-large");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "virt_num_groups",
                                        (long long) virt_num_groups_78939,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_groups",
                                        (long long) num_groups_70078, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "group_size",
                                        (long long) segred_group_sizze_70077,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "elems_per_thread",
                                        (long long) elements_per_thread_78938,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_78937,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_78942;
                            
                            segred_tmp_mem_78942.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_78942,
                                                      (int64_t) 8 *
                                                      virt_num_groups_78939,
                                                      "segred_tmp_mem_78942")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_78944;
                            
                            segred_tmp_mem_78944.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_78944,
                                                      (int64_t) 8 *
                                                      virt_num_groups_78939,
                                                      "segred_tmp_mem_78944")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_78946;
                            
                            segred_tmp_mem_78946.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_78946,
                                                      (int64_t) 8 *
                                                      virt_num_groups_78939,
                                                      "segred_tmp_mem_78946")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_78948 =
                                                   ctx->mainzicounter_mem_78948;
                            
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    1,
                                                                    (size_t) 1,
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70077),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    3,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70077),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    4,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70077),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    5,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    6,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    7,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    8,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    9,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    10,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    11,
                                                                    sizeof(num_groups_70078),
                                                                    &num_groups_70078));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    12,
                                                                    sizeof(groups_per_segment_78937),
                                                                    &groups_per_segment_78937));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    13,
                                                                    sizeof(elements_per_thread_78938),
                                                                    &elements_per_thread_78938));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    14,
                                                                    sizeof(virt_num_groups_78939),
                                                                    &virt_num_groups_78939));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    15,
                                                                    sizeof(threads_per_segment_78941),
                                                                    &threads_per_segment_78941));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    16,
                                                                    sizeof(mem_77350.mem),
                                                                    &mem_77350.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    17,
                                                                    sizeof(mem_77358.mem),
                                                                    &mem_77358.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    18,
                                                                    sizeof(mem_77382.mem),
                                                                    &mem_77382.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    19,
                                                                    sizeof(mem_77469.mem),
                                                                    &mem_77469.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    20,
                                                                    sizeof(mem_77473.mem),
                                                                    &mem_77473.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    21,
                                                                    sizeof(mem_77478.mem),
                                                                    &mem_77478.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    22,
                                                                    sizeof(mem_77482.mem),
                                                                    &mem_77482.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    23,
                                                                    sizeof(mem_77486.mem),
                                                                    &mem_77486.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    24,
                                                                    sizeof(segred_tmp_mem_78942.mem),
                                                                    &segred_tmp_mem_78942.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    25,
                                                                    sizeof(segred_tmp_mem_78944.mem),
                                                                    &segred_tmp_mem_78944.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    26,
                                                                    sizeof(segred_tmp_mem_78946.mem),
                                                                    &segred_tmp_mem_78946.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70086,
                                                                    27,
                                                                    sizeof(mainzicounter_mem_78948.mem),
                                                                    &mainzicounter_mem_78948.mem));
                            if (1 * ((size_t) num_groups_70078 *
                                     (size_t) segred_group_sizze_70077) != 0) {
                                const size_t global_work_sizze_80138[1] =
                                             {(size_t) num_groups_70078 *
                                             (size_t) segred_group_sizze_70077};
                                const size_t local_work_sizze_80142[1] =
                                             {(size_t) segred_group_sizze_70077};
                                int64_t time_start_80139 = 0, time_end_80140 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_large_70086",
                                            global_work_sizze_80138[0],
                                            local_work_sizze_80142[0],
                                            (int) (0 + 1 + (int64_t) 8 *
                                                   segred_group_sizze_70077 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_70077 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_70077));
                                    time_start_80139 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_large_70086,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80138,
                                                                                local_work_sizze_80142,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_large_70086_runs,
                                                                                                                          &ctx->mainzisegred_large_70086_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80140 = get_wall_time();
                                    
                                    long time_diff_80141 = time_end_80140 -
                                         time_start_80139;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_large_70086",
                                            time_diff_80141);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_78946,
                                                      "segred_tmp_mem_78946") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_78944,
                                                      "segred_tmp_mem_78944") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_78942,
                                                      "segred_tmp_mem_78942") !=
                                0)
                                return 1;
                        }
                        
                        int64_t segmap_usable_groups_70127 =
                                sdiv_up64(binop_x_77011,
                                          segmap_group_sizze_70126);
                        struct memblock_device mem_77491;
                        
                        mem_77491.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77491, bytes_77013,
                                                  "mem_77491")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77495;
                        
                        mem_77495.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77495, bytes_77013,
                                                  "mem_77495")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77499;
                        
                        mem_77499.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77499, bytes_77013,
                                                  "mem_77499")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegMap");
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                1,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                2,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                3,
                                                                sizeof(mem_77478.mem),
                                                                &mem_77478.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                4,
                                                                sizeof(mem_77482.mem),
                                                                &mem_77482.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                5,
                                                                sizeof(mem_77486.mem),
                                                                &mem_77486.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                6,
                                                                sizeof(mem_77491.mem),
                                                                &mem_77491.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                7,
                                                                sizeof(mem_77495.mem),
                                                                &mem_77495.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70133,
                                                                8,
                                                                sizeof(mem_77499.mem),
                                                                &mem_77499.mem));
                        if (1 * ((size_t) segmap_usable_groups_70127 *
                                 (size_t) segmap_group_sizze_70126) != 0) {
                            const size_t global_work_sizze_80143[1] =
                                         {(size_t) segmap_usable_groups_70127 *
                                         (size_t) segmap_group_sizze_70126};
                            const size_t local_work_sizze_80147[1] =
                                         {(size_t) segmap_group_sizze_70126};
                            int64_t time_start_80144 = 0, time_end_80145 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segmap_70133",
                                        global_work_sizze_80143[0],
                                        local_work_sizze_80147[0], (int) 0);
                                time_start_80144 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegmap_70133,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80143,
                                                                            local_work_sizze_80147,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegmap_70133_runs,
                                                                                                                      &ctx->mainzisegmap_70133_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80145 = get_wall_time();
                                
                                long time_diff_80146 = time_end_80145 -
                                     time_start_80144;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segmap_70133", time_diff_80146);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &mem_77478,
                                                  "mem_77478") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77482,
                                                  "mem_77482") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77486,
                                                  "mem_77486") != 0)
                            return 1;
                        
                        struct memblock_device mem_77504;
                        
                        mem_77504.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77504, bytes_77013,
                                                  "mem_77504")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77508;
                        
                        mem_77508.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77508, bytes_77013,
                                                  "mem_77508")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (slt64(q_65380 * (int64_t) 2,
                                  segred_group_sizze_70148)) {
                            int64_t segment_sizze_nonzzero_79006 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_79007 = num_groups_70149 *
                                    segred_group_sizze_70148;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-small");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "segments_per_group",
                                        (long long) squot64(segred_group_sizze_70148,
                                                            segment_sizze_nonzzero_79006),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "required_groups",
                                        (long long) sext_i64_i32(sdiv_up64(m_65377 *
                                                                           n_m_65386,
                                                                           squot64(segred_group_sizze_70148,
                                                                                   segment_sizze_nonzzero_79006))),
                                        '\n');
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    1,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    3,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    4,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    5,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    6,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    7,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    8,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    9,
                                                                    sizeof(num_groups_70149),
                                                                    &num_groups_70149));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    10,
                                                                    sizeof(segment_sizze_nonzzero_79006),
                                                                    &segment_sizze_nonzzero_79006));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    11,
                                                                    sizeof(mem_77350.mem),
                                                                    &mem_77350.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    12,
                                                                    sizeof(mem_77354.mem),
                                                                    &mem_77354.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    13,
                                                                    sizeof(mem_77358.mem),
                                                                    &mem_77358.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    14,
                                                                    sizeof(mem_77382.mem),
                                                                    &mem_77382.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    15,
                                                                    sizeof(mem_77469.mem),
                                                                    &mem_77469.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    16,
                                                                    sizeof(mem_77473.mem),
                                                                    &mem_77473.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    17,
                                                                    sizeof(mem_77491.mem),
                                                                    &mem_77491.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    18,
                                                                    sizeof(mem_77495.mem),
                                                                    &mem_77495.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    19,
                                                                    sizeof(mem_77499.mem),
                                                                    &mem_77499.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    20,
                                                                    sizeof(mem_77504.mem),
                                                                    &mem_77504.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_70156,
                                                                    21,
                                                                    sizeof(mem_77508.mem),
                                                                    &mem_77508.mem));
                            if (1 * ((size_t) num_groups_70149 *
                                     (size_t) segred_group_sizze_70148) != 0) {
                                const size_t global_work_sizze_80148[1] =
                                             {(size_t) num_groups_70149 *
                                             (size_t) segred_group_sizze_70148};
                                const size_t local_work_sizze_80152[1] =
                                             {(size_t) segred_group_sizze_70148};
                                int64_t time_start_80149 = 0, time_end_80150 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_small_70156",
                                            global_work_sizze_80148[0],
                                            local_work_sizze_80152[0],
                                            (int) (0 + (int64_t) 8 *
                                                   segred_group_sizze_70148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_70148));
                                    time_start_80149 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_small_70156,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80148,
                                                                                local_work_sizze_80152,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_small_70156_runs,
                                                                                                                          &ctx->mainzisegred_small_70156_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80150 = get_wall_time();
                                    
                                    long time_diff_80151 = time_end_80150 -
                                         time_start_80149;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_small_70156",
                                            time_diff_80151);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_79041 =
                                    sdiv_up64(num_groups_70149,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_79042 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_70148 *
                                              groups_per_segment_79041);
                            int64_t virt_num_groups_79043 =
                                    groups_per_segment_79041 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_79044 = num_groups_70149 *
                                    segred_group_sizze_70148;
                            int64_t threads_per_segment_79045 =
                                    groups_per_segment_79041 *
                                    segred_group_sizze_70148;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-large");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "virt_num_groups",
                                        (long long) virt_num_groups_79043,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_groups",
                                        (long long) num_groups_70149, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "group_size",
                                        (long long) segred_group_sizze_70148,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "elems_per_thread",
                                        (long long) elements_per_thread_79042,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_79041,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_79046;
                            
                            segred_tmp_mem_79046.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79046,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79043,
                                                      "segred_tmp_mem_79046")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79048;
                            
                            segred_tmp_mem_79048.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79048,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79043,
                                                      "segred_tmp_mem_79048")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_79050 =
                                                   ctx->mainzicounter_mem_79050;
                            
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    1,
                                                                    (size_t) 1,
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    3,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_70148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    4,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    5,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    6,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    7,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    8,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    9,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    10,
                                                                    sizeof(num_groups_70149),
                                                                    &num_groups_70149));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    11,
                                                                    sizeof(groups_per_segment_79041),
                                                                    &groups_per_segment_79041));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    12,
                                                                    sizeof(elements_per_thread_79042),
                                                                    &elements_per_thread_79042));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    13,
                                                                    sizeof(virt_num_groups_79043),
                                                                    &virt_num_groups_79043));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    14,
                                                                    sizeof(threads_per_segment_79045),
                                                                    &threads_per_segment_79045));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    15,
                                                                    sizeof(mem_77350.mem),
                                                                    &mem_77350.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    16,
                                                                    sizeof(mem_77354.mem),
                                                                    &mem_77354.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    17,
                                                                    sizeof(mem_77358.mem),
                                                                    &mem_77358.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    18,
                                                                    sizeof(mem_77382.mem),
                                                                    &mem_77382.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    19,
                                                                    sizeof(mem_77469.mem),
                                                                    &mem_77469.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    20,
                                                                    sizeof(mem_77473.mem),
                                                                    &mem_77473.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    21,
                                                                    sizeof(mem_77491.mem),
                                                                    &mem_77491.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    22,
                                                                    sizeof(mem_77495.mem),
                                                                    &mem_77495.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    23,
                                                                    sizeof(mem_77499.mem),
                                                                    &mem_77499.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    24,
                                                                    sizeof(mem_77504.mem),
                                                                    &mem_77504.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    25,
                                                                    sizeof(mem_77508.mem),
                                                                    &mem_77508.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    26,
                                                                    sizeof(segred_tmp_mem_79046.mem),
                                                                    &segred_tmp_mem_79046.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    27,
                                                                    sizeof(segred_tmp_mem_79048.mem),
                                                                    &segred_tmp_mem_79048.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_70156,
                                                                    28,
                                                                    sizeof(mainzicounter_mem_79050.mem),
                                                                    &mainzicounter_mem_79050.mem));
                            if (1 * ((size_t) num_groups_70149 *
                                     (size_t) segred_group_sizze_70148) != 0) {
                                const size_t global_work_sizze_80154[1] =
                                             {(size_t) num_groups_70149 *
                                             (size_t) segred_group_sizze_70148};
                                const size_t local_work_sizze_80158[1] =
                                             {(size_t) segred_group_sizze_70148};
                                int64_t time_start_80155 = 0, time_end_80156 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_large_70156",
                                            global_work_sizze_80154[0],
                                            local_work_sizze_80158[0],
                                            (int) (0 + 1 + (int64_t) 8 *
                                                   segred_group_sizze_70148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_70148));
                                    time_start_80155 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_large_70156,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80154,
                                                                                local_work_sizze_80158,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_large_70156_runs,
                                                                                                                          &ctx->mainzisegred_large_70156_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80156 = get_wall_time();
                                    
                                    long time_diff_80157 = time_end_80156 -
                                         time_start_80155;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_large_70156",
                                            time_diff_80157);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79048,
                                                      "segred_tmp_mem_79048") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79046,
                                                      "segred_tmp_mem_79046") !=
                                0)
                                return 1;
                        }
                        if (memblock_unref_device(ctx, &mem_77469,
                                                  "mem_77469") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77473,
                                                  "mem_77473") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77491,
                                                  "mem_77491") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77495,
                                                  "mem_77495") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77499,
                                                  "mem_77499") != 0)
                            return 1;
                        if (memblock_set_device(ctx, &ext_mem_77510, &mem_77504,
                                                "mem_77504") != 0)
                            return 1;
                        if (memblock_set_device(ctx, &ext_mem_77509, &mem_77508,
                                                "mem_77508") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77508,
                                                  "mem_77508") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77504,
                                                  "mem_77504") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77499,
                                                  "mem_77499") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77495,
                                                  "mem_77495") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77491,
                                                  "mem_77491") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77486,
                                                  "mem_77486") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77482,
                                                  "mem_77482") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77478,
                                                  "mem_77478") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77473,
                                                  "mem_77473") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77469,
                                                  "mem_77469") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77465,
                                                  "mem_77465") != 0)
                            return 1;
                    }
                    if (memblock_unref_device(ctx, &mem_77350, "mem_77350") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77354, "mem_77354") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77358, "mem_77358") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77364, "mem_77364") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77368, "mem_77368") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77371, "mem_77371") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77374, "mem_77374") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77377, "mem_77377") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77382, "mem_77382") !=
                        0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77522, &ext_mem_77510,
                                            "ext_mem_77510") != 0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77521, &ext_mem_77509,
                                            "ext_mem_77509") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77509,
                                              "ext_mem_77509") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77510,
                                              "ext_mem_77510") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77382, "mem_77382") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77377, "mem_77377") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77374, "mem_77374") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77371, "mem_77371") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77368, "mem_77368") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77364, "mem_77364") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77358, "mem_77358") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77354, "mem_77354") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77350, "mem_77350") !=
                        0)
                        return 1;
                }
                if (memblock_set_device(ctx, &ext_mem_77856, &ext_mem_77522,
                                        "ext_mem_77522") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_77855, &ext_mem_77521,
                                        "ext_mem_77521") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_77521,
                                          "ext_mem_77521") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_77522,
                                          "ext_mem_77522") != 0)
                    return 1;
            } else {
                bool suff_outer_par_70213;
                
                suff_outer_par_70213 =
                    *ctx->tuning_params.mainzisuff_outer_par_4 <= m_65377;
                if (ctx->logging)
                    fprintf(ctx->log, "Compared %s <= %ld: %s.\n",
                            "main.suff_outer_par_4", (long) m_65377,
                            suff_outer_par_70213 ? "true" : "false");
                
                int64_t segmap_group_sizze_70457;
                
                segmap_group_sizze_70457 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_70217;
                
                int64_t num_groups_70458;
                int32_t max_num_groups_79094;
                
                max_num_groups_79094 =
                    *ctx->tuning_params.mainzisegmap_num_groups_70219;
                num_groups_70458 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(m_65377,
                                                                        segmap_group_sizze_70457),
                                                              sext_i32_i64(max_num_groups_79094))));
                
                int64_t nest_sizze_71707 = m_65377 * n_65378;
                int64_t segscan_group_sizze_71708;
                
                segscan_group_sizze_71708 =
                    *ctx->tuning_params.mainzisegscan_group_sizze_71688;
                
                int64_t num_groups_71709;
                int32_t max_num_groups_79095;
                
                max_num_groups_79095 =
                    *ctx->tuning_params.mainzisegscan_num_groups_71690;
                num_groups_71709 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(nest_sizze_71707,
                                                                        segscan_group_sizze_71708),
                                                              sext_i32_i64(max_num_groups_79095))));
                
                int64_t segmap_group_sizze_71761;
                
                segmap_group_sizze_71761 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_71602;
                
                int64_t segmap_group_sizze_71781;
                
                segmap_group_sizze_71781 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_71576;
                
                int64_t segmap_group_sizze_71791;
                
                segmap_group_sizze_71791 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_71550;
                
                int64_t nest_sizze_71812 = m_65377 * q_65380;
                int64_t segmap_group_sizze_71813;
                
                segmap_group_sizze_71813 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_71525;
                
                bool suff_outer_par_71830;
                
                suff_outer_par_71830 =
                    *ctx->tuning_params.mainzisuff_outer_par_5 <= binop_x_77011;
                if (ctx->logging)
                    fprintf(ctx->log, "Compared %s <= %ld: %s.\n",
                            "main.suff_outer_par_5", (long) binop_x_77011,
                            suff_outer_par_71830 ? "true" : "false");
                
                int64_t segmap_group_sizze_72044;
                
                segmap_group_sizze_72044 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_71134;
                
                int64_t nest_sizze_72147 = q_65380 * binop_x_77011;
                int64_t segred_group_sizze_72148;
                
                segred_group_sizze_72148 =
                    *ctx->tuning_params.mainzisegred_group_sizze_71073;
                
                int64_t num_groups_72149;
                int32_t max_num_groups_79096;
                
                max_num_groups_79096 =
                    *ctx->tuning_params.mainzisegred_num_groups_71075;
                num_groups_72149 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(nest_sizze_72147,
                                                                        segred_group_sizze_72148),
                                                              sext_i32_i64(max_num_groups_79096))));
                
                int64_t segmap_group_sizze_72207;
                
                segmap_group_sizze_72207 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_71032;
                
                int64_t segred_group_sizze_72250;
                
                segred_group_sizze_72250 =
                    *ctx->tuning_params.mainzisegred_group_sizze_70946;
                
                int64_t num_groups_72251;
                int32_t max_num_groups_79097;
                
                max_num_groups_79097 =
                    *ctx->tuning_params.mainzisegred_num_groups_70948;
                num_groups_72251 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(nest_sizze_72147,
                                                                        segred_group_sizze_72250),
                                                              sext_i32_i64(max_num_groups_79097))));
                
                int64_t tile_sizze_76012;
                
                tile_sizze_76012 = *ctx->tuning_params.mainzitile_sizze_76011;
                
                int64_t group_sizze_76013 = tile_sizze_76012 * tile_sizze_76012;
                int64_t bytes_77524 = (int64_t) 8 * nest_sizze_71707;
                int64_t binop_y_77527 = (int64_t) 8 * n_65378;
                int64_t bytes_77528 = smax64((int64_t) 0, binop_y_77527);
                int64_t binop_y_77587 = (int64_t) 8 * q_65380;
                int64_t bytes_77588 = smax64((int64_t) 0, binop_y_77587);
                int64_t binop_y_77602 = (int64_t) 8 * n_m_65386;
                int64_t bytes_77603 = smax64((int64_t) 0, binop_y_77602);
                int64_t bytes_77641 = smax64((int64_t) 0, bytes_77524);
                int64_t binop_y_77658 = (int64_t) 8 * m_65377;
                int64_t bytes_77659 = smax64((int64_t) 0, binop_y_77658);
                int64_t binop_y_77672 = (int64_t) 8 * nest_sizze_71812;
                int64_t bytes_77673 = smax64((int64_t) 0, binop_y_77672);
                int64_t bytes_77678 = (int64_t) 8 * group_sizze_76013;
                int64_t bytes_77713 = smax64((int64_t) 0, bytes_77678);
                int64_t binop_x_78075 = (int64_t) 8 * tile_sizze_76012;
                int64_t sizze_78076 = tile_sizze_76012 * binop_x_78075;
                int64_t binop_x_78133 = (int64_t) 8 * tile_sizze_76012;
                int64_t num_bytes_78134 = tile_sizze_76012 * binop_x_78133;
                int64_t binop_x_78138 = (int64_t) 8 * tile_sizze_76012;
                int64_t num_bytes_78139 = tile_sizze_76012 * binop_x_78138;
                int64_t binop_x_78143 = (int64_t) 8 * tile_sizze_76012;
                int64_t num_bytes_78144 = tile_sizze_76012 * binop_x_78143;
                int64_t binop_x_78148 = (int64_t) 8 * tile_sizze_76012;
                int64_t num_bytes_78149 = tile_sizze_76012 * binop_x_78148;
                int64_t binop_x_78153 = (int64_t) 8 * tile_sizze_76012;
                int64_t num_bytes_78154 = tile_sizze_76012 * binop_x_78153;
                int64_t maxSubHelper_78200 = umax64(bytes_77528, bytes_77603);
                int64_t maxSubHelper_78207 = umax64(bytes_77678, sizze_78076);
                int64_t maxSubHelper_78208 = umax64(num_bytes_78154,
                                                    maxSubHelper_78207);
                int64_t maxSubHelper_78209 = umax64(bytes_77678, sizze_78076);
                int64_t maxSubHelper_78210 = umax64(num_bytes_78149,
                                                    maxSubHelper_78209);
                int64_t maxSubHelper_78211 = umax64(bytes_77678, sizze_78076);
                int64_t maxSubHelper_78212 = umax64(num_bytes_78144,
                                                    maxSubHelper_78211);
                int64_t maxSubHelper_78213 = umax64(bytes_77678, sizze_78076);
                int64_t maxSubHelper_78214 = umax64(num_bytes_78139,
                                                    maxSubHelper_78213);
                int64_t maxSubHelper_78215 = umax64(sizze_78076,
                                                    num_bytes_78134);
                int64_t num_threads_78271 = segmap_group_sizze_70457 *
                        num_groups_70458;
                int64_t total_sizze_78272 = maxSubHelper_78200 *
                        num_threads_78271;
                int64_t total_sizze_78273 = bytes_77603 * num_threads_78271;
                int64_t total_sizze_78274 = bytes_77588 * num_threads_78271;
                int64_t total_sizze_78275 = bytes_77528 * num_threads_78271;
                int64_t total_sizze_78276 = bytes_77528 * num_threads_78271;
                int64_t total_sizze_78277 = bytes_77528 * num_threads_78271;
                struct memblock_device ext_mem_77854;
                
                ext_mem_77854.references = NULL;
                
                struct memblock_device ext_mem_77853;
                
                ext_mem_77853.references = NULL;
                
                int32_t local_memory_capacity_79554;
                
                local_memory_capacity_79554 = ctx->opencl.max_local_memory;
                if (sle64((int64_t) 0,
                          sext_i32_i64(local_memory_capacity_79554)) &&
                    suff_outer_par_70213) {
                    struct memblock_device mem_77525;
                    
                    mem_77525.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77525, bytes_77524,
                                              "mem_77525")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77525,
                                                              (int64_t) 0,
                                                              Y_mem_77010,
                                                              (int64_t) 0,
                                                              (int64_t) 1,
                                                              n_65378,
                                                              m_65377) != 0) {
                        if (memblock_unref_device(ctx, &mem_77525,
                                                  "mem_77525") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77853,
                                                  "ext_mem_77853") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77854,
                                                  "ext_mem_77854") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77634;
                    
                    mem_77634.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77634, binop_y_77012,
                                              "mem_77634")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77637;
                    
                    mem_77637.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77637, binop_y_77012,
                                              "mem_77637")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78201;
                    
                    color_78201.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78201,
                                              total_sizze_78272,
                                              "color_78201")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78202;
                    
                    color_78202.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78202,
                                              total_sizze_78273,
                                              "color_78202")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78203;
                    
                    color_78203.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78203,
                                              total_sizze_78274,
                                              "color_78203")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78204;
                    
                    color_78204.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78204,
                                              total_sizze_78275,
                                              "color_78204")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78205;
                    
                    color_78205.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78205,
                                              total_sizze_78276,
                                              "color_78205")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device color_78206;
                    
                    color_78206.references = NULL;
                    if (memblock_alloc_device(ctx, &color_78206,
                                              total_sizze_78277,
                                              "color_78206")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            1,
                                                            sizeof(ctx->failure_is_an_option),
                                                            &ctx->failure_is_an_option));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            3, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            4, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            5, sizeof(q_65380),
                                                            &q_65380));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            6,
                                                            sizeof(jump_65382),
                                                            &jump_65382));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            7,
                                                            sizeof(n_m_65386),
                                                            &n_m_65386));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            8, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            9, sizeof(x_65393),
                                                            &x_65393));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            10,
                                                            sizeof(min_res_65398),
                                                            &min_res_65398));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            11,
                                                            sizeof(loop_cond_65403),
                                                            &loop_cond_65403));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            12,
                                                            sizeof(i64_res_65404),
                                                            &i64_res_65404));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            13,
                                                            sizeof(num_groups_70458),
                                                            &num_groups_70458));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            14,
                                                            sizeof(num_threads_78271),
                                                            &num_threads_78271));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            15,
                                                            sizeof(mem_77525.mem),
                                                            &mem_77525.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            16,
                                                            sizeof(mem_77634.mem),
                                                            &mem_77634.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            17,
                                                            sizeof(mem_77637.mem),
                                                            &mem_77637.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            18,
                                                            sizeof(color_78201.mem),
                                                            &color_78201.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            19,
                                                            sizeof(color_78202.mem),
                                                            &color_78202.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            20,
                                                            sizeof(color_78203.mem),
                                                            &color_78203.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            21,
                                                            sizeof(color_78204.mem),
                                                            &color_78204.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            22,
                                                            sizeof(color_78205.mem),
                                                            &color_78205.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_70463,
                                                            23,
                                                            sizeof(color_78206.mem),
                                                            &color_78206.mem));
                    if (1 * ((size_t) num_groups_70458 *
                             (size_t) segmap_group_sizze_70457) != 0) {
                        const size_t global_work_sizze_80159[1] =
                                     {(size_t) num_groups_70458 *
                                     (size_t) segmap_group_sizze_70457};
                        const size_t local_work_sizze_80163[1] =
                                     {(size_t) segmap_group_sizze_70457};
                        int64_t time_start_80160 = 0, time_end_80161 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_70463",
                                    global_work_sizze_80159[0],
                                    local_work_sizze_80163[0], (int) 0);
                            time_start_80160 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_70463,
                                                                        1, NULL,
                                                                        global_work_sizze_80159,
                                                                        local_work_sizze_80163,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_70463_runs,
                                                                                                                  &ctx->mainzisegmap_70463_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80161 = get_wall_time();
                            
                            long time_diff_80162 = time_end_80161 -
                                 time_start_80160;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_70463", time_diff_80162);
                        }
                    }
                    ctx->failure_is_an_option = 1;
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    if (memblock_unref_device(ctx, &mem_77525, "mem_77525") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78201,
                                              "color_78201") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78202,
                                              "color_78202") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78203,
                                              "color_78203") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78204,
                                              "color_78204") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78205,
                                              "color_78205") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78206,
                                              "color_78206") != 0)
                        return 1;
                    
                    struct memblock_device mem_77846;
                    
                    mem_77846.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77846, bytes_77013,
                                              "mem_77846")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77846,
                                                              (int64_t) 0,
                                                              mem_77634,
                                                              (int64_t) 0,
                                                              (int64_t) 1,
                                                              m_65377,
                                                              n_m_65386) != 0) {
                        if (memblock_unref_device(ctx, &mem_77846,
                                                  "mem_77846") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78206,
                                                  "color_78206") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78205,
                                                  "color_78205") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78204,
                                                  "color_78204") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78203,
                                                  "color_78203") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78202,
                                                  "color_78202") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78201,
                                                  "color_78201") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77637,
                                                  "mem_77637") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77634,
                                                  "mem_77634") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77525,
                                                  "mem_77525") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77853,
                                                  "ext_mem_77853") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77854,
                                                  "ext_mem_77854") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_unref_device(ctx, &mem_77634, "mem_77634") !=
                        0)
                        return 1;
                    
                    struct memblock_device mem_77851;
                    
                    mem_77851.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77851, bytes_77013,
                                              "mem_77851")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhgpu_map_transpose_f64(ctx, mem_77851,
                                                              (int64_t) 0,
                                                              mem_77637,
                                                              (int64_t) 0,
                                                              (int64_t) 1,
                                                              m_65377,
                                                              n_m_65386) != 0) {
                        if (memblock_unref_device(ctx, &mem_77851,
                                                  "mem_77851") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77846,
                                                  "mem_77846") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78206,
                                                  "color_78206") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78205,
                                                  "color_78205") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78204,
                                                  "color_78204") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78203,
                                                  "color_78203") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78202,
                                                  "color_78202") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &color_78201,
                                                  "color_78201") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77637,
                                                  "mem_77637") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77634,
                                                  "mem_77634") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77525,
                                                  "mem_77525") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77853,
                                                  "ext_mem_77853") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77854,
                                                  "ext_mem_77854") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_unref_device(ctx, &mem_77637, "mem_77637") !=
                        0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77854, &mem_77846,
                                            "mem_77846") != 0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77853, &mem_77851,
                                            "mem_77851") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77851, "mem_77851") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77846, "mem_77846") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78206,
                                              "color_78206") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78205,
                                              "color_78205") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78204,
                                              "color_78204") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78203,
                                              "color_78203") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78202,
                                              "color_78202") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &color_78201,
                                              "color_78201") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77637, "mem_77637") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77634, "mem_77634") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77525, "mem_77525") !=
                        0)
                        return 1;
                } else {
                    struct memblock_device mem_77642;
                    
                    mem_77642.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77642, bytes_77641,
                                              "mem_77642")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (slt64((int64_t) 0, m_65377 * n_65378)) {
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegScan");
                        
                        int64_t stage1_max_num_groups_79139;
                        
                        stage1_max_num_groups_79139 =
                            ctx->opencl.max_group_size;
                        
                        int64_t stage1_num_groups_79140 =
                                smin64(stage1_max_num_groups_79139,
                                       num_groups_71709);
                        int32_t num_threads_79141 =
                                sext_i64_i32(stage1_num_groups_79140 *
                                segscan_group_sizze_71708);
                        
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_71714,
                                                                1,
                                                                (size_t) smax64((int64_t) 1,
                                                                                (int64_t) 8 *
                                                                                segscan_group_sizze_71708),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_71714,
                                                                2,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_71714,
                                                                3,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_71714,
                                                                4,
                                                                sizeof(num_threads_79141),
                                                                &num_threads_79141));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_71714,
                                                                5,
                                                                sizeof(Y_mem_77010.mem),
                                                                &Y_mem_77010.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_71714,
                                                                6,
                                                                sizeof(mem_77642.mem),
                                                                &mem_77642.mem));
                        if (1 * ((size_t) stage1_num_groups_79140 *
                                 (size_t) segscan_group_sizze_71708) != 0) {
                            const size_t global_work_sizze_80164[1] =
                                         {(size_t) stage1_num_groups_79140 *
                                         (size_t) segscan_group_sizze_71708};
                            const size_t local_work_sizze_80168[1] =
                                         {(size_t) segscan_group_sizze_71708};
                            int64_t time_start_80165 = 0, time_end_80166 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.scan_stage1_71714",
                                        global_work_sizze_80164[0],
                                        local_work_sizze_80168[0], (int) (0 +
                                                                          smax64((int64_t) 1,
                                                                                 (int64_t) 8 *
                                                                                 segscan_group_sizze_71708)));
                                time_start_80165 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainziscan_stage1_71714,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80164,
                                                                            local_work_sizze_80168,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainziscan_stage1_71714_runs,
                                                                                                                      &ctx->mainziscan_stage1_71714_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80166 = get_wall_time();
                                
                                long time_diff_80167 = time_end_80166 -
                                     time_start_80165;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.scan_stage1_71714",
                                        time_diff_80167);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c", "elems_per_group",
                                    (long long) (segscan_group_sizze_71708 *
                                                 sdiv_up64(m_65377 * n_65378,
                                                           sext_i32_i64(num_threads_79141))),
                                    '\n');
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_71714,
                                                                1,
                                                                (size_t) smax64((int64_t) 1,
                                                                                (int64_t) 8 *
                                                                                stage1_num_groups_79140),
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_71714,
                                                                2,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_71714,
                                                                3,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_71714,
                                                                4,
                                                                sizeof(stage1_num_groups_79140),
                                                                &stage1_num_groups_79140));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_71714,
                                                                5,
                                                                sizeof(num_threads_79141),
                                                                &num_threads_79141));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_71714,
                                                                6,
                                                                sizeof(mem_77642.mem),
                                                                &mem_77642.mem));
                        if (1 * ((size_t) (int64_t) 1 *
                                 (size_t) stage1_num_groups_79140) != 0) {
                            const size_t global_work_sizze_80169[1] =
                                         {(size_t) (int64_t) 1 *
                                         (size_t) stage1_num_groups_79140};
                            const size_t local_work_sizze_80173[1] =
                                         {(size_t) stage1_num_groups_79140};
                            int64_t time_start_80170 = 0, time_end_80171 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.scan_stage2_71714",
                                        global_work_sizze_80169[0],
                                        local_work_sizze_80173[0], (int) (0 +
                                                                          smax64((int64_t) 1,
                                                                                 (int64_t) 8 *
                                                                                 stage1_num_groups_79140)));
                                time_start_80170 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainziscan_stage2_71714,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80169,
                                                                            local_work_sizze_80173,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainziscan_stage2_71714_runs,
                                                                                                                      &ctx->mainziscan_stage2_71714_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80171 = get_wall_time();
                                
                                long time_diff_80172 = time_end_80171 -
                                     time_start_80170;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.scan_stage2_71714",
                                        time_diff_80172);
                            }
                        }
                        
                        int32_t required_groups_79192 =
                                sext_i64_i32(sdiv_up64(m_65377 * n_65378,
                                                       segscan_group_sizze_71708));
                        
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_71714,
                                                                1,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_71714,
                                                                2,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_71714,
                                                                3,
                                                                sizeof(num_groups_71709),
                                                                &num_groups_71709));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_71714,
                                                                4,
                                                                sizeof(num_threads_79141),
                                                                &num_threads_79141));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_71714,
                                                                5,
                                                                sizeof(required_groups_79192),
                                                                &required_groups_79192));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_71714,
                                                                6,
                                                                sizeof(mem_77642.mem),
                                                                &mem_77642.mem));
                        if (1 * ((size_t) num_groups_71709 *
                                 (size_t) segscan_group_sizze_71708) != 0) {
                            const size_t global_work_sizze_80174[1] =
                                         {(size_t) num_groups_71709 *
                                         (size_t) segscan_group_sizze_71708};
                            const size_t local_work_sizze_80178[1] =
                                         {(size_t) segscan_group_sizze_71708};
                            int64_t time_start_80175 = 0, time_end_80176 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.scan_stage3_71714",
                                        global_work_sizze_80174[0],
                                        local_work_sizze_80178[0], (int) 0);
                                time_start_80175 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainziscan_stage3_71714,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80174,
                                                                            local_work_sizze_80178,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainziscan_stage3_71714_runs,
                                                                                                                      &ctx->mainziscan_stage3_71714_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80176 = get_wall_time();
                                
                                long time_diff_80177 = time_end_80176 -
                                     time_start_80175;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.scan_stage3_71714",
                                        time_diff_80177);
                            }
                        }
                    }
                    
                    struct memblock_device mem_77646;
                    
                    mem_77646.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77646, bytes_77641,
                                              "mem_77646")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhreplicate_f64(ctx, mem_77646, m_65377 *
                                                      n_65378, 0.0) != 0) {
                        if (memblock_unref_device(ctx, &mem_77646,
                                                  "mem_77646") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77642,
                                                  "mem_77642") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77853,
                                                  "ext_mem_77853") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77854,
                                                  "ext_mem_77854") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77650;
                    
                    mem_77650.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77650, bytes_77641,
                                              "mem_77650")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhreplicate_i64(ctx, mem_77650, m_65377 *
                                                      n_65378, (int64_t) -1) !=
                        0) {
                        if (memblock_unref_device(ctx, &mem_77650,
                                                  "mem_77650") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77646,
                                                  "mem_77646") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77642,
                                                  "mem_77642") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77853,
                                                  "ext_mem_77853") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77854,
                                                  "ext_mem_77854") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77855,
                                                  "ext_mem_77855") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77856,
                                                  "ext_mem_77856") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77857,
                                                  "ext_mem_77857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_77858,
                                                  "ext_mem_77858") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78029,
                                                  "ext_mem_78029") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &ext_mem_78030,
                                                  "ext_mem_78030") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_out_78307,
                                                  "mem_out_78307") != 0)
                            return 1;
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t segmap_usable_groups_71762 =
                            sdiv_up64(nest_sizze_71707,
                                      segmap_group_sizze_71761);
                    
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71767,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71767,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71767,
                                                            3,
                                                            sizeof(Y_mem_77010.mem),
                                                            &Y_mem_77010.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71767,
                                                            4,
                                                            sizeof(mem_77642.mem),
                                                            &mem_77642.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71767,
                                                            5,
                                                            sizeof(mem_77646.mem),
                                                            &mem_77646.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71767,
                                                            6,
                                                            sizeof(mem_77650.mem),
                                                            &mem_77650.mem));
                    if (1 * ((size_t) segmap_usable_groups_71762 *
                             (size_t) segmap_group_sizze_71761) != 0) {
                        const size_t global_work_sizze_80179[1] =
                                     {(size_t) segmap_usable_groups_71762 *
                                     (size_t) segmap_group_sizze_71761};
                        const size_t local_work_sizze_80183[1] =
                                     {(size_t) segmap_group_sizze_71761};
                        int64_t time_start_80180 = 0, time_end_80181 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_71767",
                                    global_work_sizze_80179[0],
                                    local_work_sizze_80183[0], (int) 0);
                            time_start_80180 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_71767,
                                                                        1, NULL,
                                                                        global_work_sizze_80179,
                                                                        local_work_sizze_80183,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_71767_runs,
                                                                                                                  &ctx->mainzisegmap_71767_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80181 = get_wall_time();
                            
                            long time_diff_80182 = time_end_80181 -
                                 time_start_80180;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_71767", time_diff_80182);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    int64_t segmap_usable_groups_71782 =
                            sdiv_up64(nest_sizze_71707,
                                      segmap_group_sizze_71781);
                    struct memblock_device mem_77656;
                    
                    mem_77656.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77656, bytes_77641,
                                              "mem_77656")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71786,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71786,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71786,
                                                            3,
                                                            sizeof(mem_77650.mem),
                                                            &mem_77650.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71786,
                                                            4,
                                                            sizeof(mem_77656.mem),
                                                            &mem_77656.mem));
                    if (1 * ((size_t) segmap_usable_groups_71782 *
                             (size_t) segmap_group_sizze_71781) != 0) {
                        const size_t global_work_sizze_80184[1] =
                                     {(size_t) segmap_usable_groups_71782 *
                                     (size_t) segmap_group_sizze_71781};
                        const size_t local_work_sizze_80188[1] =
                                     {(size_t) segmap_group_sizze_71781};
                        int64_t time_start_80185 = 0, time_end_80186 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_71786",
                                    global_work_sizze_80184[0],
                                    local_work_sizze_80188[0], (int) 0);
                            time_start_80185 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_71786,
                                                                        1, NULL,
                                                                        global_work_sizze_80184,
                                                                        local_work_sizze_80188,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_71786_runs,
                                                                                                                  &ctx->mainzisegmap_71786_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80186 = get_wall_time();
                            
                            long time_diff_80187 = time_end_80186 -
                                 time_start_80185;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_71786", time_diff_80187);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    int64_t segmap_usable_groups_71792 = sdiv_up64(m_65377,
                                                                   segmap_group_sizze_71791);
                    struct memblock_device mem_77660;
                    
                    mem_77660.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77660, bytes_77659,
                                              "mem_77660")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77663;
                    
                    mem_77663.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77663, bytes_77659,
                                              "mem_77663")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77666;
                    
                    mem_77666.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77666, bytes_77659,
                                              "mem_77666")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device mem_77669;
                    
                    mem_77669.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77669, bytes_77659,
                                              "mem_77669")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            3, sizeof(q_65380),
                                                            &q_65380));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            4, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            5,
                                                            sizeof(min_res_65398),
                                                            &min_res_65398));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            6,
                                                            sizeof(i64_res_65404),
                                                            &i64_res_65404));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            7,
                                                            sizeof(mem_77642.mem),
                                                            &mem_77642.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            8,
                                                            sizeof(mem_77660.mem),
                                                            &mem_77660.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            9,
                                                            sizeof(mem_77663.mem),
                                                            &mem_77663.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            10,
                                                            sizeof(mem_77666.mem),
                                                            &mem_77666.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71798,
                                                            11,
                                                            sizeof(mem_77669.mem),
                                                            &mem_77669.mem));
                    if (1 * ((size_t) segmap_usable_groups_71792 *
                             (size_t) segmap_group_sizze_71791) != 0) {
                        const size_t global_work_sizze_80189[1] =
                                     {(size_t) segmap_usable_groups_71792 *
                                     (size_t) segmap_group_sizze_71791};
                        const size_t local_work_sizze_80193[1] =
                                     {(size_t) segmap_group_sizze_71791};
                        int64_t time_start_80190 = 0, time_end_80191 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_71798",
                                    global_work_sizze_80189[0],
                                    local_work_sizze_80193[0], (int) 0);
                            time_start_80190 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_71798,
                                                                        1, NULL,
                                                                        global_work_sizze_80189,
                                                                        local_work_sizze_80193,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_71798_runs,
                                                                                                                  &ctx->mainzisegmap_71798_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80191 = get_wall_time();
                            
                            long time_diff_80192 = time_end_80191 -
                                 time_start_80190;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_71798", time_diff_80192);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    int64_t segmap_usable_groups_71814 =
                            sdiv_up64(nest_sizze_71812,
                                      segmap_group_sizze_71813);
                    struct memblock_device mem_77674;
                    
                    mem_77674.references = NULL;
                    if (memblock_alloc_device(ctx, &mem_77674, bytes_77673,
                                              "mem_77674")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegMap");
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71818,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71818,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71818,
                                                            3, sizeof(q_65380),
                                                            &q_65380));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71818,
                                                            4, sizeof(i_65392),
                                                            &i_65392));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71818,
                                                            5,
                                                            sizeof(mem_77642.mem),
                                                            &mem_77642.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_71818,
                                                            6,
                                                            sizeof(mem_77674.mem),
                                                            &mem_77674.mem));
                    if (1 * ((size_t) segmap_usable_groups_71814 *
                             (size_t) segmap_group_sizze_71813) != 0) {
                        const size_t global_work_sizze_80194[1] =
                                     {(size_t) segmap_usable_groups_71814 *
                                     (size_t) segmap_group_sizze_71813};
                        const size_t local_work_sizze_80198[1] =
                                     {(size_t) segmap_group_sizze_71813};
                        int64_t time_start_80195 = 0, time_end_80196 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.segmap_71818",
                                    global_work_sizze_80194[0],
                                    local_work_sizze_80198[0], (int) 0);
                            time_start_80195 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainzisegmap_71818,
                                                                        1, NULL,
                                                                        global_work_sizze_80194,
                                                                        local_work_sizze_80198,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainzisegmap_71818_runs,
                                                                                                                  &ctx->mainzisegmap_71818_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80196 = get_wall_time();
                            
                            long time_diff_80197 = time_end_80196 -
                                 time_start_80195;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.segmap_71818", time_diff_80197);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "");
                    
                    struct memblock_device ext_mem_77842;
                    
                    ext_mem_77842.references = NULL;
                    
                    struct memblock_device ext_mem_77841;
                    
                    ext_mem_77841.references = NULL;
                    
                    int32_t local_memory_capacity_79553;
                    
                    local_memory_capacity_79553 = ctx->opencl.max_local_memory;
                    if (sle64(bytes_77713 + srem64((int64_t) 8 -
                                                   srem64(bytes_77713,
                                                          (int64_t) 8),
                                                   (int64_t) 8),
                              sext_i32_i64(local_memory_capacity_79553)) &&
                        suff_outer_par_71830) {
                        int64_t num_groups_x_76014 = sdiv_up64(m_65377,
                                                               tile_sizze_76012);
                        int64_t num_groups_y_76015 = sdiv_up64(n_m_65386,
                                                               tile_sizze_76012);
                        int64_t num_groups_top_76016 = num_groups_x_76014 *
                                num_groups_y_76015;
                        int64_t num_whole_tiles_76147 = squot64(q_65380,
                                                                tile_sizze_76012);
                        int64_t residual_input_76447 = srem64(q_65380,
                                                              tile_sizze_76012);
                        bool cond_76448 = residual_input_76447 == (int64_t) 0;
                        struct memblock_device mem_77772;
                        
                        mem_77772.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77772, bytes_77013,
                                                  "mem_77772")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77776;
                        
                        mem_77776.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77776, bytes_77013,
                                                  "mem_77776")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegMap");
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                1,
                                                                sizeof(ctx->failure_is_an_option),
                                                                &ctx->failure_is_an_option));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                3,
                                                                (size_t) bytes_77713,
                                                                NULL));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                4,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                5,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                6,
                                                                sizeof(q_65380),
                                                                &q_65380));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                7,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                8,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                9,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                10,
                                                                sizeof(x_65393),
                                                                &x_65393));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                11,
                                                                sizeof(min_res_65398),
                                                                &min_res_65398));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                12,
                                                                sizeof(loop_cond_65403),
                                                                &loop_cond_65403));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                13,
                                                                sizeof(num_groups_x_76014),
                                                                &num_groups_x_76014));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                14,
                                                                sizeof(num_groups_y_76015),
                                                                &num_groups_y_76015));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                15,
                                                                sizeof(num_whole_tiles_76147),
                                                                &num_whole_tiles_76147));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                16,
                                                                sizeof(residual_input_76447),
                                                                &residual_input_76447));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                17,
                                                                sizeof(cond_76448),
                                                                &cond_76448));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                18,
                                                                sizeof(mem_77642.mem),
                                                                &mem_77642.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                19,
                                                                sizeof(mem_77646.mem),
                                                                &mem_77646.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                20,
                                                                sizeof(mem_77650.mem),
                                                                &mem_77650.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                21,
                                                                sizeof(mem_77656.mem),
                                                                &mem_77656.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                22,
                                                                sizeof(mem_77660.mem),
                                                                &mem_77660.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                23,
                                                                sizeof(mem_77663.mem),
                                                                &mem_77663.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                24,
                                                                sizeof(mem_77666.mem),
                                                                &mem_77666.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                25,
                                                                sizeof(mem_77669.mem),
                                                                &mem_77669.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                26,
                                                                sizeof(mem_77674.mem),
                                                                &mem_77674.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                27,
                                                                sizeof(mem_77772.mem),
                                                                &mem_77772.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_76017,
                                                                28,
                                                                sizeof(mem_77776.mem),
                                                                &mem_77776.mem));
                        if (1 * ((size_t) num_groups_top_76016 *
                                 (size_t) group_sizze_76013) != 0) {
                            const size_t global_work_sizze_80199[1] =
                                         {(size_t) num_groups_top_76016 *
                                         (size_t) group_sizze_76013};
                            const size_t local_work_sizze_80203[1] =
                                         {(size_t) group_sizze_76013};
                            int64_t time_start_80200 = 0, time_end_80201 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segmap_intragroup_76017",
                                        global_work_sizze_80199[0],
                                        local_work_sizze_80203[0], (int) (0 +
                                                                          bytes_77713));
                                time_start_80200 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegmap_intragroup_76017,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80199,
                                                                            local_work_sizze_80203,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegmap_intragroup_76017_runs,
                                                                                                                      &ctx->mainzisegmap_intragroup_76017_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80201 = get_wall_time();
                                
                                long time_diff_80202 = time_end_80201 -
                                     time_start_80200;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segmap_intragroup_76017",
                                        time_diff_80202);
                            }
                        }
                        ctx->failure_is_an_option = 1;
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_set_device(ctx, &ext_mem_77842, &mem_77772,
                                                "mem_77772") != 0)
                            return 1;
                        if (memblock_set_device(ctx, &ext_mem_77841, &mem_77776,
                                                "mem_77776") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77776,
                                                  "mem_77776") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77772,
                                                  "mem_77772") != 0)
                            return 1;
                    } else {
                        int64_t segmap_usable_groups_72045 =
                                sdiv_up64(binop_x_77011,
                                          segmap_group_sizze_72044);
                        struct memblock_device mem_77781;
                        
                        mem_77781.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77781, bytes_77013,
                                                  "mem_77781")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77785;
                        
                        mem_77785.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77785, bytes_77013,
                                                  "mem_77785")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77789;
                        
                        mem_77789.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77789, bytes_77013,
                                                  "mem_77789")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegMap");
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                1,
                                                                sizeof(ctx->failure_is_an_option),
                                                                &ctx->failure_is_an_option));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                3,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                4,
                                                                sizeof(n_65378),
                                                                &n_65378));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                5,
                                                                sizeof(jump_65382),
                                                                &jump_65382));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                6,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                7,
                                                                sizeof(i_65392),
                                                                &i_65392));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                8,
                                                                sizeof(x_65393),
                                                                &x_65393));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                9,
                                                                sizeof(min_res_65398),
                                                                &min_res_65398));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                10,
                                                                sizeof(loop_cond_65403),
                                                                &loop_cond_65403));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                11,
                                                                sizeof(mem_77650.mem),
                                                                &mem_77650.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                12,
                                                                sizeof(mem_77656.mem),
                                                                &mem_77656.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                13,
                                                                sizeof(mem_77660.mem),
                                                                &mem_77660.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                14,
                                                                sizeof(mem_77663.mem),
                                                                &mem_77663.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                15,
                                                                sizeof(mem_77666.mem),
                                                                &mem_77666.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                16,
                                                                sizeof(mem_77669.mem),
                                                                &mem_77669.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                17,
                                                                sizeof(mem_77781.mem),
                                                                &mem_77781.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                18,
                                                                sizeof(mem_77785.mem),
                                                                &mem_77785.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72051,
                                                                19,
                                                                sizeof(mem_77789.mem),
                                                                &mem_77789.mem));
                        if (1 * ((size_t) segmap_usable_groups_72045 *
                                 (size_t) segmap_group_sizze_72044) != 0) {
                            const size_t global_work_sizze_80204[1] =
                                         {(size_t) segmap_usable_groups_72045 *
                                         (size_t) segmap_group_sizze_72044};
                            const size_t local_work_sizze_80208[1] =
                                         {(size_t) segmap_group_sizze_72044};
                            int64_t time_start_80205 = 0, time_end_80206 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segmap_72051",
                                        global_work_sizze_80204[0],
                                        local_work_sizze_80208[0], (int) 0);
                                time_start_80205 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegmap_72051,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80204,
                                                                            local_work_sizze_80208,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegmap_72051_runs,
                                                                                                                      &ctx->mainzisegmap_72051_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80206 = get_wall_time();
                                
                                long time_diff_80207 = time_end_80206 -
                                     time_start_80205;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segmap_72051", time_diff_80207);
                            }
                        }
                        ctx->failure_is_an_option = 1;
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &mem_77781,
                                                  "mem_77781") != 0)
                            return 1;
                        
                        struct memblock_device mem_77794;
                        
                        mem_77794.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77794, bytes_77013,
                                                  "mem_77794")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77798;
                        
                        mem_77798.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77798, bytes_77013,
                                                  "mem_77798")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77802;
                        
                        mem_77802.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77802, bytes_77013,
                                                  "mem_77802")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77806;
                        
                        mem_77806.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77806, bytes_77013,
                                                  "mem_77806")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77810;
                        
                        mem_77810.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77810, bytes_77013,
                                                  "mem_77810")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (slt64(q_65380 * (int64_t) 2,
                                  segred_group_sizze_72148)) {
                            int64_t segment_sizze_nonzzero_79329 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_79330 = num_groups_72149 *
                                    segred_group_sizze_72148;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-small");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "segments_per_group",
                                        (long long) squot64(segred_group_sizze_72148,
                                                            segment_sizze_nonzzero_79329),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "required_groups",
                                        (long long) sext_i64_i32(sdiv_up64(m_65377 *
                                                                           n_m_65386,
                                                                           squot64(segred_group_sizze_72148,
                                                                                   segment_sizze_nonzzero_79329))),
                                        '\n');
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    1,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    3,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    4,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    5,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    6,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    7,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    8,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    9,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    10,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    11,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    12,
                                                                    sizeof(num_groups_72149),
                                                                    &num_groups_72149));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    13,
                                                                    sizeof(segment_sizze_nonzzero_79329),
                                                                    &segment_sizze_nonzzero_79329));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    14,
                                                                    sizeof(mem_77642.mem),
                                                                    &mem_77642.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    15,
                                                                    sizeof(mem_77650.mem),
                                                                    &mem_77650.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    16,
                                                                    sizeof(mem_77674.mem),
                                                                    &mem_77674.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    17,
                                                                    sizeof(mem_77785.mem),
                                                                    &mem_77785.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    18,
                                                                    sizeof(mem_77789.mem),
                                                                    &mem_77789.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    19,
                                                                    sizeof(mem_77794.mem),
                                                                    &mem_77794.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    20,
                                                                    sizeof(mem_77798.mem),
                                                                    &mem_77798.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    21,
                                                                    sizeof(mem_77802.mem),
                                                                    &mem_77802.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    22,
                                                                    sizeof(mem_77806.mem),
                                                                    &mem_77806.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72159,
                                                                    23,
                                                                    sizeof(mem_77810.mem),
                                                                    &mem_77810.mem));
                            if (1 * ((size_t) num_groups_72149 *
                                     (size_t) segred_group_sizze_72148) != 0) {
                                const size_t global_work_sizze_80209[1] =
                                             {(size_t) num_groups_72149 *
                                             (size_t) segred_group_sizze_72148};
                                const size_t local_work_sizze_80213[1] =
                                             {(size_t) segred_group_sizze_72148};
                                int64_t time_start_80210 = 0, time_end_80211 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_small_72159",
                                            global_work_sizze_80209[0],
                                            local_work_sizze_80213[0],
                                            (int) (0 + (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148));
                                    time_start_80210 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_small_72159,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80209,
                                                                                local_work_sizze_80213,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_small_72159_runs,
                                                                                                                          &ctx->mainzisegred_small_72159_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80211 = get_wall_time();
                                    
                                    long time_diff_80212 = time_end_80211 -
                                         time_start_80210;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_small_72159",
                                            time_diff_80212);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_79382 =
                                    sdiv_up64(num_groups_72149,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_79383 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_72148 *
                                              groups_per_segment_79382);
                            int64_t virt_num_groups_79384 =
                                    groups_per_segment_79382 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_79385 = num_groups_72149 *
                                    segred_group_sizze_72148;
                            int64_t threads_per_segment_79386 =
                                    groups_per_segment_79382 *
                                    segred_group_sizze_72148;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-large");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "virt_num_groups",
                                        (long long) virt_num_groups_79384,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_groups",
                                        (long long) num_groups_72149, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "group_size",
                                        (long long) segred_group_sizze_72148,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "elems_per_thread",
                                        (long long) elements_per_thread_79383,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_79382,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_79387;
                            
                            segred_tmp_mem_79387.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79387,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79384,
                                                      "segred_tmp_mem_79387")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79389;
                            
                            segred_tmp_mem_79389.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79389,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79384,
                                                      "segred_tmp_mem_79389")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79391;
                            
                            segred_tmp_mem_79391.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79391,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79384,
                                                      "segred_tmp_mem_79391")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79393;
                            
                            segred_tmp_mem_79393.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79393,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79384,
                                                      "segred_tmp_mem_79393")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79395;
                            
                            segred_tmp_mem_79395.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79395,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79384,
                                                      "segred_tmp_mem_79395")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_79397 =
                                                   ctx->mainzicounter_mem_79397;
                            
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    1,
                                                                    (size_t) 1,
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    3,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    4,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    5,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    6,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72148),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    7,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    8,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    9,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    10,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    11,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    12,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    13,
                                                                    sizeof(num_groups_72149),
                                                                    &num_groups_72149));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    14,
                                                                    sizeof(groups_per_segment_79382),
                                                                    &groups_per_segment_79382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    15,
                                                                    sizeof(elements_per_thread_79383),
                                                                    &elements_per_thread_79383));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    16,
                                                                    sizeof(virt_num_groups_79384),
                                                                    &virt_num_groups_79384));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    17,
                                                                    sizeof(threads_per_segment_79386),
                                                                    &threads_per_segment_79386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    18,
                                                                    sizeof(mem_77642.mem),
                                                                    &mem_77642.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    19,
                                                                    sizeof(mem_77650.mem),
                                                                    &mem_77650.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    20,
                                                                    sizeof(mem_77674.mem),
                                                                    &mem_77674.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    21,
                                                                    sizeof(mem_77785.mem),
                                                                    &mem_77785.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    22,
                                                                    sizeof(mem_77789.mem),
                                                                    &mem_77789.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    23,
                                                                    sizeof(mem_77794.mem),
                                                                    &mem_77794.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    24,
                                                                    sizeof(mem_77798.mem),
                                                                    &mem_77798.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    25,
                                                                    sizeof(mem_77802.mem),
                                                                    &mem_77802.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    26,
                                                                    sizeof(mem_77806.mem),
                                                                    &mem_77806.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    27,
                                                                    sizeof(mem_77810.mem),
                                                                    &mem_77810.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    28,
                                                                    sizeof(segred_tmp_mem_79387.mem),
                                                                    &segred_tmp_mem_79387.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    29,
                                                                    sizeof(segred_tmp_mem_79389.mem),
                                                                    &segred_tmp_mem_79389.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    30,
                                                                    sizeof(segred_tmp_mem_79391.mem),
                                                                    &segred_tmp_mem_79391.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    31,
                                                                    sizeof(segred_tmp_mem_79393.mem),
                                                                    &segred_tmp_mem_79393.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    32,
                                                                    sizeof(segred_tmp_mem_79395.mem),
                                                                    &segred_tmp_mem_79395.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72159,
                                                                    33,
                                                                    sizeof(mainzicounter_mem_79397.mem),
                                                                    &mainzicounter_mem_79397.mem));
                            if (1 * ((size_t) num_groups_72149 *
                                     (size_t) segred_group_sizze_72148) != 0) {
                                const size_t global_work_sizze_80215[1] =
                                             {(size_t) num_groups_72149 *
                                             (size_t) segred_group_sizze_72148};
                                const size_t local_work_sizze_80219[1] =
                                             {(size_t) segred_group_sizze_72148};
                                int64_t time_start_80216 = 0, time_end_80217 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_large_72159",
                                            global_work_sizze_80215[0],
                                            local_work_sizze_80219[0],
                                            (int) (0 + 1 + (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72148));
                                    time_start_80216 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_large_72159,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80215,
                                                                                local_work_sizze_80219,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_large_72159_runs,
                                                                                                                          &ctx->mainzisegred_large_72159_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80217 = get_wall_time();
                                    
                                    long time_diff_80218 = time_end_80217 -
                                         time_start_80216;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_large_72159",
                                            time_diff_80218);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79395,
                                                      "segred_tmp_mem_79395") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79393,
                                                      "segred_tmp_mem_79393") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79391,
                                                      "segred_tmp_mem_79391") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79389,
                                                      "segred_tmp_mem_79389") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79387,
                                                      "segred_tmp_mem_79387") !=
                                0)
                                return 1;
                        }
                        
                        int64_t segmap_usable_groups_72208 =
                                sdiv_up64(binop_x_77011,
                                          segmap_group_sizze_72207);
                        struct memblock_device mem_77815;
                        
                        mem_77815.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77815, bytes_77013,
                                                  "mem_77815")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77819;
                        
                        mem_77819.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77819, bytes_77013,
                                                  "mem_77819")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77823;
                        
                        mem_77823.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77823, bytes_77013,
                                                  "mem_77823")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77827;
                        
                        mem_77827.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77827, bytes_77013,
                                                  "mem_77827")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77831;
                        
                        mem_77831.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77831, bytes_77013,
                                                  "mem_77831")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "\n# SegMap");
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                1,
                                                                sizeof(m_65377),
                                                                &m_65377));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                2,
                                                                sizeof(n_m_65386),
                                                                &n_m_65386));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                3,
                                                                sizeof(mem_77794.mem),
                                                                &mem_77794.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                4,
                                                                sizeof(mem_77798.mem),
                                                                &mem_77798.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                5,
                                                                sizeof(mem_77802.mem),
                                                                &mem_77802.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                6,
                                                                sizeof(mem_77806.mem),
                                                                &mem_77806.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                7,
                                                                sizeof(mem_77810.mem),
                                                                &mem_77810.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                8,
                                                                sizeof(mem_77815.mem),
                                                                &mem_77815.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                9,
                                                                sizeof(mem_77819.mem),
                                                                &mem_77819.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                10,
                                                                sizeof(mem_77823.mem),
                                                                &mem_77823.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                11,
                                                                sizeof(mem_77827.mem),
                                                                &mem_77827.mem));
                        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72216,
                                                                12,
                                                                sizeof(mem_77831.mem),
                                                                &mem_77831.mem));
                        if (1 * ((size_t) segmap_usable_groups_72208 *
                                 (size_t) segmap_group_sizze_72207) != 0) {
                            const size_t global_work_sizze_80220[1] =
                                         {(size_t) segmap_usable_groups_72208 *
                                         (size_t) segmap_group_sizze_72207};
                            const size_t local_work_sizze_80224[1] =
                                         {(size_t) segmap_group_sizze_72207};
                            int64_t time_start_80221 = 0, time_end_80222 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                        "main.segmap_72216",
                                        global_work_sizze_80220[0],
                                        local_work_sizze_80224[0], (int) 0);
                                time_start_80221 = get_wall_time();
                            }
                            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                            ctx->mainzisegmap_72216,
                                                                            1,
                                                                            NULL,
                                                                            global_work_sizze_80220,
                                                                            local_work_sizze_80224,
                                                                            0,
                                                                            NULL,
                                                                            ctx->profiling_paused ||
                                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                      &ctx->mainzisegmap_72216_runs,
                                                                                                                      &ctx->mainzisegmap_72216_total_runtime)));
                            if (ctx->debugging) {
                                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                time_end_80222 = get_wall_time();
                                
                                long time_diff_80223 = time_end_80222 -
                                     time_start_80221;
                                
                                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                        "main.segmap_72216", time_diff_80223);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &mem_77794,
                                                  "mem_77794") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77798,
                                                  "mem_77798") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77802,
                                                  "mem_77802") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77806,
                                                  "mem_77806") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77810,
                                                  "mem_77810") != 0)
                            return 1;
                        
                        struct memblock_device mem_77836;
                        
                        mem_77836.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77836, bytes_77013,
                                                  "mem_77836")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mem_77840;
                        
                        mem_77840.references = NULL;
                        if (memblock_alloc_device(ctx, &mem_77840, bytes_77013,
                                                  "mem_77840")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (slt64(q_65380 * (int64_t) 2,
                                  segred_group_sizze_72250)) {
                            int64_t segment_sizze_nonzzero_79467 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_79468 = num_groups_72251 *
                                    segred_group_sizze_72250;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-small");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "segments_per_group",
                                        (long long) squot64(segred_group_sizze_72250,
                                                            segment_sizze_nonzzero_79467),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "required_groups",
                                        (long long) sext_i64_i32(sdiv_up64(m_65377 *
                                                                           n_m_65386,
                                                                           squot64(segred_group_sizze_72250,
                                                                                   segment_sizze_nonzzero_79467))),
                                        '\n');
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    1,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72250),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72250),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    3,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    4,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    5,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    6,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    7,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    8,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    9,
                                                                    sizeof(num_groups_72251),
                                                                    &num_groups_72251));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    10,
                                                                    sizeof(segment_sizze_nonzzero_79467),
                                                                    &segment_sizze_nonzzero_79467));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    11,
                                                                    sizeof(mem_77642.mem),
                                                                    &mem_77642.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    12,
                                                                    sizeof(mem_77646.mem),
                                                                    &mem_77646.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    13,
                                                                    sizeof(mem_77650.mem),
                                                                    &mem_77650.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    14,
                                                                    sizeof(mem_77674.mem),
                                                                    &mem_77674.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    15,
                                                                    sizeof(mem_77785.mem),
                                                                    &mem_77785.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    16,
                                                                    sizeof(mem_77789.mem),
                                                                    &mem_77789.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    17,
                                                                    sizeof(mem_77815.mem),
                                                                    &mem_77815.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    18,
                                                                    sizeof(mem_77819.mem),
                                                                    &mem_77819.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    19,
                                                                    sizeof(mem_77823.mem),
                                                                    &mem_77823.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    20,
                                                                    sizeof(mem_77827.mem),
                                                                    &mem_77827.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    21,
                                                                    sizeof(mem_77831.mem),
                                                                    &mem_77831.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    22,
                                                                    sizeof(mem_77836.mem),
                                                                    &mem_77836.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_small_72258,
                                                                    23,
                                                                    sizeof(mem_77840.mem),
                                                                    &mem_77840.mem));
                            if (1 * ((size_t) num_groups_72251 *
                                     (size_t) segred_group_sizze_72250) != 0) {
                                const size_t global_work_sizze_80225[1] =
                                             {(size_t) num_groups_72251 *
                                             (size_t) segred_group_sizze_72250};
                                const size_t local_work_sizze_80229[1] =
                                             {(size_t) segred_group_sizze_72250};
                                int64_t time_start_80226 = 0, time_end_80227 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_small_72258",
                                            global_work_sizze_80225[0],
                                            local_work_sizze_80229[0],
                                            (int) (0 + (int64_t) 8 *
                                                   segred_group_sizze_72250 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72250));
                                    time_start_80226 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_small_72258,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80225,
                                                                                local_work_sizze_80229,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_small_72258_runs,
                                                                                                                          &ctx->mainzisegred_small_72258_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80227 = get_wall_time();
                                    
                                    long time_diff_80228 = time_end_80227 -
                                         time_start_80226;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_small_72258",
                                            time_diff_80228);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_79502 =
                                    sdiv_up64(num_groups_72251,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_79503 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_72250 *
                                              groups_per_segment_79502);
                            int64_t virt_num_groups_79504 =
                                    groups_per_segment_79502 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_79505 = num_groups_72251 *
                                    segred_group_sizze_72250;
                            int64_t threads_per_segment_79506 =
                                    groups_per_segment_79502 *
                                    segred_group_sizze_72250;
                            
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "\n# SegRed-large");
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_segments",
                                        (long long) (m_65377 * n_m_65386),
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "segment_size",
                                        (long long) q_65380, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "virt_num_groups",
                                        (long long) virt_num_groups_79504,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "num_groups",
                                        (long long) num_groups_72251, '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c", "group_size",
                                        (long long) segred_group_sizze_72250,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "elems_per_thread",
                                        (long long) elements_per_thread_79503,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_79502,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_79507;
                            
                            segred_tmp_mem_79507.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79507,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79504,
                                                      "segred_tmp_mem_79507")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79509;
                            
                            segred_tmp_mem_79509.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79509,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79504,
                                                      "segred_tmp_mem_79509")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_79511 =
                                                   ctx->mainzicounter_mem_79511;
                            
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    1,
                                                                    (size_t) 1,
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    2,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72250),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    3,
                                                                    (size_t) ((int64_t) 8 *
                                                                              segred_group_sizze_72250),
                                                                    NULL));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    4,
                                                                    sizeof(m_65377),
                                                                    &m_65377));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    5,
                                                                    sizeof(n_65378),
                                                                    &n_65378));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    6,
                                                                    sizeof(q_65380),
                                                                    &q_65380));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    7,
                                                                    sizeof(jump_65382),
                                                                    &jump_65382));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    8,
                                                                    sizeof(n_m_65386),
                                                                    &n_m_65386));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    9,
                                                                    sizeof(i_65392),
                                                                    &i_65392));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    10,
                                                                    sizeof(num_groups_72251),
                                                                    &num_groups_72251));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    11,
                                                                    sizeof(groups_per_segment_79502),
                                                                    &groups_per_segment_79502));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    12,
                                                                    sizeof(elements_per_thread_79503),
                                                                    &elements_per_thread_79503));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    13,
                                                                    sizeof(virt_num_groups_79504),
                                                                    &virt_num_groups_79504));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    14,
                                                                    sizeof(threads_per_segment_79506),
                                                                    &threads_per_segment_79506));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    15,
                                                                    sizeof(mem_77642.mem),
                                                                    &mem_77642.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    16,
                                                                    sizeof(mem_77646.mem),
                                                                    &mem_77646.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    17,
                                                                    sizeof(mem_77650.mem),
                                                                    &mem_77650.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    18,
                                                                    sizeof(mem_77674.mem),
                                                                    &mem_77674.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    19,
                                                                    sizeof(mem_77785.mem),
                                                                    &mem_77785.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    20,
                                                                    sizeof(mem_77789.mem),
                                                                    &mem_77789.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    21,
                                                                    sizeof(mem_77815.mem),
                                                                    &mem_77815.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    22,
                                                                    sizeof(mem_77819.mem),
                                                                    &mem_77819.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    23,
                                                                    sizeof(mem_77823.mem),
                                                                    &mem_77823.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    24,
                                                                    sizeof(mem_77827.mem),
                                                                    &mem_77827.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    25,
                                                                    sizeof(mem_77831.mem),
                                                                    &mem_77831.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    26,
                                                                    sizeof(mem_77836.mem),
                                                                    &mem_77836.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    27,
                                                                    sizeof(mem_77840.mem),
                                                                    &mem_77840.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    28,
                                                                    sizeof(segred_tmp_mem_79507.mem),
                                                                    &segred_tmp_mem_79507.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    29,
                                                                    sizeof(segred_tmp_mem_79509.mem),
                                                                    &segred_tmp_mem_79509.mem));
                            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegred_large_72258,
                                                                    30,
                                                                    sizeof(mainzicounter_mem_79511.mem),
                                                                    &mainzicounter_mem_79511.mem));
                            if (1 * ((size_t) num_groups_72251 *
                                     (size_t) segred_group_sizze_72250) != 0) {
                                const size_t global_work_sizze_80231[1] =
                                             {(size_t) num_groups_72251 *
                                             (size_t) segred_group_sizze_72250};
                                const size_t local_work_sizze_80235[1] =
                                             {(size_t) segred_group_sizze_72250};
                                int64_t time_start_80232 = 0, time_end_80233 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                            "main.segred_large_72258",
                                            global_work_sizze_80231[0],
                                            local_work_sizze_80235[0],
                                            (int) (0 + 1 + (int64_t) 8 *
                                                   segred_group_sizze_72250 +
                                                   (int64_t) 8 *
                                                   segred_group_sizze_72250));
                                    time_start_80232 = get_wall_time();
                                }
                                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                                ctx->mainzisegred_large_72258,
                                                                                1,
                                                                                NULL,
                                                                                global_work_sizze_80231,
                                                                                local_work_sizze_80235,
                                                                                0,
                                                                                NULL,
                                                                                ctx->profiling_paused ||
                                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                          &ctx->mainzisegred_large_72258_runs,
                                                                                                                          &ctx->mainzisegred_large_72258_total_runtime)));
                                if (ctx->debugging) {
                                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                                    time_end_80233 = get_wall_time();
                                    
                                    long time_diff_80234 = time_end_80233 -
                                         time_start_80232;
                                    
                                    fprintf(ctx->log,
                                            "kernel %s runtime: %ldus\n",
                                            "main.segred_large_72258",
                                            time_diff_80234);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79509,
                                                      "segred_tmp_mem_79509") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79507,
                                                      "segred_tmp_mem_79507") !=
                                0)
                                return 1;
                        }
                        if (memblock_unref_device(ctx, &mem_77785,
                                                  "mem_77785") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77789,
                                                  "mem_77789") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77815,
                                                  "mem_77815") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77819,
                                                  "mem_77819") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77823,
                                                  "mem_77823") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77827,
                                                  "mem_77827") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77831,
                                                  "mem_77831") != 0)
                            return 1;
                        if (memblock_set_device(ctx, &ext_mem_77842, &mem_77836,
                                                "mem_77836") != 0)
                            return 1;
                        if (memblock_set_device(ctx, &ext_mem_77841, &mem_77840,
                                                "mem_77840") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77840,
                                                  "mem_77840") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77836,
                                                  "mem_77836") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77831,
                                                  "mem_77831") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77827,
                                                  "mem_77827") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77823,
                                                  "mem_77823") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77819,
                                                  "mem_77819") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77815,
                                                  "mem_77815") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77810,
                                                  "mem_77810") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77806,
                                                  "mem_77806") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77802,
                                                  "mem_77802") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77798,
                                                  "mem_77798") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77794,
                                                  "mem_77794") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77789,
                                                  "mem_77789") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77785,
                                                  "mem_77785") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &mem_77781,
                                                  "mem_77781") != 0)
                            return 1;
                    }
                    if (memblock_unref_device(ctx, &mem_77642, "mem_77642") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77646, "mem_77646") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77650, "mem_77650") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77656, "mem_77656") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77660, "mem_77660") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77663, "mem_77663") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77666, "mem_77666") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77669, "mem_77669") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77674, "mem_77674") !=
                        0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77854, &ext_mem_77842,
                                            "ext_mem_77842") != 0)
                        return 1;
                    if (memblock_set_device(ctx, &ext_mem_77853, &ext_mem_77841,
                                            "ext_mem_77841") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77841,
                                              "ext_mem_77841") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_77842,
                                              "ext_mem_77842") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77674, "mem_77674") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77669, "mem_77669") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77666, "mem_77666") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77663, "mem_77663") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77660, "mem_77660") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77656, "mem_77656") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77650, "mem_77650") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77646, "mem_77646") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77642, "mem_77642") !=
                        0)
                        return 1;
                }
                if (memblock_set_device(ctx, &ext_mem_77856, &ext_mem_77854,
                                        "ext_mem_77854") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_77855, &ext_mem_77853,
                                        "ext_mem_77853") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_77853,
                                          "ext_mem_77853") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_77854,
                                          "ext_mem_77854") != 0)
                    return 1;
            }
            if (memblock_set_device(ctx, &ext_mem_77858, &ext_mem_77856,
                                    "ext_mem_77856") != 0)
                return 1;
            if (memblock_set_device(ctx, &ext_mem_77857, &ext_mem_77855,
                                    "ext_mem_77855") != 0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_77855, "ext_mem_77855") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_77856, "ext_mem_77856") !=
                0)
                return 1;
        }
        if (memblock_set_device(ctx, &ext_mem_78030, &ext_mem_77858,
                                "ext_mem_77858") != 0)
            return 1;
        if (memblock_set_device(ctx, &ext_mem_78029, &ext_mem_77857,
                                "ext_mem_77857") != 0)
            return 1;
        if (memblock_unref_device(ctx, &ext_mem_77857, "ext_mem_77857") != 0)
            return 1;
        if (memblock_unref_device(ctx, &ext_mem_77858, "ext_mem_77858") != 0)
            return 1;
    } else {
        bool match_lit_66036 = (int64_t) 0 == degree_65381;
        int64_t binop_x_77859 = m_65377 * n_m_65386;
        int64_t binop_y_77860 = (int64_t) 8 * binop_x_77859;
        int64_t bytes_77861 = smax64((int64_t) 0, binop_y_77860);
        int64_t binop_x_77864 = m_65377 * n_65378;
        int64_t binop_y_77865 = (int64_t) 8 * binop_x_77864;
        int64_t bytes_77866 = smax64((int64_t) 0, binop_y_77865);
        int64_t binop_y_77883 = (int64_t) 8 * m_65377;
        int64_t bytes_77884 = smax64((int64_t) 0, binop_y_77883);
        int64_t binop_x_77896 = m_65377 * q_65380;
        int64_t binop_y_77897 = (int64_t) 8 * binop_x_77896;
        int64_t bytes_77898 = smax64((int64_t) 0, binop_y_77897);
        int64_t binop_y_77902 = (int64_t) 8 * q_65380;
        int64_t bytes_77903 = smax64((int64_t) 0, binop_y_77902);
        struct memblock_device ext_mem_78028;
        
        ext_mem_78028.references = NULL;
        
        struct memblock_device ext_mem_78027;
        
        ext_mem_78027.references = NULL;
        if (match_lit_66036) {
            struct memblock_device mem_77862;
            
            mem_77862.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77862, bytes_77861,
                                      "mem_77862")) {
                err = 1;
                goto cleanup;
            }
            if (futrts_builtinzhreplicate_f64(ctx, mem_77862, m_65377 *
                                              n_m_65386, 0.0) != 0) {
                if (memblock_unref_device(ctx, &mem_77862, "mem_77862") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78027,
                                          "ext_mem_78027") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78028,
                                          "ext_mem_78028") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78029,
                                          "ext_mem_78029") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78030,
                                          "ext_mem_78030") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_out_78307,
                                          "mem_out_78307") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            
            int64_t segscan_group_sizze_72693;
            
            segscan_group_sizze_72693 =
                *ctx->tuning_params.mainzisegscan_group_sizze_72673;
            
            int64_t num_groups_72694;
            int32_t max_num_groups_79555;
            
            max_num_groups_79555 =
                *ctx->tuning_params.mainzisegscan_num_groups_72675;
            num_groups_72694 = sext_i64_i32(smax64((int64_t) 1,
                                                   smin64(sdiv_up64(binop_x_77864,
                                                                    segscan_group_sizze_72693),
                                                          sext_i32_i64(max_num_groups_79555))));
            
            struct memblock_device mem_77867;
            
            mem_77867.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77867, bytes_77866,
                                      "mem_77867")) {
                err = 1;
                goto cleanup;
            }
            if (slt64((int64_t) 0, m_65377 * n_65378)) {
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegScan");
                
                int64_t stage1_max_num_groups_79556;
                
                stage1_max_num_groups_79556 = ctx->opencl.max_group_size;
                
                int64_t stage1_num_groups_79557 =
                        smin64(stage1_max_num_groups_79556, num_groups_72694);
                int32_t num_threads_79558 =
                        sext_i64_i32(stage1_num_groups_79557 *
                        segscan_group_sizze_72693);
                
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_72699,
                                                        1,
                                                        (size_t) smax64((int64_t) 1,
                                                                        (int64_t) 8 *
                                                                        segscan_group_sizze_72693),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_72699,
                                                        2, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_72699,
                                                        3, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_72699,
                                                        4,
                                                        sizeof(num_threads_79558),
                                                        &num_threads_79558));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_72699,
                                                        5,
                                                        sizeof(Y_mem_77010.mem),
                                                        &Y_mem_77010.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_72699,
                                                        6,
                                                        sizeof(mem_77867.mem),
                                                        &mem_77867.mem));
                if (1 * ((size_t) stage1_num_groups_79557 *
                         (size_t) segscan_group_sizze_72693) != 0) {
                    const size_t global_work_sizze_80236[1] =
                                 {(size_t) stage1_num_groups_79557 *
                                 (size_t) segscan_group_sizze_72693};
                    const size_t local_work_sizze_80240[1] =
                                 {(size_t) segscan_group_sizze_72693};
                    int64_t time_start_80237 = 0, time_end_80238 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.scan_stage1_72699",
                                global_work_sizze_80236[0],
                                local_work_sizze_80240[0], (int) (0 +
                                                                  smax64((int64_t) 1,
                                                                         (int64_t) 8 *
                                                                         segscan_group_sizze_72693)));
                        time_start_80237 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainziscan_stage1_72699,
                                                                    1, NULL,
                                                                    global_work_sizze_80236,
                                                                    local_work_sizze_80240,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainziscan_stage1_72699_runs,
                                                                                                              &ctx->mainziscan_stage1_72699_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80238 = get_wall_time();
                        
                        long time_diff_80239 = time_end_80238 -
                             time_start_80237;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.scan_stage1_72699", time_diff_80239);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s: %llu%c", "elems_per_group",
                            (long long) (segscan_group_sizze_72693 *
                                         sdiv_up64(m_65377 * n_65378,
                                                   sext_i32_i64(num_threads_79558))),
                            '\n');
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_72699,
                                                        1,
                                                        (size_t) smax64((int64_t) 1,
                                                                        (int64_t) 8 *
                                                                        stage1_num_groups_79557),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_72699,
                                                        2, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_72699,
                                                        3, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_72699,
                                                        4,
                                                        sizeof(stage1_num_groups_79557),
                                                        &stage1_num_groups_79557));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_72699,
                                                        5,
                                                        sizeof(num_threads_79558),
                                                        &num_threads_79558));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_72699,
                                                        6,
                                                        sizeof(mem_77867.mem),
                                                        &mem_77867.mem));
                if (1 * ((size_t) (int64_t) 1 *
                         (size_t) stage1_num_groups_79557) != 0) {
                    const size_t global_work_sizze_80241[1] =
                                 {(size_t) (int64_t) 1 *
                                 (size_t) stage1_num_groups_79557};
                    const size_t local_work_sizze_80245[1] =
                                 {(size_t) stage1_num_groups_79557};
                    int64_t time_start_80242 = 0, time_end_80243 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.scan_stage2_72699",
                                global_work_sizze_80241[0],
                                local_work_sizze_80245[0], (int) (0 +
                                                                  smax64((int64_t) 1,
                                                                         (int64_t) 8 *
                                                                         stage1_num_groups_79557)));
                        time_start_80242 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainziscan_stage2_72699,
                                                                    1, NULL,
                                                                    global_work_sizze_80241,
                                                                    local_work_sizze_80245,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainziscan_stage2_72699_runs,
                                                                                                              &ctx->mainziscan_stage2_72699_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80243 = get_wall_time();
                        
                        long time_diff_80244 = time_end_80243 -
                             time_start_80242;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.scan_stage2_72699", time_diff_80244);
                    }
                }
                
                int32_t required_groups_79609 = sext_i64_i32(sdiv_up64(m_65377 *
                                                                       n_65378,
                                                                       segscan_group_sizze_72693));
                
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_72699,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_72699,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_72699,
                                                        3,
                                                        sizeof(num_groups_72694),
                                                        &num_groups_72694));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_72699,
                                                        4,
                                                        sizeof(num_threads_79558),
                                                        &num_threads_79558));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_72699,
                                                        5,
                                                        sizeof(required_groups_79609),
                                                        &required_groups_79609));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_72699,
                                                        6,
                                                        sizeof(mem_77867.mem),
                                                        &mem_77867.mem));
                if (1 * ((size_t) num_groups_72694 *
                         (size_t) segscan_group_sizze_72693) != 0) {
                    const size_t global_work_sizze_80246[1] =
                                 {(size_t) num_groups_72694 *
                                 (size_t) segscan_group_sizze_72693};
                    const size_t local_work_sizze_80250[1] =
                                 {(size_t) segscan_group_sizze_72693};
                    int64_t time_start_80247 = 0, time_end_80248 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.scan_stage3_72699",
                                global_work_sizze_80246[0],
                                local_work_sizze_80250[0], (int) 0);
                        time_start_80247 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainziscan_stage3_72699,
                                                                    1, NULL,
                                                                    global_work_sizze_80246,
                                                                    local_work_sizze_80250,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainziscan_stage3_72699_runs,
                                                                                                              &ctx->mainziscan_stage3_72699_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80248 = get_wall_time();
                        
                        long time_diff_80249 = time_end_80248 -
                             time_start_80247;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.scan_stage3_72699", time_diff_80249);
                    }
                }
            }
            
            struct memblock_device mem_77871;
            
            mem_77871.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77871, bytes_77866,
                                      "mem_77871")) {
                err = 1;
                goto cleanup;
            }
            if (futrts_builtinzhreplicate_f64(ctx, mem_77871, m_65377 * n_65378,
                                              0.0) != 0) {
                if (memblock_unref_device(ctx, &mem_77871, "mem_77871") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77867, "mem_77867") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77862, "mem_77862") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78027,
                                          "ext_mem_78027") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78028,
                                          "ext_mem_78028") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78029,
                                          "ext_mem_78029") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78030,
                                          "ext_mem_78030") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_out_78307,
                                          "mem_out_78307") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            
            struct memblock_device mem_77875;
            
            mem_77875.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77875, bytes_77866,
                                      "mem_77875")) {
                err = 1;
                goto cleanup;
            }
            if (futrts_builtinzhreplicate_i64(ctx, mem_77875, m_65377 * n_65378,
                                              (int64_t) -1) != 0) {
                if (memblock_unref_device(ctx, &mem_77875, "mem_77875") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77871, "mem_77871") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77867, "mem_77867") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77862, "mem_77862") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78027,
                                          "ext_mem_78027") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78028,
                                          "ext_mem_78028") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78029,
                                          "ext_mem_78029") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &ext_mem_78030,
                                          "ext_mem_78030") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_out_78307,
                                          "mem_out_78307") != 0)
                    return 1;
                err = 1;
                goto cleanup;
            }
            
            int64_t segmap_group_sizze_72746;
            
            segmap_group_sizze_72746 =
                *ctx->tuning_params.mainzisegmap_group_sizze_72587;
            
            int64_t segmap_usable_groups_72747 = sdiv_up64(binop_x_77864,
                                                           segmap_group_sizze_72746);
            
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "\n# SegMap");
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72752, 1,
                                                    sizeof(m_65377), &m_65377));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72752, 2,
                                                    sizeof(n_65378), &n_65378));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72752, 3,
                                                    sizeof(Y_mem_77010.mem),
                                                    &Y_mem_77010.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72752, 4,
                                                    sizeof(mem_77867.mem),
                                                    &mem_77867.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72752, 5,
                                                    sizeof(mem_77871.mem),
                                                    &mem_77871.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72752, 6,
                                                    sizeof(mem_77875.mem),
                                                    &mem_77875.mem));
            if (1 * ((size_t) segmap_usable_groups_72747 *
                     (size_t) segmap_group_sizze_72746) != 0) {
                const size_t global_work_sizze_80251[1] =
                             {(size_t) segmap_usable_groups_72747 *
                             (size_t) segmap_group_sizze_72746};
                const size_t local_work_sizze_80255[1] =
                             {(size_t) segmap_group_sizze_72746};
                int64_t time_start_80252 = 0, time_end_80253 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                            "main.segmap_72752", global_work_sizze_80251[0],
                            local_work_sizze_80255[0], (int) 0);
                    time_start_80252 = get_wall_time();
                }
                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                ctx->mainzisegmap_72752,
                                                                1, NULL,
                                                                global_work_sizze_80251,
                                                                local_work_sizze_80255,
                                                                0, NULL,
                                                                ctx->profiling_paused ||
                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                          &ctx->mainzisegmap_72752_runs,
                                                                                                          &ctx->mainzisegmap_72752_total_runtime)));
                if (ctx->debugging) {
                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                    time_end_80253 = get_wall_time();
                    
                    long time_diff_80254 = time_end_80253 - time_start_80252;
                    
                    fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                            "main.segmap_72752", time_diff_80254);
                }
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "");
            
            int64_t segmap_group_sizze_72766;
            
            segmap_group_sizze_72766 =
                *ctx->tuning_params.mainzisegmap_group_sizze_72561;
            
            int64_t segmap_usable_groups_72767 = sdiv_up64(binop_x_77864,
                                                           segmap_group_sizze_72766);
            struct memblock_device mem_77881;
            
            mem_77881.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77881, bytes_77866,
                                      "mem_77881")) {
                err = 1;
                goto cleanup;
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "\n# SegMap");
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72771, 1,
                                                    sizeof(m_65377), &m_65377));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72771, 2,
                                                    sizeof(n_65378), &n_65378));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72771, 3,
                                                    sizeof(mem_77875.mem),
                                                    &mem_77875.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72771, 4,
                                                    sizeof(mem_77881.mem),
                                                    &mem_77881.mem));
            if (1 * ((size_t) segmap_usable_groups_72767 *
                     (size_t) segmap_group_sizze_72766) != 0) {
                const size_t global_work_sizze_80256[1] =
                             {(size_t) segmap_usable_groups_72767 *
                             (size_t) segmap_group_sizze_72766};
                const size_t local_work_sizze_80260[1] =
                             {(size_t) segmap_group_sizze_72766};
                int64_t time_start_80257 = 0, time_end_80258 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                            "main.segmap_72771", global_work_sizze_80256[0],
                            local_work_sizze_80260[0], (int) 0);
                    time_start_80257 = get_wall_time();
                }
                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                ctx->mainzisegmap_72771,
                                                                1, NULL,
                                                                global_work_sizze_80256,
                                                                local_work_sizze_80260,
                                                                0, NULL,
                                                                ctx->profiling_paused ||
                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                          &ctx->mainzisegmap_72771_runs,
                                                                                                          &ctx->mainzisegmap_72771_total_runtime)));
                if (ctx->debugging) {
                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                    time_end_80258 = get_wall_time();
                    
                    long time_diff_80259 = time_end_80258 - time_start_80257;
                    
                    fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                            "main.segmap_72771", time_diff_80259);
                }
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "");
            
            int64_t segmap_group_sizze_72776;
            
            segmap_group_sizze_72776 =
                *ctx->tuning_params.mainzisegmap_group_sizze_72535;
            
            int64_t segmap_usable_groups_72777 = sdiv_up64(m_65377,
                                                           segmap_group_sizze_72776);
            struct memblock_device mem_77885;
            
            mem_77885.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77885, bytes_77884,
                                      "mem_77885")) {
                err = 1;
                goto cleanup;
            }
            
            struct memblock_device mem_77888;
            
            mem_77888.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77888, bytes_77884,
                                      "mem_77888")) {
                err = 1;
                goto cleanup;
            }
            
            struct memblock_device mem_77891;
            
            mem_77891.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77891, bytes_77884,
                                      "mem_77891")) {
                err = 1;
                goto cleanup;
            }
            
            struct memblock_device mem_77894;
            
            mem_77894.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77894, bytes_77884,
                                      "mem_77894")) {
                err = 1;
                goto cleanup;
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "\n# SegMap");
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 1,
                                                    sizeof(m_65377), &m_65377));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 2,
                                                    sizeof(n_65378), &n_65378));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 3,
                                                    sizeof(q_65380), &q_65380));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 4,
                                                    sizeof(i_65392), &i_65392));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 5,
                                                    sizeof(min_res_65398),
                                                    &min_res_65398));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 6,
                                                    sizeof(i64_res_65404),
                                                    &i64_res_65404));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 7,
                                                    sizeof(mem_77867.mem),
                                                    &mem_77867.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 8,
                                                    sizeof(mem_77885.mem),
                                                    &mem_77885.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 9,
                                                    sizeof(mem_77888.mem),
                                                    &mem_77888.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 10,
                                                    sizeof(mem_77891.mem),
                                                    &mem_77891.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72783, 11,
                                                    sizeof(mem_77894.mem),
                                                    &mem_77894.mem));
            if (1 * ((size_t) segmap_usable_groups_72777 *
                     (size_t) segmap_group_sizze_72776) != 0) {
                const size_t global_work_sizze_80261[1] =
                             {(size_t) segmap_usable_groups_72777 *
                             (size_t) segmap_group_sizze_72776};
                const size_t local_work_sizze_80265[1] =
                             {(size_t) segmap_group_sizze_72776};
                int64_t time_start_80262 = 0, time_end_80263 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                            "main.segmap_72783", global_work_sizze_80261[0],
                            local_work_sizze_80265[0], (int) 0);
                    time_start_80262 = get_wall_time();
                }
                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                ctx->mainzisegmap_72783,
                                                                1, NULL,
                                                                global_work_sizze_80261,
                                                                local_work_sizze_80265,
                                                                0, NULL,
                                                                ctx->profiling_paused ||
                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                          &ctx->mainzisegmap_72783_runs,
                                                                                                          &ctx->mainzisegmap_72783_total_runtime)));
                if (ctx->debugging) {
                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                    time_end_80263 = get_wall_time();
                    
                    long time_diff_80264 = time_end_80263 - time_start_80262;
                    
                    fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                            "main.segmap_72783", time_diff_80264);
                }
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "");
            
            int64_t segmap_group_sizze_72798;
            
            segmap_group_sizze_72798 =
                *ctx->tuning_params.mainzisegmap_group_sizze_72510;
            
            int64_t segmap_usable_groups_72799 = sdiv_up64(binop_x_77896,
                                                           segmap_group_sizze_72798);
            struct memblock_device mem_77899;
            
            mem_77899.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77899, bytes_77898,
                                      "mem_77899")) {
                err = 1;
                goto cleanup;
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "\n# SegMap");
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72803, 1,
                                                    sizeof(m_65377), &m_65377));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72803, 2,
                                                    sizeof(n_65378), &n_65378));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72803, 3,
                                                    sizeof(q_65380), &q_65380));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72803, 4,
                                                    sizeof(i_65392), &i_65392));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72803, 5,
                                                    sizeof(mem_77867.mem),
                                                    &mem_77867.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_72803, 6,
                                                    sizeof(mem_77899.mem),
                                                    &mem_77899.mem));
            if (1 * ((size_t) segmap_usable_groups_72799 *
                     (size_t) segmap_group_sizze_72798) != 0) {
                const size_t global_work_sizze_80266[1] =
                             {(size_t) segmap_usable_groups_72799 *
                             (size_t) segmap_group_sizze_72798};
                const size_t local_work_sizze_80270[1] =
                             {(size_t) segmap_group_sizze_72798};
                int64_t time_start_80267 = 0, time_end_80268 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                            "main.segmap_72803", global_work_sizze_80266[0],
                            local_work_sizze_80270[0], (int) 0);
                    time_start_80267 = get_wall_time();
                }
                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                ctx->mainzisegmap_72803,
                                                                1, NULL,
                                                                global_work_sizze_80266,
                                                                local_work_sizze_80270,
                                                                0, NULL,
                                                                ctx->profiling_paused ||
                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                          &ctx->mainzisegmap_72803_runs,
                                                                                                          &ctx->mainzisegmap_72803_total_runtime)));
                if (ctx->debugging) {
                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                    time_end_80268 = get_wall_time();
                    
                    long time_diff_80269 = time_end_80268 - time_start_80267;
                    
                    fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                            "main.segmap_72803", time_diff_80269);
                }
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "");
            
            struct memblock_device mem_77909;
            
            mem_77909.references = NULL;
            if (memblock_alloc_device(ctx, &mem_77909, bytes_77861,
                                      "mem_77909")) {
                err = 1;
                goto cleanup;
            }
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "\n# SegMap");
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    1,
                                                    sizeof(ctx->failure_is_an_option),
                                                    &ctx->failure_is_an_option));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    3, (size_t) ((int64_t) 8 *
                                                                 q_65380),
                                                    NULL));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    4, (size_t) ((int64_t) 8 *
                                                                 q_65380),
                                                    NULL));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    5, (size_t) bytes_77903,
                                                    NULL));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    6, sizeof(m_65377),
                                                    &m_65377));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    7, sizeof(n_65378),
                                                    &n_65378));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    8, sizeof(q_65380),
                                                    &q_65380));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    9, sizeof(jump_65382),
                                                    &jump_65382));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    10, sizeof(n_m_65386),
                                                    &n_m_65386));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    11, sizeof(i_65392),
                                                    &i_65392));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    12, sizeof(x_65393),
                                                    &x_65393));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    13, sizeof(min_res_65398),
                                                    &min_res_65398));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    14, sizeof(loop_cond_65403),
                                                    &loop_cond_65403));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    15, sizeof(mem_77867.mem),
                                                    &mem_77867.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    16, sizeof(mem_77871.mem),
                                                    &mem_77871.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    17, sizeof(mem_77875.mem),
                                                    &mem_77875.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    18, sizeof(mem_77881.mem),
                                                    &mem_77881.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    19, sizeof(mem_77885.mem),
                                                    &mem_77885.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    20, sizeof(mem_77888.mem),
                                                    &mem_77888.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    21, sizeof(mem_77891.mem),
                                                    &mem_77891.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    22, sizeof(mem_77894.mem),
                                                    &mem_77894.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    23, sizeof(mem_77899.mem),
                                                    &mem_77899.mem));
            OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_72819,
                                                    24, sizeof(mem_77909.mem),
                                                    &mem_77909.mem));
            if (1 * ((size_t) binop_x_77859 * (size_t) q_65380) != 0) {
                const size_t global_work_sizze_80271[1] =
                             {(size_t) binop_x_77859 * (size_t) q_65380};
                const size_t local_work_sizze_80275[1] = {(size_t) q_65380};
                int64_t time_start_80272 = 0, time_end_80273 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                            "main.segmap_intragroup_72819",
                            global_work_sizze_80271[0],
                            local_work_sizze_80275[0], (int) (0 + (int64_t) 8 *
                                                              q_65380 +
                                                              (int64_t) 8 *
                                                              q_65380 +
                                                              bytes_77903));
                    time_start_80272 = get_wall_time();
                }
                OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                ctx->mainzisegmap_intragroup_72819,
                                                                1, NULL,
                                                                global_work_sizze_80271,
                                                                local_work_sizze_80275,
                                                                0, NULL,
                                                                ctx->profiling_paused ||
                                                                !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                          &ctx->mainzisegmap_intragroup_72819_runs,
                                                                                                          &ctx->mainzisegmap_intragroup_72819_total_runtime)));
                if (ctx->debugging) {
                    OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                    time_end_80273 = get_wall_time();
                    
                    long time_diff_80274 = time_end_80273 - time_start_80272;
                    
                    fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                            "main.segmap_intragroup_72819", time_diff_80274);
                }
            }
            ctx->failure_is_an_option = 1;
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "");
            if (memblock_unref_device(ctx, &mem_77867, "mem_77867") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77871, "mem_77871") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77875, "mem_77875") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77881, "mem_77881") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77885, "mem_77885") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77888, "mem_77888") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77891, "mem_77891") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77894, "mem_77894") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77899, "mem_77899") != 0)
                return 1;
            if (memblock_set_device(ctx, &ext_mem_78028, &mem_77909,
                                    "mem_77909") != 0)
                return 1;
            if (memblock_set_device(ctx, &ext_mem_78027, &mem_77862,
                                    "mem_77862") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77909, "mem_77909") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77899, "mem_77899") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77894, "mem_77894") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77891, "mem_77891") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77888, "mem_77888") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77885, "mem_77885") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77881, "mem_77881") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77875, "mem_77875") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77871, "mem_77871") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77867, "mem_77867") != 0)
                return 1;
            if (memblock_unref_device(ctx, &mem_77862, "mem_77862") != 0)
                return 1;
        } else {
            bool match_lit_66202 = (int64_t) 1 == degree_65381;
            struct memblock_device ext_mem_78026;
            
            ext_mem_78026.references = NULL;
            
            struct memblock_device ext_mem_78025;
            
            ext_mem_78025.references = NULL;
            if (match_lit_66202) {
                int64_t segscan_group_sizze_73360;
                
                segscan_group_sizze_73360 =
                    *ctx->tuning_params.mainzisegscan_group_sizze_73340;
                
                int64_t num_groups_73361;
                int32_t max_num_groups_79686;
                
                max_num_groups_79686 =
                    *ctx->tuning_params.mainzisegscan_num_groups_73342;
                num_groups_73361 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(binop_x_77864,
                                                                        segscan_group_sizze_73360),
                                                              sext_i32_i64(max_num_groups_79686))));
                
                struct memblock_device mem_77914;
                
                mem_77914.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77914, bytes_77866,
                                          "mem_77914")) {
                    err = 1;
                    goto cleanup;
                }
                if (slt64((int64_t) 0, m_65377 * n_65378)) {
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegScan");
                    
                    int64_t stage1_max_num_groups_79687;
                    
                    stage1_max_num_groups_79687 = ctx->opencl.max_group_size;
                    
                    int64_t stage1_num_groups_79688 =
                            smin64(stage1_max_num_groups_79687,
                                   num_groups_73361);
                    int32_t num_threads_79689 =
                            sext_i64_i32(stage1_num_groups_79688 *
                            segscan_group_sizze_73360);
                    
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_73366,
                                                            1,
                                                            (size_t) smax64((int64_t) 1,
                                                                            (int64_t) 8 *
                                                                            segscan_group_sizze_73360),
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_73366,
                                                            2, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_73366,
                                                            3, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_73366,
                                                            4,
                                                            sizeof(num_threads_79689),
                                                            &num_threads_79689));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_73366,
                                                            5,
                                                            sizeof(Y_mem_77010.mem),
                                                            &Y_mem_77010.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_73366,
                                                            6,
                                                            sizeof(mem_77914.mem),
                                                            &mem_77914.mem));
                    if (1 * ((size_t) stage1_num_groups_79688 *
                             (size_t) segscan_group_sizze_73360) != 0) {
                        const size_t global_work_sizze_80276[1] =
                                     {(size_t) stage1_num_groups_79688 *
                                     (size_t) segscan_group_sizze_73360};
                        const size_t local_work_sizze_80280[1] =
                                     {(size_t) segscan_group_sizze_73360};
                        int64_t time_start_80277 = 0, time_end_80278 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage1_73366",
                                    global_work_sizze_80276[0],
                                    local_work_sizze_80280[0], (int) (0 +
                                                                      smax64((int64_t) 1,
                                                                             (int64_t) 8 *
                                                                             segscan_group_sizze_73360)));
                            time_start_80277 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage1_73366,
                                                                        1, NULL,
                                                                        global_work_sizze_80276,
                                                                        local_work_sizze_80280,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage1_73366_runs,
                                                                                                                  &ctx->mainziscan_stage1_73366_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80278 = get_wall_time();
                            
                            long time_diff_80279 = time_end_80278 -
                                 time_start_80277;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage1_73366", time_diff_80279);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c", "elems_per_group",
                                (long long) (segscan_group_sizze_73360 *
                                             sdiv_up64(m_65377 * n_65378,
                                                       sext_i32_i64(num_threads_79689))),
                                '\n');
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_73366,
                                                            1,
                                                            (size_t) smax64((int64_t) 1,
                                                                            (int64_t) 8 *
                                                                            stage1_num_groups_79688),
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_73366,
                                                            2, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_73366,
                                                            3, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_73366,
                                                            4,
                                                            sizeof(stage1_num_groups_79688),
                                                            &stage1_num_groups_79688));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_73366,
                                                            5,
                                                            sizeof(num_threads_79689),
                                                            &num_threads_79689));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_73366,
                                                            6,
                                                            sizeof(mem_77914.mem),
                                                            &mem_77914.mem));
                    if (1 * ((size_t) (int64_t) 1 *
                             (size_t) stage1_num_groups_79688) != 0) {
                        const size_t global_work_sizze_80281[1] =
                                     {(size_t) (int64_t) 1 *
                                     (size_t) stage1_num_groups_79688};
                        const size_t local_work_sizze_80285[1] =
                                     {(size_t) stage1_num_groups_79688};
                        int64_t time_start_80282 = 0, time_end_80283 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage2_73366",
                                    global_work_sizze_80281[0],
                                    local_work_sizze_80285[0], (int) (0 +
                                                                      smax64((int64_t) 1,
                                                                             (int64_t) 8 *
                                                                             stage1_num_groups_79688)));
                            time_start_80282 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage2_73366,
                                                                        1, NULL,
                                                                        global_work_sizze_80281,
                                                                        local_work_sizze_80285,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage2_73366_runs,
                                                                                                                  &ctx->mainziscan_stage2_73366_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80283 = get_wall_time();
                            
                            long time_diff_80284 = time_end_80283 -
                                 time_start_80282;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage2_73366", time_diff_80284);
                        }
                    }
                    
                    int32_t required_groups_79740 =
                            sext_i64_i32(sdiv_up64(m_65377 * n_65378,
                                                   segscan_group_sizze_73360));
                    
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_73366,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_73366,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_73366,
                                                            3,
                                                            sizeof(num_groups_73361),
                                                            &num_groups_73361));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_73366,
                                                            4,
                                                            sizeof(num_threads_79689),
                                                            &num_threads_79689));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_73366,
                                                            5,
                                                            sizeof(required_groups_79740),
                                                            &required_groups_79740));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_73366,
                                                            6,
                                                            sizeof(mem_77914.mem),
                                                            &mem_77914.mem));
                    if (1 * ((size_t) num_groups_73361 *
                             (size_t) segscan_group_sizze_73360) != 0) {
                        const size_t global_work_sizze_80286[1] =
                                     {(size_t) num_groups_73361 *
                                     (size_t) segscan_group_sizze_73360};
                        const size_t local_work_sizze_80290[1] =
                                     {(size_t) segscan_group_sizze_73360};
                        int64_t time_start_80287 = 0, time_end_80288 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage3_73366",
                                    global_work_sizze_80286[0],
                                    local_work_sizze_80290[0], (int) 0);
                            time_start_80287 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage3_73366,
                                                                        1, NULL,
                                                                        global_work_sizze_80286,
                                                                        local_work_sizze_80290,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage3_73366_runs,
                                                                                                                  &ctx->mainziscan_stage3_73366_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80288 = get_wall_time();
                            
                            long time_diff_80289 = time_end_80288 -
                                 time_start_80287;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage3_73366", time_diff_80289);
                        }
                    }
                }
                
                struct memblock_device mem_77918;
                
                mem_77918.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77918, bytes_77866,
                                          "mem_77918")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhreplicate_f64(ctx, mem_77918, m_65377 *
                                                  n_65378, 0.0) != 0) {
                    if (memblock_unref_device(ctx, &mem_77918, "mem_77918") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77914, "mem_77914") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78025,
                                              "ext_mem_78025") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78026,
                                              "ext_mem_78026") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78027,
                                              "ext_mem_78027") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78028,
                                              "ext_mem_78028") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77922;
                
                mem_77922.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77922, bytes_77866,
                                          "mem_77922")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhreplicate_i64(ctx, mem_77922, m_65377 *
                                                  n_65378, (int64_t) -1) != 0) {
                    if (memblock_unref_device(ctx, &mem_77922, "mem_77922") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77918, "mem_77918") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77914, "mem_77914") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78025,
                                              "ext_mem_78025") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78026,
                                              "ext_mem_78026") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78027,
                                              "ext_mem_78027") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78028,
                                              "ext_mem_78028") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                int64_t segmap_group_sizze_73413;
                
                segmap_group_sizze_73413 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_73254;
                
                int64_t segmap_usable_groups_73414 = sdiv_up64(binop_x_77864,
                                                               segmap_group_sizze_73413);
                
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73419,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73419,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73419,
                                                        3,
                                                        sizeof(Y_mem_77010.mem),
                                                        &Y_mem_77010.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73419,
                                                        4,
                                                        sizeof(mem_77914.mem),
                                                        &mem_77914.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73419,
                                                        5,
                                                        sizeof(mem_77918.mem),
                                                        &mem_77918.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73419,
                                                        6,
                                                        sizeof(mem_77922.mem),
                                                        &mem_77922.mem));
                if (1 * ((size_t) segmap_usable_groups_73414 *
                         (size_t) segmap_group_sizze_73413) != 0) {
                    const size_t global_work_sizze_80291[1] =
                                 {(size_t) segmap_usable_groups_73414 *
                                 (size_t) segmap_group_sizze_73413};
                    const size_t local_work_sizze_80295[1] =
                                 {(size_t) segmap_group_sizze_73413};
                    int64_t time_start_80292 = 0, time_end_80293 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_73419", global_work_sizze_80291[0],
                                local_work_sizze_80295[0], (int) 0);
                        time_start_80292 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_73419,
                                                                    1, NULL,
                                                                    global_work_sizze_80291,
                                                                    local_work_sizze_80295,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_73419_runs,
                                                                                                              &ctx->mainzisegmap_73419_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80293 = get_wall_time();
                        
                        long time_diff_80294 = time_end_80293 -
                             time_start_80292;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_73419", time_diff_80294);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_group_sizze_73433;
                
                segmap_group_sizze_73433 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_73228;
                
                int64_t segmap_usable_groups_73434 = sdiv_up64(binop_x_77864,
                                                               segmap_group_sizze_73433);
                struct memblock_device mem_77928;
                
                mem_77928.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77928, bytes_77866,
                                          "mem_77928")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73438,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73438,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73438,
                                                        3,
                                                        sizeof(mem_77922.mem),
                                                        &mem_77922.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73438,
                                                        4,
                                                        sizeof(mem_77928.mem),
                                                        &mem_77928.mem));
                if (1 * ((size_t) segmap_usable_groups_73434 *
                         (size_t) segmap_group_sizze_73433) != 0) {
                    const size_t global_work_sizze_80296[1] =
                                 {(size_t) segmap_usable_groups_73434 *
                                 (size_t) segmap_group_sizze_73433};
                    const size_t local_work_sizze_80300[1] =
                                 {(size_t) segmap_group_sizze_73433};
                    int64_t time_start_80297 = 0, time_end_80298 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_73438", global_work_sizze_80296[0],
                                local_work_sizze_80300[0], (int) 0);
                        time_start_80297 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_73438,
                                                                    1, NULL,
                                                                    global_work_sizze_80296,
                                                                    local_work_sizze_80300,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_73438_runs,
                                                                                                              &ctx->mainzisegmap_73438_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80298 = get_wall_time();
                        
                        long time_diff_80299 = time_end_80298 -
                             time_start_80297;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_73438", time_diff_80299);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_group_sizze_73443;
                
                segmap_group_sizze_73443 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_73202;
                
                int64_t segmap_usable_groups_73444 = sdiv_up64(m_65377,
                                                               segmap_group_sizze_73443);
                struct memblock_device mem_77932;
                
                mem_77932.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77932, bytes_77884,
                                          "mem_77932")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77935;
                
                mem_77935.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77935, bytes_77884,
                                          "mem_77935")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77938;
                
                mem_77938.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77938, bytes_77884,
                                          "mem_77938")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77941;
                
                mem_77941.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77941, bytes_77884,
                                          "mem_77941")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        3, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        4, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        5,
                                                        sizeof(min_res_65398),
                                                        &min_res_65398));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        6,
                                                        sizeof(i64_res_65404),
                                                        &i64_res_65404));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        7,
                                                        sizeof(mem_77914.mem),
                                                        &mem_77914.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        8,
                                                        sizeof(mem_77932.mem),
                                                        &mem_77932.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        9,
                                                        sizeof(mem_77935.mem),
                                                        &mem_77935.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        10,
                                                        sizeof(mem_77938.mem),
                                                        &mem_77938.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73450,
                                                        11,
                                                        sizeof(mem_77941.mem),
                                                        &mem_77941.mem));
                if (1 * ((size_t) segmap_usable_groups_73444 *
                         (size_t) segmap_group_sizze_73443) != 0) {
                    const size_t global_work_sizze_80301[1] =
                                 {(size_t) segmap_usable_groups_73444 *
                                 (size_t) segmap_group_sizze_73443};
                    const size_t local_work_sizze_80305[1] =
                                 {(size_t) segmap_group_sizze_73443};
                    int64_t time_start_80302 = 0, time_end_80303 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_73450", global_work_sizze_80301[0],
                                local_work_sizze_80305[0], (int) 0);
                        time_start_80302 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_73450,
                                                                    1, NULL,
                                                                    global_work_sizze_80301,
                                                                    local_work_sizze_80305,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_73450_runs,
                                                                                                              &ctx->mainzisegmap_73450_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80303 = get_wall_time();
                        
                        long time_diff_80304 = time_end_80303 -
                             time_start_80302;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_73450", time_diff_80304);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_group_sizze_73465;
                
                segmap_group_sizze_73465 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_73177;
                
                int64_t segmap_usable_groups_73466 = sdiv_up64(binop_x_77896,
                                                               segmap_group_sizze_73465);
                struct memblock_device mem_77946;
                
                mem_77946.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77946, bytes_77898,
                                          "mem_77946")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73470,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73470,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73470,
                                                        3, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73470,
                                                        4, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73470,
                                                        5,
                                                        sizeof(mem_77914.mem),
                                                        &mem_77914.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_73470,
                                                        6,
                                                        sizeof(mem_77946.mem),
                                                        &mem_77946.mem));
                if (1 * ((size_t) segmap_usable_groups_73466 *
                         (size_t) segmap_group_sizze_73465) != 0) {
                    const size_t global_work_sizze_80306[1] =
                                 {(size_t) segmap_usable_groups_73466 *
                                 (size_t) segmap_group_sizze_73465};
                    const size_t local_work_sizze_80310[1] =
                                 {(size_t) segmap_group_sizze_73465};
                    int64_t time_start_80307 = 0, time_end_80308 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_73470", global_work_sizze_80306[0],
                                local_work_sizze_80310[0], (int) 0);
                        time_start_80307 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_73470,
                                                                    1, NULL,
                                                                    global_work_sizze_80306,
                                                                    local_work_sizze_80310,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_73470_runs,
                                                                                                              &ctx->mainzisegmap_73470_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80308 = get_wall_time();
                        
                        long time_diff_80309 = time_end_80308 -
                             time_start_80307;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_73470", time_diff_80309);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                struct memblock_device mem_77959;
                
                mem_77959.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77959, bytes_77861,
                                          "mem_77959")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77963;
                
                mem_77963.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77963, bytes_77861,
                                          "mem_77963")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        1,
                                                        sizeof(ctx->failure_is_an_option),
                                                        &ctx->failure_is_an_option));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        3,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        4,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        5,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        6,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        7,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        8, (size_t) bytes_77903,
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        9, (size_t) bytes_77903,
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        10, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        11, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        12, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        13, sizeof(jump_65382),
                                                        &jump_65382));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        14, sizeof(n_m_65386),
                                                        &n_m_65386));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        15, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        16, sizeof(x_65393),
                                                        &x_65393));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        17,
                                                        sizeof(min_res_65398),
                                                        &min_res_65398));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        18,
                                                        sizeof(loop_cond_65403),
                                                        &loop_cond_65403));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        19,
                                                        sizeof(mem_77914.mem),
                                                        &mem_77914.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        20,
                                                        sizeof(mem_77918.mem),
                                                        &mem_77918.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        21,
                                                        sizeof(mem_77922.mem),
                                                        &mem_77922.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        22,
                                                        sizeof(mem_77928.mem),
                                                        &mem_77928.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        23,
                                                        sizeof(mem_77932.mem),
                                                        &mem_77932.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        24,
                                                        sizeof(mem_77935.mem),
                                                        &mem_77935.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        25,
                                                        sizeof(mem_77938.mem),
                                                        &mem_77938.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        26,
                                                        sizeof(mem_77941.mem),
                                                        &mem_77941.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        27,
                                                        sizeof(mem_77946.mem),
                                                        &mem_77946.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        28,
                                                        sizeof(mem_77959.mem),
                                                        &mem_77959.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_73487,
                                                        29,
                                                        sizeof(mem_77963.mem),
                                                        &mem_77963.mem));
                if (1 * ((size_t) binop_x_77859 * (size_t) q_65380) != 0) {
                    const size_t global_work_sizze_80311[1] =
                                 {(size_t) binop_x_77859 * (size_t) q_65380};
                    const size_t local_work_sizze_80315[1] = {(size_t) q_65380};
                    int64_t time_start_80312 = 0, time_end_80313 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_intragroup_73487",
                                global_work_sizze_80311[0],
                                local_work_sizze_80315[0], (int) (0 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  bytes_77903 +
                                                                  bytes_77903));
                        time_start_80312 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_intragroup_73487,
                                                                    1, NULL,
                                                                    global_work_sizze_80311,
                                                                    local_work_sizze_80315,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_intragroup_73487_runs,
                                                                                                              &ctx->mainzisegmap_intragroup_73487_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80313 = get_wall_time();
                        
                        long time_diff_80314 = time_end_80313 -
                             time_start_80312;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_intragroup_73487",
                                time_diff_80314);
                    }
                }
                ctx->failure_is_an_option = 1;
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                if (memblock_unref_device(ctx, &mem_77914, "mem_77914") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77918, "mem_77918") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77922, "mem_77922") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77928, "mem_77928") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77932, "mem_77932") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77935, "mem_77935") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77938, "mem_77938") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77941, "mem_77941") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77946, "mem_77946") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_78026, &mem_77959,
                                        "mem_77959") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_78025, &mem_77963,
                                        "mem_77963") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77963, "mem_77963") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77959, "mem_77959") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77946, "mem_77946") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77941, "mem_77941") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77938, "mem_77938") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77935, "mem_77935") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77932, "mem_77932") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77928, "mem_77928") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77922, "mem_77922") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77918, "mem_77918") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77914, "mem_77914") != 0)
                    return 1;
            } else {
                int64_t segscan_group_sizze_74117;
                
                segscan_group_sizze_74117 =
                    *ctx->tuning_params.mainzisegscan_group_sizze_74097;
                
                int64_t num_groups_74118;
                int32_t max_num_groups_79823;
                
                max_num_groups_79823 =
                    *ctx->tuning_params.mainzisegscan_num_groups_74099;
                num_groups_74118 = sext_i64_i32(smax64((int64_t) 1,
                                                       smin64(sdiv_up64(binop_x_77864,
                                                                        segscan_group_sizze_74117),
                                                              sext_i32_i64(max_num_groups_79823))));
                
                struct memblock_device mem_77968;
                
                mem_77968.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77968, bytes_77866,
                                          "mem_77968")) {
                    err = 1;
                    goto cleanup;
                }
                if (slt64((int64_t) 0, m_65377 * n_65378)) {
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s\n", "\n# SegScan");
                    
                    int64_t stage1_max_num_groups_79824;
                    
                    stage1_max_num_groups_79824 = ctx->opencl.max_group_size;
                    
                    int64_t stage1_num_groups_79825 =
                            smin64(stage1_max_num_groups_79824,
                                   num_groups_74118);
                    int32_t num_threads_79826 =
                            sext_i64_i32(stage1_num_groups_79825 *
                            segscan_group_sizze_74117);
                    
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_74123,
                                                            1,
                                                            (size_t) smax64((int64_t) 1,
                                                                            (int64_t) 8 *
                                                                            segscan_group_sizze_74117),
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_74123,
                                                            2, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_74123,
                                                            3, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_74123,
                                                            4,
                                                            sizeof(num_threads_79826),
                                                            &num_threads_79826));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_74123,
                                                            5,
                                                            sizeof(Y_mem_77010.mem),
                                                            &Y_mem_77010.mem));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage1_74123,
                                                            6,
                                                            sizeof(mem_77968.mem),
                                                            &mem_77968.mem));
                    if (1 * ((size_t) stage1_num_groups_79825 *
                             (size_t) segscan_group_sizze_74117) != 0) {
                        const size_t global_work_sizze_80316[1] =
                                     {(size_t) stage1_num_groups_79825 *
                                     (size_t) segscan_group_sizze_74117};
                        const size_t local_work_sizze_80320[1] =
                                     {(size_t) segscan_group_sizze_74117};
                        int64_t time_start_80317 = 0, time_end_80318 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage1_74123",
                                    global_work_sizze_80316[0],
                                    local_work_sizze_80320[0], (int) (0 +
                                                                      smax64((int64_t) 1,
                                                                             (int64_t) 8 *
                                                                             segscan_group_sizze_74117)));
                            time_start_80317 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage1_74123,
                                                                        1, NULL,
                                                                        global_work_sizze_80316,
                                                                        local_work_sizze_80320,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage1_74123_runs,
                                                                                                                  &ctx->mainziscan_stage1_74123_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80318 = get_wall_time();
                            
                            long time_diff_80319 = time_end_80318 -
                                 time_start_80317;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage1_74123", time_diff_80319);
                        }
                    }
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c", "elems_per_group",
                                (long long) (segscan_group_sizze_74117 *
                                             sdiv_up64(m_65377 * n_65378,
                                                       sext_i32_i64(num_threads_79826))),
                                '\n');
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_74123,
                                                            1,
                                                            (size_t) smax64((int64_t) 1,
                                                                            (int64_t) 8 *
                                                                            stage1_num_groups_79825),
                                                            NULL));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_74123,
                                                            2, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_74123,
                                                            3, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_74123,
                                                            4,
                                                            sizeof(stage1_num_groups_79825),
                                                            &stage1_num_groups_79825));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_74123,
                                                            5,
                                                            sizeof(num_threads_79826),
                                                            &num_threads_79826));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage2_74123,
                                                            6,
                                                            sizeof(mem_77968.mem),
                                                            &mem_77968.mem));
                    if (1 * ((size_t) (int64_t) 1 *
                             (size_t) stage1_num_groups_79825) != 0) {
                        const size_t global_work_sizze_80321[1] =
                                     {(size_t) (int64_t) 1 *
                                     (size_t) stage1_num_groups_79825};
                        const size_t local_work_sizze_80325[1] =
                                     {(size_t) stage1_num_groups_79825};
                        int64_t time_start_80322 = 0, time_end_80323 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage2_74123",
                                    global_work_sizze_80321[0],
                                    local_work_sizze_80325[0], (int) (0 +
                                                                      smax64((int64_t) 1,
                                                                             (int64_t) 8 *
                                                                             stage1_num_groups_79825)));
                            time_start_80322 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage2_74123,
                                                                        1, NULL,
                                                                        global_work_sizze_80321,
                                                                        local_work_sizze_80325,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage2_74123_runs,
                                                                                                                  &ctx->mainziscan_stage2_74123_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80323 = get_wall_time();
                            
                            long time_diff_80324 = time_end_80323 -
                                 time_start_80322;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage2_74123", time_diff_80324);
                        }
                    }
                    
                    int32_t required_groups_79877 =
                            sext_i64_i32(sdiv_up64(m_65377 * n_65378,
                                                   segscan_group_sizze_74117));
                    
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_74123,
                                                            1, sizeof(m_65377),
                                                            &m_65377));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_74123,
                                                            2, sizeof(n_65378),
                                                            &n_65378));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_74123,
                                                            3,
                                                            sizeof(num_groups_74118),
                                                            &num_groups_74118));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_74123,
                                                            4,
                                                            sizeof(num_threads_79826),
                                                            &num_threads_79826));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_74123,
                                                            5,
                                                            sizeof(required_groups_79877),
                                                            &required_groups_79877));
                    OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainziscan_stage3_74123,
                                                            6,
                                                            sizeof(mem_77968.mem),
                                                            &mem_77968.mem));
                    if (1 * ((size_t) num_groups_74118 *
                             (size_t) segscan_group_sizze_74117) != 0) {
                        const size_t global_work_sizze_80326[1] =
                                     {(size_t) num_groups_74118 *
                                     (size_t) segscan_group_sizze_74117};
                        const size_t local_work_sizze_80330[1] =
                                     {(size_t) segscan_group_sizze_74117};
                        int64_t time_start_80327 = 0, time_end_80328 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                    "main.scan_stage3_74123",
                                    global_work_sizze_80326[0],
                                    local_work_sizze_80330[0], (int) 0);
                            time_start_80327 = get_wall_time();
                        }
                        OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                        ctx->mainziscan_stage3_74123,
                                                                        1, NULL,
                                                                        global_work_sizze_80326,
                                                                        local_work_sizze_80330,
                                                                        0, NULL,
                                                                        ctx->profiling_paused ||
                                                                        !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                                  &ctx->mainziscan_stage3_74123_runs,
                                                                                                                  &ctx->mainziscan_stage3_74123_total_runtime)));
                        if (ctx->debugging) {
                            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                            time_end_80328 = get_wall_time();
                            
                            long time_diff_80329 = time_end_80328 -
                                 time_start_80327;
                            
                            fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                    "main.scan_stage3_74123", time_diff_80329);
                        }
                    }
                }
                
                struct memblock_device mem_77972;
                
                mem_77972.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77972, bytes_77866,
                                          "mem_77972")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhreplicate_f64(ctx, mem_77972, m_65377 *
                                                  n_65378, 0.0) != 0) {
                    if (memblock_unref_device(ctx, &mem_77972, "mem_77972") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77968, "mem_77968") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78025,
                                              "ext_mem_78025") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78026,
                                              "ext_mem_78026") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78027,
                                              "ext_mem_78027") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78028,
                                              "ext_mem_78028") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77976;
                
                mem_77976.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77976, bytes_77866,
                                          "mem_77976")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhreplicate_i64(ctx, mem_77976, m_65377 *
                                                  n_65378, (int64_t) -1) != 0) {
                    if (memblock_unref_device(ctx, &mem_77976, "mem_77976") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77972, "mem_77972") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_77968, "mem_77968") !=
                        0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78025,
                                              "ext_mem_78025") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78026,
                                              "ext_mem_78026") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78027,
                                              "ext_mem_78027") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78028,
                                              "ext_mem_78028") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78029,
                                              "ext_mem_78029") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &ext_mem_78030,
                                              "ext_mem_78030") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &mem_out_78307,
                                              "mem_out_78307") != 0)
                        return 1;
                    err = 1;
                    goto cleanup;
                }
                
                int64_t segmap_group_sizze_74170;
                
                segmap_group_sizze_74170 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_74011;
                
                int64_t segmap_usable_groups_74171 = sdiv_up64(binop_x_77864,
                                                               segmap_group_sizze_74170);
                
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74176,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74176,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74176,
                                                        3,
                                                        sizeof(Y_mem_77010.mem),
                                                        &Y_mem_77010.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74176,
                                                        4,
                                                        sizeof(mem_77968.mem),
                                                        &mem_77968.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74176,
                                                        5,
                                                        sizeof(mem_77972.mem),
                                                        &mem_77972.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74176,
                                                        6,
                                                        sizeof(mem_77976.mem),
                                                        &mem_77976.mem));
                if (1 * ((size_t) segmap_usable_groups_74171 *
                         (size_t) segmap_group_sizze_74170) != 0) {
                    const size_t global_work_sizze_80331[1] =
                                 {(size_t) segmap_usable_groups_74171 *
                                 (size_t) segmap_group_sizze_74170};
                    const size_t local_work_sizze_80335[1] =
                                 {(size_t) segmap_group_sizze_74170};
                    int64_t time_start_80332 = 0, time_end_80333 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_74176", global_work_sizze_80331[0],
                                local_work_sizze_80335[0], (int) 0);
                        time_start_80332 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_74176,
                                                                    1, NULL,
                                                                    global_work_sizze_80331,
                                                                    local_work_sizze_80335,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_74176_runs,
                                                                                                              &ctx->mainzisegmap_74176_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80333 = get_wall_time();
                        
                        long time_diff_80334 = time_end_80333 -
                             time_start_80332;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_74176", time_diff_80334);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_group_sizze_74190;
                
                segmap_group_sizze_74190 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_73985;
                
                int64_t segmap_usable_groups_74191 = sdiv_up64(binop_x_77864,
                                                               segmap_group_sizze_74190);
                struct memblock_device mem_77982;
                
                mem_77982.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77982, bytes_77866,
                                          "mem_77982")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74195,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74195,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74195,
                                                        3,
                                                        sizeof(mem_77976.mem),
                                                        &mem_77976.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74195,
                                                        4,
                                                        sizeof(mem_77982.mem),
                                                        &mem_77982.mem));
                if (1 * ((size_t) segmap_usable_groups_74191 *
                         (size_t) segmap_group_sizze_74190) != 0) {
                    const size_t global_work_sizze_80336[1] =
                                 {(size_t) segmap_usable_groups_74191 *
                                 (size_t) segmap_group_sizze_74190};
                    const size_t local_work_sizze_80340[1] =
                                 {(size_t) segmap_group_sizze_74190};
                    int64_t time_start_80337 = 0, time_end_80338 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_74195", global_work_sizze_80336[0],
                                local_work_sizze_80340[0], (int) 0);
                        time_start_80337 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_74195,
                                                                    1, NULL,
                                                                    global_work_sizze_80336,
                                                                    local_work_sizze_80340,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_74195_runs,
                                                                                                              &ctx->mainzisegmap_74195_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80338 = get_wall_time();
                        
                        long time_diff_80339 = time_end_80338 -
                             time_start_80337;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_74195", time_diff_80339);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_group_sizze_74200;
                
                segmap_group_sizze_74200 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_73959;
                
                int64_t segmap_usable_groups_74201 = sdiv_up64(m_65377,
                                                               segmap_group_sizze_74200);
                struct memblock_device mem_77986;
                
                mem_77986.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77986, bytes_77884,
                                          "mem_77986")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77989;
                
                mem_77989.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77989, bytes_77884,
                                          "mem_77989")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77992;
                
                mem_77992.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77992, bytes_77884,
                                          "mem_77992")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_77995;
                
                mem_77995.references = NULL;
                if (memblock_alloc_device(ctx, &mem_77995, bytes_77884,
                                          "mem_77995")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        3, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        4, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        5,
                                                        sizeof(min_res_65398),
                                                        &min_res_65398));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        6,
                                                        sizeof(i64_res_65404),
                                                        &i64_res_65404));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        7,
                                                        sizeof(mem_77968.mem),
                                                        &mem_77968.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        8,
                                                        sizeof(mem_77986.mem),
                                                        &mem_77986.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        9,
                                                        sizeof(mem_77989.mem),
                                                        &mem_77989.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        10,
                                                        sizeof(mem_77992.mem),
                                                        &mem_77992.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74207,
                                                        11,
                                                        sizeof(mem_77995.mem),
                                                        &mem_77995.mem));
                if (1 * ((size_t) segmap_usable_groups_74201 *
                         (size_t) segmap_group_sizze_74200) != 0) {
                    const size_t global_work_sizze_80341[1] =
                                 {(size_t) segmap_usable_groups_74201 *
                                 (size_t) segmap_group_sizze_74200};
                    const size_t local_work_sizze_80345[1] =
                                 {(size_t) segmap_group_sizze_74200};
                    int64_t time_start_80342 = 0, time_end_80343 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_74207", global_work_sizze_80341[0],
                                local_work_sizze_80345[0], (int) 0);
                        time_start_80342 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_74207,
                                                                    1, NULL,
                                                                    global_work_sizze_80341,
                                                                    local_work_sizze_80345,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_74207_runs,
                                                                                                              &ctx->mainzisegmap_74207_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80343 = get_wall_time();
                        
                        long time_diff_80344 = time_end_80343 -
                             time_start_80342;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_74207", time_diff_80344);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                int64_t segmap_group_sizze_74222;
                
                segmap_group_sizze_74222 =
                    *ctx->tuning_params.mainzisegmap_group_sizze_73934;
                
                int64_t segmap_usable_groups_74223 = sdiv_up64(binop_x_77896,
                                                               segmap_group_sizze_74222);
                struct memblock_device mem_78000;
                
                mem_78000.references = NULL;
                if (memblock_alloc_device(ctx, &mem_78000, bytes_77898,
                                          "mem_78000")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74227,
                                                        1, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74227,
                                                        2, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74227,
                                                        3, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74227,
                                                        4, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74227,
                                                        5,
                                                        sizeof(mem_77968.mem),
                                                        &mem_77968.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74227,
                                                        6,
                                                        sizeof(mem_78000.mem),
                                                        &mem_78000.mem));
                if (1 * ((size_t) segmap_usable_groups_74223 *
                         (size_t) segmap_group_sizze_74222) != 0) {
                    const size_t global_work_sizze_80346[1] =
                                 {(size_t) segmap_usable_groups_74223 *
                                 (size_t) segmap_group_sizze_74222};
                    const size_t local_work_sizze_80350[1] =
                                 {(size_t) segmap_group_sizze_74222};
                    int64_t time_start_80347 = 0, time_end_80348 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_74227", global_work_sizze_80346[0],
                                local_work_sizze_80350[0], (int) 0);
                        time_start_80347 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_74227,
                                                                    1, NULL,
                                                                    global_work_sizze_80346,
                                                                    local_work_sizze_80350,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_74227_runs,
                                                                                                              &ctx->mainzisegmap_74227_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80348 = get_wall_time();
                        
                        long time_diff_80349 = time_end_80348 -
                             time_start_80347;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_74227", time_diff_80349);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                struct memblock_device mem_78020;
                
                mem_78020.references = NULL;
                if (memblock_alloc_device(ctx, &mem_78020, bytes_77861,
                                          "mem_78020")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device mem_78024;
                
                mem_78024.references = NULL;
                if (memblock_alloc_device(ctx, &mem_78024, bytes_77861,
                                          "mem_78024")) {
                    err = 1;
                    goto cleanup;
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "\n# SegMap");
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        1,
                                                        sizeof(ctx->failure_is_an_option),
                                                        &ctx->failure_is_an_option));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        3,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        4,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        5,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        6,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        7,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        8,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        9,
                                                        (size_t) ((int64_t) 8 *
                                                                  q_65380),
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        10,
                                                        (size_t) bytes_77903,
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        11,
                                                        (size_t) bytes_77903,
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        12,
                                                        (size_t) bytes_77903,
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        13,
                                                        (size_t) bytes_77903,
                                                        NULL));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        14, sizeof(m_65377),
                                                        &m_65377));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        15, sizeof(n_65378),
                                                        &n_65378));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        16, sizeof(q_65380),
                                                        &q_65380));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        17, sizeof(jump_65382),
                                                        &jump_65382));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        18, sizeof(n_m_65386),
                                                        &n_m_65386));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        19, sizeof(i_65392),
                                                        &i_65392));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        20, sizeof(x_65393),
                                                        &x_65393));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        21,
                                                        sizeof(min_res_65398),
                                                        &min_res_65398));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        22,
                                                        sizeof(loop_cond_65403),
                                                        &loop_cond_65403));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        23,
                                                        sizeof(mem_77968.mem),
                                                        &mem_77968.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        24,
                                                        sizeof(mem_77972.mem),
                                                        &mem_77972.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        25,
                                                        sizeof(mem_77976.mem),
                                                        &mem_77976.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        26,
                                                        sizeof(mem_77982.mem),
                                                        &mem_77982.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        27,
                                                        sizeof(mem_77986.mem),
                                                        &mem_77986.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        28,
                                                        sizeof(mem_77989.mem),
                                                        &mem_77989.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        29,
                                                        sizeof(mem_77992.mem),
                                                        &mem_77992.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        30,
                                                        sizeof(mem_77995.mem),
                                                        &mem_77995.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        31,
                                                        sizeof(mem_78000.mem),
                                                        &mem_78000.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        32,
                                                        sizeof(mem_78020.mem),
                                                        &mem_78020.mem));
                OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_intragroup_74244,
                                                        33,
                                                        sizeof(mem_78024.mem),
                                                        &mem_78024.mem));
                if (1 * ((size_t) binop_x_77859 * (size_t) q_65380) != 0) {
                    const size_t global_work_sizze_80351[1] =
                                 {(size_t) binop_x_77859 * (size_t) q_65380};
                    const size_t local_work_sizze_80355[1] = {(size_t) q_65380};
                    int64_t time_start_80352 = 0, time_end_80353 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                                "main.segmap_intragroup_74244",
                                global_work_sizze_80351[0],
                                local_work_sizze_80355[0], (int) (0 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  (int64_t) 8 *
                                                                  q_65380 +
                                                                  bytes_77903 +
                                                                  bytes_77903 +
                                                                  bytes_77903 +
                                                                  bytes_77903));
                        time_start_80352 = get_wall_time();
                    }
                    OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                                    ctx->mainzisegmap_intragroup_74244,
                                                                    1, NULL,
                                                                    global_work_sizze_80351,
                                                                    local_work_sizze_80355,
                                                                    0, NULL,
                                                                    ctx->profiling_paused ||
                                                                    !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                              &ctx->mainzisegmap_intragroup_74244_runs,
                                                                                                              &ctx->mainzisegmap_intragroup_74244_total_runtime)));
                    if (ctx->debugging) {
                        OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                        time_end_80353 = get_wall_time();
                        
                        long time_diff_80354 = time_end_80353 -
                             time_start_80352;
                        
                        fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                                "main.segmap_intragroup_74244",
                                time_diff_80354);
                    }
                }
                ctx->failure_is_an_option = 1;
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                if (memblock_unref_device(ctx, &mem_77968, "mem_77968") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77972, "mem_77972") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77976, "mem_77976") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77982, "mem_77982") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77986, "mem_77986") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77989, "mem_77989") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77992, "mem_77992") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77995, "mem_77995") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_78000, "mem_78000") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_78026, &mem_78020,
                                        "mem_78020") != 0)
                    return 1;
                if (memblock_set_device(ctx, &ext_mem_78025, &mem_78024,
                                        "mem_78024") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_78024, "mem_78024") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_78020, "mem_78020") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_78000, "mem_78000") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77995, "mem_77995") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77992, "mem_77992") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77989, "mem_77989") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77986, "mem_77986") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77982, "mem_77982") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77976, "mem_77976") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77972, "mem_77972") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &mem_77968, "mem_77968") != 0)
                    return 1;
            }
            if (memblock_set_device(ctx, &ext_mem_78028, &ext_mem_78026,
                                    "ext_mem_78026") != 0)
                return 1;
            if (memblock_set_device(ctx, &ext_mem_78027, &ext_mem_78025,
                                    "ext_mem_78025") != 0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_78025, "ext_mem_78025") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_78026, "ext_mem_78026") !=
                0)
                return 1;
        }
        if (memblock_set_device(ctx, &ext_mem_78030, &ext_mem_78028,
                                "ext_mem_78028") != 0)
            return 1;
        if (memblock_set_device(ctx, &ext_mem_78029, &ext_mem_78027,
                                "ext_mem_78027") != 0)
            return 1;
        if (memblock_unref_device(ctx, &ext_mem_78027, "ext_mem_78027") != 0)
            return 1;
        if (memblock_unref_device(ctx, &ext_mem_78028, "ext_mem_78028") != 0)
            return 1;
    }
    
    bool cond_66666 = slt64((int64_t) 1, jump_65382);
    int64_t ext_78037;
    
    if (cond_66666) {
        ext_78037 = n_65378;
    } else {
        ext_78037 = n_m_65386;
    }
    
    int64_t binop_x_78032 = m_65377 * n_65378;
    int64_t binop_y_78033 = (int64_t) 8 * binop_x_78032;
    int64_t bytes_78034 = smax64((int64_t) 0, binop_y_78033);
    struct memblock_device ext_mem_78036;
    
    ext_mem_78036.references = NULL;
    if (cond_66666) {
        bool zzero_66668 = jump_65382 == (int64_t) 0;
        bool nonzzero_66669 = !zzero_66668;
        bool nonzzero_cert_66670;
        
        if (!nonzzero_66669) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  loess.fut:547:20-27\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  utils.fut:6:3-16\n   #4  loess.fut:546:3-550:9\n   #5  loess.fut:609:13-59\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:608:5-610:29\n   #9  loess.fut:573:1-612:26\n");
            if (memblock_unref_device(ctx, &ext_mem_78036, "ext_mem_78036") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_78029, "ext_mem_78029") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_78030, "ext_mem_78030") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &mem_out_78307, "mem_out_78307") !=
                0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t y_66671 = sub64(n_m_65386, (int64_t) 1);
        int64_t segmap_group_sizze_74584;
        
        segmap_group_sizze_74584 =
            *ctx->tuning_params.mainzisegmap_group_sizze_74466;
        
        int64_t segmap_usable_groups_74585 = sdiv_up64(binop_x_78032,
                                                       segmap_group_sizze_74584);
        struct memblock_device mem_78035;
        
        mem_78035.references = NULL;
        if (memblock_alloc_device(ctx, &mem_78035, bytes_78034, "mem_78035")) {
            err = 1;
            goto cleanup;
        }
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "\n# SegMap");
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 1,
                                                sizeof(ctx->failure_is_an_option),
                                                &ctx->failure_is_an_option));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 3,
                                                sizeof(m_65377), &m_65377));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 4,
                                                sizeof(n_65378), &n_65378));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 5,
                                                sizeof(jump_65382),
                                                &jump_65382));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 6,
                                                sizeof(n_m_65386), &n_m_65386));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 7,
                                                sizeof(i_65392), &i_65392));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 8,
                                                sizeof(y_66671), &y_66671));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 9,
                                                sizeof(ext_mem_78029.mem),
                                                &ext_mem_78029.mem));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 10,
                                                sizeof(ext_mem_78030.mem),
                                                &ext_mem_78030.mem));
        OPENCL_SUCCEED_OR_RETURN(clSetKernelArg(ctx->mainzisegmap_74589, 11,
                                                sizeof(mem_78035.mem),
                                                &mem_78035.mem));
        if (1 * ((size_t) segmap_usable_groups_74585 *
                 (size_t) segmap_group_sizze_74584) != 0) {
            const size_t global_work_sizze_80356[1] =
                         {(size_t) segmap_usable_groups_74585 *
                         (size_t) segmap_group_sizze_74584};
            const size_t local_work_sizze_80360[1] =
                         {(size_t) segmap_group_sizze_74584};
            int64_t time_start_80357 = 0, time_end_80358 = 0;
            
            if (ctx->debugging) {
                fprintf(ctx->log,
                        "Launching %s with global work size [%zu] and local work size [%zu]; local memory: %d bytes.\n",
                        "main.segmap_74589", global_work_sizze_80356[0],
                        local_work_sizze_80360[0], (int) 0);
                time_start_80357 = get_wall_time();
            }
            OPENCL_SUCCEED_OR_RETURN(clEnqueueNDRangeKernel(ctx->opencl.queue,
                                                            ctx->mainzisegmap_74589,
                                                            1, NULL,
                                                            global_work_sizze_80356,
                                                            local_work_sizze_80360,
                                                            0, NULL,
                                                            ctx->profiling_paused ||
                                                            !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                                      &ctx->mainzisegmap_74589_runs,
                                                                                                      &ctx->mainzisegmap_74589_total_runtime)));
            if (ctx->debugging) {
                OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
                time_end_80358 = get_wall_time();
                
                long time_diff_80359 = time_end_80358 - time_start_80357;
                
                fprintf(ctx->log, "kernel %s runtime: %ldus\n",
                        "main.segmap_74589", time_diff_80359);
            }
        }
        ctx->failure_is_an_option = 1;
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "");
        if (memblock_set_device(ctx, &ext_mem_78036, &mem_78035, "mem_78035") !=
            0)
            return 1;
        if (memblock_unref_device(ctx, &mem_78035, "mem_78035") != 0)
            return 1;
    } else {
        bool dim_match_66723 = n_65378 == n_m_65386;
        bool empty_or_match_cert_66724;
        
        if (!dim_match_66723) {
            ctx->error =
                msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                          "Value of (core language) shape (",
                          (long long) m_65377, ", ", (long long) n_m_65386,
                          ") cannot match shape of type `[",
                          (long long) m_65377, "][", (long long) n_65378,
                          "]f64`.",
                          "-> #0  loess.fut:612:5-26\n   #1  loess.fut:573:1-612:26\n");
            if (memblock_unref_device(ctx, &ext_mem_78036, "ext_mem_78036") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_78029, "ext_mem_78029") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &ext_mem_78030, "ext_mem_78030") !=
                0)
                return 1;
            if (memblock_unref_device(ctx, &mem_out_78307, "mem_out_78307") !=
                0)
                return 1;
            err = 1;
            goto cleanup;
        }
        if (memblock_set_device(ctx, &ext_mem_78036, &ext_mem_78030,
                                "ext_mem_78030") != 0)
            return 1;
    }
    if (memblock_unref_device(ctx, &ext_mem_78029, "ext_mem_78029") != 0)
        return 1;
    if (memblock_unref_device(ctx, &ext_mem_78030, "ext_mem_78030") != 0)
        return 1;
    
    struct memblock_device mem_78041;
    
    mem_78041.references = NULL;
    if (memblock_alloc_device(ctx, &mem_78041, bytes_78034, "mem_78041")) {
        err = 1;
        goto cleanup;
    }
    if (m_65377 * n_65378 * (int64_t) 8 > 0) {
        OPENCL_SUCCEED_OR_RETURN(clEnqueueCopyBuffer(ctx->opencl.queue,
                                                     ext_mem_78036.mem,
                                                     mem_78041.mem,
                                                     (size_t) (int64_t) 0,
                                                     (size_t) (int64_t) 0,
                                                     (size_t) (m_65377 *
                                                               n_65378 *
                                                               (int64_t) 8), 0,
                                                     NULL,
                                                     ctx->profiling_paused ||
                                                     !ctx->profiling ? NULL : opencl_get_event(&ctx->opencl,
                                                                                               &ctx->copy_dev_to_dev_runs,
                                                                                               &ctx->copy_dev_to_dev_total_runtime)));
        if (ctx->debugging)
            OPENCL_SUCCEED_FATAL(clFinish(ctx->opencl.queue));
    }
    if (memblock_unref_device(ctx, &ext_mem_78036, "ext_mem_78036") != 0)
        return 1;
    if (memblock_set_device(ctx, &mem_out_78307, &mem_78041, "mem_78041") != 0)
        return 1;
    (*mem_out_p_80004).references = NULL;
    if (memblock_set_device(ctx, &*mem_out_p_80004, &mem_out_78307,
                            "mem_out_78307") != 0)
        return 1;
    if (memblock_unref_device(ctx, &mem_78041, "mem_78041") != 0)
        return 1;
    if (memblock_unref_device(ctx, &ext_mem_78036, "ext_mem_78036") != 0)
        return 1;
    if (memblock_unref_device(ctx, &ext_mem_78029, "ext_mem_78029") != 0)
        return 1;
    if (memblock_unref_device(ctx, &ext_mem_78030, "ext_mem_78030") != 0)
        return 1;
    if (memblock_unref_device(ctx, &mem_out_78307, "mem_out_78307") != 0)
        return 1;
    
  cleanup:
    { }
    return err;
}

int futhark_entry_main(struct futhark_context *ctx,
                       struct futhark_f64_2d **out0, const
                       struct futhark_f64_2d *in0, const int64_t in1, const
                       int64_t in2, const int64_t in3, const int64_t in4, const
                       int64_t in5)
{
    struct memblock_device Y_mem_77010;
    
    Y_mem_77010.references = NULL;
    
    int64_t m_65377;
    int64_t n_65378;
    int64_t q_65380;
    int64_t degree_65381;
    int64_t jump_65382;
    int64_t jump_threshold_65383;
    int64_t q_threshold_65384;
    struct memblock_device mem_out_78307;
    
    mem_out_78307.references = NULL;
    
    int ret = 0;
    
    lock_lock(&ctx->lock);
    Y_mem_77010 = in0->mem;
    m_65377 = in0->shape[0];
    n_65378 = in0->shape[1];
    q_65380 = in1;
    degree_65381 = in2;
    jump_65382 = in3;
    jump_threshold_65383 = in4;
    q_threshold_65384 = in5;
    if (!(m_65377 == in0->shape[0] && n_65378 == in0->shape[1])) {
        ret = 1;
        if (!ctx->error)
            ctx->error =
                msgprintf("Error: entry point arguments have invalid sizes.\n");
    }
    if (ret == 0) {
        ret = futrts_entry_main(ctx, &mem_out_78307, Y_mem_77010, m_65377,
                                n_65378, q_65380, degree_65381, jump_65382,
                                jump_threshold_65383, q_threshold_65384);
        if (ret == 0) {
            assert((*out0 =
                    (struct futhark_f64_2d *) malloc(sizeof(struct futhark_f64_2d))) !=
                NULL);
            (*out0)->mem = mem_out_78307;
            (*out0)->shape[0] = m_65377;
            (*out0)->shape[1] = n_65378;
        }
    }
    lock_unlock(&ctx->lock);
    return ret;
}
  
