// 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>

#include <cuda.h>
#include <cuda_runtime.h>
#include <nvrtc.h>

#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_nvrtc_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_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_ptx_to(struct futhark_context_config *cfg,
                                        const char *path);
void futhark_context_config_load_ptx_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);
void futhark_context_free(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
                                              CUdeviceptr 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);
CUdeviceptr 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_cuda

#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>


#include <cuda.h>
#include <cuda_runtime.h>
#include <nvrtc.h>


// 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 mainziid_counter_mem_realtype_80265[1];
static int32_t mainzicounter_mem_realtype_80340[10240];
static int32_t mainzicounter_mem_realtype_80374[10240];
static int32_t mainziid_counter_mem_realtype_80404[1];
static int32_t mainzicounter_mem_realtype_80486[10240];
static int32_t mainzicounter_mem_realtype_80537[10240];
static int32_t mainziid_counter_mem_realtype_80573[1];
static int32_t mainzicounter_mem_realtype_80661[10240];
static int32_t mainzicounter_mem_realtype_80726[10240];
static int32_t mainziid_counter_mem_realtype_80752[1];
static int32_t mainziid_counter_mem_realtype_80808[1];
static int32_t mainziid_counter_mem_realtype_80873[1];
struct memblock_device {
    int *references;
    CUdeviceptr mem;
    int64_t size;
    const char *desc;
};
struct memblock {
    int *references;
    unsigned char *mem;
    int64_t size;
    const char *desc;
};
#include <cuda.h>
#include <nvrtc.h>
typedef CUdeviceptr 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 cuda.h.

#define CUDA_SUCCEED_FATAL(x) cuda_api_succeed_fatal(x, #x, __FILE__, __LINE__)
#define CUDA_SUCCEED_NONFATAL(x) cuda_api_succeed_nonfatal(x, #x, __FILE__, __LINE__)
#define NVRTC_SUCCEED_FATAL(x) nvrtc_api_succeed_fatal(x, #x, __FILE__, __LINE__)
#define NVRTC_SUCCEED_NONFATAL(x) nvrtc_api_succeed_nonfatal(x, #x, __FILE__, __LINE__)

#define SUCCEED_OR_RETURN(serror) {               \
    if (serror) {                                 \
      if (!ctx->error) {                          \
        ctx->error = serror;                      \
        return bad;                               \
      } else {                                    \
        free(serror);                             \
      }                                           \
    }                                             \
  }

#define CUDA_SUCCEED_OR_RETURN(e) SUCCEED_OR_RETURN(CUDA_SUCCEED_NONFATAL(e))

// CUDA_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;

static inline void cuda_api_succeed_fatal(CUresult res, const char *call,
    const char *file, int line) {
  if (res != CUDA_SUCCESS) {
    const char *err_str;
    cuGetErrorString(res, &err_str);
    if (err_str == NULL) { err_str = "Unknown"; }
    futhark_panic(-1, "%s:%d: CUDA call\n  %s\nfailed with error code %d (%s)\n",
        file, line, call, res, err_str);
  }
}

static char* cuda_api_succeed_nonfatal(CUresult res, const char *call,
    const char *file, int line) {
  if (res != CUDA_SUCCESS) {
    const char *err_str;
    cuGetErrorString(res, &err_str);
    if (err_str == NULL) { err_str = "Unknown"; }
    return msgprintf("%s:%d: CUDA call\n  %s\nfailed with error code %d (%s)\n",
        file, line, call, res, err_str);
  } else {
    return NULL;
  }
}

static inline void nvrtc_api_succeed_fatal(nvrtcResult res, const char *call,
                                           const char *file, int line) {
  if (res != NVRTC_SUCCESS) {
    const char *err_str = nvrtcGetErrorString(res);
    futhark_panic(-1, "%s:%d: NVRTC call\n  %s\nfailed with error code %d (%s)\n",
        file, line, call, res, err_str);
  }
}

static char* nvrtc_api_succeed_nonfatal(nvrtcResult res, const char *call,
                                        const char *file, int line) {
  if (res != NVRTC_SUCCESS) {
    const char *err_str = nvrtcGetErrorString(res);
    return msgprintf("%s:%d: NVRTC call\n  %s\nfailed with error code %d (%s)\n",
                     file, line, call, res, err_str);
  } else {
    return NULL;
  }
}

struct cuda_config {
  int debugging;
  int logging;
  const char *preferred_device;
  int preferred_device_num;

  const char *dump_program_to;
  const char *load_program_from;

  const char *dump_ptx_to;
  const char *load_ptx_from;

  size_t default_block_size;
  size_t default_grid_size;
  size_t default_tile_size;
  size_t default_reg_tile_size;
  size_t default_threshold;

  int default_block_size_changed;
  int default_grid_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 cuda_config_init(struct cuda_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->preferred_device_num = 0;
  cfg->preferred_device = "";
  cfg->dump_program_to = NULL;
  cfg->load_program_from = NULL;

  cfg->dump_ptx_to = NULL;
  cfg->load_ptx_from = NULL;

  cfg->default_block_size = 256;
  cfg->default_grid_size = 0; // Set properly later.
  cfg->default_tile_size = 32;
  cfg->default_reg_tile_size = 2;
  cfg->default_threshold = 32*1024;

  cfg->default_block_size_changed = 0;
  cfg->default_grid_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 {
  cudaEvent_t *events; // Points to two events.
  int *runs;
  int64_t *runtime;
};

struct cuda_context {
  CUdevice dev;
  CUcontext cu_ctx;
  CUmodule module;

  struct cuda_config cfg;

  struct free_list free_list;

  size_t max_block_size;
  size_t max_grid_size;
  size_t max_tile_size;
  size_t max_threshold;
  size_t max_shared_memory;
  size_t max_bespoke;

  size_t lockstep_width;

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

#define CU_DEV_ATTR(x) (CU_DEVICE_ATTRIBUTE_##x)
#define device_query(dev,attrib) _device_query(dev, CU_DEV_ATTR(attrib))
static int _device_query(CUdevice dev, CUdevice_attribute attrib) {
  int val;
  CUDA_SUCCEED_FATAL(cuDeviceGetAttribute(&val, attrib, dev));
  return val;
}

#define CU_FUN_ATTR(x) (CU_FUNC_ATTRIBUTE_##x)
#define function_query(fn,attrib) _function_query(dev, CU_FUN_ATTR(attrib))
static int _function_query(CUfunction dev, CUfunction_attribute attrib) {
  int val;
  CUDA_SUCCEED_FATAL(cuFuncGetAttribute(&val, attrib, dev));
  return val;
}

static void set_preferred_device(struct cuda_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;
}

static int cuda_device_setup(struct cuda_context *ctx) {
  char name[256];
  int count, chosen = -1, best_cc = -1;
  int cc_major_best, cc_minor_best;
  int cc_major, cc_minor;
  CUdevice dev;

  CUDA_SUCCEED_FATAL(cuDeviceGetCount(&count));
  if (count == 0) { return 1; }

  int num_device_matches = 0;

  // XXX: Current device selection policy is to choose the device with the
  // highest compute capability (if no preferred device is set).
  // This should maybe be changed, since greater compute capability is not
  // necessarily an indicator of better performance.
  for (int i = 0; i < count; i++) {
    CUDA_SUCCEED_FATAL(cuDeviceGet(&dev, i));

    cc_major = device_query(dev, COMPUTE_CAPABILITY_MAJOR);
    cc_minor = device_query(dev, COMPUTE_CAPABILITY_MINOR);

    CUDA_SUCCEED_FATAL(cuDeviceGetName(name, sizeof(name) - 1, dev));
    name[sizeof(name) - 1] = 0;

    if (ctx->cfg.debugging) {
      fprintf(stderr, "Device #%d: name=\"%s\", compute capability=%d.%d\n",
          i, name, cc_major, cc_minor);
    }

    if (device_query(dev, COMPUTE_MODE) == CU_COMPUTEMODE_PROHIBITED) {
      if (ctx->cfg.debugging) {
        fprintf(stderr, "Device #%d is compute-prohibited, ignoring\n", i);
      }
      continue;
    }

    if (best_cc == -1 || cc_major > cc_major_best ||
        (cc_major == cc_major_best && cc_minor > cc_minor_best)) {
      best_cc = i;
      cc_major_best = cc_major;
      cc_minor_best = cc_minor;
    }

    if (strstr(name, ctx->cfg.preferred_device) != NULL &&
        num_device_matches++ == ctx->cfg.preferred_device_num) {
      chosen = i;
      break;
    }
  }

  if (chosen == -1) { chosen = best_cc; }
  if (chosen == -1) { return 1; }

  if (ctx->cfg.debugging) {
    fprintf(stderr, "Using device #%d\n", chosen);
  }

  CUDA_SUCCEED_FATAL(cuDeviceGet(&ctx->dev, chosen));
  return 0;
}

static char *concat_fragments(const char *src_fragments[]) {
  size_t src_len = 0;
  const char **p;

  for (p = src_fragments; *p; p++) {
    src_len += strlen(*p);
  }

  char *src = (char*) malloc(src_len + 1);
  size_t n = 0;
  for (p = src_fragments; *p; p++) {
    strcpy(src + n, *p);
    n += strlen(*p);
  }

  return src;
}

static const char *cuda_nvrtc_get_arch(CUdevice dev) {
  struct {
    int major;
    int minor;
    const char *arch_str;
  } static const x[] = {
    { 3, 0, "compute_30" },
    { 3, 2, "compute_32" },
    { 3, 5, "compute_35" },
    { 3, 7, "compute_37" },
    { 5, 0, "compute_50" },
    { 5, 2, "compute_52" },
    { 5, 3, "compute_53" },
    { 6, 0, "compute_60" },
    { 6, 1, "compute_61" },
    { 6, 2, "compute_62" },
    { 7, 0, "compute_70" },
    { 7, 2, "compute_72" },
    { 7, 5, "compute_75" },
    { 8, 0, "compute_80" }
  };

  int major = device_query(dev, COMPUTE_CAPABILITY_MAJOR);
  int minor = device_query(dev, COMPUTE_CAPABILITY_MINOR);

  int chosen = -1;
  for (int i = 0; i < sizeof(x)/sizeof(x[0]); i++) {
    if (x[i].major < major || (x[i].major == major && x[i].minor <= minor)) {
      chosen = i;
    } else {
      break;
    }
  }

  if (chosen == -1) {
    futhark_panic(-1, "Unsupported compute capability %d.%d\n", major, minor);
  }

  if (x[chosen].major != major || x[chosen].minor != minor) {
    fprintf(stderr,
            "Warning: device compute capability is %d.%d, but newest supported by Futhark is %d.%d.\n",
            major, minor, x[chosen].major, x[chosen].minor);
  }

  return x[chosen].arch_str;
}

static char* cuda_nvrtc_build(struct cuda_context *ctx, const char *src,
                              const char *extra_opts[], char **ptx) {
  nvrtcProgram prog;
  char *problem = NULL;

  problem = NVRTC_SUCCEED_NONFATAL(nvrtcCreateProgram(&prog, src, "futhark-cuda", 0, NULL, NULL));

  if (problem) {
    return problem;
  }

  int arch_set = 0, num_extra_opts;

  // nvrtc cannot handle multiple -arch options.  Hence, if one of the
  // extra_opts is -arch, we have to be careful not to do our usual
  // automatic generation.
  for (num_extra_opts = 0; extra_opts[num_extra_opts] != NULL; num_extra_opts++) {
    if (strstr(extra_opts[num_extra_opts], "-arch")
        == extra_opts[num_extra_opts] ||
        strstr(extra_opts[num_extra_opts], "--gpu-architecture")
        == extra_opts[num_extra_opts]) {
      arch_set = 1;
    }
  }

  size_t n_opts, i = 0, i_dyn, n_opts_alloc = 20 + num_extra_opts + ctx->cfg.num_sizes;
  const char **opts = (const char**) malloc(n_opts_alloc * sizeof(const char *));
  if (!arch_set) {
    opts[i++] = "-arch";
    opts[i++] = cuda_nvrtc_get_arch(ctx->dev);
  }
  opts[i++] = "-default-device";
  if (ctx->cfg.debugging) {
    opts[i++] = "-G";
    opts[i++] = "-lineinfo";
  } else {
    opts[i++] = "--disable-warnings";
  }
  i_dyn = i;
  for (size_t j = 0; j < ctx->cfg.num_sizes; j++) {
    opts[i++] = msgprintf("-D%s=%zu", ctx->cfg.size_vars[j],
        ctx->cfg.size_values[j]);
  }
  opts[i++] = msgprintf("-DLOCKSTEP_WIDTH=%zu", ctx->lockstep_width);
  opts[i++] = msgprintf("-DMAX_THREADS_PER_BLOCK=%zu", ctx->max_block_size);

  // Time for the best lines of the code in the entire compiler.
  if (getenv("CUDA_HOME") != NULL) {
    opts[i++] = msgprintf("-I%s/include", getenv("CUDA_HOME"));
  }
  if (getenv("CUDA_ROOT") != NULL) {
    opts[i++] = msgprintf("-I%s/include", getenv("CUDA_ROOT"));
  }
  if (getenv("CUDA_PATH") != NULL) {
    opts[i++] = msgprintf("-I%s/include", getenv("CUDA_PATH"));
  }
  opts[i++] = msgprintf("-I/usr/local/cuda/include");
  opts[i++] = msgprintf("-I/usr/include");

  // It is crucial that the extra_opts are last, so that the free()
  // logic below does not cause problems.
  for (int j = 0; extra_opts[j] != NULL; j++) {
    opts[i++] = extra_opts[j];
  }

  n_opts = i;

  if (ctx->cfg.debugging) {
    fprintf(stderr, "NVRTC compile options:\n");
    for (size_t j = 0; j < n_opts; j++) {
      fprintf(stderr, "\t%s\n", opts[j]);
    }
    fprintf(stderr, "\n");
  }

  nvrtcResult res = nvrtcCompileProgram(prog, n_opts, opts);
  if (res != NVRTC_SUCCESS) {
    size_t log_size;
    if (nvrtcGetProgramLogSize(prog, &log_size) == NVRTC_SUCCESS) {
      char *log = (char*) malloc(log_size);
      if (nvrtcGetProgramLog(prog, log) == NVRTC_SUCCESS) {
        problem = msgprintf("NVRTC compilation failed.\n\n%s\n", log);
      } else {
        problem = msgprintf("Could not retrieve compilation log\n");
      }
      free(log);
    }
    return problem;
  }

  for (i = i_dyn; i < n_opts-num_extra_opts; i++) { free((char *)opts[i]); }
  free(opts);

  size_t ptx_size;
  NVRTC_SUCCEED_FATAL(nvrtcGetPTXSize(prog, &ptx_size));
  *ptx = (char*) malloc(ptx_size);
  NVRTC_SUCCEED_FATAL(nvrtcGetPTX(prog, *ptx));

  NVRTC_SUCCEED_FATAL(nvrtcDestroyProgram(&prog));

  return NULL;
}

static void cuda_size_setup(struct cuda_context *ctx)
{
  if (ctx->cfg.default_block_size > ctx->max_block_size) {
    if (ctx->cfg.default_block_size_changed) {
      fprintf(stderr,
          "Note: Device limits default block size to %zu (down from %zu).\n",
          ctx->max_block_size, ctx->cfg.default_block_size);
    }
    ctx->cfg.default_block_size = ctx->max_block_size;
  }
  if (ctx->cfg.default_grid_size > ctx->max_grid_size) {
    if (ctx->cfg.default_grid_size_changed) {
      fprintf(stderr,
          "Note: Device limits default grid size to %zu (down from %zu).\n",
          ctx->max_grid_size, ctx->cfg.default_grid_size);
    }
    ctx->cfg.default_grid_size = ctx->max_grid_size;
  }
  if (ctx->cfg.default_tile_size > ctx->max_tile_size) {
    if (ctx->cfg.default_tile_size_changed) {
      fprintf(stderr,
          "Note: Device limits default tile size to %zu (down from %zu).\n",
          ctx->max_tile_size, ctx->cfg.default_tile_size);
    }
    ctx->cfg.default_tile_size = ctx->max_tile_size;
  }

  if (!ctx->cfg.default_grid_size_changed) {
    ctx->cfg.default_grid_size =
      (device_query(ctx->dev, MULTIPROCESSOR_COUNT) *
       device_query(ctx->dev, MAX_THREADS_PER_MULTIPROCESSOR))
      / ctx->cfg.default_block_size;
  }

  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 = ctx->max_block_size;
      default_value = ctx->cfg.default_block_size;
    } else if (strstr(size_class, "num_groups") == size_class) {
      max_value = ctx->max_grid_size;
      default_value = ctx->cfg.default_grid_size;
      // 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 = ctx->max_tile_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 %zu (down from %zu)\n",
              size_name, max_value, *size_value);
      *size_value = max_value;
    }
  }
}

static char* cuda_module_setup(struct cuda_context *ctx,
                               const char *src_fragments[],
                               const char *extra_opts[]) {
  char *ptx = NULL, *src = NULL;

  if (ctx->cfg.load_program_from == NULL) {
    src = concat_fragments(src_fragments);
  } else {
    src = slurp_file(ctx->cfg.load_program_from, NULL);
  }

  if (ctx->cfg.load_ptx_from) {
    if (ctx->cfg.load_program_from != NULL) {
      fprintf(stderr,
              "WARNING: Using PTX from %s instead of C code from %s\n",
              ctx->cfg.load_ptx_from, ctx->cfg.load_program_from);
    }
    ptx = slurp_file(ctx->cfg.load_ptx_from, NULL);
  }

  if (ctx->cfg.dump_program_to != NULL) {
    dump_file(ctx->cfg.dump_program_to, src, strlen(src));
  }

  if (ptx == NULL) {
    char* problem = cuda_nvrtc_build(ctx, src, extra_opts, &ptx);
    if (problem != NULL) {
      free(src);
      return problem;
    }
  }

  if (ctx->cfg.dump_ptx_to != NULL) {
    dump_file(ctx->cfg.dump_ptx_to, ptx, strlen(ptx));
  }

  CUDA_SUCCEED_FATAL(cuModuleLoadData(&ctx->module, ptx));

  free(ptx);
  if (src != NULL) {
    free(src);
  }

  return NULL;
}

static char* cuda_setup(struct cuda_context *ctx, const char *src_fragments[], const char *extra_opts[]) {
  CUDA_SUCCEED_FATAL(cuInit(0));

  if (cuda_device_setup(ctx) != 0) {
    futhark_panic(-1, "No suitable CUDA device found.\n");
  }
  CUDA_SUCCEED_FATAL(cuCtxCreate(&ctx->cu_ctx, 0, ctx->dev));

  free_list_init(&ctx->free_list);

  ctx->max_shared_memory = device_query(ctx->dev, MAX_SHARED_MEMORY_PER_BLOCK);
  ctx->max_block_size = device_query(ctx->dev, MAX_THREADS_PER_BLOCK);
  ctx->max_grid_size = device_query(ctx->dev, MAX_GRID_DIM_X);
  ctx->max_tile_size = sqrt(ctx->max_block_size);
  ctx->max_threshold = 0;
  ctx->max_bespoke = 0;
  ctx->lockstep_width = device_query(ctx->dev, WARP_SIZE);

  cuda_size_setup(ctx);
  return cuda_module_setup(ctx, src_fragments, extra_opts);
}

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

    float ms;
    if ((err = cudaEventElapsedTime(&ms, record.events[0], record.events[1])) != cudaSuccess) {
      return err;
    }

    // CUDA provides milisecond resolution, but we want microseconds.
    *record.runs += 1;
    *record.runtime += ms*1000;

    if ((err = cudaEventDestroy(record.events[0])) != cudaSuccess) {
      return err;
    }
    if ((err = cudaEventDestroy(record.events[1])) != cudaSuccess) {
      return err;
    }

    free(record.events);
  }

  ctx->profiling_records_used = 0;

  return cudaSuccess;
}

// Returns pointer to two events.
static cudaEvent_t* cuda_get_events(struct cuda_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));
    }
    cudaEvent_t *events = calloc(2, sizeof(cudaEvent_t));
    cudaEventCreate(&events[0]);
    cudaEventCreate(&events[1]);
    ctx->profiling_records[ctx->profiling_records_used].events = events;
    ctx->profiling_records[ctx->profiling_records_used].runs = runs;
    ctx->profiling_records[ctx->profiling_records_used].runtime = runtime;
    ctx->profiling_records_used++;
    return events;
}

static CUresult cuda_free_all(struct cuda_context *ctx);

static void cuda_cleanup(struct cuda_context *ctx) {
  CUDA_SUCCEED_FATAL(cuda_free_all(ctx));
  (void)cuda_tally_profiling_records(ctx);
  free(ctx->profiling_records);
  CUDA_SUCCEED_FATAL(cuModuleUnload(ctx->module));
  CUDA_SUCCEED_FATAL(cuCtxDestroy(ctx->cu_ctx));
}

static CUresult cuda_alloc(struct cuda_context *ctx, size_t min_size,
                           const char *tag, CUdeviceptr *mem_out) {
  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) {
    if (size >= min_size) {
      return CUDA_SUCCESS;
    } else {
      CUresult res = cuMemFree(*mem_out);
      if (res != CUDA_SUCCESS) {
        return res;
      }
    }
  }

  CUresult res = cuMemAlloc(mem_out, min_size);
  while (res == CUDA_ERROR_OUT_OF_MEMORY) {
    CUdeviceptr mem;
    if (free_list_first(&ctx->free_list, &mem) == 0) {
      res = cuMemFree(mem);
      if (res != CUDA_SUCCESS) {
        return res;
      }
    } else {
      break;
    }
    res = cuMemAlloc(mem_out, min_size);
  }

  return res;
}

static CUresult cuda_free(struct cuda_context *ctx, CUdeviceptr mem,
                          const char *tag) {
  size_t size;
  CUdeviceptr 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) {
    CUresult res = cuMemFree(existing_mem);
    if (res != CUDA_SUCCESS) {
      return res;
    }
  }

  CUresult res = cuMemGetAddressRange(NULL, &size, mem);
  if (res == CUDA_SUCCESS) {
    free_list_insert(&ctx->free_list, size, mem, tag);
  }

  return res;
}

static CUresult cuda_free_all(struct cuda_context *ctx) {
  CUdeviceptr mem;
  free_list_pack(&ctx->free_list);
  while (free_list_first(&ctx->free_list, &mem) == 0) {
    CUresult res = cuMemFree(mem);
    if (res != CUDA_SUCCESS) {
      return res;
    }
  }

  return CUDA_SUCCESS;
}

// End of cuda.h.

const char *cuda_program[] =
           {"\n#define FUTHARK_CUDA\n#define FUTHARK_F64_ENABLED\n\ntypedef char int8_t;\ntypedef short int16_t;\ntypedef int int32_t;\ntypedef long long int64_t;\ntypedef unsigned char uint8_t;\ntypedef unsigned short uint16_t;\ntypedef unsigned int uint32_t;\ntypedef unsigned long long uint64_t;\ntypedef uint8_t uchar;\ntypedef uint16_t ushort;\ntypedef uint32_t uint;\ntypedef uint64_t ulong;\n#define __kernel extern \"C\" __global__ __launch_bounds__(MAX_THREADS_PER_BLOCK)\n#define __global\n#define __local\n#define __private\n#define __constant\n#define __write_only\n#define __read_only\n\nstatic inline int get_group_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) {\n  switch (d) {\n    case 0: d = block_dim0; break;\n    case 1: d = block_dim1; break;\n    case 2: d = block_dim2; break;\n  }\n  switch (d) {\n    case 0: return blockIdx.x;\n    case 1: return blockIdx.y;\n    case 2: return blockIdx.z;\n    default: return 0;\n  }\n}\n#define get_group_id(d) get_group_id_fn(block_dim0, block_dim1, block_dim2, d)\n\nstatic inline int get_num_groups_fn(int block_dim0, int block_dim1, int block_dim2, int d) {\n  switch (d) {\n    case 0: d = block_dim0; break;\n    case 1: d = block_dim1; break;\n    case 2: d = block_dim2; break;\n  }\n  switch(d) {\n    case 0: return gridDim.x;\n    case 1: return gridDim.y;\n    case 2: return gridDim.z;\n    default: return 0;\n  }\n}\n#define get_num_groups(d) get_num_groups_fn(block_dim0, block_dim1, block_dim2, d)\n\nstatic inline int get_local_id(int d) {\n  switch (d) {\n    case 0: return threadIdx.x;\n    case 1: return threadIdx.y;\n    case 2: return threadIdx.z;\n    default: return 0;\n  }\n}\n\nstatic inline int get_local_size(int d) {\n  switch (d) {\n    case 0: return blockDim.x;\n    case 1: return blockDim.y;\n    case 2: return blockDim.z;\n    default: return 0;\n  }\n}\n\nstatic inline int get_global_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) {\n  return get_group_id(d) * get_local_size(d) + get_local_id(d);\n}\n#define get_global_id(d) get_global_id_fn(block_dim0,",
            " block_dim1, block_dim2, d)\n\nstatic inline int get_global_size(int block_dim0, int block_dim1, int block_dim2, int d) {\n  return get_num_groups(d) * get_local_size(d);\n}\n\n#define CLK_LOCAL_MEM_FENCE 1\n#define CLK_GLOBAL_MEM_FENCE 2\nstatic inline void barrier(int x) {\n  __syncthreads();\n}\nstatic inline void mem_fence_local() {\n  __threadfence_block();\n}\nstatic inline void mem_fence_global() {\n  __threadfence();\n}\n\n#define NAN (0.0/0.0)\n#define INFINITY (1.0/0.0)\nextern volatile __shared__ unsigned char shared_mem[];\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 notice 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, 0x00",
            "00, 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, 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  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, 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  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, 0x369E0000,\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, 0x3712000",
            "0, 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, 0x37740000, 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, 0x379B800",
            "0, 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, 0x37CC8000, 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, 0x37EE000",
            "0, 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, 0x380F8000, 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, 0x38204",
            "000, 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, 0x3838C000, 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, 0x38498",
            "000, 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, 0x38620000, 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, 0x3872C",
            "000, 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, 0x3805A000, 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  0x380",
            "E0000, 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, 0x381A4000, 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, 0x382",
            "2A000, 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, 0x382EE000, 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, 0x383",
            "74000, 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, 0x38438000, 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, 0x384",
            "BE000,\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, 0x3",
            "8608000, 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, 0x3",
            "8752000, 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, 0x03000000, 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 initialisers.\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\nstati",
            "c 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, uint64_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 inli",
            "ne 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\nstatic 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\nsta",
            "tic 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(int",
            "8_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 fu",
            "trts_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(int64_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  retur",
            "n 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 fptoui_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 __OP",
            "ENCL_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, float 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, b",
            "ut 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 futrts_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 double 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 dou",
            "ble 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(doub",
            "le 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 t",
            "hat 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 fptosi_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 fpow",
            "16(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 inline 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(f1",
            "6 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 futrts_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\nstat",
            "ic 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 atomi",
            "c_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, 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_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 atomi",
            "c_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\nin",
            "line 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 atomicOr((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_78476(int32_t num_elems_78473,\n                                                      int64_t val_78474,\n                                                      __global\n                                                      unsigned char *mem_78472)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    const int block_dim2 = 2;\n    int32_t replicate_gtid_78476;\n    int32_t replicate_ltid_78477;\n    int32_t replicate_gid_78478;\n    \n    replicate_gtid_78476 = get_global_id(0);\n    replicate_ltid_78477 = get_local_id(0);\n    replicate_gid_78478 = get_group_id(0);\n    \n    int64_t slice_78482 = num_elems_78473;\n    int64_t rep_i_78481 = sext_i32_i64(replicate_gtid_78476);\n    int64_t remnant_78483 = sext_i32_i64(replicate_gtid_78476) - rep_i_78481;\n    \n    if (slt64(replicate_gtid_78476, num_elems_78473)) {\n        ((__global int64_t *) mem_78472)[rep_i_78481] = val_78474;\n    }\n    \n  error_0:\n    return;\n}\n__kernel void builtinzhreplicate_i8zireplicate_78371(int32_t num_elems_78368,\n                                                     int8_t val_78369, __global\n                                                     unsigned char *mem_78367)\n{\n    const int block_dim0 = 0;\n    const int block_dim1 = 1;\n    cons",
            "t int block_dim2 = 2;\n    int32_t replicate_gtid_78371;\n    int32_t replicate_ltid_78372;\n    int32_t replicate_gid_78373;\n    \n    replicate_gtid_78371 = get_global_id(0);\n    replicate_ltid_78372 = get_local_id(0);\n    replicate_gid_78373 = get_group_id(0);\n    \n    int64_t slice_78377 = num_elems_78368;\n    int64_t rep_i_78376 = sext_i32_i64(replicate_gtid_78371);\n    int64_t remnant_78378 = sext_i32_i64(replicate_gtid_78371) - rep_i_78376;\n    \n    if (slt64(replicate_gtid_78371, num_elems_78368)) {\n        ((__global int8_t *) mem_78367)[rep_i_78376] = val_78369;\n    }\n    \n  error_0:\n    return;\n}\n__kernel void gpu_map_transpose_f64(const int block_dim0, const int block_dim1,\n                                    const int block_dim2,\n                                    uint block_9_backing_offset_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    volatile unsigned char *block_9_backing_0 =\n                           &shared_mem[block_9_backing_offset_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(const int block_dim0, const\n                     ",
            "                          int block_dim1, const\n                                               int block_dim2,\n                                               uint block_9_backing_offset_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    volatile unsigned char *block_9_backing_0 =\n                           &shared_mem[block_9_backing_offset_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(const int block_dim0, const\n                                              int block_dim1, const\n                                              int block_dim2,\n                                              uint block_9_backing_offset_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    volatile unsigned char *block_9_backing_0 =\n                           &shared_mem[block_9_backing_offset_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(uint block_9_backing_offset_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    volatile unsigned char *block_9_backing_0 =\n                           &shared_mem[block_9_backing_offset_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 mainzisegmap_66915(__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_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            last_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_77",
            "017)[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                    defunc_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_res_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_66996 && 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(glo",
            "bal_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_67029 && 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 a",
            "bs_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                        defunc_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                        d",
            "efunc_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_tid_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_di",
            "m1 = 1;\n    const int block_dim2 = 2;\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78484;\n    int32_t local_tid_78485;\n    int64_t group_sizze_78488;\n    int32_t wave_sizze_78487;\n    int32_t group_tid_78486;\n    \n    global_tid_78484 = get_global_id(0);\n    local_tid_78485 = get_local_id(0);\n    group_sizze_78488 = get_local_size(0);\n    wave_sizze_78487 = LOCKSTEP_WIDTH;\n    group_tid_78486 = get_group_id(0);\n    \n    int32_t phys_tid_67937 = global_tid_78484;\n    int64_t global_tid_78489 = sext_i32_i64(group_tid_78486) *\n            segmap_group_sizze_67931 + sext_i32_i64(local_tid_78485);\n    int64_t slice_78490 = n_65378;\n    int64_t slice_78491 = m_65377 * slice_78490;\n    int64_t gtid_67935 = squot64(global_tid_78489, slice_78490);\n    int64_t remnant_78492 = global_tid_78489 - gtid_67935 * slice_78490;\n    int64_t gtid_67936 = remnant_78492;\n    int64_t remnant_78493 = remnant_78492 - gtid_67936;\n    \n    if (slt64(gtid_67935, m_65377) && slt64(gtid_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_6",
            "7943) &&\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_78494;\n    int32_t local_tid_78495;\n    int64_t group_sizze_78498;\n    int32_t wave_sizze_78497;\n    int32_t group_tid_78496;\n    \n    global_tid_78494 = get_global_id(0);\n    local_tid_78495 = get_local_id(0);\n    group_sizze_78498 = get_local_size(0);\n    wave_sizze_78497 = LOCKSTEP_WIDTH;\n    group_tid_78496 = get_group_id(0);\n    \n    int32_t phys_tid_67956 = global_tid_78494;\n    int64_t global_tid_78499 = sext_i32_i64(group_tid_78496) *\n            segmap_group_sizze_67951 + sext_i32_i64(local_tid_78495);\n    int64_t slice_78500 = n_65378;\n    int64_t slice_78501 = m_65377 * slice_78500;\n    int64_t gtid_67954 = squot64(global_tid_78499, slice_78500);\n    int64_t remnant_78502 = global_tid_78499 - gtid_67954 * slice_78500;\n    int64_t gtid_67955 = remnant_78502;\n    int64_t remnant_78503 = remnant_78502 - gtid_67955;\n    \n    if (slt",
            "64(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_78504;\n    int32_t local_tid_78505;\n    int64_t group_sizze_78508;\n    int32_t wave_sizze_78507;\n    int32_t group_tid_78506;\n    \n    global_tid_78504 = get_global_id(0);\n    local_tid_78505 = get_local_id(0);\n    group_sizze_78508 = get_local_size(0);\n    wave_sizze_78507 = LOCKSTEP_WIDTH;\n    group_tid_78506 = get_group_id(0);\n    \n    int32_t phys_tid_67968 = global_tid_78504;\n    int64_t global_tid_78509 = sext_i32_i64(group_tid_78506) *\n            segmap_group_sizze_67961 + sext_i32_i64(local_tid_78505);\n    int64_t slice_78510 = m_65377;\n    int64_t gtid_67967 = global_tid_78509;\n    int64_t remnant_78511 = global_tid_78509 ",
            "- 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_78512;\n    int32_t local_tid_78513;\n    int64_t group_sizze_78516;\n    int32_t wave_sizze_78515;\n    int32_t group_tid_78514;\n    \n    global_tid_78512 = get_global_id(0);\n    local_tid_78513 = get_local_id(0);\n    group_sizze_78516 = get_local_size(0);\n    wave_sizze_78515 = LOCKSTEP_WIDTH;\n    group_tid_78514 = get_group_id(0);\n    \n    int32_t phys_tid_67988 = global_tid_7",
            "8512;\n    int64_t global_tid_78517 = sext_i32_i64(group_tid_78514) *\n            segmap_group_sizze_67983 + sext_i32_i64(local_tid_78513);\n    int64_t slice_78518 = q_65380;\n    int64_t slice_78519 = m_65377 * slice_78518;\n    int64_t gtid_67986 = squot64(global_tid_78517, slice_78518);\n    int64_t remnant_78520 = global_tid_78517 - gtid_67986 * slice_78518;\n    int64_t gtid_67987 = remnant_78520;\n    int64_t remnant_78521 = remnant_78520 - 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_77148)[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_78556;\n    int32_t local_tid_78557;\n    int64_t group_sizze_78560;\n    int32_t wave_sizze_78559;\n    int32_t group_tid_78558;\n    \n    global_tid_78556 = get_global_id(0);\n    local_tid_78557 = get_local_id(0);\n    group_sizze_78560 = get_local_size(0);\n    wave_sizze_78559 = LOCKSTEP_WIDTH;\n    group_tid_78558 = get_group_id(0);\n    \n    int32_t phys_tid_68159 = global_tid_78556;\n    int64_t global_tid_78561 = sext_i32_i64(group_tid_78558) *\n            segmap_group_sizze_68152 + sext_i32_i64(local_tid_78557);\n    int64_t slice_78562 = n_m_65386;\n    int64_t slice_78563 = m_65377 * slice_78562;\n    int64_t gtid_68157 = squot64(global_tid_78561, slice_78562);\n    int64_t remnant_78564 = global_tid_78561 - gtid_68157 * slice_78562;\n    int64_t gtid_68158 = remnant_78564;\n    int64_t remnant_78565 = remnant_78564 - 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)[gti",
            "d_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_78566 = loop_cond_68190;\n            int64_t low_tmp_78567 = loopres_68186;\n            int64_t high_tmp_78568 = loopres_68187;\n            \n            loop_while_68173 = loop_while_tmp_78566;\n            low_68174 = low_tmp_78567;\n            high_68175 = high_tmp_78568;\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_78569 = loop_cond_68231;\n            int64_t l_idx_tmp_78570 = loopres_68218;\n            int64_t r_idx_tmp_78571 = loopres_68219;\n            int64_t span_tmp_78572 = loopres_68220;\n           ",
            " \n            loop_while_68195 = loop_while_tmp_78569;\n            l_idx_68196 = l_idx_tmp_78570;\n            r_idx_68197 = r_idx_tmp_78571;\n            span_68198 = span_tmp_78572;\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_failure_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_78645;\n    int32_t local_tid_78646;\n    int64_t group_sizze_78649;\n    int32_t wave_sizze_78648;\n    int32_t group_tid_78647;\n    \n    global_tid_78645 = get_global_id(0);\n    local_tid_78646 = get_local_id(0);\n    group_sizze_78649 = get_local_size(0);\n    wave_sizze_78648 = LOCKSTEP_WIDTH;\n    group_tid_78647 = get_group_id(0);\n    \n    int32_t phys_tid_68300 = global_tid_78645;\n    int64_t global_tid_78650 = sext_i32_i64(group_tid_78647) *\n            segmap_group_sizze_68295 + sext_i32_i64(local_tid_78646);\n    int64_t slice_78651 = n_m_65386;\n    int64_",
            "t slice_78652 = m_65377 * slice_78651;\n    int64_t gtid_68298 = squot64(global_tid_78650, slice_78651);\n    int64_t remnant_78653 = global_tid_78650 - gtid_68298 * slice_78651;\n    int64_t gtid_68299 = remnant_78653;\n    int64_t remnant_78654 = remnant_78653 - 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_78733;\n    int32_t local_tid_78734;\n    int64_t group_sizze_78737;\n    int32_t wave_sizze_78736;\n    int32_t group_tid_78735;\n    \n    global_tid_78733 = get_global_id(0);\n    local_tid_78734 = get_local_id(0);\n    group_sizze_78737 = get_local_size(0);\n    wave_sizze_78736 = LOCKSTEP_WIDTH;\n    group_tid_78735 = get_group_id(0);\n    \n    int32_t phys_tid_68572 = global_tid_78733;\n    int32_t phys_group_id_78738;\n    \n    phys_group_id_78738 = get_group_id(0);\n    for (int32_t i_78739 = 0; i_78739 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377, segmap_group_sizze_68566)) -\n                   phys_group_id_78738, sext_i64_i32(num_groups_68567));\n         i_78739++) {\n        int32_t virt_group_id_78740 = phys_group_id_78738 + i_78739 *\n                sext_i64_i32(num_groups_68567);\n        int64_t global_tid_78741 = sext_i32_i64(virt_group_id_78740) *\n                segmap_group_sizze_68566 + sext_i32_i64(local_tid_78734);\n        int64_t slice_78742 = m_65377;\n        int64_t gtid_68571 = global_tid_78741;\n        int64_t remnant_78743 = global_tid_78741 - 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_78744 = defunc_1_op_res_68577;\n                \n                scanacc_76857 = scanacc_tmp_78744;\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_78746 = 0; i_78746 < n_65378; i_78746++) {\n                ((__global double *) color_78183)[phys_tid_68572 + i_78746 *\n                                                  num_threads_78254] = 0.0;\n            }\n            for (int64_t i_78747 = 0; i_78747 < n_65378; i_78747++) {\n                ((__global int64_t *) color_78182)[phys_tid_68572 + i_78747 *\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_78750 = 0; i_78750 < (int64_t) 1;\n                         i_78750++) {\n               ",
            "         double tmp_78751;\n                        \n                        tmp_78751 = ((__global double *) mem_77233)[m_65377 *\n                                                                    write_iter_76862 +\n                                                                    gtid_68571 +\n                                                                    i_78750 *\n                                                                    m_65377];\n                        ((__global double *) color_78183)[phys_tid_68572 +\n                                                          num_threads_78254 *\n                                                          defunc_1_f_res_68592 +\n                                                          i_78750 *\n                                                          num_threads_78254] =\n                            tmp_78751;\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) 9223372036854775807;\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_6861",
            "9;\n                    }\n                    \n                    bool loop_cond_68634 = sle64(loopres_68630, loopres_68631);\n                    bool loop_while_tmp_78756 = loop_cond_68634;\n                    int64_t low_tmp_78757 = loopres_68630;\n                    int64_t high_tmp_78758 = loopres_68631;\n                    \n                    loop_while_68617 = loop_while_tmp_78756;\n                    low_68618 = low_tmp_78757;\n                    high_68619 = high_tmp_78758;\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 = loop_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_68652);\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_686",
            "58 = ((__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_78759 = loop_cond_68675;\n                    int64_t l_idx_tmp_78760 = loopres_68662;\n                    int64_t r_idx_tmp_78761 = loopres_68663;\n                    int64_t span_tmp_78762 = loopres_68664;\n                    \n                    loop_while_68639 = loop_while_tmp_78759;\n                    l_idx_68640 = l_idx_tmp_78760;\n                    r_idx_68641 = r_idx_tmp_78761;\n                    span_68642 = span_tmp_78762;\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_6868",
            "0 && 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 = abs64(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_78763 = defunc_1_op_res_68702;\n                    double redout_tmp_78764 = defunc_1_op_res_68705;\n                    double redout_tmp_78765 = defunc_1_op_res_68708;\n                    \n                    redout_76885 = redout_tmp_78763;\n                    redout_76886 = redout_tmp_78764;\n                    redout_76887 = redout_tmp_78765;\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_78766 = defunc_1_op_res_68740;\n                    double redout_tmp_78767 = defunc_1_op_res_68743;\n                    \n                    redout_76889 = redout_tmp_78766;\n                    redout_76890 = redout_tmp_78767;\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_78768 = 0; i_78768 < n_m_65386; i_78768++) {\n                double tmp_78769;\n                \n                tmp_78769 = ((__global double *) color_78179)[phys_tid_68572 +\n                                                              i_78768 *\n                                                ",
            "              num_threads_78254];\n                ((__global double *) mem_77342)[gtid_68571 + i_78768 *\n                                                m_65377] = tmp_78769;\n            }\n            for (int64_t i_78770 = 0; i_78770 < n_m_65386; i_78770++) {\n                double tmp_78771;\n                \n                tmp_78771 = ((__global double *) color_78178)[phys_tid_68572 +\n                                                              i_78770 *\n                                                              num_threads_78254];\n                ((__global double *) mem_77345)[gtid_68571 + i_78770 *\n                                                m_65377] = tmp_78771;\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_78875;\n    int32_t local_tid_78876;\n    int64_t group_sizze_78879;\n    int32_t wave_sizze_78878;\n    int32_t group_tid_78877;\n    \n    global_tid_78875 = get_global_id(0);\n    local_tid_78876 = get_local_id(0);\n    group_sizze_78879 = get_local_size(0);\n    wave_sizze_78878 = LOCKSTEP_WIDTH;\n    group_tid_78877 = get_group_id(0);\n    \n    int32_t phys_tid_69728 = global_tid_78875;\n    int64_t global_tid_78880 = sext_i32_i64(group_tid_78877) *\n            segmap_group_sizze_69722 + sext_i32_i64(local_ti",
            "d_78876);\n    int64_t slice_78881 = n_65378;\n    int64_t slice_78882 = m_65377 * slice_78881;\n    int64_t gtid_69726 = squot64(global_tid_78880, slice_78881);\n    int64_t remnant_78883 = global_tid_78880 - gtid_69726 * slice_78881;\n    int64_t gtid_69727 = remnant_78883;\n    int64_t remnant_78884 = remnant_78883 - 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_s",
            "izze_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_78885;\n    int32_t local_tid_78886;\n    int64_t group_sizze_78889;\n    int32_t wave_sizze_78888;\n    int32_t group_tid_78887;\n    \n    global_tid_78885 = get_global_id(0);\n    local_tid_78886 = get_local_id(0);\n    group_sizze_78889 = get_local_size(0);\n    wave_sizze_78888 = LOCKSTEP_WIDTH;\n    group_tid_78887 = get_group_id(0);\n    \n    int32_t phys_tid_69747 = global_tid_78885;\n    int64_t global_tid_78890 = sext_i32_i64(group_tid_78887) *\n            segmap_group_sizze_69742 + sext_i32_i64(local_tid_78886);\n    int64_t slice_78891 = n_65378;\n    int64_t slice_78892 = m_65377 * slice_78891;\n    int64_t gtid_69745 = squot64(global_tid_78890, slice_78891);\n    int64_t remnant_78893 = global_tid_78890 - gtid_69745 * slice_78891;\n    int64_t gtid_69746 = remnant_78893;\n    int64_t remnant_78894 = remnant_78893 - 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_65",
            "378, 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_78895;\n    int32_t local_tid_78896;\n    int64_t group_sizze_78899;\n    int32_t wave_sizze_78898;\n    int32_t group_tid_78897;\n    \n    global_tid_78895 = get_global_id(0);\n    local_tid_78896 = get_local_id(0);\n    group_sizze_78899 = get_local_size(0);\n    wave_sizze_78898 = LOCKSTEP_WIDTH;\n    group_tid_78897 = get_group_id(0);\n    \n    int32_t phys_tid_69759 = global_tid_78895;\n    int64_t global_tid_78900 = sext_i32_i64(group_tid_78897) *\n            segmap_group_sizze_69752 + sext_i32_i64(local_tid_78896);\n    int64_t slice_78901 = m_65377;\n    int64_t gtid_69758 = global_tid_78900;\n    int64_t remnant_78902 = global_tid_78900 - 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_78903;\n    int32_t local_tid_78904;\n    int64_t group_sizze_78907;\n    int32_t wave_sizze_78906;\n    int32_t group_tid_78905;\n    \n    global_tid_78903 = get_global_id(0);\n    local_tid_78904 = get_local_id(0);\n    group_sizze_78907 = get_local_size(0);\n    wave_sizze_78906 = LOCKSTEP_WIDTH;\n    group_tid_78905 = get_group_id(0);\n    \n    int32_t phys_tid_69779 = global_tid_78903;\n    int64_t global_tid_78908 = sext_i32_i64(group_tid_78905) *\n            segmap_group_sizze_69774 + sext_i32_i64(local_tid_78904);\n    int64_t slice_78909 = q_65380;\n    int64_t slice_78910 = m_65377 * slice_78909;\n    int64_t gtid_69777 = squot64(global_tid_78908, slice_78909);\n    int64_t remnant_78911 = global_tid_78908 - gtid_69777 * slice_78909;\n    int64_t gtid_69778 = remnant_78911;\n    int64_t remnant_78912 = remnant_78911 - 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_77",
            "350)[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 gl",
            "obal_tid_78967;\n    int32_t local_tid_78968;\n    int64_t group_sizze_78971;\n    int32_t wave_sizze_78970;\n    int32_t group_tid_78969;\n    \n    global_tid_78967 = get_global_id(0);\n    local_tid_78968 = get_local_id(0);\n    group_sizze_78971 = get_local_size(0);\n    wave_sizze_78970 = LOCKSTEP_WIDTH;\n    group_tid_78969 = get_group_id(0);\n    \n    int32_t phys_tid_69980 = global_tid_78967;\n    int64_t global_tid_78972 = sext_i32_i64(group_tid_78969) *\n            segmap_group_sizze_69973 + sext_i32_i64(local_tid_78968);\n    int64_t slice_78973 = n_m_65386;\n    int64_t slice_78974 = m_65377 * slice_78973;\n    int64_t gtid_69978 = squot64(global_tid_78972, slice_78973);\n    int64_t remnant_78975 = global_tid_78972 - gtid_69978 * slice_78973;\n    int64_t gtid_69979 = remnant_78975;\n    int64_t remnant_78976 = remnant_78975 - 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 mi",
            "d_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_70003, (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_78977 = loop_cond_70011;",
            "\n            int64_t low_tmp_78978 = loopres_70007;\n            int64_t high_tmp_78979 = loopres_70008;\n            \n            loop_while_69994 = loop_while_tmp_78977;\n            low_69995 = low_tmp_78978;\n            high_69996 = high_tmp_78979;\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_idx_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, de",
            "func_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_69990);\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_78980 = loop_cond_70052;\n            int64_t l_idx_tmp_78981 = loopres_70039;\n            int64_t r_idx_tmp_78982 = loopres_70040;\n            int64_t span_tmp_78983 = loopres_70041;\n            \n            loop_while_70016 = loop_while_tmp_78980;\n            l_idx_70017 = l_idx_tmp_78981;\n            r_idx_70018 = r_idx_tmp_78982;\n            span_70019 = span_tmp_78983;\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_6",
            "9989;\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_79084;\n    int32_t local_tid_79085;\n    int64_t group_sizze_79088;\n    int32_t wave_sizze_79087;\n    int32_t group_tid_79086;\n    \n    global_tid_79084 = get_global_id(0);\n    local_tid_79085 = get_local_id(0);\n    group_sizze_79088 = get_local_size(0);\n    wave_sizze_79087 = LOCKSTEP_WIDTH;\n    group_tid_79086 = get_group_id(0);\n    \n    int32_t phys_tid_70133 = global_tid_79084;\n    int64_t global_tid_79089 = sext_i32_i64(group_tid_79086) *\n            segmap_group_sizze_70126 + sext_i32_i64(local_tid_79085);\n    int64_t slice_79090 = n_m_65386;\n    int64_t slice_79091 = m_65377 * slice_79090;\n    int64_t gtid_70131 = squot64(global_tid_79089, slice_79090);\n    int64_t remnant_79092 = global_tid_79089 - gtid_70131 * slice_79090;\n    int64_t gtid_70132 = remnant_79092;\n    int64_t remnant_79093 = remnant_79092 - 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                                 unsigned 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_79186;\n    int32_t local_tid_79187;\n    int64_t group_sizze_79190;\n    int32_t wave_sizze_79189;\n    int32_t group_tid_79188;\n    \n    global_tid_79186 = get_global_id(0);\n    local_tid_79187 = get_local_id(0);\n    group_sizze_79190 = get_local_size(0);\n    wave_sizze_79189 = LOCKSTEP_WIDTH;\n    group_tid_79188 = get_group_id(0);\n    \n    int32_t phys_tid_70463 = global_tid_79186;\n  ",
            "  int32_t phys_group_id_79191;\n    \n    phys_group_id_79191 = get_group_id(0);\n    for (int32_t i_79192 = 0; i_79192 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377, segmap_group_sizze_70457)) -\n                   phys_group_id_79191, sext_i64_i32(num_groups_70458));\n         i_79192++) {\n        int32_t virt_group_id_79193 = phys_group_id_79191 + i_79192 *\n                sext_i64_i32(num_groups_70458);\n        int64_t global_tid_79194 = sext_i32_i64(virt_group_id_79193) *\n                segmap_group_sizze_70457 + sext_i32_i64(local_tid_79187);\n        int64_t slice_79195 = m_65377;\n        int64_t gtid_70462 = global_tid_79194;\n        int64_t remnant_79196 = global_tid_79194 - 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 = ((__global 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_79197 = defunc_1_op_res_70468;\n                \n                scanacc_76904 = scanacc_tmp_79197;\n            }\n            discard_76908 = scanacc_76",
            "904;\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_79199 = 0; i_79199 < n_65378; i_79199++) {\n                ((__global double *) color_78206)[phys_tid_70463 + i_79199 *\n                                                  num_threads_78271] = 0.0;\n            }\n            for (int64_t i_79200 = 0; i_79200 < n_65378; i_79200++) {\n                ((__global int64_t *) color_78205)[phys_tid_70463 + i_79200 *\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_iv_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_79203 = 0; i_79203 < (int64_t) 1;\n                         i_79203++) {\n                        double tmp_79204;\n                        \n                        tmp_79204 = ((__global double *) mem_77525)[m_65377 *\n                                                                    write_iter_76909 +\n                                                                    gtid_70462 +\n                                                                    i_79203 *\n                                                                    m_65377];\n                        ((__global double *) color_78206)[phys_tid_70463 +\n                                                          num_threads_78271 *\n                                                          defunc_1_f_res_70483 +\n                                                          i_79203 *\n                                                          num_threads_78271] =\n                            tmp_79204;\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_76923 < 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_79209 = loop_cond_70525;\n                    int64_t low_tmp_79210 = loopres_70521;\n                    int64_t high_tmp_79211 = loopres_70522;\n                    \n                    loop_while_70508 = loop_while_tmp_79209;\n                    low_70509 = low_tmp_79210;\n                    high_70510 = high_tmp_79211;\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_79212 = loop_cond_70566;\n                    int64_t l_idx_tmp_79213 = loopres_70553;\n                    int64_t r_idx_tmp_79214 = loopres_70554;\n                    int64_t span_tmp_79215 = loopres_70555",
            ";\n                    \n                    loop_while_70530 = loop_while_tmp_79212;\n                    l_idx_70531 = l_idx_tmp_79213;\n                    r_idx_70532 = r_idx_tmp_79214;\n                    span_70533 = span_tmp_79215;\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_705",
            "79 = 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                int64_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_7",
            "6936 = 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_79216 = defunc_1_op_res_70595;\n                    double redout_tmp_79217 = defunc_1_op_res_70598;\n                    double redout_tmp_79218 = defunc_1_op_res_70601;\n                    double redout_tmp_79219 = defunc_1_op_res_70604;\n                    double redout_tmp_79220 = defunc_1_op_res_70607;\n                    \n                    redout_76932 = redout_tmp_79216;\n                    redout_76933 = redout_tmp_79217;\n                    redout_76934 = redout_tmp_79218;\n                    redout_76935 = redout_tmp_79219;\n                    redout_76936 = redout_tmp_79220;\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 = defunc_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                redo",
            "ut_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_706",
            "72 * 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_79221 = defunc_1_op_res_70658;\n                    double redout_tmp_79222 = defunc_1_op_res_70661;\n                    \n                    redout_76938 = redout_tmp_79221;\n                    redout_76939 = redout_tmp_79222;\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 double *) color_78201)[phys_tid_70463 + i_76929 *\n                                                  num_threads_78271] =\n                    defunc_2_reduce_res_70655;\n            }\n            for (int64_t i_79223 = 0; i_79223 < n_m_65386; i_79223++) {\n                double tmp_79224;\n                \n                tmp_79224 = ((__global double *) color_78202)[phys_tid_70463 +\n                                                              i_79223 *\n                                                              num_threads_78271];\n                ((__global double *) mem_77634)[gtid_70462 + i_79223 *\n                                                m_65377] = tmp_79224;\n            }\n            for (int64_t i_79225 = 0; i_79225 < n_m_65386; i_79225++) {\n                double tmp_79226;\n                \n                tmp_79226 = ((__global double *) color_78201)[phys_tid_70463 +\n                                                              i_79225 *\n                                  ",
            "                            num_threads_78271];\n                ((__global double *) mem_77637)[gtid_70462 + i_79225 *\n                                                m_65377] = tmp_79226;\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_79330;\n    int32_t local_tid_79331;\n    int64_t group_sizze_79334;\n    int32_t wave_sizze_79333;\n    int32_t group_tid_79332;\n    \n    global_tid_79330 = get_global_id(0);\n    local_tid_79331 = get_local_id(0);\n    group_sizze_79334 = get_local_size(0);\n    wave_sizze_79333 = LOCKSTEP_WIDTH;\n    group_tid_79332 = get_group_id(0);\n    \n    int32_t phys_tid_71767 = global_tid_79330;\n    int64_t global_tid_79335 = sext_i32_i64(group_tid_79332) *\n            segmap_group_sizze_71761 + sext_i32_i64(local_tid_79331);\n    int64_t slice_79336 = n_65378;\n    int64_t slice_79337 = m_65377 * slice_79336;\n    int64_t gtid_71765 = squot64(global_tid_79335, slice_79336);\n    int64_t remnant_79338 = global_tid_79335 - gtid_71765 * slice_79336;\n    int64_t gtid_71766 = remnant_79338;\n    int64_t remnant_79339 = remnant_79338 - 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_65378 +\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_79340;\n    int32_t local_tid_79341;\n    int64_t group_sizze_79344;\n    int32_t wave_sizze_79343;\n    int32_t group_tid_79342;\n    \n    global_tid_79340 = get_global_id(0);\n    local_tid_79341 = get_local_id(0);\n    group_sizze_79344 = get_local_size(0);\n    wave_sizze_79343 = LOCKSTEP_WIDTH;\n    group_tid_79342 = get_group_id(0);\n    \n    int32_t phys_tid_71786 = global_tid_79340;\n    int64_t global_tid_79345 = sext_i32_i64(group_tid_79342) *\n            segmap_group_sizze_71781 + sext_i32_i64(local_tid_79341);\n    int64_t slice_79346 = n_65378;\n    int64_t slice_79347 = m_65377 * slice_79346;\n    int64_t gtid_71784 = squot64(global_tid_79345, slice_79346);\n    int64_t remnant_79348 = global_tid_79345 - gtid_71784 * slice_79346;\n    int64_t gtid_71785 = remnant_79348;\n    int64_t remnant_79349 = remnant_79348 - 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_79350;\n    int32_t local_tid_79351;\n    int64_t group_sizze_79354;\n    int32_t wave_sizze_79353;\n    int32_t group_tid_79352;\n    \n    global_tid_79350 = get_global_id(0);\n    local_tid_79351 = get_local_id(0);\n    group_sizze_79354 = get_local_size(0);\n    wave_sizze_79353 = LOCKSTEP_WIDTH;\n    group_tid_79352 = get_group_id(0);\n    \n    int32_t phys_tid_71798 = global_tid_79350;\n    int64_t global_tid_79355 = sext_i32_i64(group_tid_79352) *\n            segmap_group_sizze_71791 + sext_i32_i64(local_tid_79351);\n    int64_t slice_79356 = m_65377;\n    int64_t gtid_71797 = global_tid_79355;\n    int64_t remnant_79357 = global_tid_79355 - 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_79358;\n    int32_t local_tid_79359;\n    int64_t group_sizze_79362;\n    int32_t wave_sizze_79361;\n    int32_t group_tid_79360;\n    \n    global_tid_79358 = get_global_id(0);\n    local_tid_79359 = get_local_id(0);\n    group_sizze_79362 = get_local_size(0);\n    wave_sizze_79361 = LOCKSTEP_WIDTH;\n    group_tid_79360 = get_group_id(0);\n    \n    int32_t phys_tid_71818 = global_tid_79358;\n    int64_t global_tid_79363 = sext_i32_i64(group_tid_79360) *\n            segmap_group_sizze_71813 + sext_i32_i64(local_tid_79359);\n    int64_t slice_79364 = q_65380;\n    int64_t slice_79365 = m_65377 * slice_79364;\n    int64_t gtid_71816 = squot64(global_tid_79363, slice_79364);\n    int64_t remnant_79366 = global_tid_79363 - gtid_71816 * slice_79364;\n    int64_t gtid_71817 = remnant_79366;\n    int64_t remnant_79367 = remnant_79366 - 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    #un",
            "def 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_79438;\n    int32_t local_tid_79439;\n    int64_t group_sizze_79442;\n    int32_t wave_sizze_79441;\n    int32_t group_tid_79440;\n    \n    global_tid_79438 = get_global_id(0);\n    local_tid_79439 = get_local_id(0);\n    group_sizze_79442 = get_local_size(0);\n    wave_sizze_79441 = LOCKSTEP_WIDTH;\n    group_tid_79440 = get_group_id(0);\n    \n    int32_t phys_tid_72051 = global_tid_79438;\n    int64_t global_tid_79443 = sext_i32_i64(group_tid_79440) *\n            segmap_group_sizze_72044 + se",
            "xt_i32_i64(local_tid_79439);\n    int64_t slice_79444 = n_m_65386;\n    int64_t slice_79445 = m_65377 * slice_79444;\n    int64_t gtid_72049 = squot64(global_tid_79443, slice_79444);\n    int64_t remnant_79446 = global_tid_79443 - gtid_72049 * slice_79444;\n    int64_t gtid_72050 = remnant_79446;\n    int64_t remnant_79447 = remnant_79446 - 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_65392, 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_72069, (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_79448 = loop_cond_72082;\n            int64_t low_tmp_79449 = loopres_72078;\n            int64_t high_tmp_79450 = loopres_72079;\n            \n            loop_while_72065 = loop_while_tmp_79448;\n            low_72066 = low_tmp_79449;\n            high_72067 = high_tmp_79450;\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                        glo",
            "bal_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_72108);\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_79451 = loop_cond_72123;\n            int64_t l_idx_tmp_79452 = loopres_72110;\n            int64_t r_idx_tmp_79453 = loopres_72111;\n            int64_t span_tmp_79454 = loopres_72112;\n            \n            loop_while_72087 = loop_while_tmp_79451;\n            l_idx_72088 = l_idx_tmp_79452;\n            r_idx_72089 = r_idx_tmp_79453;\n            span_72090 = span_tmp_79454;\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_79583;\n    int32_t local_tid_79584;\n    int64_t group_sizze_79587;\n    int32_t wave_sizze_79586;\n    int32_t group_tid_79585;\n    \n    global_tid_79583 = get_global_id(0);\n    local_tid_79584 = get_local_id(0);\n    group_sizze_79587 = get_local_size(0);\n    wave_sizze_79586 = LOCKSTEP_WIDTH;\n    group_tid_79585 = get_group_id(0);\n    \n    int32_t phys_tid_72216 = global_tid_79583;\n    int64_t global_tid_79588 = sext_i32_i64(group_tid_79585) *\n            segmap_group_sizze_72207 + sext_i32_i64(local_tid_79584);\n    int64_t slice_79589 = n_m_65386;\n    int64_t slice_79590 = m_65377 * slice_79589;\n    int64_t gtid_72214 = squot64(global_tid_79588, slice_79589);\n    int64_t remnant_79591 = global_tid_79588 - gtid_72214 * slice_79589;\n    int64_t gtid_72215 = remnant_79591;\n    int64_t remnant_79592 = remnant_79591 - 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_reduce_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_722",
            "32 = 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_72243;\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_79785;\n    int32_t local_tid_79786;\n    int64_t group_sizze_79789;\n    int32_t wave_sizze_79788;\n    int32_t group_tid_79787;\n    \n    global_tid_79785 = get_global_id(0);\n    local_tid_79786 = get_local_id(0);\n    group_sizze_79789 = get_local_size(0);\n    wave_sizze_79788 = LOCKSTEP_WIDTH;\n    group_tid_79787 = get_group_id(0);\n    \n    int32_t phys_tid_72752 = global_tid_79785;\n    int64_t global_tid_79790 = sext_i32_i64(group_tid_79787) *\n            segmap_group_sizze_72746 + sext_i32_i64(local_tid_79786);\n    int64_t slice_79791 = n_65378;\n    int64_t slice_79792 = m_65377 * slice_79791;\n    int64_t gtid_72750 = squot64(global_tid_79790, slice_79791);\n    int64_t remnant_79793 = global_tid_79790 - gtid_72750 * slice_79791;\n    int64_t gtid_72751 = remnant_79793;\n    int64_t remnant_79794 = remnant_79793 - gtid_72751;\n    \n    if (slt64(gtid_72750, m_65377) && slt64(gtid_72751, n_65378)) {\n        double x_72753;\n        \n        x_72753 = ((__global 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            ((__gl",
            "obal 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 (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79795;\n    int32_t local_tid_79796;\n    int64_t group_sizze_79799;\n    int32_t wave_sizze_79798;\n    int32_t group_tid_79797;\n    \n    global_tid_79795 = get_global_id(0);\n    local_tid_79796 = get_local_id(0);\n    group_sizze_79799 = get_local_size(0);\n    wave_sizze_79798 = LOCKSTEP_WIDTH;\n    group_tid_79797 = get_group_id(0);\n    \n    int32_t phys_tid_72771 = global_tid_79795;\n    int64_t global_tid_79800 = sext_i32_i64(group_tid_79797) *\n            segmap_group_sizze_72766 + sext_i32_i64(local_tid_79796);\n    int64_t slice_79801 = n_65378;\n    int64_t slice_79802 = m_65377 * slice_79801;\n    int64_t gtid_72769 = squot64(global_tid_79800, slice_79801);\n    int64_t remnant_79803 = global_tid_79800 - gtid_72769 * slice_79801;\n    int64_t gtid_72770 = remnant_79803;\n    int64_t remnant_79804 = remnant_79803 - 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_79805;\n    int32_t local_tid_79806;\n    int64_t group_sizze_79809;\n    int32_t wave_sizze_79808;\n    int32_t group_tid_79807;\n    \n    global_tid_79805 = get_global_id(0);\n    local_tid_79806 = get_local_id(0);\n    group_sizze_79809 = get_local_size(0);\n    wave_sizze_79808 = LOCKSTEP_WIDTH;\n    group_tid_79807 = get_group_id(0);\n    \n    int32_t phys_tid_72783 = global_tid_79805;\n    int64_t global_tid_79810 = sext_i32_i64(group_tid_79807) *\n            segmap_group_sizze_72776 + sext_i32_i64(local_tid_79806);\n    int64_t slice_79811 = m_65377;\n    int64_t gtid_72782 = global_tid_79810;\n    int64_t remnant_79812 = global_tid_79810 - 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_79813;\n    int32_t local_tid_79814;\n    int64_t group_sizze_79817;\n    int32_t wave_sizze_79816;\n    int32_t group_tid_79815;\n    \n    global_tid_79813 = get_global_id(0);\n    local_tid_79814 = get_local_id(0);\n    group_sizze_79817 = get_local_size(0);\n    wave_sizze_79816 = LOCKSTEP_WIDTH;\n    group_tid_79815 = get_group_id(0);\n    \n    int32_t phys_tid_72803 = global_tid_79813;\n    int64_t global_tid_79818 = sext_i32_i64(group_tid_79815) *\n            ",
            "segmap_group_sizze_72798 + sext_i32_i64(local_tid_79814);\n    int64_t slice_79819 = q_65380;\n    int64_t slice_79820 = m_65377 * slice_79819;\n    int64_t gtid_72801 = squot64(global_tid_79818, slice_79819);\n    int64_t remnant_79821 = global_tid_79818 - gtid_72801 * slice_79819;\n    int64_t gtid_72802 = remnant_79821;\n    int64_t remnant_79822 = remnant_79821 - 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_79954;\n    int32_t local_tid_79955;\n    int64_t group_sizze_79958;\n    int32_t wave_sizze_79957;\n    int32_t group_tid_79956;\n    \n    global_tid_79954 = get_global_id(0);\n    local_tid_79955 = get_local_id(0);\n    group_sizze_79958 = get_local_size(0);\n    wave_sizze_79957 = LO",
            "CKSTEP_WIDTH;\n    group_tid_79956 = get_group_id(0);\n    \n    int32_t phys_tid_73419 = global_tid_79954;\n    int64_t global_tid_79959 = sext_i32_i64(group_tid_79956) *\n            segmap_group_sizze_73413 + sext_i32_i64(local_tid_79955);\n    int64_t slice_79960 = n_65378;\n    int64_t slice_79961 = m_65377 * slice_79960;\n    int64_t gtid_73417 = squot64(global_tid_79959, slice_79960);\n    int64_t remnant_79962 = global_tid_79959 - gtid_73417 * slice_79960;\n    int64_t gtid_73418 = remnant_79962;\n    int64_t remnant_79963 = remnant_79962 - 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_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_73438 = global_tid_79964;\n    int64_t global_tid_79969 = sext_i32_i64(group_tid_79966) *\n            segmap_group_sizze_73433 + 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_73436 = squot64(global_tid_79969, slice_79970);\n    int64_t remnant_79972 = global_tid_79969 - gtid_73436 * slice_79970;\n    int64_t gtid_73437 = remnant_79972;\n    int64_t remnant_79973 = remnant_79972 - 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_79974;\n    int32_t local_tid_79975;\n    int64_t group_sizze_79978;\n    int32_t wave_sizze_79977;\n    int32_t group_tid_79976;\n    \n    global_tid_79974 = get_global_id(0);\n    local_tid_79975 = get_local_id(0);\n    group_sizze_79978 = get_local_size(0);\n    wave_sizze_79977 = LOCKSTEP_WIDTH;\n    group_tid_79976 = get_group_id(0);\n    \n    int32_t phys_tid_73450 = global_tid_79974;\n    int64_t global_tid_79979 = sext_i32_i64(group_tid_79976) *\n            segmap_group_sizze_73443 + sext_i32_i64(local_tid_79975);\n    int64_t slice_79980 = m_65377;\n    int64_t gtid_73449 = global_tid_79979;\n    int64_t remnant_79981 = global_tid_79979 - 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_group_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_79982;\n    int32_t local_tid_79983;\n    int64_t group_sizze_79986;\n    int32_t wave_sizze_79985;\n    int32_t group_tid_79984;\n    \n    global_tid_79982 = get_global_id(0);\n    local_tid_79983 = get_local_id(0);\n    group_sizze_79986 = get_local_size(0);\n    wave_sizze_79985 = LOCKSTEP_WIDTH;\n    group_tid_79984 = get_group_id(0);\n    \n    int32_t phys_tid_73470 = global_tid_79982;\n    int64_t global_tid_79987 = sext_i32_i64(group_tid_79984) *\n            segmap_group_sizze_73465 + sext_i32_i64(local_tid_79983);\n    int64_t slice_79988 = q_65380;\n    int64_t slice_79989 = m_65377 * slice_79988;\n    int64_t gtid_73468 = squot64(global_tid_79987, slice_79988);\n    int64_t remnant_79990 = global_tid_79987 - gtid_73468 * slice_79988;\n    int64_t gtid_73469 = remnant_79",
            "990;\n    int64_t remnant_79991 = remnant_79990 - 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                                 unsigned 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_80129;\n    int32_t local_tid_80130;\n    int64_t group_sizze_80133;\n    int32_t wave_sizze_80132;\n    int32_t group_tid_80131;\n    \n    global_tid_80129 = get_global_id(0);\n    local_tid_80130 = get_local_id(0);\n    group_sizze_80133 = get_local_size(0);\n    wave_sizze_80132 = LOCKSTEP_WIDTH;\n    group_tid_80131 = get_group_id(0);\n    \n    int32_t phys_tid_74176 = global_tid_80129;\n    int64_t global_tid_80134 = sext_i32_i64(group_tid_80131) *\n            segmap_group_sizze_74170 + sext_i32_i64(local_tid_80130);\n    int64_t slice_80135 = n_65378;\n    int64_t slice_80136 = m_65377 * slice_",
            "80135;\n    int64_t gtid_74174 = squot64(global_tid_80134, slice_80135);\n    int64_t remnant_80137 = global_tid_80134 - gtid_74174 * slice_80135;\n    int64_t gtid_74175 = remnant_80137;\n    int64_t remnant_80138 = remnant_80137 - 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_6",
            "5377,\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_80139;\n    int32_t local_tid_80140;\n    int64_t group_sizze_80143;\n    int32_t wave_sizze_80142;\n    int32_t group_tid_80141;\n    \n    global_tid_80139 = get_global_id(0);\n    local_tid_80140 = get_local_id(0);\n    group_sizze_80143 = get_local_size(0);\n    wave_sizze_80142 = LOCKSTEP_WIDTH;\n    group_tid_80141 = get_group_id(0);\n    \n    int32_t phys_tid_74195 = global_tid_80139;\n    int64_t global_tid_80144 = sext_i32_i64(group_tid_80141) *\n            segmap_group_sizze_74190 + sext_i32_i64(local_tid_80140);\n    int64_t slice_80145 = n_65378;\n    int64_t slice_80146 = m_65377 * slice_80145;\n    int64_t gtid_74193 = squot64(global_tid_80144, slice_80145);\n    int64_t remnant_80147 = global_tid_80144 - gtid_74193 * slice_80145;\n    int64_t gtid_74194 = remnant_80147;\n    int64_t remnant_80148 = remnant_80147 - 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_80149;\n    int32_t local_tid_80150;\n    int64_t group_sizze_80153;\n    int32_t wave_sizze_80152;\n    int32_t group_tid_80151;\n    \n    global_tid_80149 = get_global_id(0);\n    local_tid_80150 = get_local_id(0);\n    group_sizze_80153 = get_local_size(0);\n    wave_sizze_80152 = LOCKSTEP_WIDTH;\n    group_tid_80151 = get_group_id(0);\n    \n    int32_t phys_tid_74207 = global_tid_80149;\n    int64_t global_tid_80154 = sext_i32_i64(group_tid_80151) *\n            segmap_group_sizze_74200 + sext_i32_i64(local_tid_80150);\n    int64_t slice_80155 = m_65377;\n    int64_t gtid_74206 = global_tid_80154;\n    int64_t remnant_80156 = global_tid_80154 - 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_80157;\n    int32_t local_tid_80158;\n    int64_t group_sizze_80161;\n    int32_t wave_sizze_80160;\n    int32_t group_tid_80159;\n    \n    global_tid_80157 = get_global_id(0);\n    local_tid_80158 = get_local_id(0);\n    group_sizze_80161 = get_local_size(0);\n    wave_sizze_80160 = LOCKSTEP_WIDTH;\n    group_tid_80159 = get_group_id(0);\n    \n    int32_t phys_tid_74227 = global_tid_80157;\n    int64_t global_tid_80162 = sext_i32_i64(group_tid_80159) *\n            segmap_group_sizze_74222 + sext_i32_i64(local_tid_80158);\n    int64_t slice_80163 = q_65380;\n    int64_t slice_80164 = m_65377 * slice_80163;\n    int64_t gtid_74225 = squot64(global_tid_80162, slice_80163);\n    int64_t remnant_80165 = global_tid_80162 - gtid_74225 * slice_80163;\n    int64_t gtid_74226 = remnant_80165;\n    int64_t remnant_80166 = remnant_80165 - 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_80204;\n    int32_t local_tid_80205;\n    int64_t group_sizze_80208;\n    int32_t wave_sizze_80207;\n    int32_t group_tid_80206;\n    \n    global_tid_80204 = get_global_id(0);\n    local_tid_80205 = get_local_id(0);\n    group_sizze_80208 = get_local_size(0);\n    wave_sizze_80207 = LOCKSTEP_WIDTH;\n    group_tid_80206 = get_group_id(0);\n    \n    int32_t phys_tid_74589 = global_tid_80204;\n    int64_t global_tid_80209 = sext_i32_i64(group_tid_80206) *\n            segmap_group_sizze_74584 + sext_i32_i64(local_tid_80205);\n    int64_t slice_80210 = n_65378;\n    int64_t slice_80211 = m_65377 * slice_80210;\n    int64_t gtid_74587 = squot64(global_tid_80209, slice_80210);\n    int64_t remnant_80212 = global_",
            "tid_80209 - gtid_74587 * slice_80210;\n    int64_t gtid_74588 = remnant_80212;\n    int64_t remnant_80213 = remnant_80212 - 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_65386 +\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 de",
            "func_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                                            uint red_arr_mem_79846_backing_offset_0,\n                                            uint red_arr_mem_79842_backing_offset_1,\n                                            uint color_78231_backing_offset_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_6",
            "5393 = 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    volatile unsigned char *red_arr_mem_79846_backing_2 =\n                           &shared_mem[red_arr_mem_79846_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79842_backing_1 =\n                           &shared_mem[red_arr_mem_79842_backing_offset_1];\n    volatile unsigned char *color_78231_backing_0 =\n                           &shared_mem[color_78231_backing_offset_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_79823;\n    int32_t local_tid_79824;\n    int64_t group_sizze_79827;\n    int32_t wave_sizze_79826;\n    int32_t group_tid_79825;\n    \n    global_tid_79823 = get_global_id(0);\n    local_tid_79824 = get_local_id(0);\n    group_sizze_79827 = get_local_size(0);\n    wave_sizze_79826 = LOCKSTEP_WIDTH;\n    group_tid_79825 = get_group_id(0);\n    \n    int32_t phys_tid_72819 = group_tid_79825;\n    int64_t slice_79829 = q_65380;\n    int64_t ltid_pre_79828 = sext_i32_i64(local_tid_79824);\n    int64_t remnant_79830 = sext_i32_i64(local_tid_79824) - ltid_pre_79828;\n    int64_t slice_79831 = n_m_65386;\n    int64_t slice_79832 = m_65377 * slice_79831;\n    int64_t gtid_72817 = squot64(sext_i32_i64(group_tid_79825), slice_79831);\n    int64_t remnant_79833 = sext_i32_i64(group_tid_79825) - gtid_72817 *\n            slice_79831;\n    int64_t gtid_72818 = remnant_79833;\n    int64_t remnant_79834 = remnant_79833 - 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_res_72856;\n            loopres_72854 = high_72842;\n        }\n        \n        bool loop_cond_72857 = sle64(loopres_72853, loopres_72854);\n        bool loop_while_tmp_79835 = loop_cond_72857;\n        int64_t low_tmp_79836 = loopres_72853;\n        int64_t high_tmp_79837 = loopres_72854;\n        \n        loop_while_72840 = loop_while_tmp_79835;\n        low_72841 = low_tmp_79836;\n        high_72842 = high_tmp_79837;\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_cm",
            "pxchg_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_i",
            "dx_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_79838 = loop_cond_72898;\n        int64_t l_idx_tmp_79839 = loopres_72885;\n        int64_t r_idx_tmp_79840 = loopres_72886;\n        int64_t span_tmp_79841 = loopres_72887;\n        \n        loop_while_72862 = loop_while_tmp_79838;\n        l_idx_72863 = l_idx_tmp_79839;\n        r_idx_72864 = r_idx_tmp_79840;\n        span_72865 = span_tmp_79841;\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_args[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_79828));\n    int32_t phys_tid_72923 = local_tid_79824;\n    __local unsigned char *red_arr_mem_79842;\n    \n    red_arr_mem_79842 = (__local unsigned char *) red_arr_mem_79842_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_79842)[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_79844;\n    int32_t skip_waves_79845 = 1;\n    double x_72924;\n    double x_72925;\n    \n",
            "    offset_79844 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79824, sext_i64_i32(q_65380))) {\n            x_72924 = ((__local\n                        double *) red_arr_mem_79842)[sext_i32_i64(local_tid_79824 +\n                                                     offset_79844)];\n        }\n    }\n    offset_79844 = 1;\n    while (slt32(offset_79844, wave_sizze_79826)) {\n        if (slt32(local_tid_79824 + offset_79844, sext_i64_i32(q_65380)) &&\n            ((local_tid_79824 - squot32(local_tid_79824, wave_sizze_79826) *\n              wave_sizze_79826) & (2 * offset_79844 - 1)) == 0) {\n            // read array element\n            {\n                x_72925 = ((volatile __local\n                            double *) red_arr_mem_79842)[sext_i32_i64(local_tid_79824 +\n                                                         offset_79844)];\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_79842)[sext_i32_i64(local_tid_79824)] =\n                    x_72924;\n            }\n        }\n        offset_79844 *= 2;\n    }\n    while (slt32(skip_waves_79845, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79826 - 1,\n                                           wave_sizze_79826))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79844 = skip_waves_79845 * wave_sizze_79826;\n        if (slt32(local_tid_79824 + offset_79844, sext_i64_i32(q_65380)) &&\n            ((local_tid_79824 - squot32(local_tid_79824, wave_sizze_79826) *\n              wave_sizze_79826) == 0 && (squot32(local_tid_79824,\n                                                 wave_sizze_79826) & (2 *\n                                                  ",
            "                    skip_waves_79845 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_72925 = ((__local\n                            double *) red_arr_mem_79842)[sext_i32_i64(local_tid_79824 +\n                                                         offset_79844)];\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                ((__local\n                  double *) red_arr_mem_79842)[sext_i32_i64(local_tid_79824)] =\n                    x_72924;\n            }\n        }\n        skip_waves_79845 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_72920 = ((__local\n                                  double *) red_arr_mem_79842)[(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_79828));\n    int32_t phys_tid_72947 = local_tid_79824;\n    __local unsigned char *red_arr_mem_79846;\n    \n    red_arr_mem_79846 = (__local unsigned char *) red_arr_mem_79846_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_79846)[gtid_72946] =\n        defunc_9_fit_fun_res_72958;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_79848;\n    int32_t skip_waves_79849 = 1;\n    double x_72948;\n    double x_72949;\n    \n    offset_79848 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79824, sext_i64_i32(q_65380))) {\n            x_72948 = ((__local\n                        double *) red_arr_mem_79846)[sext_i32_i64(local_tid_79824 +\n                                                     offset_79848)];\n        }\n    }\n    offset_79848 = 1;\n    while (slt32(offset_79848, wave_sizze_79826)) {\n        if (slt32(local_tid_79824 + offset_79848, sext_i64_i32(q_65380)) &&\n            ((local_tid_79824 - squot32(local_tid_79824, wave_sizze_79826) *\n              wave_sizze_79826) & (2 * offset_79848 - 1)) == 0) {\n            // read array element\n            {\n                x_72949 = ((volatile __local\n                            double *) red_arr_mem_79846)[sext_i32_i64(local_tid_79824 +\n                                                         offset_79848)];\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_79846)[sext_i32_i64(local_tid_79824)] =\n                    x_72948;\n            }\n        }\n        offset_79848 *= 2;\n    }\n    while (slt32(skip_waves_79849, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79826 - 1,\n                                           wave_sizze_79826))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_79848 = skip_waves_79849 * w",
            "ave_sizze_79826;\n        if (slt32(local_tid_79824 + offset_79848, sext_i64_i32(q_65380)) &&\n            ((local_tid_79824 - squot32(local_tid_79824, wave_sizze_79826) *\n              wave_sizze_79826) == 0 && (squot32(local_tid_79824,\n                                                 wave_sizze_79826) & (2 *\n                                                                      skip_waves_79849 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_72949 = ((__local\n                            double *) red_arr_mem_79846)[sext_i32_i64(local_tid_79824 +\n                                                         offset_79848)];\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_79846)[sext_i32_i64(local_tid_79824)] =\n                    x_72948;\n            }\n        }\n        skip_waves_79849 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_72945 = ((__local\n                                  double *) red_arr_mem_79846)[(int64_t) 0];\n    if (local_tid_79824 == 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                                            uint red_arr_mem_80021_backing_offset_0,\n                                            uint red_arr_mem_80019_backing_offset_1,\n                                            uint red_arr_m",
            "em_80015_backing_offset_2,\n                                            uint red_arr_mem_80013_backing_offset_3,\n                                            uint red_arr_mem_80011_backing_offset_4,\n                                            uint color_78233_backing_offset_5,\n                                            uint color_78232_backing_offset_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    volatile unsigned char *red_arr_mem_80021_backing_6 =\n                           &shared_mem[red_arr_mem_80021_backing_offset_0];\n    volati",
            "le unsigned char *red_arr_mem_80019_backing_5 =\n                           &shared_mem[red_arr_mem_80019_backing_offset_1];\n    volatile unsigned char *red_arr_mem_80015_backing_4 =\n                           &shared_mem[red_arr_mem_80015_backing_offset_2];\n    volatile unsigned char *red_arr_mem_80013_backing_3 =\n                           &shared_mem[red_arr_mem_80013_backing_offset_3];\n    volatile unsigned char *red_arr_mem_80011_backing_2 =\n                           &shared_mem[red_arr_mem_80011_backing_offset_4];\n    volatile unsigned char *color_78233_backing_1 =\n                           &shared_mem[color_78233_backing_offset_5];\n    volatile unsigned char *color_78232_backing_0 =\n                           &shared_mem[color_78232_backing_offset_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_79992;\n    int32_t local_tid_79993;\n    int64_t group_sizze_79996;\n    int32_t wave_sizze_79995;\n    int32_t group_tid_79994;\n    \n    global_tid_79992 = get_global_id(0);\n    local_tid_79993 = get_local_id(0);\n    group_sizze_79996 = get_local_size(0);\n    wave_sizze_79995 = LOCKSTEP_WIDTH;\n    group_tid_79994 = get_group_id(0);\n    \n    int32_t phys_tid_73487 = group_tid_79994;\n    int64_t slice_79998 = q_65380;\n    int64_t ltid_pre_79997 = sext_i32_i64(local_tid_79993);\n    int64_t remnant_79999 = sext_i32_i64(local_tid_79993) - ltid_pre_79997;\n    int64_t slice_80000 = n_m_65386;\n    int64_t slice_80001 = m_65377 * slice_80000;\n    int64_t gtid_73485 = squot64(sext_i32_i64(group_tid_79994), slice_80000);\n    int64_t remnant_80002 = sext_i32_i64(group_tid_79994) - gtid_73485 *\n            slice_80000;\n    int64_t gtid_73486 = remnant_80002;\n    int64_t remnant_80003 = remnant_80002 - gtid_73486;\n    __local unsigned char *color_78232;\n    \n    colo",
            "r_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_73514;\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_80004 = loop_cond_73525;\n        int64_t low_tmp_80005 = loopres_73521;\n        int64_t high_tmp_80006 = loopres_73522;\n        \n        loop_while_73508 = loop_while_tmp_80004;\n        low_73509 = low_tmp_80005;\n        high_73510 = high_tmp_80006;\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_73529;\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 mi",
            "n_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_failure = 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_7",
            "3554;\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_80007 = loop_cond_73566;\n        int64_t l_idx_tmp_80008 = loopres_73553;\n        int64_t r_idx_tmp_80009 = loopres_73554;\n        int64_t span_tmp_80010 = loopres_73555;\n        \n        loop_while_7353",
            "0 = loop_while_tmp_80007;\n        l_idx_73531 = l_idx_tmp_80008;\n        r_idx_73532 = r_idx_tmp_80009;\n        span_73533 = span_tmp_80010;\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_cmpxchg_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_79997));\n    int32_t phys_tid_73594 = local_tid_79993;\n    __local unsigned char *red_arr_mem_80011;\n    \n    red_arr_mem_80011 = (__local unsigned char *) red_arr_mem_80011_backing_2;\n    \n    __local unsigned char *red_arr_mem_80013;\n    \n    red_arr_mem_80013 = (__local unsigned char *) red_arr_mem_80013_backing_3;\n    \n    __local unsigned char *red_arr_mem_80015;\n    \n    red_arr_mem_80015 = (__local unsigned char *) red_arr_mem_80015_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_80011)[gtid_73593] = tmp4_73620;\n    ((__local double *) red_arr_mem_80013)[gtid_73593] = defunc_1_f_res_73621;\n    ((__local double *) red_arr_mem_80015)[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_80017;\n    int32_t skip_waves_80018 = 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_80017 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79993, sext_i64_i32(q_65380))) {\n            x_73595 = ((__local\n                        double *) red_arr_mem_80011)[sext_i32_i64(local_tid_79993 +\n                                                     offset_80017)];\n            x_73596 = ((__local\n                        double *) red_arr_mem_80013)[sext_i32_i64(local_tid_79993 +\n                                                     offset_80017)];\n            x_73597 = ((__local\n                        double *) red_arr_mem_80015)[sext_i32_i64(local_tid_79993 +\n                                                     offset_80017)];\n        }\n    }\n    offset_80017 = 1;\n    while (slt32(offset_80017, wave_sizze_79995)) {\n        if (slt32(local_tid_79993 + offset_80017, sext_i64_i32(q_65380",
            ")) &&\n            ((local_tid_79993 - squot32(local_tid_79993, wave_sizze_79995) *\n              wave_sizze_79995) & (2 * offset_80017 - 1)) == 0) {\n            // read array element\n            {\n                x_73598 = ((volatile __local\n                            double *) red_arr_mem_80011)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80017)];\n                x_73599 = ((volatile __local\n                            double *) red_arr_mem_80013)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80017)];\n                x_73600 = ((volatile __local\n                            double *) red_arr_mem_80015)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80017)];\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_80011)[sext_i32_i64(local_tid_79993)] =\n                    x_73595;\n                ((volatile __local\n                  double *) red_arr_mem_80013)[sext_i32_i64(local_tid_79993)] =\n                    x_73596;\n                ((volatile __local\n                  double *) red_arr_mem_80015)[sext_i32_i64(local_tid_79993)] =\n                    x_73597;\n            }\n        }\n        offset_80017 *= 2;\n    }\n    while (slt32(skip_waves_80018, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79995 - 1,\n                                           wave_sizze_79995))) {",
            "\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_80017 = skip_waves_80018 * wave_sizze_79995;\n        if (slt32(local_tid_79993 + offset_80017, sext_i64_i32(q_65380)) &&\n            ((local_tid_79993 - squot32(local_tid_79993, wave_sizze_79995) *\n              wave_sizze_79995) == 0 && (squot32(local_tid_79993,\n                                                 wave_sizze_79995) & (2 *\n                                                                      skip_waves_80018 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_73598 = ((__local\n                            double *) red_arr_mem_80011)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80017)];\n                x_73599 = ((__local\n                            double *) red_arr_mem_80013)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80017)];\n                x_73600 = ((__local\n                            double *) red_arr_mem_80015)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80017)];\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_80011)[sext_i32_i64(local_tid_79993)] =\n                    x_73595;\n                ((__local\n                  double *) red_arr_mem_80013)[sext_i32_i64(local_tid_79993)] =\n                    x_73596;\n              ",
            "  ((__local\n                  double *) red_arr_mem_80015)[sext_i32_i64(local_tid_79993)] =\n                    x_73597;\n            }\n        }\n        skip_waves_80018 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_73588 = ((__local\n                                  double *) red_arr_mem_80011)[(int64_t) 0];\n    defunc_2_reduce_res_73589 = ((__local\n                                  double *) red_arr_mem_80013)[(int64_t) 0];\n    defunc_2_reduce_res_73590 = ((__local\n                                  double *) red_arr_mem_80015)[(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_79997));\n    int32_t phys_tid_73634 = local_tid_79993;\n    __local unsigned char *red_arr_mem_80019;\n    \n    red_arr_mem_80019 = (__local unsigned char *) red_arr_mem_80019_backing_5;\n    \n    __local unsigned char *red_arr_mem_80021;\n    \n    red_arr_mem_80021 = (__local unsigned char *) red_arr_mem_80021_backing_6;\n    \n    double 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_80019)[gtid_73633] =\n        defunc_9_fit_fun_res_73651;\n    ((__local double *) red_arr_mem_80021)[gtid_73633] =\n        defunc_9_slope_fun_res_73655;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_80023;\n    int32_t skip_waves_80024 = 1;\n    double x_73635;\n    double x_73636;\n    double x_73637;\n    double x_73638;\n    \n    offset_80023 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_79993, sext_i64_i32(q_65380))) {\n            x_73635 = ((__local\n                        double *) red_arr_mem_80019)[sext_i32_i64(local_tid_79993 +\n                                                     offset_80023)];\n            x_73636 = ((__local\n                        double *) red_arr_mem_80021)[sext_i32_i64(local_tid_79993 +\n                                                     offset_80023)];\n        }\n    }\n    offset_80023 = 1;\n    while (slt32(offset_80023, wave_sizze_79995)) {\n        if (slt32(local_tid_79993 + offset_80023, sext_i64_i32(q_65380)) &&\n            ((local_tid_79993 - squot32(local_tid_79993, wave_sizze_79995) *\n              wave_sizze_79995) & (2 * offset_80023 - 1)) == 0) {\n            // read array element\n            {\n                x_73637 = ((volatile __local\n                            double *) red_arr_mem_80019)[sext_i32_i64(l",
            "ocal_tid_79993 +\n                                                         offset_80023)];\n                x_73638 = ((volatile __local\n                            double *) red_arr_mem_80021)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80023)];\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_80019)[sext_i32_i64(local_tid_79993)] =\n                    x_73635;\n                ((volatile __local\n                  double *) red_arr_mem_80021)[sext_i32_i64(local_tid_79993)] =\n                    x_73636;\n            }\n        }\n        offset_80023 *= 2;\n    }\n    while (slt32(skip_waves_80024, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_79995 - 1,\n                                           wave_sizze_79995))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_80023 = skip_waves_80024 * wave_sizze_79995;\n        if (slt32(local_tid_79993 + offset_80023, sext_i64_i32(q_65380)) &&\n            ((local_tid_79993 - squot32(local_tid_79993, wave_sizze_79995) *\n              wave_sizze_79995) == 0 && (squot32(local_tid_79993,\n                                                 wave_sizze_79995) & (2 *\n                                                                      skip_waves_80024 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_73637 = ((__local\n                            double *) red_arr_mem_80019)[sext_i32_i64(local_tid_79993 +\n                             ",
            "                            offset_80023)];\n                x_73638 = ((__local\n                            double *) red_arr_mem_80021)[sext_i32_i64(local_tid_79993 +\n                                                         offset_80023)];\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_80019)[sext_i32_i64(local_tid_79993)] =\n                    x_73635;\n                ((__local\n                  double *) red_arr_mem_80021)[sext_i32_i64(local_tid_79993)] =\n                    x_73636;\n            }\n        }\n        skip_waves_80024 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_73631 = ((__local\n                                  double *) red_arr_mem_80019)[(int64_t) 0];\n    defunc_2_reduce_res_73632 = ((__local\n                                  double *) red_arr_mem_80021)[(int64_t) 0];\n    if (local_tid_79993 == 0) {\n        ((__global double *) mem_77959)[gtid_73485 * n_m_65386 + gtid_73486] =\n            defunc_2_reduce_res_73631;\n    }\n    if (local_tid_79993 == 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                                            uint red_arr_mem_80200_backing_offset_0,\n                                            uint red_arr_mem_80198_backing_offset_1,\n                                ",
            "            uint red_arr_mem_80194_backing_offset_2,\n                                            uint red_arr_mem_80192_backing_offset_3,\n                                            uint red_arr_mem_80190_backing_offset_4,\n                                            uint red_arr_mem_80188_backing_offset_5,\n                                            uint red_arr_mem_80186_backing_offset_6,\n                                            uint color_78237_backing_offset_7,\n                                            uint color_78236_backing_offset_8,\n                                            uint color_78235_backing_offset_9,\n                                            uint color_78234_backing_offset_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    volatile unsigned char *red_arr_mem_80200_backing_10 =\n                           &shared_mem[red_arr_mem_80200_backing_offset_0];\n    volatile unsigned char *red_arr_mem_80198_backing_9 =\n                           &shared_mem[red_arr_mem_80198_backing_offset_1];\n    volatile unsigned char *red_arr_mem_80194_backing_8 =\n                           &shared_mem[red_arr_mem_80194_backing_offset_2];\n    volatile unsigned char *red_arr_mem_80192_backing_7 =\n                           &shared_mem[red_arr_mem_80192_backing_offset_3];\n    volatile unsigned char *red_arr_mem_80190_backing_6 =\n                           &shared_mem[red_arr_mem_80190_backing_offset_4];\n    volatile unsigned char *red_arr_mem_80188_backing_5 =\n                           &shared_mem[red_arr_mem_80188_backing_offset_5];\n    volatile unsigned char *red_arr_mem_80186_backing_4 =\n                           &shared_mem[red_arr_mem_80186_backing_offset_6];\n    volatile unsigned char *color_78237_backing_3 =\n                           &shared_mem[color_78237_backing_offset_7];\n    volatile unsigned char *color_78236_backing_2 =\n                           &shared_mem[color_78236_backing_offset_8];\n    volatile unsigned char *color_78235_backing_1 =\n                           &shared_mem[color_78235_backing_offset_9];\n    volatile unsigned char *color_78234_backing_0 =\n                           &shared_mem[color_78234_backing_offset_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_80167;\n    int32_t local_tid_80168;\n    int64_t group_sizze_80171;\n    int32_t wave_sizze_80170;",
            "\n    int32_t group_tid_80169;\n    \n    global_tid_80167 = get_global_id(0);\n    local_tid_80168 = get_local_id(0);\n    group_sizze_80171 = get_local_size(0);\n    wave_sizze_80170 = LOCKSTEP_WIDTH;\n    group_tid_80169 = get_group_id(0);\n    \n    int32_t phys_tid_74244 = group_tid_80169;\n    int64_t slice_80173 = q_65380;\n    int64_t ltid_pre_80172 = sext_i32_i64(local_tid_80168);\n    int64_t remnant_80174 = sext_i32_i64(local_tid_80168) - ltid_pre_80172;\n    int64_t slice_80175 = n_m_65386;\n    int64_t slice_80176 = m_65377 * slice_80175;\n    int64_t gtid_74242 = squot64(sext_i32_i64(group_tid_80169), slice_80175);\n    int64_t remnant_80177 = sext_i32_i64(group_tid_80169) - gtid_74242 *\n            slice_80175;\n    int64_t gtid_74243 = remnant_80177;\n    int64_t remnant_80178 = remnant_80177 - 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    int6",
            "4_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_7428",
            "1;\n            loopres_74279 = high_74267;\n        }\n        \n        bool loop_cond_74282 = sle64(loopres_74278, loopres_74279);\n        bool loop_while_tmp_80179 = loop_cond_74282;\n        int64_t low_tmp_80180 = loopres_74278;\n        int64_t high_tmp_80181 = loopres_74279;\n        \n        loop_while_74265 = loop_while_tmp_80179;\n        low_74266 = low_tmp_80180;\n        high_74267 = high_tmp_80181;\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, defu",
            "nc_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_80182 = loop_cond_74323;\n        int64_t l_idx_tmp_80183 = loopres_74310;\n        int64_t r_idx_tmp_80184 = loopres_74311;\n        int64_t span_tmp_80185 = loopres_74312;\n        \n        loop_while_74287 = loop_while_tmp_80182;\n        l_idx_74288 = l_idx_tmp_80183;\n        r_idx_74289 = r_idx_tmp_80184;\n        span_74290 = span_tmp_80185;\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_cmpxchg_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_80172));\n    int32_t phys_tid_74348 = local_tid_80168;\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(max_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_80172));\n    int32_t phys_tid_74374 = local_tid_80168;\n    __local unsigned char *red_arr_mem_80186;\n    \n    red_arr_mem_80186 = (__local unsigned char *) red_arr_mem_80186_backing_4;\n    \n    __local unsigned char *red_arr_mem_80188;\n    \n    red_arr_mem_80188 = (__local unsigned char *) red_arr_mem_80188_backing_5;\n    \n    __local unsigned char *red_arr_mem_80190;\n    \n    red_arr_mem_80190 = (__local unsigned char *) red_arr_mem_80190_backing_6;\n    \n    __local unsigned char *red_arr_mem_80192;\n    \n    red_arr_mem_80192 = (__local unsigned char *) red_arr_mem_80192_backi",
            "ng_7;\n    \n    __local unsigned char *red_arr_mem_80194;\n    \n    red_arr_mem_80194 = (__local unsigned char *) red_arr_mem_80194_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_80186)[gtid_74373] = x_74391;\n    ((__local double *) red_arr_mem_80188)[gtid_74373] = defunc_1_f_res_74392;\n    ((__local double *) red_arr_mem_80190)[gtid_74373] = defunc_1_f_res_74393;\n    ((__local double *) red_arr_mem_80192)[gtid_74373] = defunc_1_f_res_74394;\n    ((__local double *) red_arr_mem_80194)[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_80196;\n    int32_t skip_waves_80197 = 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_80196 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_80168, sext_i64_i32(q_65380))) {\n            x_74375 = ((__local\n                        double *) red_arr_mem_80186)[sext_i32_i64(local_tid_80168 +\n                                                     offset_80196)];\n            x_74376 = ((__local\n                        double *) red_arr_mem_80188)[sext_i32_i64(local_tid_80168 +\n                                                     offset_80196)];\n            x_74377 = ((__local\n                        double *) red_arr",
            "_mem_80190)[sext_i32_i64(local_tid_80168 +\n                                                     offset_80196)];\n            x_74378 = ((__local\n                        double *) red_arr_mem_80192)[sext_i32_i64(local_tid_80168 +\n                                                     offset_80196)];\n            x_74379 = ((__local\n                        double *) red_arr_mem_80194)[sext_i32_i64(local_tid_80168 +\n                                                     offset_80196)];\n        }\n    }\n    offset_80196 = 1;\n    while (slt32(offset_80196, wave_sizze_80170)) {\n        if (slt32(local_tid_80168 + offset_80196, sext_i64_i32(q_65380)) &&\n            ((local_tid_80168 - squot32(local_tid_80168, wave_sizze_80170) *\n              wave_sizze_80170) & (2 * offset_80196 - 1)) == 0) {\n            // read array element\n            {\n                x_74380 = ((volatile __local\n                            double *) red_arr_mem_80186)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74381 = ((volatile __local\n                            double *) red_arr_mem_80188)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74382 = ((volatile __local\n                            double *) red_arr_mem_80190)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74383 = ((volatile __local\n                            double *) red_arr_mem_80192)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74384 = ((volatile __local\n                            double *) red_arr_mem_80194)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n            }\n            // apply reduction operation\n            {\n                double defunc_1_op_res_74385 = x_74375 + x_743",
            "80;\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_80186)[sext_i32_i64(local_tid_80168)] =\n                    x_74375;\n                ((volatile __local\n                  double *) red_arr_mem_80188)[sext_i32_i64(local_tid_80168)] =\n                    x_74376;\n                ((volatile __local\n                  double *) red_arr_mem_80190)[sext_i32_i64(local_tid_80168)] =\n                    x_74377;\n                ((volatile __local\n                  double *) red_arr_mem_80192)[sext_i32_i64(local_tid_80168)] =\n                    x_74378;\n                ((volatile __local\n                  double *) red_arr_mem_80194)[sext_i32_i64(local_tid_80168)] =\n                    x_74379;\n            }\n        }\n        offset_80196 *= 2;\n    }\n    while (slt32(skip_waves_80197, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_80170 - 1,\n                                           wave_sizze_80170))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_80196 = skip_waves_80197 * wave_sizze_80170;\n        if (slt32(local_tid_80168 + offset_80196, sext_i64_i32(q_65380)) &&\n            ((local_tid_80168 - squot32(local_tid_80168, wave_sizze_80170) *\n              wave_sizze_80170) == 0 && (squot32(local_tid_80168,\n                                                 wave_sizze_80170) & (2 *\n                                    ",
            "                                  skip_waves_80197 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_74380 = ((__local\n                            double *) red_arr_mem_80186)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74381 = ((__local\n                            double *) red_arr_mem_80188)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74382 = ((__local\n                            double *) red_arr_mem_80190)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74383 = ((__local\n                            double *) red_arr_mem_80192)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\n                x_74384 = ((__local\n                            double *) red_arr_mem_80194)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80196)];\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_80186)[sext_i32_i64(lo",
            "cal_tid_80168)] =\n                    x_74375;\n                ((__local\n                  double *) red_arr_mem_80188)[sext_i32_i64(local_tid_80168)] =\n                    x_74376;\n                ((__local\n                  double *) red_arr_mem_80190)[sext_i32_i64(local_tid_80168)] =\n                    x_74377;\n                ((__local\n                  double *) red_arr_mem_80192)[sext_i32_i64(local_tid_80168)] =\n                    x_74378;\n                ((__local\n                  double *) red_arr_mem_80194)[sext_i32_i64(local_tid_80168)] =\n                    x_74379;\n            }\n        }\n        skip_waves_80197 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_74366 = ((__local\n                                  double *) red_arr_mem_80186)[(int64_t) 0];\n    defunc_2_reduce_res_74367 = ((__local\n                                  double *) red_arr_mem_80188)[(int64_t) 0];\n    defunc_2_reduce_res_74368 = ((__local\n                                  double *) red_arr_mem_80190)[(int64_t) 0];\n    defunc_2_reduce_res_74369 = ((__local\n                                  double *) red_arr_mem_80192)[(int64_t) 0];\n    defunc_2_reduce_res_74370 = ((__local\n                                  double *) red_arr_mem_80194)[(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_80172));\n    int32_t phys_tid_74424 = local_tid_80168;\n    __local unsigned char *red_arr_mem_80198;\n    \n    red_arr_mem_80198 = (__local unsigned char *) red_arr_mem_80198_backing_9;\n    \n    __local unsigned char *red_arr_mem_80200;\n    \n    red_arr_mem_80200 = (__local unsigned char *) red_arr_mem_80200_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_80198)[gtid_74423] =\n        defunc_9_fit_fun_res_74444;\n    ((__local double *) red_arr_mem_80200)[gtid_74423] =\n        defunc_9_slope_fun_res_74450;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t offset_80202;\n    int32_t skip_waves_80203 = 1;\n    double x_74425;\n    double x_74426;\n    double x_74427;\n    double x_74428;\n    \n    offset_80202 = 0;\n    // participating threads read initial accumulator\n    {\n        if (slt32(local_tid_80168, sext_i64_i32(q_65380))) {\n            x_74425 = ((__local\n                        double *) red_arr_mem_80198)[sext_i32_i64(local_tid_80168 +\n                                                     offset_80202)];\n            x_74426 = ((__local\n                        double *) red_arr_mem_80200)[sext_i32_i64(local_tid_80168 +\n                                                     offset_80202)];\n        }\n    }\n    offset_80202 = 1;\n    while (slt32(offset_80202, wave_sizze_80170)) {\n        if (slt32(local_tid_80168 + offset_80202, sext_i64_i32(q_65380)) &&\n            ((local_tid_80168 - squot32(local_tid_80168, wave_sizze_80170) *\n              wave_sizze_80170) & (2 * offset_80202 - 1)) == 0) {\n            // read array element\n            {\n                x_74427 = ((volatile __local\n                            double *) red_arr_mem_80198)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80",
            "202)];\n                x_74428 = ((volatile __local\n                            double *) red_arr_mem_80200)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80202)];\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_80198)[sext_i32_i64(local_tid_80168)] =\n                    x_74425;\n                ((volatile __local\n                  double *) red_arr_mem_80200)[sext_i32_i64(local_tid_80168)] =\n                    x_74426;\n            }\n        }\n        offset_80202 *= 2;\n    }\n    while (slt32(skip_waves_80203, squot32(sext_i64_i32(q_65380) +\n                                           wave_sizze_80170 - 1,\n                                           wave_sizze_80170))) {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        offset_80202 = skip_waves_80203 * wave_sizze_80170;\n        if (slt32(local_tid_80168 + offset_80202, sext_i64_i32(q_65380)) &&\n            ((local_tid_80168 - squot32(local_tid_80168, wave_sizze_80170) *\n              wave_sizze_80170) == 0 && (squot32(local_tid_80168,\n                                                 wave_sizze_80170) & (2 *\n                                                                      skip_waves_80203 -\n                                                                      1)) ==\n             0)) {\n            // read array element\n            {\n                x_74427 = ((__local\n                            double *) red_arr_mem_80198)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80202)];\n                x_74428 = ((__local\n   ",
            "                         double *) red_arr_mem_80200)[sext_i32_i64(local_tid_80168 +\n                                                         offset_80202)];\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_80198)[sext_i32_i64(local_tid_80168)] =\n                    x_74425;\n                ((__local\n                  double *) red_arr_mem_80200)[sext_i32_i64(local_tid_80168)] =\n                    x_74426;\n            }\n        }\n        skip_waves_80203 *= 2;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    defunc_2_reduce_res_74421 = ((__local\n                                  double *) red_arr_mem_80198)[(int64_t) 0];\n    defunc_2_reduce_res_74422 = ((__local\n                                  double *) red_arr_mem_80200)[(int64_t) 0];\n    if (local_tid_80168 == 0) {\n        ((__global double *) mem_78020)[gtid_74242 * n_m_65386 + gtid_74243] =\n            defunc_2_reduce_res_74421;\n    }\n    if (local_tid_80168 == 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                                            uint color_78172_backing_offset_0,\n                                            int64_t m_65377, int64_t n_65378,\n                                            int64_t q_65380, int64_t jump_65382,\n                                            int",
            "64_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    volatile unsigned char *color_78172_backing_0 =\n                           &shared_mem[color_78172_backing_offset_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_failu",
            "re = false;\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int32_t global_tid_78522;\n    int32_t local_tid_78523;\n    int64_t group_sizze_78526;\n    int32_t wave_sizze_78525;\n    int32_t group_tid_78524;\n    \n    global_tid_78522 = get_global_id(0);\n    local_tid_78523 = get_local_id(0);\n    group_sizze_78526 = get_local_size(0);\n    wave_sizze_78525 = LOCKSTEP_WIDTH;\n    group_tid_78524 = get_group_id(0);\n    \n    int32_t gid_flat_74792 = group_tid_78524;\n    int64_t slice_78529 = tile_sizze_74787;\n    int64_t slice_78530 = tile_sizze_74787 * slice_78529;\n    int64_t ltid_pre_78527 = squot64(sext_i32_i64(local_tid_78523),\n                                     slice_78529);\n    int64_t remnant_78531 = sext_i32_i64(local_tid_78523) - ltid_pre_78527 *\n            slice_78529;\n    int64_t ltid_pre_78528 = remnant_78531;\n    int64_t remnant_78532 = remnant_78531 - ltid_pre_78528;\n    int64_t slice_78533 = num_groups_y_74790;\n    int64_t slice_78534 = num_groups_x_74789 * slice_78533;\n    int64_t gid_x_74784 = squot64(sext_i32_i64(group_tid_78524), slice_78533);\n    int64_t remnant_78535 = sext_i32_i64(group_tid_78524) - gid_x_74784 *\n            slice_78533;\n    int64_t gid_y_74785 = remnant_78535;\n    int64_t remnant_78536 = remnant_78535 - 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_78527));\n    int64_t ltid_x_74809 = sext_i32_i64(sext_i64_i32(ltid_pre_78528));\n    int32_t ltid_flat_74810 = local_tid_78523;\n    \n    if (slt64(ltid_y_74811, tile_sizze_74787) && slt64(ltid_x_74809,\n                                                       tile_sizze_747",
            "87)) {\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            loop_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_74847 = 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 = hig",
            "h_74836;\n                }\n                \n                bool loop_cond_74851 = sle64(loopres_74847, loopres_74848);\n                bool loop_while_tmp_78537 = loop_cond_74851;\n                int64_t low_tmp_78538 = loopres_74847;\n                int64_t high_tmp_78539 = loopres_74848;\n                \n                loop_while_74834 = loop_while_tmp_78537;\n                low_74835 = low_tmp_78538;\n                high_74836 = high_tmp_78539;\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_res_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                bo",
            "ol loop_cond_74892 = slt64(loopres_74881, min_res_65398);\n                bool loop_while_tmp_78540 = loop_cond_74892;\n                int64_t l_idx_tmp_78541 = loopres_74879;\n                int64_t r_idx_tmp_78542 = loopres_74880;\n                int64_t span_tmp_78543 = loopres_74881;\n                \n                loop_while_74856 = loop_while_tmp_78540;\n                l_idx_74857 = l_idx_tmp_78541;\n                r_idx_74858 = r_idx_tmp_78542;\n                span_74859 = span_tmp_78543;\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 = ((__global 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        color_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_78527));\n    int64_t ltid_x_74928 = sext_i32_i64(sext_i64_i32(lt",
            "id_pre_78528));\n    int32_t ltid_flat_74929 = local_tid_78523;\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_78544;\n    \n    tmp_78544 = color_78171[(int64_t) 0];\n    color_78170[(int64_t) 0] = tmp_78544;\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_78527));\n        int64_t ltid_x_75033 = sext_i32_i64(sext_i64_i32(ltid_pre_78528));\n        int32_t ltid_flat_75034 = local_tid_78523;\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_78527));\n     ",
            "   int64_t ltid_x_75056 = sext_i32_i64(sext_i64_i32(ltid_pre_78528));\n        int32_t ltid_flat_75057 = local_tid_78523;\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_78548 = defunc_1_op_res_75079;\n                \n                redout_76850 = redout_tmp_78548;\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_78545[1];\n        \n        for (int32_t i_3 = 0; i_3 < 1; i_3++)\n            mem_param_tmp_78545[i_3] = mem_param_out_78113[i_3];\n        \n        double mem_param_out_tmp_78546[1];\n        \n        for (int32_t i_4 = 0; i_4 < 1; i_4++)\n            mem_param",
            "_out_tmp_78546[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_78545[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_78546[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_78549;\n        \n        tmp_78549 = ext_mem_77177[(int64_t) 0];\n        color_78170[(int64_t) 0] = tmp_78549;\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_78527));\n        int64_t ltid_x_75216 = sext_i32_i64(sext_i64_i32(ltid_pre_78528));\n        int32_t ltid_flat_75217 = local_tid_78523;\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_78527));\n        int64_t ltid_x_75240 = sext_i32_i64(sext_i64_i32(ltid_pre_78528));\n        int32_t ltid_flat_75241 = local_tid_78523;\n        int64_t gtid_75244 = binop_x_74812 + ltid_y_75242;\n        int64_t gt",
            "id_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_75249, 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_78550 = defunc_1_op_res_75263;\n                \n                redout_76852 = redout_tmp_78550;\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_78551;\n        \n        tmp_78551 = color_78171[(int64_t) 0];\n        color_78170[(int64_t) 0] = tmp_78551;\n    }\n    \n    int64_t ltid_y_75294 = sext_i32_i64(sext_i64_i32(ltid_pre_78527));\n    int64_t ltid_x_75292 = sext_i32_i64(sext_i64_i32(ltid_pre_78528));\n    int32_t ltid_flat_75293 = local_tid_78523;\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 = add64(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_78552 = defunc_1_op_res_75313;\n                \n                redout_76854 = redout_tmp_78552;\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_78553 = gid_x_74784 * tile_sizze_74787 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78527));\n    int64_t thread_out_index_78554 = gid_y_74785 * tile_sizze_74787 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78528));\n    \n    if (slt64(thread_out_index_78553, m_65377) && slt64(thread_out_index_78554,\n                                                        n_m_65386)) {\n        double tmp_78555;\n        \n        tmp_78555 = color_78171[(int64_t) 0];\n        ((__global double *) mem_77195)[thread_out_index_78553 * n_m_65386 +\n                                        thread_out_index_78554] = tmp_78555;\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                                            uint color_78195_backing_offset_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    volatile unsigned char *color_78195_backing_0 =\n                           &shared_mem[color_78195_backing_offset_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_78913;\n    int32_t local_tid_78914;\n    int64_t group_sizze_78917;\n    int32_t wave_sizze_78916;\n    int32_t group_tid_78915;\n    \n    global_tid_78",
            "913 = get_global_id(0);\n    local_tid_78914 = get_local_id(0);\n    group_sizze_78917 = get_local_size(0);\n    wave_sizze_78916 = LOCKSTEP_WIDTH;\n    group_tid_78915 = get_group_id(0);\n    \n    int32_t gid_flat_75346 = group_tid_78915;\n    int64_t slice_78920 = tile_sizze_75341;\n    int64_t slice_78921 = tile_sizze_75341 * slice_78920;\n    int64_t ltid_pre_78918 = squot64(sext_i32_i64(local_tid_78914),\n                                     slice_78920);\n    int64_t remnant_78922 = sext_i32_i64(local_tid_78914) - ltid_pre_78918 *\n            slice_78920;\n    int64_t ltid_pre_78919 = remnant_78922;\n    int64_t remnant_78923 = remnant_78922 - ltid_pre_78919;\n    int64_t slice_78924 = num_groups_y_75344;\n    int64_t slice_78925 = num_groups_x_75343 * slice_78924;\n    int64_t gid_x_75338 = squot64(sext_i32_i64(group_tid_78915), slice_78924);\n    int64_t remnant_78926 = sext_i32_i64(group_tid_78915) - gid_x_75338 *\n            slice_78924;\n    int64_t gid_y_75339 = remnant_78926;\n    int64_t remnant_78927 = remnant_78926 - 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_78918));\n    int64_t ltid_x_75363 = sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n    int32_t ltid_flat_75364 = local_tid_78914;\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 + bino",
            "p_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 boun",
            "ds_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_7",
            "5402);\n                bool loop_while_tmp_78928 = loop_cond_75405;\n                int64_t low_tmp_78929 = loopres_75401;\n                int64_t high_tmp_78930 = loopres_75402;\n                \n                loop_while_75388 = loop_while_tmp_78928;\n                low_75389 = low_tmp_78929;\n                high_75390 = high_tmp_78930;\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_75420) {\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_78931 = loop_cond",
            "_75446;\n                int64_t l_idx_tmp_78932 = loopres_75433;\n                int64_t r_idx_tmp_78933 = loopres_75434;\n                int64_t span_tmp_78934 = loopres_75435;\n                \n                loop_while_75410 = loop_while_tmp_78931;\n                l_idx_75411 = l_idx_tmp_78932;\n                r_idx_75412 = r_idx_tmp_78933;\n                span_75413 = span_tmp_78934;\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_78197[(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_78918));\n    int64_t ltid_x_75482 = sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n    int32_t ltid_flat_75483 = local_tid_78914;\n    \n    if (slt64(ltid_y_75484, tile_sizze_75",
            "341) && 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_78935;\n    \n    tmp_78935 = color_78190[(int64_t) 0];\n    color_78191[(int64_t) 0] = tmp_78935;\n    \n    double tmp_78936;\n    \n    tmp_78936 = color_78189[(int64_t) 0];\n    color_78190[(int64_t) 0] = tmp_78936;\n    \n    double tmp_78937;\n    \n    tmp_78937 = color_78192[(int64_t) 0];\n    color_78189[(int64_t) 0] = tmp_78937;\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_78918));\n        int64_t ltid_x_75613 = sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n        int32_t ltid_flat_75614 = local_tid_78914;\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_78918));\n        int64_t ltid_x_75638 = sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n        int32_t ltid_flat_75639 = local_tid_78914;\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_75659;\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_78947 = defunc_1_op_res_75671;\n                double redout_tmp_78948 = defunc_1_op_res_75672;\n                double redout_tmp_78949 = defunc_1_op_res_75673;\n                \n                redout_76892 = redout_tmp_78947;\n                redout_76893 = redout_tmp_78948;\n                redout_76894 = redout_tmp_78949;\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_75650;\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_78938[1];\n        \n        for (int32_t i_7 = 0; i_7 < 1; i_7++)\n            mem_param_tmp_78938[i_7] = mem_param_out_7811",
            "9[i_7];\n        \n        double mem_param_out_tmp_78939[1];\n        \n        for (int32_t i_8 = 0; i_8 < 1; i_8++)\n            mem_param_out_tmp_78939[i_8] = mem_param_77407[i_8];\n        \n        double mem_param_tmp_78940[1];\n        \n        for (int32_t i_9 = 0; i_9 < 1; i_9++)\n            mem_param_tmp_78940[i_9] = mem_param_out_78124[i_9];\n        \n        double mem_param_out_tmp_78941[1];\n        \n        for (int32_t i_10 = 0; i_10 < 1; i_10++)\n            mem_param_out_tmp_78941[i_10] = mem_param_77408[i_10];\n        \n        double mem_param_tmp_78942[1];\n        \n        for (int32_t i_11 = 0; i_11 < 1; i_11++)\n            mem_param_tmp_78942[i_11] = mem_param_out_78129[i_11];\n        \n        double mem_param_out_tmp_78943[1];\n        \n        for (int32_t i_12 = 0; i_12 < 1; i_12++)\n            mem_param_out_tmp_78943[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_78938[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_78939[i_14];\n        for (int32_t i_15 = 0; i_15 < 1; i_15++)\n            mem_param_77408[i_15] = mem_param_tmp_78940[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_78941[i_16];\n        for (int32_t i_17 = 0; i_17 < 1; i_17++)\n            mem_param_77409[i_17] = mem_param_tmp_78942[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_78943[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_78950;\n        \n        tmp_78950 = ext_mem_77427[(int64_t) 0];\n        color_78189[(int64_t) 0] = tmp_78950;\n        \n        double tmp_78951;\n        \n        tmp_78951 = ext_mem_77426[(int64_t) 0];\n        color_78190[(int64_t) 0] = tmp_78951;\n        \n        double tmp_78952;\n        \n        tmp_78952 = ext_mem_77425[(int64_t) 0];\n        color_78191[(int64_t) 0] = tmp_78952;\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_78918));\n        int64_t ltid_x_75844 = sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n        int32_t ltid_flat_75845 = local_tid_78914;\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 double *) 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_78918));\n        int64_t ltid_x_75870 = sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n        int32_t ltid_flat_75871 = local_tid_78914;\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_78953 = defunc_1_op_res_75903;\n                double",
            " redout_tmp_78954 = defunc_1_op_res_75904;\n                double redout_tmp_78955 = defunc_1_op_res_75905;\n                \n                redout_76896 = redout_tmp_78953;\n                redout_76897 = redout_tmp_78954;\n                redout_76898 = redout_tmp_78955;\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_78956;\n        \n        tmp_78956 = color_78194[(int64_t) 0];\n        color_78189[(int64_t) 0] = tmp_78956;\n        \n        double tmp_78957;\n        \n        tmp_78957 = color_78193[(int64_t) 0];\n        color_78190[(int64_t) 0] = tmp_78957;\n        \n        double tmp_78958;\n        \n        tmp_78958 = color_78192[(int64_t) 0];\n        color_78191[(int64_t) 0] = tmp_78958;\n    }\n    \n    int64_t ltid_y_75942 = sext_i32_i64(sext_i64_i32(ltid_pre_78918));\n    int64_t ltid_x_75940 = sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n    int32_t ltid_flat_75941 = local_tid_78914;\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                int",
            "64_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_75992 = 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_78959 = defunc_1_op_res_75972;\n                double redout_tmp_78960 = defunc_1_op_res_75975;\n                \n                redout_76900 = redout_tmp_78959;\n                redout_76901 = redout_tmp_78960;\n            }\n            defunc_2_reduce_res_75968 = redout_76900;\n            defunc_2_reduce_res_75969 = redout_76901;\n            postlude_75953 = 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_78961 = gid_x_75338 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_p",
            "re_78918));\n    int64_t thread_out_index_78962 = gid_y_75339 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n    \n    if (slt64(thread_out_index_78961, m_65377) && slt64(thread_out_index_78962,\n                                                        n_m_65386)) {\n        double tmp_78963;\n        \n        tmp_78963 = color_78193[(int64_t) 0];\n        ((__global double *) mem_77456)[thread_out_index_78961 * n_m_65386 +\n                                        thread_out_index_78962] = tmp_78963;\n    }\n    \n    int64_t thread_out_index_78964 = gid_x_75338 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78918));\n    int64_t thread_out_index_78965 = gid_y_75339 * tile_sizze_75341 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_78919));\n    \n    if (slt64(thread_out_index_78964, m_65377) && slt64(thread_out_index_78965,\n                                                        n_m_65386)) {\n        double tmp_78966;\n        \n        tmp_78966 = color_78192[(int64_t) 0];\n        ((__global double *) mem_77460)[thread_out_index_78964 * n_m_65386 +\n                                        thread_out_index_78965] = tmp_78966;\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                                            uint color_78226_backing_offset_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_654",
            "03_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    volatile unsigned char *color_78226_backing_0 =\n                           &shared_mem[color_78226_backing_offset_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_79368;\n    int32_t local_tid_79369;\n    int64_t group_sizze_79372;\n    int32_t wave_sizze_",
            "79371;\n    int32_t group_tid_79370;\n    \n    global_tid_79368 = get_global_id(0);\n    local_tid_79369 = get_local_id(0);\n    group_sizze_79372 = get_local_size(0);\n    wave_sizze_79371 = LOCKSTEP_WIDTH;\n    group_tid_79370 = get_group_id(0);\n    \n    int32_t gid_flat_76017 = group_tid_79370;\n    int64_t slice_79375 = tile_sizze_76012;\n    int64_t slice_79376 = tile_sizze_76012 * slice_79375;\n    int64_t ltid_pre_79373 = squot64(sext_i32_i64(local_tid_79369),\n                                     slice_79375);\n    int64_t remnant_79377 = sext_i32_i64(local_tid_79369) - ltid_pre_79373 *\n            slice_79375;\n    int64_t ltid_pre_79374 = remnant_79377;\n    int64_t remnant_79378 = remnant_79377 - ltid_pre_79374;\n    int64_t slice_79379 = num_groups_y_76015;\n    int64_t slice_79380 = num_groups_x_76014 * slice_79379;\n    int64_t gid_x_76009 = squot64(sext_i32_i64(group_tid_79370), slice_79379);\n    int64_t remnant_79381 = sext_i32_i64(group_tid_79370) - gid_x_76009 *\n            slice_79379;\n    int64_t gid_y_76010 = remnant_79381;\n    int64_t remnant_79382 = remnant_79381 - 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_79373));\n    int64_t ltid_x_76034 = sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n    int32_t ltid_flat_76035 = local_tid_79369;\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_res_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_79383 = loop_cond_76076;\n                int64_t low_tmp_79384 = loopres_76072;\n                int64_t high_tmp_79385 = loopres_76073;\n                \n                loop_while_76059 = loop_while_tmp_79383;\n                low_76060 = low_tmp_79384;\n                high_76061 = high_tmp_79385;\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 = smin64(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] = (int",
            "64_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 lo",
            "opres_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_79386 = loop_cond_76117;\n                int64_t l_idx_tmp_79387 = loopres_76104;\n                int64_t r_idx_tmp_79388 = loopres_76105;\n                int64_t span_tmp_79389 = loopres_76106;\n                \n                loop_while_76081 = loop_while_tmp_79386;\n                l_idx_76082 = l_idx_tmp_79387;\n                r_idx_76083 = r_idx_tmp_79388;\n                span_76084 = span_tmp_79389;\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_a",
            "rg_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_79373))",
            ";\n    int64_t ltid_x_76153 = sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n    int32_t ltid_flat_76154 = local_tid_79369;\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_79390;\n    \n    tmp_79390 = color_78219[(int64_t) 0];\n    color_78220[(int64_t) 0] = tmp_79390;\n    \n    double tmp_79391;\n    \n    tmp_79391 = color_78218[(int64_t) 0];\n    color_78219[(int64_t) 0] = tmp_79391;\n    \n    double tmp_79392;\n    \n    tmp_79392 = color_78217[(int64_t) 0];\n    color_78218[(int64_t) 0] = tmp_79392;\n    \n    double tmp_79393;\n    \n    tmp_79393 = color_78216[(int64_t) 0];\n    color_78217[(int64_t) 0] = tmp_79393;\n    \n    double tmp_79394;\n    \n    tmp_79394 = color_78221[(int64_t) 0];\n    color_78216[(int64_t) 0] = tmp_79394;\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_unused_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_79373));\n        int64_t ltid_x_76310 = sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n        int32_t ltid_flat_76311 = local_tid_79369;\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_79373));\n        int64_t ltid_x_76337 = sext_i32_i64(sext_i6",
            "4_i32(ltid_pre_79374));\n        int32_t ltid_flat_76338 = local_tid_79369;\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_763",
            "98;\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_79410 = defunc_1_op_res_76380;\n                double redout_tmp_79411 = defunc_1_op_res_76381;\n                double redout_tmp_79412 = defunc_1_op_res_76382;\n                double redout_tmp_79413 = defunc_1_op_res_76383;\n                double redout_tmp_79414 = defunc_1_op_res_76384;\n                \n                redout_76941 = redout_tmp_79410;\n                redout_76942 = redout_tmp_79411;\n                redout_76943 = redout_tmp_79412;\n                redout_76944 = redout_tmp_79413;\n                redout_76945 = redout_tmp_79414;\n            }\n            x_76365 = redout_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_o",
            "ut_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_79395[1];\n        \n        for (int32_t i_11 = 0; i_11 < 1; i_11++)\n            mem_param_tmp_79395[i_11] = mem_param_out_78137[i_11];\n        \n        double mem_param_out_tmp_79396[1];\n        \n        for (int32_t i_12 = 0; i_12 < 1; i_12++)\n            mem_param_out_tmp_79396[i_12] = mem_param_77705[i_12];\n        \n        double mem_param_tmp_79397[1];\n        \n        for (int32_t i_13 = 0; i_13 < 1; i_13++)\n            mem_param_tmp_79397[i_13] = mem_param_out_78142[i_13];\n        \n        double mem_param_out_tmp_79398[1];\n        \n        for (int32_t i_14 = 0; i_14 < 1; i_14++)\n            mem_param_out_tmp_79398[i_14] = mem_param_77706[i_14];\n        \n        double mem_param_tmp_79399[1];\n        \n        for (int32_t i_15 = 0; i_15 < 1; i_15++)\n            mem_param_tmp_79399[i_15] = mem_param_out_78147[i_15];\n        \n        double mem_param_out_tmp_79400[1];\n        \n        for (int32_t i_16 = 0; i_16 < 1; i_16++)\n            mem_param_out_tmp_79400[i_16] = mem_param_77707[i_16];\n        \n        double mem_param_tmp_79401[1];\n        \n        for (int32_t i_17 = 0; i_17 < 1; i_17++)\n            mem_param_tmp_79401[i_17] = mem_param_out_78152[i_17];\n        \n        double mem_param_out_tmp_79402[1];\n        \n        for (int32_t i_18 = 0; i_18 < 1; i_18++)\n            mem_param_out_tmp_79402[i_18] = mem_param_77708[i_18];\n        \n        double mem_param_tmp_79403[1];\n        \n        for (int32_t i_19 = 0; i_19 < 1; i_19++)\n            mem_param_tmp_79403[i_19] = mem_param_out_78157[i_19];\n        \n        double mem_param_out_tmp_79404[1];\n        \n        for (int32_t i_20 = 0; i_20 < 1; i_20++)\n            mem_param_out_tmp_79404[i_20] = mem_param_77709[i_20];\n        for (in",
            "t32_t i_21 = 0; i_21 < 1; i_21++)\n            mem_param_77705[i_21] = mem_param_tmp_79395[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_79396[i_22];\n        for (int32_t i_23 = 0; i_23 < 1; i_23++)\n            mem_param_77706[i_23] = mem_param_tmp_79397[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_79398[i_24];\n        for (int32_t i_25 = 0; i_25 < 1; i_25++)\n            mem_param_77707[i_25] = mem_param_tmp_79399[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_79400[i_26];\n        for (int32_t i_27 = 0; i_27 < 1; i_27++)\n            mem_param_77708[i_27] = mem_param_tmp_79401[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_79402[i_28];\n        for (int32_t i_29 = 0; i_29 < 1; i_29++)\n            mem_param_77709[i_29] = mem_param_tmp_79403[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_79404[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_79415;\n        \n        tmp_79415 = ext_mem_77735[(int64_t) 0];\n        color_78216[(int64_t) 0] = tmp_79415;\n        \n        double tmp_79416;\n        \n        tmp_79416 = ext_mem_77734[(int64_t) 0];\n        color_78217[(int64_t) 0] = tmp_79416;\n        \n        double tmp_79417;\n        \n        tmp_79417 = ext_mem_77733[(int64_t) 0];\n        color_78218[(int64_t) 0] = tmp_79417;\n        \n        double tmp_79418;\n        \n        tmp_79418 = ext_mem_77732[(int64_t) 0];\n        color_78219[(int64_t) 0] = tmp_79418;\n        \n        double tmp_79419;\n        \n        tmp_79419 = ext_mem_77731[(int64_t) 0];\n        color_78220[(int64_t) 0] = tmp_79419;\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_79373));\n        int64_t ltid_x_76589 = sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n        int32_t ltid_flat_76590 = local_tid_79369;\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        i",
            "nt64_t ltid_y_76619 = sext_i32_i64(sext_i64_i32(ltid_pre_79373));\n        int64_t ltid_x_76617 = sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n        int32_t ltid_flat_76618 = local_tid_79369;\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_769",
            "49 = 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_79420 = defunc_1_op_res_76660;\n                double redout_tmp_79421 = defunc_1_op_res_76661;\n                double redout_tmp_79422 = defunc_1_op_res_76662;\n                double redout_tmp_79423 = defunc_1_op_res_76663;\n                double redout_tmp_79424 = defunc_1_op_res_76664;\n                \n                redout_76947 = redout_tmp_79420;\n                redout_76948 = redout_tmp_79421;\n                redout_76949 = redout_tmp_79422;\n                redout_76950 = redout_tmp_79423;\n                redout_76951 = redout_tmp_79424;\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 = a",
            "cc_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_79425;\n        \n        tmp_79425 = color_78225[(int64_t) 0];\n        color_78216[(int64_t) 0] = tmp_79425;\n        \n        double tmp_79426;\n        \n        tmp_79426 = color_78224[(int64_t) 0];\n        color_78217[(int64_t) 0] = tmp_79426;\n        \n        double tmp_79427;\n        \n        tmp_79427 = color_78223[(int64_t) 0];\n        color_78218[(int64_t) 0] = tmp_79427;\n        \n        double tmp_79428;\n        \n        tmp_79428 = color_78222[(int64_t) 0];\n        color_78219[(int64_t) 0] = tmp_79428;\n        \n        double tmp_79429;\n        \n        tmp_79429 = color_78221[(int64_t) 0];\n        color_78220[(int64_t) 0] = tmp_79429;\n    }\n    \n    int64_t ltid_y_76705 = sext_i32_i64(sext_i64_i32(ltid_pre_79373));\n    int64_t ltid_x_76703 = sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n    int32_t ltid_flat_76704 = local_tid_79369;\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_76728 - 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_79430 = defunc_1_op_res_76754;\n                double redout_tmp_79431 = defunc_1_op_res_76757;\n                \n                redout_76953 = redout_tmp_79430;\n                redout_76954 = redout_tmp_79431;\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_78222[(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_79432 = gid_x_76009 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79373));\n    int64_t thread_out_index_79433 = gid_y_76010 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n    \n    if (slt64(thread_out_index_79432, m_65377) && slt64(thread_out_index_79433,\n                                                        n_m_65386)) {\n        double tmp_79434;\n        \n        tmp_79434 = col",
            "or_78222[(int64_t) 0];\n        ((__global double *) mem_77772)[thread_out_index_79432 * n_m_65386 +\n                                        thread_out_index_79433] = tmp_79434;\n    }\n    \n    int64_t thread_out_index_79435 = gid_x_76009 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79373));\n    int64_t thread_out_index_79436 = gid_y_76010 * tile_sizze_76012 +\n            sext_i32_i64(sext_i64_i32(ltid_pre_79374));\n    \n    if (slt64(thread_out_index_79435, m_65377) && slt64(thread_out_index_79436,\n                                                        n_m_65386)) {\n        double tmp_79437;\n        \n        tmp_79437 = color_78221[(int64_t) 0];\n        ((__global double *) mem_77776)[thread_out_index_79435 * n_m_65386 +\n                                        thread_out_index_79436] = tmp_79437;\n    }\n    \n  error_7:\n    return;\n    #undef tile_sizze_76012\n}\n__kernel void mainzisegred_large_68263(__global int *global_failure,\n                                       uint sync_arr_mem_78618_backing_offset_0,\n                                       uint red_arr_mem_78616_backing_offset_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_78602,\n                                       int64_t elements_per_thread_78603,\n                                       int64_t virt_num_groups_78604,\n                                       int64_t threads_per_segment_78606,\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_78607,\n                                       __global\n                                       unsigned char *mainzicounter_mem_78609)\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    volatile unsigned char *sync_arr_mem_78618_backing_1 =\n                           &shared_mem[sync_arr_mem_78618_backing_offset_0];\n    volatile unsigned char *red_arr_mem_78616_backing_0 =\n                           &shared_mem[red_arr_mem_78616_backing_offset_1];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78611;\n    int32_t local_tid_78612;\n    int64_t group_sizze_78615;\n    int32_t wave_sizze_78614;\n    int32_t group_tid_78613;\n    \n    global_tid_78611 = get_global_id(0);\n    local_tid_78612 = get_local_id(0);\n    group_sizze_78615 = get_local_size(0);\n    wave_sizze_78614 = LOCKSTEP_WIDTH;\n    group_tid_78613 = get_group_id(0);\n    \n    int32_t phys_tid_68263 = global_tid_78611;\n    __local unsigned char *red_arr_mem_78616;\n    \n    red_arr_mem_78616 = (__local unsigned char *) red_arr_mem_78616_backing_0;\n    \n    __local unsigned char *sync_arr_mem_78618;\n    \n    sync_arr_mem_78618 = (__local unsigned char *) sync_arr_mem_78618_backing_1;\n    \n    int32_t phys_group_id_78620;\n    \n    phys_group_id_78620 = get_group_id(0);\n    for (int32_t i_78621 = 0; i_78621 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_78604) - phys_group_id_78620,\n                   sext_i64_i32(num_groups_68257)); i_78621++) {\n        int32_t virt_group_id_78622 = phys_group_id_78620 + i_78621 *\n                sext_i64_i32(num_groups_68257);\n        int32_t flat_segment_id_78623 = squot3",
            "2(virt_group_id_78622,\n                                                sext_i64_i32(groups_per_segment_78602));\n        int64_t global_tid_78624 = srem64(sext_i32_i64(virt_group_id_78622) *\n                                          segred_group_sizze_68256 +\n                                          sext_i32_i64(local_tid_78612),\n                                          segred_group_sizze_68256 *\n                                          groups_per_segment_78602);\n        int64_t slice_78625 = n_m_65386;\n        int64_t slice_78626 = m_65377 * slice_78625;\n        int64_t gtid_68260 = squot64(sext_i32_i64(flat_segment_id_78623),\n                                     slice_78625);\n        int64_t remnant_78627 = sext_i32_i64(flat_segment_id_78623) -\n                gtid_68260 * slice_78625;\n        int64_t gtid_68261 = remnant_78627;\n        int64_t remnant_78628 = remnant_78627 - gtid_68261;\n        int64_t gtid_68262;\n        double x_acc_78629;\n        int64_t chunk_sizze_78630 = smin64(elements_per_thread_78603,\n                                           sdiv_up64(q_65380 - global_tid_78624,\n                                                     threads_per_segment_78606));\n        double x_68264;\n        double x_68265;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_78629 = 0.0;\n        }\n        for (int64_t i_78634 = 0; i_78634 < chunk_sizze_78630; i_78634++) {\n            gtid_68262 = global_tid_78624 + threads_per_segment_78606 * i_78634;\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_78629;\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_78629 = 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_78629;\n            ((__local\n              double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612)] =\n                x_68264;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_78635;\n        int32_t skip_waves_78636 = 1;\n        double x_78631;\n        double x_78632;\n        \n        offset_78635 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_78612,\n                      sext_i64_i32(segred_group_sizze_68256))) {\n                x_78631 = ((__local\n                            double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612 +\n   ",
            "                                                      offset_78635)];\n            }\n        }\n        offset_78635 = 1;\n        while (slt32(offset_78635, wave_sizze_78614)) {\n            if (slt32(local_tid_78612 + offset_78635,\n                      sext_i64_i32(segred_group_sizze_68256)) &&\n                ((local_tid_78612 - squot32(local_tid_78612, wave_sizze_78614) *\n                  wave_sizze_78614) & (2 * offset_78635 - 1)) == 0) {\n                // read array element\n                {\n                    x_78632 = ((volatile __local\n                                double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612 +\n                                                             offset_78635)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78633 = x_78631 + x_78632;\n                    \n                    x_78631 = defunc_1_op_res_78633;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612)] =\n                        x_78631;\n                }\n            }\n            offset_78635 *= 2;\n        }\n        while (slt32(skip_waves_78636,\n                     squot32(sext_i64_i32(segred_group_sizze_68256) +\n                             wave_sizze_78614 - 1, wave_sizze_78614))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_78635 = skip_waves_78636 * wave_sizze_78614;\n            if (slt32(local_tid_78612 + offset_78635,\n                      sext_i64_i32(segred_group_sizze_68256)) &&\n                ((local_tid_78612 - squot32(local_tid_78612, wave_sizze_78614) *\n                  wave_sizze_78614) == 0 && (squot32(local_tid_78612,\n                                                     wave_sizze_78614) & (2 *\n                                                                          skip_waves_78636 -\n                ",
            "                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_78632 = ((__local\n                                double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612 +\n                                                             offset_78635)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78633 = x_78631 + x_78632;\n                    \n                    x_78631 = defunc_1_op_res_78633;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612)] =\n                        x_78631;\n                }\n            }\n            skip_waves_78636 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_78612) == (int64_t) 0) {\n                x_acc_78629 = x_78631;\n            }\n        }\n        if (groups_per_segment_78602 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_78612 == 0) {\n                    ((__global double *) mem_77213)[gtid_68260 * n_m_65386 +\n                                                    gtid_68261] = x_acc_78629;\n                }\n            }\n        } else {\n            int32_t old_counter_78637;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_78612 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_78607)[sext_i32_i64(virt_group_id_78622)] =\n                        x_acc_78629;\n                    mem_fence_global();\n                    old_counter_78637 =\n                        atomic_add_i32_global(&((volatile __global\n             ",
            "                                    int *) mainzicounter_mem_78609)[sext_i32_i64(srem32(flat_segment_id_78623,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_78618)[(int64_t) 0] =\n                        old_counter_78637 == groups_per_segment_78602 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_78638;\n            \n            is_last_group_78638 = ((__local\n                                    bool *) sync_arr_mem_78618)[(int64_t) 0];\n            if (is_last_group_78638) {\n                if (local_tid_78612 == 0) {\n                    old_counter_78637 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78609)[sext_i32_i64(srem32(flat_segment_id_78623,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_78602));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_78639 =\n                            sdiv_up64(groups_per_segment_78602,\n                                      segred_group_sizze_68256);\n                    \n                    x_68264 = 0.0;\n                    for (int64_t i_78640 = 0; i_78640 < read_per_thread_78639;\n                         i_78640++) {\n                        int64_t group_res_id_78641 =\n                                sext_i32_i64(local_tid_78612) *\n                                read_per_thread_78639 + i_78640;\n                        int64_t index_of_group_res_78642 =\n    ",
            "                            sext_i32_i64(flat_segment_id_78623) *\n                                groups_per_segment_78602 + group_res_id_78641;\n                        \n                        if (slt64(group_res_id_78641,\n                                  groups_per_segment_78602)) {\n                            x_68265 = ((__global\n                                        double *) segred_tmp_mem_78607)[index_of_group_res_78642];\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_78616)[sext_i32_i64(local_tid_78612)] =\n                    x_68264;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_78643;\n                    int32_t skip_waves_78644 = 1;\n                    double x_78631;\n                    double x_78632;\n                    \n                    offset_78643 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_78612,\n                                  sext_i64_i32(segred_group_sizze_68256))) {\n                            x_78631 = ((__local\n                                        double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612 +\n                                                                     offset_78643)];\n                        }\n                    }\n                    offset_78643 = 1;\n                    while (slt32(offset_78643, wave_sizze_78614)) {\n                        if (slt32(local_tid_78612 + offset_78643,\n                                  sext_i64_i32(segred_group_sizze_68256)) &&\n                            ((local_tid_78612 - squot32(local_tid_78612,\n         ",
            "                                               wave_sizze_78614) *\n                              wave_sizze_78614) & (2 * offset_78643 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_78632 = ((volatile __local\n                                            double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612 +\n                                                                         offset_78643)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78633 = x_78631 +\n                                       x_78632;\n                                \n                                x_78631 = defunc_1_op_res_78633;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612)] =\n                                    x_78631;\n                            }\n                        }\n                        offset_78643 *= 2;\n                    }\n                    while (slt32(skip_waves_78644,\n                                 squot32(sext_i64_i32(segred_group_sizze_68256) +\n                                         wave_sizze_78614 - 1,\n                                         wave_sizze_78614))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_78643 = skip_waves_78644 * wave_sizze_78614;\n                        if (slt32(local_tid_78612 + offset_78643,\n                                  sext_i64_i32(segred_group_sizze_68256)) &&\n                            ((local_tid_78612 - squot32(local_tid_78612,\n                                                        wave_sizze_78614) *\n                              wave_sizze_7",
            "8614) == 0 &&\n                             (squot32(local_tid_78612, wave_sizze_78614) & (2 *\n                                                                            skip_waves_78644 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_78632 = ((__local\n                                            double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612 +\n                                                                         offset_78643)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78633 = x_78631 +\n                                       x_78632;\n                                \n                                x_78631 = defunc_1_op_res_78633;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_78616)[sext_i32_i64(local_tid_78612)] =\n                                    x_78631;\n                            }\n                        }\n                        skip_waves_78644 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_78612 == 0) {\n                            ((__global double *) mem_77213)[gtid_68260 *\n                                                            n_m_65386 +\n                                                            gtid_68261] =\n                                x_78631;\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                                       uint sync_arr_mem_78700_backing_offset_0,\n                                       uint red_arr_mem_78698_backing_offset_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_78684,\n                                       int64_t elements_per_thread_78685,\n                                       int64_t virt_num_groups_78686,\n                                       int64_t threads_per_segment_78688,\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_78689,\n                                       __global\n                                       unsigned char *mainzicounter_mem_78691)\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    volatile unsigned char *sync_arr_mem_78700_backing_1 =\n                           &shared_mem[sync_arr_mem_78700_backing_offset_0];\n    volatile unsigned char *re",
            "d_arr_mem_78698_backing_0 =\n                           &shared_mem[red_arr_mem_78698_backing_offset_1];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78693;\n    int32_t local_tid_78694;\n    int64_t group_sizze_78697;\n    int32_t wave_sizze_78696;\n    int32_t group_tid_78695;\n    \n    global_tid_78693 = get_global_id(0);\n    local_tid_78694 = get_local_id(0);\n    group_sizze_78697 = get_local_size(0);\n    wave_sizze_78696 = LOCKSTEP_WIDTH;\n    group_tid_78695 = get_group_id(0);\n    \n    int32_t phys_tid_68313 = global_tid_78693;\n    __local unsigned char *red_arr_mem_78698;\n    \n    red_arr_mem_78698 = (__local unsigned char *) red_arr_mem_78698_backing_0;\n    \n    __local unsigned char *sync_arr_mem_78700;\n    \n    sync_arr_mem_78700 = (__local unsigned char *) sync_arr_mem_78700_backing_1;\n    \n    int32_t phys_group_id_78702;\n    \n    phys_group_id_78702 = get_group_id(0);\n    for (int32_t i_78703 = 0; i_78703 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_78686) - phys_group_id_78702,\n                   sext_i64_i32(num_groups_68307)); i_78703++) {\n        int32_t virt_group_id_78704 = phys_group_id_78702 + i_78703 *\n                sext_i64_i32(num_groups_68307);\n        int32_t flat_segment_id_78705 = squot32(virt_group_id_78704,\n                                                sext_i64_i32(groups_per_segment_78684));\n        int64_t global_tid_78706 = srem64(sext_i32_i64(virt_group_id_78704) *\n                                          segred_group_sizze_68306 +\n                                          sext_i32_i64(local_tid_78694),\n                                          segred_group_sizze_68306 *\n                                          groups_per_segment_78684);\n        int64_t slice_78707 = n_m_65386;\n        int64_t slice_78708 = m_65377 * slice_78707;\n        int64_t gtid_68310 = squot64(sext_i32_i64(flat_segment_id_78705),\n                                     slice_78707);\n        int64_t remnant_78709 = sext_i32_i6",
            "4(flat_segment_id_78705) -\n                gtid_68310 * slice_78707;\n        int64_t gtid_68311 = remnant_78709;\n        int64_t remnant_78710 = remnant_78709 - gtid_68311;\n        int64_t gtid_68312;\n        double x_acc_78711;\n        int64_t chunk_sizze_78712 = smin64(elements_per_thread_78685,\n                                           sdiv_up64(q_65380 - global_tid_78706,\n                                                     threads_per_segment_78688));\n        double x_68314;\n        double x_68315;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_78711 = 0.0;\n        }\n        for (int64_t i_78716 = 0; i_78716 < chunk_sizze_78712; i_78716++) {\n            gtid_68312 = global_tid_78706 + threads_per_segment_78688 * i_78716;\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_78711;\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_78711 = 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_78711;\n            ((__local\n              double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694)] =\n                x_68314;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_78717;\n        int32_t skip_wave",
            "s_78718 = 1;\n        double x_78713;\n        double x_78714;\n        \n        offset_78717 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_78694,\n                      sext_i64_i32(segred_group_sizze_68306))) {\n                x_78713 = ((__local\n                            double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694 +\n                                                         offset_78717)];\n            }\n        }\n        offset_78717 = 1;\n        while (slt32(offset_78717, wave_sizze_78696)) {\n            if (slt32(local_tid_78694 + offset_78717,\n                      sext_i64_i32(segred_group_sizze_68306)) &&\n                ((local_tid_78694 - squot32(local_tid_78694, wave_sizze_78696) *\n                  wave_sizze_78696) & (2 * offset_78717 - 1)) == 0) {\n                // read array element\n                {\n                    x_78714 = ((volatile __local\n                                double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694 +\n                                                             offset_78717)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78715 = x_78713 + x_78714;\n                    \n                    x_78713 = defunc_1_op_res_78715;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694)] =\n                        x_78713;\n                }\n            }\n            offset_78717 *= 2;\n        }\n        while (slt32(skip_waves_78718,\n                     squot32(sext_i64_i32(segred_group_sizze_68306) +\n                             wave_sizze_78696 - 1, wave_sizze_78696))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_78717 = skip_waves_78718 * wave_sizze_78696;\n            if (slt32(local_tid_78694 + offset_78717,\n        ",
            "              sext_i64_i32(segred_group_sizze_68306)) &&\n                ((local_tid_78694 - squot32(local_tid_78694, wave_sizze_78696) *\n                  wave_sizze_78696) == 0 && (squot32(local_tid_78694,\n                                                     wave_sizze_78696) & (2 *\n                                                                          skip_waves_78718 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_78714 = ((__local\n                                double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694 +\n                                                             offset_78717)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_78715 = x_78713 + x_78714;\n                    \n                    x_78713 = defunc_1_op_res_78715;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694)] =\n                        x_78713;\n                }\n            }\n            skip_waves_78718 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_78694) == (int64_t) 0) {\n                x_acc_78711 = x_78713;\n            }\n        }\n        if (groups_per_segment_78684 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_78694 == 0) {\n                    ((__global double *) mem_77223)[gtid_68310 * n_m_65386 +\n                                                    gtid_68311] = x_acc_78711;\n                }\n            }\n        } else {\n            int32_t old_counter_78719;\n            \n            // first thread in group saves group result",
            " to global memory\n            {\n                if (local_tid_78694 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_78689)[sext_i32_i64(virt_group_id_78704)] =\n                        x_acc_78711;\n                    mem_fence_global();\n                    old_counter_78719 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78691)[sext_i32_i64(srem32(flat_segment_id_78705,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_78700)[(int64_t) 0] =\n                        old_counter_78719 == groups_per_segment_78684 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_78720;\n            \n            is_last_group_78720 = ((__local\n                                    bool *) sync_arr_mem_78700)[(int64_t) 0];\n            if (is_last_group_78720) {\n                if (local_tid_78694 == 0) {\n                    old_counter_78719 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_78691)[sext_i32_i64(srem32(flat_segment_id_78705,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_78684));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_78721 =\n                            sdiv_up64(groups_per_segment_78684,\n                                      segred_group_sizze_68306);\n                    \n  ",
            "                  x_68314 = 0.0;\n                    for (int64_t i_78722 = 0; i_78722 < read_per_thread_78721;\n                         i_78722++) {\n                        int64_t group_res_id_78723 =\n                                sext_i32_i64(local_tid_78694) *\n                                read_per_thread_78721 + i_78722;\n                        int64_t index_of_group_res_78724 =\n                                sext_i32_i64(flat_segment_id_78705) *\n                                groups_per_segment_78684 + group_res_id_78723;\n                        \n                        if (slt64(group_res_id_78723,\n                                  groups_per_segment_78684)) {\n                            x_68315 = ((__global\n                                        double *) segred_tmp_mem_78689)[index_of_group_res_78724];\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_78698)[sext_i32_i64(local_tid_78694)] =\n                    x_68314;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_78725;\n                    int32_t skip_waves_78726 = 1;\n                    double x_78713;\n                    double x_78714;\n                    \n                    offset_78725 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_78694,\n                                  sext_i64_i32(segred_group_sizze_68306))) {\n                            x_78713 = ((__local\n                                        double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694 +\n                                                                     ",
            "offset_78725)];\n                        }\n                    }\n                    offset_78725 = 1;\n                    while (slt32(offset_78725, wave_sizze_78696)) {\n                        if (slt32(local_tid_78694 + offset_78725,\n                                  sext_i64_i32(segred_group_sizze_68306)) &&\n                            ((local_tid_78694 - squot32(local_tid_78694,\n                                                        wave_sizze_78696) *\n                              wave_sizze_78696) & (2 * offset_78725 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_78714 = ((volatile __local\n                                            double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694 +\n                                                                         offset_78725)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78715 = x_78713 +\n                                       x_78714;\n                                \n                                x_78713 = defunc_1_op_res_78715;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694)] =\n                                    x_78713;\n                            }\n                        }\n                        offset_78725 *= 2;\n                    }\n                    while (slt32(skip_waves_78726,\n                                 squot32(sext_i64_i32(segred_group_sizze_68306) +\n                                         wave_sizze_78696 - 1,\n                                         wave_sizze_78696))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n               ",
            "         offset_78725 = skip_waves_78726 * wave_sizze_78696;\n                        if (slt32(local_tid_78694 + offset_78725,\n                                  sext_i64_i32(segred_group_sizze_68306)) &&\n                            ((local_tid_78694 - squot32(local_tid_78694,\n                                                        wave_sizze_78696) *\n                              wave_sizze_78696) == 0 &&\n                             (squot32(local_tid_78694, wave_sizze_78696) & (2 *\n                                                                            skip_waves_78726 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_78714 = ((__local\n                                            double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694 +\n                                                                         offset_78725)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_78715 = x_78713 +\n                                       x_78714;\n                                \n                                x_78713 = defunc_1_op_res_78715;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_78698)[sext_i32_i64(local_tid_78694)] =\n                                    x_78713;\n                            }\n                        }\n                        skip_waves_78726 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_78694 == 0) {\n                            ((__global double *) mem_77223)[gtid_68310 *\n ",
            "                                                           n_m_65386 +\n                                                            gtid_68311] =\n                                x_78713;\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                                       uint sync_arr_mem_79049_backing_offset_0,\n                                       uint red_arr_mem_79047_backing_offset_1,\n                                       uint red_arr_mem_79045_backing_offset_2,\n                                       uint red_arr_mem_79043_backing_offset_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_79025,\n                                       int64_t elements_per_thread_79026,\n                                       int64_t virt_num_groups_79027,\n                                       int64_t threads_per_segment_79029,\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_79030,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79032,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79034,\n                                       __global\n                                       unsigned char *mainzicounter_mem_79036)\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    volatile unsigned char *sync_arr_mem_79049_backing_3 =\n                           &shared_mem[sync_arr_mem_79049_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79047_backing_2 =\n                           &shared_mem[red_arr_mem_79047_backing_offset_1];\n    volatile unsigned char *red_arr_mem_79045_backing_1 =\n                           &shared_mem[red_arr_mem_79045_backing_offset_2];\n    volatile unsigned char *red_arr_mem_79043_backing_0 =\n                           &shared_mem[red_arr_mem_79043_backing_offset_3];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79038;\n    int32_t local_tid_79039;\n    int64_t group_sizze_79042;\n    int32_t wave_sizze_79041;\n    int32_t group_tid_79040;\n    \n    global_tid_79038 = get_global_id(0);\n    local_tid_79039 = get_local_id(0);\n    group_sizze_79042 = get_local_size(0);\n    wave_sizze_79041 = LOCKSTEP_WIDTH;\n    group_tid_79040 = get_group_id(0);\n    \n    int32_t phys_tid_70086 = global_tid_79038;\n    __local unsigned char *red_arr_mem_79043;\n    \n    red_arr_mem_79043 = (__local unsigned char *) red_arr_mem_79043_backing_0;\n    \n    __local unsigned char *red_arr_mem_79045;\n    \n    red_arr_mem_79045 = (__local unsigned char *) red_arr_mem_79045_backing_1;\n    \n    __local unsigned char *red_arr_mem_79047;\n    \n    red_arr_mem_79047 = (__local unsigned",
            " char *) red_arr_mem_79047_backing_2;\n    \n    __local unsigned char *sync_arr_mem_79049;\n    \n    sync_arr_mem_79049 = (__local unsigned char *) sync_arr_mem_79049_backing_3;\n    \n    int32_t phys_group_id_79051;\n    \n    phys_group_id_79051 = get_group_id(0);\n    for (int32_t i_79052 = 0; i_79052 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_79027) - phys_group_id_79051,\n                   sext_i64_i32(num_groups_70078)); i_79052++) {\n        int32_t virt_group_id_79053 = phys_group_id_79051 + i_79052 *\n                sext_i64_i32(num_groups_70078);\n        int32_t flat_segment_id_79054 = squot32(virt_group_id_79053,\n                                                sext_i64_i32(groups_per_segment_79025));\n        int64_t global_tid_79055 = srem64(sext_i32_i64(virt_group_id_79053) *\n                                          segred_group_sizze_70077 +\n                                          sext_i32_i64(local_tid_79039),\n                                          segred_group_sizze_70077 *\n                                          groups_per_segment_79025);\n        int64_t slice_79056 = n_m_65386;\n        int64_t slice_79057 = m_65377 * slice_79056;\n        int64_t gtid_70083 = squot64(sext_i32_i64(flat_segment_id_79054),\n                                     slice_79056);\n        int64_t remnant_79058 = sext_i32_i64(flat_segment_id_79054) -\n                gtid_70083 * slice_79056;\n        int64_t gtid_70084 = remnant_79058;\n        int64_t remnant_79059 = remnant_79058 - gtid_70084;\n        int64_t gtid_70085;\n        double x_acc_79060;\n        double x_acc_79061;\n        double x_acc_79062;\n        int64_t chunk_sizze_79063 = smin64(elements_per_thread_79026,\n                                           sdiv_up64(q_65380 - global_tid_79055,\n                                                     threads_per_segment_79029));\n        double x_70087;\n        double x_70088;\n        double x_70089;\n        double x_70090;\n        double x_70091;\n        double x_7009",
            "2;\n        \n        // neutral-initialise the accumulators\n        {\n            x_acc_79060 = 0.0;\n            x_acc_79061 = 0.0;\n            x_acc_79062 = 0.0;\n        }\n        for (int64_t i_79073 = 0; i_79073 < chunk_sizze_79063; i_79073++) {\n            gtid_70085 = global_tid_79055 + threads_per_segment_79029 * i_79073;\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_79060;\n                    x_70088 = x_acc_79061;\n                    x_70089 = x_acc_79062;\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_70091;\n                    double defunc_1_op_res_70095 = x_70089 + x_70092;\n                    \n                    // store in accumulator\n                    {\n                        x_acc_79060 = defunc_1_op_res_70093;\n                        x_acc_79061 = defunc_1_op_res_70094;\n                        x_acc_79062 = 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_79060;\n            x_70088 = x_acc_79061;\n            x_70089 = x_acc_79062;\n            ((__local\n              double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039)] =\n                x_70087;\n            ((__local\n              double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039)] =\n                x_70088;\n            ((__local\n              double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039)] =\n                x_70089;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_79074;\n        int32_t skip_waves_79075 = 1;\n        double x_79064;\n        double x_79065;\n        double x_79066;\n        double x_79067;\n        double x_79068;\n        double x_79069;\n        \n        offset_79074 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_79039,\n                      sext_i64_i32(segred_group_sizze_70077))) {\n                x_79064 = ((__local\n                            double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039 +\n                                                         offset_79074)];\n                x_79065 = ((__local\n                            double *) red_arr_mem_79045)[sext_i32_i64(local_tid_7903",
            "9 +\n                                                         offset_79074)];\n                x_79066 = ((__local\n                            double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039 +\n                                                         offset_79074)];\n            }\n        }\n        offset_79074 = 1;\n        while (slt32(offset_79074, wave_sizze_79041)) {\n            if (slt32(local_tid_79039 + offset_79074,\n                      sext_i64_i32(segred_group_sizze_70077)) &&\n                ((local_tid_79039 - squot32(local_tid_79039, wave_sizze_79041) *\n                  wave_sizze_79041) & (2 * offset_79074 - 1)) == 0) {\n                // read array element\n                {\n                    x_79067 = ((volatile __local\n                                double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039 +\n                                                             offset_79074)];\n                    x_79068 = ((volatile __local\n                                double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039 +\n                                                             offset_79074)];\n                    x_79069 = ((volatile __local\n                                double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039 +\n                                                             offset_79074)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79070 = x_79064 + x_79067;\n                    double defunc_1_op_res_79071 = x_79065 + x_79068;\n                    double defunc_1_op_res_79072 = x_79066 + x_79069;\n                    \n                    x_79064 = defunc_1_op_res_79070;\n                    x_79065 = defunc_1_op_res_79071;\n                    x_79066 = defunc_1_op_res_79072;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_79043",
            ")[sext_i32_i64(local_tid_79039)] =\n                        x_79064;\n                    ((volatile __local\n                      double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039)] =\n                        x_79065;\n                    ((volatile __local\n                      double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039)] =\n                        x_79066;\n                }\n            }\n            offset_79074 *= 2;\n        }\n        while (slt32(skip_waves_79075,\n                     squot32(sext_i64_i32(segred_group_sizze_70077) +\n                             wave_sizze_79041 - 1, wave_sizze_79041))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_79074 = skip_waves_79075 * wave_sizze_79041;\n            if (slt32(local_tid_79039 + offset_79074,\n                      sext_i64_i32(segred_group_sizze_70077)) &&\n                ((local_tid_79039 - squot32(local_tid_79039, wave_sizze_79041) *\n                  wave_sizze_79041) == 0 && (squot32(local_tid_79039,\n                                                     wave_sizze_79041) & (2 *\n                                                                          skip_waves_79075 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_79067 = ((__local\n                                double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039 +\n                                                             offset_79074)];\n                    x_79068 = ((__local\n                                double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039 +\n                                                             offset_79074)];\n                    x_79069 = ((__local\n                                double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039 +\n                                                             offset_79074)];\n                }\n             ",
            "   // apply reduction operation\n                {\n                    double defunc_1_op_res_79070 = x_79064 + x_79067;\n                    double defunc_1_op_res_79071 = x_79065 + x_79068;\n                    double defunc_1_op_res_79072 = x_79066 + x_79069;\n                    \n                    x_79064 = defunc_1_op_res_79070;\n                    x_79065 = defunc_1_op_res_79071;\n                    x_79066 = defunc_1_op_res_79072;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039)] =\n                        x_79064;\n                    ((__local\n                      double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039)] =\n                        x_79065;\n                    ((__local\n                      double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039)] =\n                        x_79066;\n                }\n            }\n            skip_waves_79075 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_79039) == (int64_t) 0) {\n                x_acc_79060 = x_79064;\n                x_acc_79061 = x_79065;\n                x_acc_79062 = x_79066;\n            }\n        }\n        if (groups_per_segment_79025 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_79039 == 0) {\n                    ((__global double *) mem_77478)[gtid_70083 * n_m_65386 +\n                                                    gtid_70084] = x_acc_79060;\n                    ((__global double *) mem_77482)[gtid_70083 * n_m_65386 +\n                                                    gtid_70084] = x_acc_79061;\n                    ((__global double *) mem_77486)[gtid_70083 * n_m_65386 +\n                                                    gtid_70084] = x_acc_79062;\n     ",
            "           }\n            }\n        } else {\n            int32_t old_counter_79076;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_79039 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_79030)[sext_i32_i64(virt_group_id_79053)] =\n                        x_acc_79060;\n                    ((__global\n                      double *) segred_tmp_mem_79032)[sext_i32_i64(virt_group_id_79053)] =\n                        x_acc_79061;\n                    ((__global\n                      double *) segred_tmp_mem_79034)[sext_i32_i64(virt_group_id_79053)] =\n                        x_acc_79062;\n                    mem_fence_global();\n                    old_counter_79076 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79036)[sext_i32_i64(srem32(flat_segment_id_79054,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_79049)[(int64_t) 0] =\n                        old_counter_79076 == groups_per_segment_79025 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_79077;\n            \n            is_last_group_79077 = ((__local\n                                    bool *) sync_arr_mem_79049)[(int64_t) 0];\n            if (is_last_group_79077) {\n                if (local_tid_79039 == 0) {\n                    old_counter_79076 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79036)[sext_i32_i64(srem32(flat_segment_id_79054,\n                                                                               ",
            "                      10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_79025));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_79078 =\n                            sdiv_up64(groups_per_segment_79025,\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_79079 = 0; i_79079 < read_per_thread_79078;\n                         i_79079++) {\n                        int64_t group_res_id_79080 =\n                                sext_i32_i64(local_tid_79039) *\n                                read_per_thread_79078 + i_79079;\n                        int64_t index_of_group_res_79081 =\n                                sext_i32_i64(flat_segment_id_79054) *\n                                groups_per_segment_79025 + group_res_id_79080;\n                        \n                        if (slt64(group_res_id_79080,\n                                  groups_per_segment_79025)) {\n                            x_70090 = ((__global\n                                        double *) segred_tmp_mem_79030)[index_of_group_res_79081];\n                            x_70091 = ((__global\n                                        double *) segred_tmp_mem_79032)[index_of_group_res_79081];\n                            x_70092 = ((__global\n                                        double *) segred_tmp_mem_79034)[index_of_group_res_79081];\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 = defun",
            "c_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_79043)[sext_i32_i64(local_tid_79039)] =\n                    x_70087;\n                ((__local\n                  double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039)] =\n                    x_70088;\n                ((__local\n                  double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039)] =\n                    x_70089;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_79082;\n                    int32_t skip_waves_79083 = 1;\n                    double x_79064;\n                    double x_79065;\n                    double x_79066;\n                    double x_79067;\n                    double x_79068;\n                    double x_79069;\n                    \n                    offset_79082 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_79039,\n                                  sext_i64_i32(segred_group_sizze_70077))) {\n                            x_79064 = ((__local\n                                        double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039 +\n                                                                     offset_79082)];\n                            x_79065 = ((__local\n                                        double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039 +\n                                                                     offset_79082)];\n                            x_79066 = ((__local\n                                        double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039 +\n                                                                     offset_",
            "79082)];\n                        }\n                    }\n                    offset_79082 = 1;\n                    while (slt32(offset_79082, wave_sizze_79041)) {\n                        if (slt32(local_tid_79039 + offset_79082,\n                                  sext_i64_i32(segred_group_sizze_70077)) &&\n                            ((local_tid_79039 - squot32(local_tid_79039,\n                                                        wave_sizze_79041) *\n                              wave_sizze_79041) & (2 * offset_79082 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_79067 = ((volatile __local\n                                            double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039 +\n                                                                         offset_79082)];\n                                x_79068 = ((volatile __local\n                                            double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039 +\n                                                                         offset_79082)];\n                                x_79069 = ((volatile __local\n                                            double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039 +\n                                                                         offset_79082)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79070 = x_79064 +\n                                       x_79067;\n                                double defunc_1_op_res_79071 = x_79065 +\n                                       x_79068;\n                                double defunc_1_op_res_79072 = x_79066 +\n                                       x_79069;\n                                \n                                x_79064 = defunc_1_op_res_79070;\n               ",
            "                 x_79065 = defunc_1_op_res_79071;\n                                x_79066 = defunc_1_op_res_79072;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039)] =\n                                    x_79064;\n                                ((volatile __local\n                                  double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039)] =\n                                    x_79065;\n                                ((volatile __local\n                                  double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039)] =\n                                    x_79066;\n                            }\n                        }\n                        offset_79082 *= 2;\n                    }\n                    while (slt32(skip_waves_79083,\n                                 squot32(sext_i64_i32(segred_group_sizze_70077) +\n                                         wave_sizze_79041 - 1,\n                                         wave_sizze_79041))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_79082 = skip_waves_79083 * wave_sizze_79041;\n                        if (slt32(local_tid_79039 + offset_79082,\n                                  sext_i64_i32(segred_group_sizze_70077)) &&\n                            ((local_tid_79039 - squot32(local_tid_79039,\n                                                        wave_sizze_79041) *\n                              wave_sizze_79041) == 0 &&\n                             (squot32(local_tid_79039, wave_sizze_79041) & (2 *\n                                                                            skip_waves_79083 -\n                                                                            1)) ==\n                             0)) {\n                            // read array",
            " element\n                            {\n                                x_79067 = ((__local\n                                            double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039 +\n                                                                         offset_79082)];\n                                x_79068 = ((__local\n                                            double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039 +\n                                                                         offset_79082)];\n                                x_79069 = ((__local\n                                            double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039 +\n                                                                         offset_79082)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79070 = x_79064 +\n                                       x_79067;\n                                double defunc_1_op_res_79071 = x_79065 +\n                                       x_79068;\n                                double defunc_1_op_res_79072 = x_79066 +\n                                       x_79069;\n                                \n                                x_79064 = defunc_1_op_res_79070;\n                                x_79065 = defunc_1_op_res_79071;\n                                x_79066 = defunc_1_op_res_79072;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_79043)[sext_i32_i64(local_tid_79039)] =\n                                    x_79064;\n                                ((__local\n                                  double *) red_arr_mem_79045)[sext_i32_i64(local_tid_79039)] =\n                                    x_79065;\n                                ((_",
            "_local\n                                  double *) red_arr_mem_79047)[sext_i32_i64(local_tid_79039)] =\n                                    x_79066;\n                            }\n                        }\n                        skip_waves_79083 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_79039 == 0) {\n                            ((__global double *) mem_77478)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084] =\n                                x_79064;\n                            ((__global double *) mem_77482)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084] =\n                                x_79065;\n                            ((__global double *) mem_77486)[gtid_70083 *\n                                                            n_m_65386 +\n                                                            gtid_70084] =\n                                x_79066;\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                                       uint sync_arr_mem_79149_backing_offset_0,\n                                       uint red_arr_mem_79147_backing_offset_1,\n                                       uint red_arr_mem_79145_backing_offset_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_g",
            "roups_70149,\n                                       int64_t groups_per_segment_79129,\n                                       int64_t elements_per_thread_79130,\n                                       int64_t virt_num_groups_79131,\n                                       int64_t threads_per_segment_79133,\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_79134,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79136,\n                                       __global\n                                       unsigned char *mainzicounter_mem_79138)\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    volatile unsigned char *sync_arr_mem_79149_backing_2 =\n                           &shared_mem[sync_arr_mem_79149_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79147_backing_1 =\n                           &shared_mem[red_arr_mem_79147_backing_offset_1];\n    volatile unsigned char *red_arr_mem_79145_backing_0 =\n            ",
            "               &shared_mem[red_arr_mem_79145_backing_offset_2];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79140;\n    int32_t local_tid_79141;\n    int64_t group_sizze_79144;\n    int32_t wave_sizze_79143;\n    int32_t group_tid_79142;\n    \n    global_tid_79140 = get_global_id(0);\n    local_tid_79141 = get_local_id(0);\n    group_sizze_79144 = get_local_size(0);\n    wave_sizze_79143 = LOCKSTEP_WIDTH;\n    group_tid_79142 = get_group_id(0);\n    \n    int32_t phys_tid_70156 = global_tid_79140;\n    __local unsigned char *red_arr_mem_79145;\n    \n    red_arr_mem_79145 = (__local unsigned char *) red_arr_mem_79145_backing_0;\n    \n    __local unsigned char *red_arr_mem_79147;\n    \n    red_arr_mem_79147 = (__local unsigned char *) red_arr_mem_79147_backing_1;\n    \n    __local unsigned char *sync_arr_mem_79149;\n    \n    sync_arr_mem_79149 = (__local unsigned char *) sync_arr_mem_79149_backing_2;\n    \n    int32_t phys_group_id_79151;\n    \n    phys_group_id_79151 = get_group_id(0);\n    for (int32_t i_79152 = 0; i_79152 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_79131) - phys_group_id_79151,\n                   sext_i64_i32(num_groups_70149)); i_79152++) {\n        int32_t virt_group_id_79153 = phys_group_id_79151 + i_79152 *\n                sext_i64_i32(num_groups_70149);\n        int32_t flat_segment_id_79154 = squot32(virt_group_id_79153,\n                                                sext_i64_i32(groups_per_segment_79129));\n        int64_t global_tid_79155 = srem64(sext_i32_i64(virt_group_id_79153) *\n                                          segred_group_sizze_70148 +\n                                          sext_i32_i64(local_tid_79141),\n                                          segred_group_sizze_70148 *\n                                          groups_per_segment_79129);\n        int64_t slice_79156 = n_m_65386;\n        int64_t slice_79157 = m_65377 * slice_79156;\n        int64_t gtid_70153 = squot64(sext_i32_i64(flat_segment_id_79154),",
            "\n                                     slice_79156);\n        int64_t remnant_79158 = sext_i32_i64(flat_segment_id_79154) -\n                gtid_70153 * slice_79156;\n        int64_t gtid_70154 = remnant_79158;\n        int64_t remnant_79159 = remnant_79158 - gtid_70154;\n        int64_t gtid_70155;\n        double x_acc_79160;\n        double x_acc_79161;\n        int64_t chunk_sizze_79162 = smin64(elements_per_thread_79130,\n                                           sdiv_up64(q_65380 - global_tid_79155,\n                                                     threads_per_segment_79133));\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_79160 = 0.0;\n            x_acc_79161 = 0.0;\n        }\n        for (int64_t i_79169 = 0; i_79169 < chunk_sizze_79162; i_79169++) {\n            gtid_70155 = global_tid_79155 + threads_per_segment_79133 * i_79169;\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 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 = b1",
            "1_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_79160;\n                    x_70158 = x_acc_79161;\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_79160 = defunc_1_op_res_70161;\n                        x_acc_79161 = 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_79160;\n            x_70158 = x_acc_79161;\n            ((__local\n              double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141)] =\n                x_70157;\n            ((__local\n              double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141)] =\n                x_70158;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_79170;\n        int32_t skip_waves_79171 = 1;\n        double x_79163;\n        double x_79164;\n        double x_79165;\n        double x_79166;\n        \n        offset_79170 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_79141,\n                      sext_i64_i32(segred_group_sizze_70148))) {\n                x_79163 = ((",
            "__local\n                            double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141 +\n                                                         offset_79170)];\n                x_79164 = ((__local\n                            double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141 +\n                                                         offset_79170)];\n            }\n        }\n        offset_79170 = 1;\n        while (slt32(offset_79170, wave_sizze_79143)) {\n            if (slt32(local_tid_79141 + offset_79170,\n                      sext_i64_i32(segred_group_sizze_70148)) &&\n                ((local_tid_79141 - squot32(local_tid_79141, wave_sizze_79143) *\n                  wave_sizze_79143) & (2 * offset_79170 - 1)) == 0) {\n                // read array element\n                {\n                    x_79165 = ((volatile __local\n                                double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141 +\n                                                             offset_79170)];\n                    x_79166 = ((volatile __local\n                                double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141 +\n                                                             offset_79170)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79167 = x_79163 + x_79165;\n                    double defunc_1_op_res_79168 = x_79164 + x_79166;\n                    \n                    x_79163 = defunc_1_op_res_79167;\n                    x_79164 = defunc_1_op_res_79168;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141)] =\n                        x_79163;\n                    ((volatile __local\n                      double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141)] =\n                        x_79164;\n                }\n       ",
            "     }\n            offset_79170 *= 2;\n        }\n        while (slt32(skip_waves_79171,\n                     squot32(sext_i64_i32(segred_group_sizze_70148) +\n                             wave_sizze_79143 - 1, wave_sizze_79143))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_79170 = skip_waves_79171 * wave_sizze_79143;\n            if (slt32(local_tid_79141 + offset_79170,\n                      sext_i64_i32(segred_group_sizze_70148)) &&\n                ((local_tid_79141 - squot32(local_tid_79141, wave_sizze_79143) *\n                  wave_sizze_79143) == 0 && (squot32(local_tid_79141,\n                                                     wave_sizze_79143) & (2 *\n                                                                          skip_waves_79171 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_79165 = ((__local\n                                double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141 +\n                                                             offset_79170)];\n                    x_79166 = ((__local\n                                double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141 +\n                                                             offset_79170)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79167 = x_79163 + x_79165;\n                    double defunc_1_op_res_79168 = x_79164 + x_79166;\n                    \n                    x_79163 = defunc_1_op_res_79167;\n                    x_79164 = defunc_1_op_res_79168;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141)] =\n                        x_79163;\n                    ((__local\n                      double *) red_arr",
            "_mem_79147)[sext_i32_i64(local_tid_79141)] =\n                        x_79164;\n                }\n            }\n            skip_waves_79171 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_79141) == (int64_t) 0) {\n                x_acc_79160 = x_79163;\n                x_acc_79161 = x_79164;\n            }\n        }\n        if (groups_per_segment_79129 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_79141 == 0) {\n                    ((__global double *) mem_77504)[gtid_70153 * n_m_65386 +\n                                                    gtid_70154] = x_acc_79160;\n                    ((__global double *) mem_77508)[gtid_70153 * n_m_65386 +\n                                                    gtid_70154] = x_acc_79161;\n                }\n            }\n        } else {\n            int32_t old_counter_79172;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_79141 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_79134)[sext_i32_i64(virt_group_id_79153)] =\n                        x_acc_79160;\n                    ((__global\n                      double *) segred_tmp_mem_79136)[sext_i32_i64(virt_group_id_79153)] =\n                        x_acc_79161;\n                    mem_fence_global();\n                    old_counter_79172 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79138)[sext_i32_i64(srem32(flat_segment_id_79154,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_79149)[(int64_t) 0] =\n                       ",
            " old_counter_79172 == groups_per_segment_79129 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_79173;\n            \n            is_last_group_79173 = ((__local\n                                    bool *) sync_arr_mem_79149)[(int64_t) 0];\n            if (is_last_group_79173) {\n                if (local_tid_79141 == 0) {\n                    old_counter_79172 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79138)[sext_i32_i64(srem32(flat_segment_id_79154,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_79129));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_79174 =\n                            sdiv_up64(groups_per_segment_79129,\n                                      segred_group_sizze_70148);\n                    \n                    x_70157 = 0.0;\n                    x_70158 = 0.0;\n                    for (int64_t i_79175 = 0; i_79175 < read_per_thread_79174;\n                         i_79175++) {\n                        int64_t group_res_id_79176 =\n                                sext_i32_i64(local_tid_79141) *\n                                read_per_thread_79174 + i_79175;\n                        int64_t index_of_group_res_79177 =\n                                sext_i32_i64(flat_segment_id_79154) *\n                                groups_per_segment_79129 + group_res_id_79176;\n                        \n                        if (slt64(group_res_id_79176,\n                                  groups_per_segment_79129)) {\n                            x_70159 = ((__global\n   ",
            "                                     double *) segred_tmp_mem_79134)[index_of_group_res_79177];\n                            x_70160 = ((__global\n                                        double *) segred_tmp_mem_79136)[index_of_group_res_79177];\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_79145)[sext_i32_i64(local_tid_79141)] =\n                    x_70157;\n                ((__local\n                  double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141)] =\n                    x_70158;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_79178;\n                    int32_t skip_waves_79179 = 1;\n                    double x_79163;\n                    double x_79164;\n                    double x_79165;\n                    double x_79166;\n                    \n                    offset_79178 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_79141,\n                                  sext_i64_i32(segred_group_sizze_70148))) {\n                            x_79163 = ((__local\n                                        double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141 +\n                                                                     offset_79178)];\n                            x_79164 = ((__local\n                                        double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141 +\n                                                                     offset_",
            "79178)];\n                        }\n                    }\n                    offset_79178 = 1;\n                    while (slt32(offset_79178, wave_sizze_79143)) {\n                        if (slt32(local_tid_79141 + offset_79178,\n                                  sext_i64_i32(segred_group_sizze_70148)) &&\n                            ((local_tid_79141 - squot32(local_tid_79141,\n                                                        wave_sizze_79143) *\n                              wave_sizze_79143) & (2 * offset_79178 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_79165 = ((volatile __local\n                                            double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141 +\n                                                                         offset_79178)];\n                                x_79166 = ((volatile __local\n                                            double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141 +\n                                                                         offset_79178)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79167 = x_79163 +\n                                       x_79165;\n                                double defunc_1_op_res_79168 = x_79164 +\n                                       x_79166;\n                                \n                                x_79163 = defunc_1_op_res_79167;\n                                x_79164 = defunc_1_op_res_79168;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141)] =\n                                    x_79163;\n                ",
            "                ((volatile __local\n                                  double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141)] =\n                                    x_79164;\n                            }\n                        }\n                        offset_79178 *= 2;\n                    }\n                    while (slt32(skip_waves_79179,\n                                 squot32(sext_i64_i32(segred_group_sizze_70148) +\n                                         wave_sizze_79143 - 1,\n                                         wave_sizze_79143))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_79178 = skip_waves_79179 * wave_sizze_79143;\n                        if (slt32(local_tid_79141 + offset_79178,\n                                  sext_i64_i32(segred_group_sizze_70148)) &&\n                            ((local_tid_79141 - squot32(local_tid_79141,\n                                                        wave_sizze_79143) *\n                              wave_sizze_79143) == 0 &&\n                             (squot32(local_tid_79141, wave_sizze_79143) & (2 *\n                                                                            skip_waves_79179 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_79165 = ((__local\n                                            double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141 +\n                                                                         offset_79178)];\n                                x_79166 = ((__local\n                                            double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141 +\n                                                                         offset_79178)];\n                            }\n                            // apply reduction operation\n                ",
            "            {\n                                double defunc_1_op_res_79167 = x_79163 +\n                                       x_79165;\n                                double defunc_1_op_res_79168 = x_79164 +\n                                       x_79166;\n                                \n                                x_79163 = defunc_1_op_res_79167;\n                                x_79164 = defunc_1_op_res_79168;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_79145)[sext_i32_i64(local_tid_79141)] =\n                                    x_79163;\n                                ((__local\n                                  double *) red_arr_mem_79147)[sext_i32_i64(local_tid_79141)] =\n                                    x_79164;\n                            }\n                        }\n                        skip_waves_79179 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_79141 == 0) {\n                            ((__global double *) mem_77504)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154] =\n                                x_79163;\n                            ((__global double *) mem_77508)[gtid_70153 *\n                                                            n_m_65386 +\n                                                            gtid_70154] =\n                                x_79164;\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_70148\n}\n__kernel void mainzisegred_large_72159(__global int *global_failure,\n                       ",
            "                uint sync_arr_mem_79540_backing_offset_0,\n                                       uint red_arr_mem_79538_backing_offset_1,\n                                       uint red_arr_mem_79536_backing_offset_2,\n                                       uint red_arr_mem_79534_backing_offset_3,\n                                       uint red_arr_mem_79532_backing_offset_4,\n                                       uint red_arr_mem_79530_backing_offset_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_79508,\n                                       int64_t elements_per_thread_79509,\n                                       int64_t virt_num_groups_79510,\n                                       int64_t threads_per_segment_79512,\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_79513,\n                                       __global\n                                       unsigned ch",
            "ar *segred_tmp_mem_79515,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79517,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79519,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79521,\n                                       __global\n                                       unsigned char *mainzicounter_mem_79523)\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    volatile unsigned char *sync_arr_mem_79540_backing_5 =\n                           &shared_mem[sync_arr_mem_79540_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79538_backing_4 =\n                           &shared_mem[red_arr_mem_79538_backing_offset_1];\n    volatile unsigned char *red_arr_mem_79536_backing_3 =\n                           &shared_mem[red_arr_mem_79536_backing_offset_2];\n    volatile unsigned char *red_arr_mem_79534_backing_2 =\n                           &shared_mem[red_arr_mem_79534_backing_offset_3];\n    volatile unsigned char *red_arr_mem_79532_backing_1 =\n                           &shared_mem[red_arr_mem_79532_backing_offset_4];\n    volatile unsigned char *red_arr_mem_79530_backing_0 =\n                           &shared_mem[red_arr_mem_79530_backing_offset_5];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79525;\n    int32_t local_tid_79526;\n    int64_t group_sizze_79529;\n    int32_t wave_sizze_79528;\n    int32_t group_tid_79527;\n    \n    global_tid_79525 = get_global_id(0);\n    local_tid_79526 = get_local_id(0);\n    group_sizze_79529 = get_local_size(0);\n    wave_sizze_79528 = LOCKSTEP_WIDTH;\n    group_tid_79527 = get_group_id(0);\n    \n    int32_t phys_tid_72159 = global_tid_79525;\n    __local unsigned char *red_arr_mem_",
            "79530;\n    \n    red_arr_mem_79530 = (__local unsigned char *) red_arr_mem_79530_backing_0;\n    \n    __local unsigned char *red_arr_mem_79532;\n    \n    red_arr_mem_79532 = (__local unsigned char *) red_arr_mem_79532_backing_1;\n    \n    __local unsigned char *red_arr_mem_79534;\n    \n    red_arr_mem_79534 = (__local unsigned char *) red_arr_mem_79534_backing_2;\n    \n    __local unsigned char *red_arr_mem_79536;\n    \n    red_arr_mem_79536 = (__local unsigned char *) red_arr_mem_79536_backing_3;\n    \n    __local unsigned char *red_arr_mem_79538;\n    \n    red_arr_mem_79538 = (__local unsigned char *) red_arr_mem_79538_backing_4;\n    \n    __local unsigned char *sync_arr_mem_79540;\n    \n    sync_arr_mem_79540 = (__local unsigned char *) sync_arr_mem_79540_backing_5;\n    \n    int32_t phys_group_id_79542;\n    \n    phys_group_id_79542 = get_group_id(0);\n    for (int32_t i_79543 = 0; i_79543 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_79510) - phys_group_id_79542,\n                   sext_i64_i32(num_groups_72149)); i_79543++) {\n        int32_t virt_group_id_79544 = phys_group_id_79542 + i_79543 *\n                sext_i64_i32(num_groups_72149);\n        int32_t flat_segment_id_79545 = squot32(virt_group_id_79544,\n                                                sext_i64_i32(groups_per_segment_79508));\n        int64_t global_tid_79546 = srem64(sext_i32_i64(virt_group_id_79544) *\n                                          segred_group_sizze_72148 +\n                                          sext_i32_i64(local_tid_79526),\n                                          segred_group_sizze_72148 *\n                                          groups_per_segment_79508);\n        int64_t slice_79547 = n_m_65386;\n        int64_t slice_79548 = m_65377 * slice_79547;\n        int64_t gtid_72156 = squot64(sext_i32_i64(flat_segment_id_79545),\n                                     slice_79547);\n        int64_t remnant_79549 = sext_i32_i64(flat_segment_id_79545) -\n                gtid_72156 * slice_7954",
            "7;\n        int64_t gtid_72157 = remnant_79549;\n        int64_t remnant_79550 = remnant_79549 - gtid_72157;\n        int64_t gtid_72158;\n        double x_acc_79551;\n        double x_acc_79552;\n        double x_acc_79553;\n        double x_acc_79554;\n        double x_acc_79555;\n        int64_t chunk_sizze_79556 = smin64(elements_per_thread_79509,\n                                           sdiv_up64(q_65380 - global_tid_79546,\n                                                     threads_per_segment_79512));\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_79551 = 0.0;\n            x_acc_79552 = 0.0;\n            x_acc_79553 = 0.0;\n            x_acc_79554 = 0.0;\n            x_acc_79555 = 0.0;\n        }\n        for (int64_t i_79572 = 0; i_79572 < chunk_sizze_79556; i_79572++) {\n            gtid_72158 = global_tid_79546 + threads_per_segment_79512 * i_79572;\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_721",
            "94 * 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_79551;\n                    x_72161 = x_acc_79552;\n                    x_72162 = x_acc_79553;\n                    x_72163 = x_acc_79554;\n                    x_72164 = x_acc_79555;\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_79551 = defunc_1_op_res_72170;\n                        x_acc_79552 = defunc_1_op_res_72171;\n                        x_acc_79553 = defunc_1_op_res_72172;\n                        x_acc_79554 = defunc_1_op_res_72173;\n                        x_acc_79555 = 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_79551;\n            x_72161 = x_acc_79552;\n            x_72162 = x_acc_79553;\n            x_72163 = x_acc_79554;\n            x_72164 = x_acc_79555;\n            ((__local\n              double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526)] =\n                x_72160;\n            ((__local\n              double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526)] =\n                x_72161;\n            ((__local\n              double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526)] =\n                x_72162;\n            ((__local\n              double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526)] =\n                x_72163;\n            ((__local\n              double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526)] =\n                x_72164;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_79573;\n        int32_t skip_waves_79574 = 1;\n        double x_79557;\n        double x_79558;\n        double x_79559;\n        double x_79560;\n        double x_79561;\n        double x_79562;\n        double x_79563;\n        double x_79564;\n        double x_79565;\n        double x_79566;\n        \n        offset_79573 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_79526,\n                      sext_i64_i32(segred_group_sizze_72148))) {\n                x_79557 = ((__local\n                            double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526 +\n                                                         offset_79573)];\n                x_79558 = ((__local\n                            double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526 +\n                                                         offset_79573)];\n                x_79559 = ((__local\n                            double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526 +\n",
            "                                                         offset_79573)];\n                x_79560 = ((__local\n                            double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526 +\n                                                         offset_79573)];\n                x_79561 = ((__local\n                            double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526 +\n                                                         offset_79573)];\n            }\n        }\n        offset_79573 = 1;\n        while (slt32(offset_79573, wave_sizze_79528)) {\n            if (slt32(local_tid_79526 + offset_79573,\n                      sext_i64_i32(segred_group_sizze_72148)) &&\n                ((local_tid_79526 - squot32(local_tid_79526, wave_sizze_79528) *\n                  wave_sizze_79528) & (2 * offset_79573 - 1)) == 0) {\n                // read array element\n                {\n                    x_79562 = ((volatile __local\n                                double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79563 = ((volatile __local\n                                double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79564 = ((volatile __local\n                                double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79565 = ((volatile __local\n                                double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79566 = ((volatile __local\n                                double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n           ",
            "     }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79567 = x_79557 + x_79562;\n                    double defunc_1_op_res_79568 = x_79558 + x_79563;\n                    double defunc_1_op_res_79569 = x_79559 + x_79564;\n                    double defunc_1_op_res_79570 = x_79560 + x_79565;\n                    double defunc_1_op_res_79571 = x_79561 + x_79566;\n                    \n                    x_79557 = defunc_1_op_res_79567;\n                    x_79558 = defunc_1_op_res_79568;\n                    x_79559 = defunc_1_op_res_79569;\n                    x_79560 = defunc_1_op_res_79570;\n                    x_79561 = defunc_1_op_res_79571;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526)] =\n                        x_79557;\n                    ((volatile __local\n                      double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526)] =\n                        x_79558;\n                    ((volatile __local\n                      double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526)] =\n                        x_79559;\n                    ((volatile __local\n                      double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526)] =\n                        x_79560;\n                    ((volatile __local\n                      double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526)] =\n                        x_79561;\n                }\n            }\n            offset_79573 *= 2;\n        }\n        while (slt32(skip_waves_79574,\n                     squot32(sext_i64_i32(segred_group_sizze_72148) +\n                             wave_sizze_79528 - 1, wave_sizze_79528))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_79573 = skip_waves_79574 * wave_sizze_79528;\n            if (slt32(local_tid_79526 + offset_79573,\n                  ",
            "    sext_i64_i32(segred_group_sizze_72148)) &&\n                ((local_tid_79526 - squot32(local_tid_79526, wave_sizze_79528) *\n                  wave_sizze_79528) == 0 && (squot32(local_tid_79526,\n                                                     wave_sizze_79528) & (2 *\n                                                                          skip_waves_79574 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_79562 = ((__local\n                                double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79563 = ((__local\n                                double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79564 = ((__local\n                                double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79565 = ((__local\n                                double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                    x_79566 = ((__local\n                                double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526 +\n                                                             offset_79573)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79567 = x_79557 + x_79562;\n                    double defunc_1_op_res_79568 = x_79558 + x_79563;\n                    double defunc_1_op_res_79569 = x_79559 + x_79564;\n                    double defunc_1_op_res_79570 = x_79560 + x_79565;\n                    double defunc_1_op_res_79571 = x_79561 + x_79",
            "566;\n                    \n                    x_79557 = defunc_1_op_res_79567;\n                    x_79558 = defunc_1_op_res_79568;\n                    x_79559 = defunc_1_op_res_79569;\n                    x_79560 = defunc_1_op_res_79570;\n                    x_79561 = defunc_1_op_res_79571;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526)] =\n                        x_79557;\n                    ((__local\n                      double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526)] =\n                        x_79558;\n                    ((__local\n                      double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526)] =\n                        x_79559;\n                    ((__local\n                      double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526)] =\n                        x_79560;\n                    ((__local\n                      double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526)] =\n                        x_79561;\n                }\n            }\n            skip_waves_79574 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_79526) == (int64_t) 0) {\n                x_acc_79551 = x_79557;\n                x_acc_79552 = x_79558;\n                x_acc_79553 = x_79559;\n                x_acc_79554 = x_79560;\n                x_acc_79555 = x_79561;\n            }\n        }\n        if (groups_per_segment_79508 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_79526 == 0) {\n                    ((__global double *) mem_77794)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79551;\n                    ((__global double *) mem_77798)[gtid_72156 * n_m_65386 +\n                 ",
            "                                   gtid_72157] = x_acc_79552;\n                    ((__global double *) mem_77802)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79553;\n                    ((__global double *) mem_77806)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79554;\n                    ((__global double *) mem_77810)[gtid_72156 * n_m_65386 +\n                                                    gtid_72157] = x_acc_79555;\n                }\n            }\n        } else {\n            int32_t old_counter_79575;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_79526 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_79513)[sext_i32_i64(virt_group_id_79544)] =\n                        x_acc_79551;\n                    ((__global\n                      double *) segred_tmp_mem_79515)[sext_i32_i64(virt_group_id_79544)] =\n                        x_acc_79552;\n                    ((__global\n                      double *) segred_tmp_mem_79517)[sext_i32_i64(virt_group_id_79544)] =\n                        x_acc_79553;\n                    ((__global\n                      double *) segred_tmp_mem_79519)[sext_i32_i64(virt_group_id_79544)] =\n                        x_acc_79554;\n                    ((__global\n                      double *) segred_tmp_mem_79521)[sext_i32_i64(virt_group_id_79544)] =\n                        x_acc_79555;\n                    mem_fence_global();\n                    old_counter_79575 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79523)[sext_i32_i64(srem32(flat_segment_id_79545,\n                                                                                                     10240))],\n                                              (int) 1);\n     ",
            "               ((__local bool *) sync_arr_mem_79540)[(int64_t) 0] =\n                        old_counter_79575 == groups_per_segment_79508 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_79576;\n            \n            is_last_group_79576 = ((__local\n                                    bool *) sync_arr_mem_79540)[(int64_t) 0];\n            if (is_last_group_79576) {\n                if (local_tid_79526 == 0) {\n                    old_counter_79575 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79523)[sext_i32_i64(srem32(flat_segment_id_79545,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_79508));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_79577 =\n                            sdiv_up64(groups_per_segment_79508,\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_79578 = 0; i_79578 < read_per_thread_79577;\n                         i_79578++) {\n                        int64_t group_res_id_79579 =\n                                sext_i32_i64(local_tid_79526) *\n                                read_per_thread_79577 + i_79578;\n                        int64_t index_of_group_res_79580 =\n                                sext_i32_i64(flat_segment_id_79545) *\n                                groups_per_segment_79508 + group_res_id_79579",
            ";\n                        \n                        if (slt64(group_res_id_79579,\n                                  groups_per_segment_79508)) {\n                            x_72165 = ((__global\n                                        double *) segred_tmp_mem_79513)[index_of_group_res_79580];\n                            x_72166 = ((__global\n                                        double *) segred_tmp_mem_79515)[index_of_group_res_79580];\n                            x_72167 = ((__global\n                                        double *) segred_tmp_mem_79517)[index_of_group_res_79580];\n                            x_72168 = ((__global\n                                        double *) segred_tmp_mem_79519)[index_of_group_res_79580];\n                            x_72169 = ((__global\n                                        double *) segred_tmp_mem_79521)[index_of_group_res_79580];\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_79530)[sext_i32_i64(local_tid_79526)] =\n                    x_72160;\n                ((__local\n                  double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526)] =\n                    x_72161;\n                ((__local\n ",
            "                 double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526)] =\n                    x_72162;\n                ((__local\n                  double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526)] =\n                    x_72163;\n                ((__local\n                  double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526)] =\n                    x_72164;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_79581;\n                    int32_t skip_waves_79582 = 1;\n                    double x_79557;\n                    double x_79558;\n                    double x_79559;\n                    double x_79560;\n                    double x_79561;\n                    double x_79562;\n                    double x_79563;\n                    double x_79564;\n                    double x_79565;\n                    double x_79566;\n                    \n                    offset_79581 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_79526,\n                                  sext_i64_i32(segred_group_sizze_72148))) {\n                            x_79557 = ((__local\n                                        double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526 +\n                                                                     offset_79581)];\n                            x_79558 = ((__local\n                                        double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526 +\n                                                                     offset_79581)];\n                            x_79559 = ((__local\n                                        double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526 +\n                                                                     offset_79581)];\n                            x_79560 = ((__local\n                                ",
            "        double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526 +\n                                                                     offset_79581)];\n                            x_79561 = ((__local\n                                        double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526 +\n                                                                     offset_79581)];\n                        }\n                    }\n                    offset_79581 = 1;\n                    while (slt32(offset_79581, wave_sizze_79528)) {\n                        if (slt32(local_tid_79526 + offset_79581,\n                                  sext_i64_i32(segred_group_sizze_72148)) &&\n                            ((local_tid_79526 - squot32(local_tid_79526,\n                                                        wave_sizze_79528) *\n                              wave_sizze_79528) & (2 * offset_79581 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_79562 = ((volatile __local\n                                            double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                                x_79563 = ((volatile __local\n                                            double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                                x_79564 = ((volatile __local\n                                            double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                                x_79565 = ((volatile __local\n                                            double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526 +\n                                                   ",
            "                      offset_79581)];\n                                x_79566 = ((volatile __local\n                                            double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79567 = x_79557 +\n                                       x_79562;\n                                double defunc_1_op_res_79568 = x_79558 +\n                                       x_79563;\n                                double defunc_1_op_res_79569 = x_79559 +\n                                       x_79564;\n                                double defunc_1_op_res_79570 = x_79560 +\n                                       x_79565;\n                                double defunc_1_op_res_79571 = x_79561 +\n                                       x_79566;\n                                \n                                x_79557 = defunc_1_op_res_79567;\n                                x_79558 = defunc_1_op_res_79568;\n                                x_79559 = defunc_1_op_res_79569;\n                                x_79560 = defunc_1_op_res_79570;\n                                x_79561 = defunc_1_op_res_79571;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526)] =\n                                    x_79557;\n                                ((volatile __local\n                                  double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526)] =\n                                    x_79558;\n                                ((volatile __local\n                                  double *) red_arr_mem_79534)[sext_i32_i64(",
            "local_tid_79526)] =\n                                    x_79559;\n                                ((volatile __local\n                                  double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526)] =\n                                    x_79560;\n                                ((volatile __local\n                                  double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526)] =\n                                    x_79561;\n                            }\n                        }\n                        offset_79581 *= 2;\n                    }\n                    while (slt32(skip_waves_79582,\n                                 squot32(sext_i64_i32(segred_group_sizze_72148) +\n                                         wave_sizze_79528 - 1,\n                                         wave_sizze_79528))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_79581 = skip_waves_79582 * wave_sizze_79528;\n                        if (slt32(local_tid_79526 + offset_79581,\n                                  sext_i64_i32(segred_group_sizze_72148)) &&\n                            ((local_tid_79526 - squot32(local_tid_79526,\n                                                        wave_sizze_79528) *\n                              wave_sizze_79528) == 0 &&\n                             (squot32(local_tid_79526, wave_sizze_79528) & (2 *\n                                                                            skip_waves_79582 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_79562 = ((__local\n                                            double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                                x_79563 = ((__local\n                       ",
            "                     double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                                x_79564 = ((__local\n                                            double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                                x_79565 = ((__local\n                                            double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                                x_79566 = ((__local\n                                            double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526 +\n                                                                         offset_79581)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79567 = x_79557 +\n                                       x_79562;\n                                double defunc_1_op_res_79568 = x_79558 +\n                                       x_79563;\n                                double defunc_1_op_res_79569 = x_79559 +\n                                       x_79564;\n                                double defunc_1_op_res_79570 = x_79560 +\n                                       x_79565;\n                                double defunc_1_op_res_79571 = x_79561 +\n                                       x_79566;\n                                \n                                x_79557 = defunc_1_op_res_79567;\n                                x_79558 = defunc_1_op_res_79568;\n                                x_79559 = defunc_1_op_res_79569;\n                                x_79560 = defunc_1_op_res_79570;\n                                x_79561 = defunc_1_op_res_79571;\n               ",
            "             }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_79530)[sext_i32_i64(local_tid_79526)] =\n                                    x_79557;\n                                ((__local\n                                  double *) red_arr_mem_79532)[sext_i32_i64(local_tid_79526)] =\n                                    x_79558;\n                                ((__local\n                                  double *) red_arr_mem_79534)[sext_i32_i64(local_tid_79526)] =\n                                    x_79559;\n                                ((__local\n                                  double *) red_arr_mem_79536)[sext_i32_i64(local_tid_79526)] =\n                                    x_79560;\n                                ((__local\n                                  double *) red_arr_mem_79538)[sext_i32_i64(local_tid_79526)] =\n                                    x_79561;\n                            }\n                        }\n                        skip_waves_79582 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_79526 == 0) {\n                            ((__global double *) mem_77794)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79557;\n                            ((__global double *) mem_77798)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79558;\n                            ((__global double *) mem_77802)[gtid_72156 *\n                                                            n_m_65386 +\n                                                       ",
            "     gtid_72157] =\n                                x_79559;\n                            ((__global double *) mem_77806)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79560;\n                            ((__global double *) mem_77810)[gtid_72156 *\n                                                            n_m_65386 +\n                                                            gtid_72157] =\n                                x_79561;\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                                       uint sync_arr_mem_79648_backing_offset_0,\n                                       uint red_arr_mem_79646_backing_offset_1,\n                                       uint red_arr_mem_79644_backing_offset_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_79628,\n                                       int64_t elements_per_thread_79629,\n                                       int64_t virt_num_groups_79630,\n                                       int64_t threads_per_segment_79632,\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_79633,\n                                       __global\n                                       unsigned char *segred_tmp_mem_79635,\n                                       __global\n                                       unsigned char *mainzicounter_mem_79637)\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    volatile unsigned char *sync_arr_mem_79648_backing_2 =\n                           &shared_mem[sync_arr_mem_79648_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79646_backing_1 =\n                           &shared_mem[red_arr_mem_79646_backing_offset_1];\n    volatile unsigned char *red_arr_mem_79644_backing_0 =\n                           &shared_mem[red_arr_mem_79644_backing_offset_2];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79639;\n    int32_t local_tid_79640;\n    int64_t group_sizze_79643;\n    int32_t wave_sizze_79642;\n    int32_t group_tid_79641;\n    \n    global_tid_79639 = get_global_id(0);\n    local_tid_79640 = get_local_id(0);\n    group_sizze_79643 = get_local_size(0);\n    wave_sizze_79642 = LOCKSTEP_WIDTH;\n    group_tid_79641 = get_g",
            "roup_id(0);\n    \n    int32_t phys_tid_72258 = global_tid_79639;\n    __local unsigned char *red_arr_mem_79644;\n    \n    red_arr_mem_79644 = (__local unsigned char *) red_arr_mem_79644_backing_0;\n    \n    __local unsigned char *red_arr_mem_79646;\n    \n    red_arr_mem_79646 = (__local unsigned char *) red_arr_mem_79646_backing_1;\n    \n    __local unsigned char *sync_arr_mem_79648;\n    \n    sync_arr_mem_79648 = (__local unsigned char *) sync_arr_mem_79648_backing_2;\n    \n    int32_t phys_group_id_79650;\n    \n    phys_group_id_79650 = get_group_id(0);\n    for (int32_t i_79651 = 0; i_79651 <\n         sdiv_up32(sext_i64_i32(virt_num_groups_79630) - phys_group_id_79650,\n                   sext_i64_i32(num_groups_72251)); i_79651++) {\n        int32_t virt_group_id_79652 = phys_group_id_79650 + i_79651 *\n                sext_i64_i32(num_groups_72251);\n        int32_t flat_segment_id_79653 = squot32(virt_group_id_79652,\n                                                sext_i64_i32(groups_per_segment_79628));\n        int64_t global_tid_79654 = srem64(sext_i32_i64(virt_group_id_79652) *\n                                          segred_group_sizze_72250 +\n                                          sext_i32_i64(local_tid_79640),\n                                          segred_group_sizze_72250 *\n                                          groups_per_segment_79628);\n        int64_t slice_79655 = n_m_65386;\n        int64_t slice_79656 = m_65377 * slice_79655;\n        int64_t gtid_72255 = squot64(sext_i32_i64(flat_segment_id_79653),\n                                     slice_79655);\n        int64_t remnant_79657 = sext_i32_i64(flat_segment_id_79653) -\n                gtid_72255 * slice_79655;\n        int64_t gtid_72256 = remnant_79657;\n        int64_t remnant_79658 = remnant_79657 - gtid_72256;\n        int64_t gtid_72257;\n        double x_acc_79659;\n        double x_acc_79660;\n        int64_t chunk_sizze_79661 = smin64(elements_per_thread_79629,\n                                         ",
            "  sdiv_up64(q_65380 - global_tid_79654,\n                                                     threads_per_segment_79632));\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_79659 = 0.0;\n            x_acc_79660 = 0.0;\n        }\n        for (int64_t i_79668 = 0; i_79668 < chunk_sizze_79661; i_79668++) {\n            gtid_72257 = global_tid_79654 + threads_per_segment_79632 * i_79668;\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                                                            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 * d",
            "efunc_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_79659;\n                    x_72260 = x_acc_79660;\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_79659 = defunc_1_op_res_72263;\n                        x_acc_79660 = 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_79659;\n            x_72260 = x_acc_79660;\n            ((__local\n              double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640)] =\n                x_72259;\n            ((__local\n              double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640)] =\n                x_72260;\n     ",
            "   }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        int32_t offset_79669;\n        int32_t skip_waves_79670 = 1;\n        double x_79662;\n        double x_79663;\n        double x_79664;\n        double x_79665;\n        \n        offset_79669 = 0;\n        // participating threads read initial accumulator\n        {\n            if (slt32(local_tid_79640,\n                      sext_i64_i32(segred_group_sizze_72250))) {\n                x_79662 = ((__local\n                            double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640 +\n                                                         offset_79669)];\n                x_79663 = ((__local\n                            double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640 +\n                                                         offset_79669)];\n            }\n        }\n        offset_79669 = 1;\n        while (slt32(offset_79669, wave_sizze_79642)) {\n            if (slt32(local_tid_79640 + offset_79669,\n                      sext_i64_i32(segred_group_sizze_72250)) &&\n                ((local_tid_79640 - squot32(local_tid_79640, wave_sizze_79642) *\n                  wave_sizze_79642) & (2 * offset_79669 - 1)) == 0) {\n                // read array element\n                {\n                    x_79664 = ((volatile __local\n                                double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640 +\n                                                             offset_79669)];\n                    x_79665 = ((volatile __local\n                                double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640 +\n                                                             offset_79669)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79666 = x_79662 + x_79664;\n                    double defunc_1_op_res_79667 = x_79663 + x_79665;\n                    \n                    x_79662 = defunc_1_op_res_79666;\n                    ",
            "x_79663 = defunc_1_op_res_79667;\n                }\n                // write result of operation\n                {\n                    ((volatile __local\n                      double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640)] =\n                        x_79662;\n                    ((volatile __local\n                      double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640)] =\n                        x_79663;\n                }\n            }\n            offset_79669 *= 2;\n        }\n        while (slt32(skip_waves_79670,\n                     squot32(sext_i64_i32(segred_group_sizze_72250) +\n                             wave_sizze_79642 - 1, wave_sizze_79642))) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            offset_79669 = skip_waves_79670 * wave_sizze_79642;\n            if (slt32(local_tid_79640 + offset_79669,\n                      sext_i64_i32(segred_group_sizze_72250)) &&\n                ((local_tid_79640 - squot32(local_tid_79640, wave_sizze_79642) *\n                  wave_sizze_79642) == 0 && (squot32(local_tid_79640,\n                                                     wave_sizze_79642) & (2 *\n                                                                          skip_waves_79670 -\n                                                                          1)) ==\n                 0)) {\n                // read array element\n                {\n                    x_79664 = ((__local\n                                double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640 +\n                                                             offset_79669)];\n                    x_79665 = ((__local\n                                double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640 +\n                                                             offset_79669)];\n                }\n                // apply reduction operation\n                {\n                    double defunc_1_op_res_79666 = x_79662 + x_79664;\n                    double defunc_1_op_res_",
            "79667 = x_79663 + x_79665;\n                    \n                    x_79662 = defunc_1_op_res_79666;\n                    x_79663 = defunc_1_op_res_79667;\n                }\n                // write result of operation\n                {\n                    ((__local\n                      double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640)] =\n                        x_79662;\n                    ((__local\n                      double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640)] =\n                        x_79663;\n                }\n            }\n            skip_waves_79670 *= 2;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // first thread saves the result in accumulator\n        {\n            if (sext_i32_i64(local_tid_79640) == (int64_t) 0) {\n                x_acc_79659 = x_79662;\n                x_acc_79660 = x_79663;\n            }\n        }\n        if (groups_per_segment_79628 == (int64_t) 1) {\n            // first thread in group saves final result to memory\n            {\n                if (local_tid_79640 == 0) {\n                    ((__global double *) mem_77836)[gtid_72255 * n_m_65386 +\n                                                    gtid_72256] = x_acc_79659;\n                    ((__global double *) mem_77840)[gtid_72255 * n_m_65386 +\n                                                    gtid_72256] = x_acc_79660;\n                }\n            }\n        } else {\n            int32_t old_counter_79671;\n            \n            // first thread in group saves group result to global memory\n            {\n                if (local_tid_79640 == 0) {\n                    ((__global\n                      double *) segred_tmp_mem_79633)[sext_i32_i64(virt_group_id_79652)] =\n                        x_acc_79659;\n                    ((__global\n                      double *) segred_tmp_mem_79635)[sext_i32_i64(virt_group_id_79652)] =\n                        x_acc_79660;\n                    mem_fence_global();\n                    old_counter_79671 =\n   ",
            "                     atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79637)[sext_i32_i64(srem32(flat_segment_id_79653,\n                                                                                                     10240))],\n                                              (int) 1);\n                    ((__local bool *) sync_arr_mem_79648)[(int64_t) 0] =\n                        old_counter_79671 == groups_per_segment_79628 -\n                        (int64_t) 1;\n                }\n            }\n            barrier(CLK_GLOBAL_MEM_FENCE | CLK_LOCAL_MEM_FENCE);\n            \n            bool is_last_group_79672;\n            \n            is_last_group_79672 = ((__local\n                                    bool *) sync_arr_mem_79648)[(int64_t) 0];\n            if (is_last_group_79672) {\n                if (local_tid_79640 == 0) {\n                    old_counter_79671 =\n                        atomic_add_i32_global(&((volatile __global\n                                                 int *) mainzicounter_mem_79637)[sext_i32_i64(srem32(flat_segment_id_79653,\n                                                                                                     10240))],\n                                              (int) ((int64_t) 0 -\n                                                     groups_per_segment_79628));\n                }\n                // read in the per-group-results\n                {\n                    int64_t read_per_thread_79673 =\n                            sdiv_up64(groups_per_segment_79628,\n                                      segred_group_sizze_72250);\n                    \n                    x_72259 = 0.0;\n                    x_72260 = 0.0;\n                    for (int64_t i_79674 = 0; i_79674 < read_per_thread_79673;\n                         i_79674++) {\n                        int64_t group_res_id_79675 =\n                                sext_i32_i64(local_tid_79640) *\n                ",
            "                read_per_thread_79673 + i_79674;\n                        int64_t index_of_group_res_79676 =\n                                sext_i32_i64(flat_segment_id_79653) *\n                                groups_per_segment_79628 + group_res_id_79675;\n                        \n                        if (slt64(group_res_id_79675,\n                                  groups_per_segment_79628)) {\n                            x_72261 = ((__global\n                                        double *) segred_tmp_mem_79633)[index_of_group_res_79676];\n                            x_72262 = ((__global\n                                        double *) segred_tmp_mem_79635)[index_of_group_res_79676];\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_79644)[sext_i32_i64(local_tid_79640)] =\n                    x_72259;\n                ((__local\n                  double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640)] =\n                    x_72260;\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // reduce the per-group results\n                {\n                    int32_t offset_79677;\n                    int32_t skip_waves_79678 = 1;\n                    double x_79662;\n                    double x_79663;\n                    double x_79664;\n                    double x_79665;\n                    \n                    offset_79677 = 0;\n                    // participating threads read initial accumulator\n                    {\n                        if (slt32(local_tid_79640,\n                                  sext_i64_i32(segred_group_sizze_72250))) {\n      ",
            "                      x_79662 = ((__local\n                                        double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640 +\n                                                                     offset_79677)];\n                            x_79663 = ((__local\n                                        double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640 +\n                                                                     offset_79677)];\n                        }\n                    }\n                    offset_79677 = 1;\n                    while (slt32(offset_79677, wave_sizze_79642)) {\n                        if (slt32(local_tid_79640 + offset_79677,\n                                  sext_i64_i32(segred_group_sizze_72250)) &&\n                            ((local_tid_79640 - squot32(local_tid_79640,\n                                                        wave_sizze_79642) *\n                              wave_sizze_79642) & (2 * offset_79677 - 1)) ==\n                            0) {\n                            // read array element\n                            {\n                                x_79664 = ((volatile __local\n                                            double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640 +\n                                                                         offset_79677)];\n                                x_79665 = ((volatile __local\n                                            double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640 +\n                                                                         offset_79677)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79666 = x_79662 +\n                                       x_79664;\n                                double defunc_1_op_res_79667 = x_79663 +\n                                       x_79665;\n                                \n    ",
            "                            x_79662 = defunc_1_op_res_79666;\n                                x_79663 = defunc_1_op_res_79667;\n                            }\n                            // write result of operation\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640)] =\n                                    x_79662;\n                                ((volatile __local\n                                  double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640)] =\n                                    x_79663;\n                            }\n                        }\n                        offset_79677 *= 2;\n                    }\n                    while (slt32(skip_waves_79678,\n                                 squot32(sext_i64_i32(segred_group_sizze_72250) +\n                                         wave_sizze_79642 - 1,\n                                         wave_sizze_79642))) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                        offset_79677 = skip_waves_79678 * wave_sizze_79642;\n                        if (slt32(local_tid_79640 + offset_79677,\n                                  sext_i64_i32(segred_group_sizze_72250)) &&\n                            ((local_tid_79640 - squot32(local_tid_79640,\n                                                        wave_sizze_79642) *\n                              wave_sizze_79642) == 0 &&\n                             (squot32(local_tid_79640, wave_sizze_79642) & (2 *\n                                                                            skip_waves_79678 -\n                                                                            1)) ==\n                             0)) {\n                            // read array element\n                            {\n                                x_79664 = ((__local\n                                            double *) red_arr_mem_79644)[sext_i32_i64(loca",
            "l_tid_79640 +\n                                                                         offset_79677)];\n                                x_79665 = ((__local\n                                            double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640 +\n                                                                         offset_79677)];\n                            }\n                            // apply reduction operation\n                            {\n                                double defunc_1_op_res_79666 = x_79662 +\n                                       x_79664;\n                                double defunc_1_op_res_79667 = x_79663 +\n                                       x_79665;\n                                \n                                x_79662 = defunc_1_op_res_79666;\n                                x_79663 = defunc_1_op_res_79667;\n                            }\n                            // write result of operation\n                            {\n                                ((__local\n                                  double *) red_arr_mem_79644)[sext_i32_i64(local_tid_79640)] =\n                                    x_79662;\n                                ((__local\n                                  double *) red_arr_mem_79646)[sext_i32_i64(local_tid_79640)] =\n                                    x_79663;\n                            }\n                        }\n                        skip_waves_79678 *= 2;\n                    }\n                    // and back to memory with the final result\n                    {\n                        if (local_tid_79640 == 0) {\n                            ((__global double *) mem_77836)[gtid_72255 *\n                                                            n_m_65386 +\n                                                            gtid_72256] =\n                                x_79662;\n                            ((__global double *) mem_77840)[gtid_72255 *\n                                                   ",
            "         n_m_65386 +\n                                                            gtid_72256] =\n                                x_79663;\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                                       uint red_arr_mem_78580_backing_offset_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_78573,\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    volatile unsigned char *red_arr_mem_78580_backing_0 =\n                           &shared_mem[red_arr_mem_78580_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78575;\n    int32_t local_tid_78576;\n    int64_t group_sizze_78579;\n    int32_t wave_sizze_78578;\n    int32_t group_tid_78577;\n    \n    global_tid_78575 = get_global_id(0);\n    local_tid_78576 = get_local_id(0);\n    group_sizze_78579 = get_local_size(0);\n    wave_sizze_78578 = LOCKSTEP_WIDTH;\n    group",
            "_tid_78577 = get_group_id(0);\n    \n    int32_t phys_tid_68263 = global_tid_78575;\n    __local unsigned char *red_arr_mem_78580;\n    \n    red_arr_mem_78580 = (__local unsigned char *) red_arr_mem_78580_backing_0;\n    \n    int32_t phys_group_id_78582;\n    \n    phys_group_id_78582 = get_group_id(0);\n    for (int32_t i_78583 = 0; i_78583 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_68256,\n                                                  segment_sizze_nonzzero_78573))) -\n                   phys_group_id_78582, sext_i64_i32(num_groups_68257));\n         i_78583++) {\n        int32_t virt_group_id_78584 = phys_group_id_78582 + i_78583 *\n                sext_i64_i32(num_groups_68257);\n        int64_t slice_78585 = n_m_65386;\n        int64_t slice_78586 = m_65377 * slice_78585;\n        int64_t gtid_68260 = squot64(squot64(sext_i32_i64(local_tid_78576),\n                                             segment_sizze_nonzzero_78573) +\n                                     sext_i32_i64(virt_group_id_78584) *\n                                     squot64(segred_group_sizze_68256,\n                                             segment_sizze_nonzzero_78573),\n                                     slice_78585);\n        int64_t remnant_78587 = squot64(sext_i32_i64(local_tid_78576),\n                                        segment_sizze_nonzzero_78573) +\n                sext_i32_i64(virt_group_id_78584) *\n                squot64(segred_group_sizze_68256,\n                        segment_sizze_nonzzero_78573) - gtid_68260 *\n                slice_78585;\n        int64_t gtid_68261 = remnant_78587;\n        int64_t remnant_78588 = remnant_78587 - gtid_68261;\n        int64_t gtid_68262 = srem64(sext_i32_i64(local_tid_78576), 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_78576),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_68256,\n                                                              segment_sizze_nonzzero_78573)))) {\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_78580)[sext_i32_i64(local_tid_78576)] =\n                        w_j_68292;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576)] =\n                    0.0;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENC",
            "E);\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_78589;\n                double x_78590;\n                bool ltid_in_bounds_78592 = slt64(sext_i32_i64(local_tid_78576),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_68256,\n                                                          segment_sizze_nonzzero_78573));\n                int32_t skip_threads_78593;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_78592) {\n                        x_68265 = ((volatile __local\n                                    double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576)];\n                        if ((local_tid_78576 - squot32(local_tid_78576, 32) *\n                             32) == 0) {\n                            x_68264 = x_68265;\n                        }\n                    }\n                }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_78593 = 1;\n                    while (slt32(skip_threads_78593, 32)) {\n                        bool thread_active_78594 = sle32(skip_threads_78593,\n                                                         local_tid_78576 -\n                                                         squot32(local_tid_78576,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_78592;\n                        \n                        if (thread_active_78594) {\n                            // read operands\n                            {\n                                x_68264 = ((volatile __local\n                                            double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576) -\n              ",
            "                                                           sext_i32_i64(skip_threads_78593)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_78595 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78576),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_78576) -\n                                       sext_i32_i64(local_tid_78576 -\n                                       skip_threads_78593));\n                            \n                            if (thread_active_78594 && inactive_78595) {\n                                x_68264 = x_68265;\n                            }\n                            if (thread_active_78594) {\n                                if (!inactive_78595) {\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_78578, skip_threads_78593)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_78594) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576)] =\n                                    x_68264;\n                                x_68265 = x_68264;\n                            }\n                        }\n                        if (sle32(wave_sizze_78578, skip_threads_78593)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threa",
            "ds_78593 *= 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_78576 - squot32(local_tid_78576, 32) * 32) ==\n                        31 && ltid_in_bounds_78592) {\n                        ((volatile __local\n                          double *) red_arr_mem_78580)[sext_i32_i64(squot32(local_tid_78576,\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_78596;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_78576, 32) == 0 &&\n                            ltid_in_bounds_78592) {\n                            x_78590 = ((volatile __local\n                                        double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576)];\n                            if ((local_tid_78576 - squot32(local_tid_78576,\n                                                           32) * 32) == 0) {\n                                x_78589 = x_78590;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_78596 = 1;\n                        while (slt32(skip_threads_78596, 32)) {\n                            bool thread_active_78597 = sle32(skip_threads_78596,\n                                                             local_tid_78576 -\n                                                             squot32(local_tid_78576,\n                                                               ",
            "      32) *\n                                                             32) &&\n                                 (squot32(local_tid_78576, 32) == 0 &&\n                                  ltid_in_bounds_78592);\n                            \n                            if (thread_active_78597) {\n                                // read operands\n                                {\n                                    x_78589 = ((volatile __local\n                                                double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576) -\n                                                                             sext_i32_i64(skip_threads_78596)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_78598 =\n                                     slt64(srem64(sext_i32_i64(local_tid_78576 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_78576 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_78576 -\n                                                         skip_threads_78596) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_78597 && inactive_78598) {\n                                    x_78589 = x_78590;\n                                }\n                                if (thread_active_78597) {\n                                    if (!inactive_78598) {\n                                        double defunc_1_op_res_78591 = x_78589 +\n                                               x_78590;\n                                        \n                                        x_78589 = defunc_1_op_res_78591;\n                                    }\n                                }\n   ",
            "                         }\n                            if (sle32(wave_sizze_78578, skip_threads_78596)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_78597) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576)] =\n                                        x_78589;\n                                    x_78590 = x_78589;\n                                }\n                            }\n                            if (sle32(wave_sizze_78578, skip_threads_78596)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_78596 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_78599 = squot32(local_tid_78576, 32) == 0 ||\n                     !ltid_in_bounds_78592;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_78599) {\n                            x_68265 = x_68264;\n                            x_68264 = ((__local\n                                        double *) red_arr_mem_78580)[sext_i32_i64(squot32(local_tid_78576,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78600 =\n                             slt64(srem64(sext_i32_i64(local_tid_78576),\n                                          q_65380)",
            ",\n                                   sext_i32_i64(local_tid_78576) -\n                                   sext_i32_i64(squot32(local_tid_78576, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_78599) {\n                            if (inactive_78600) {\n                                x_68264 = x_68265;\n                            }\n                        }\n                        if (!no_carry_in_78599) {\n                            if (!inactive_78600) {\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_78599) {\n                            ((__local\n                              double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576)] =\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_78576, 32) == 0 &&\n                        ltid_in_bounds_78592) {\n                        ((__local\n                          double *) red_arr_mem_78580)[sext_i32_i64(local_tid_78576)] =\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_78584) *\n                      squot64(segred_group_sizze_68256,\n                              segment_sizze_nonzzero_78573) +\n                      sext_i32_i64(local_tid_78576), m_65377 ",
            "* n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_78576),\n                      squot64(segred_group_sizze_68256,\n                              segment_sizze_nonzzero_78573))) {\n                double tmp_78601;\n                \n                tmp_78601 = ((__local\n                              double *) red_arr_mem_78580)[(sext_i32_i64(local_tid_78576) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78573 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77213)[squot64(sext_i32_i64(virt_group_id_78584) *\n                                               squot64(segred_group_sizze_68256,\n                                                       segment_sizze_nonzzero_78573) +\n                                               sext_i32_i64(local_tid_78576),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78584) *\n                                        squot64(segred_group_sizze_68256,\n                                                segment_sizze_nonzzero_78573) +\n                                        sext_i32_i64(local_tid_78576) -\n                                        squot64(sext_i32_i64(virt_group_id_78584) *\n                                                squot64(segred_group_sizze_68256,\n                                                        segment_sizze_nonzzero_78573) +\n                                                sext_i32_i64(local_tid_78576),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_78601;\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_s",
            "mall_68313(__global int *global_failure,\n                                       uint red_arr_mem_78662_backing_offset_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_78655,\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    volatile unsigned char *red_arr_mem_78662_backing_0 =\n                           &shared_mem[red_arr_mem_78662_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78657;\n    int32_t local_tid_78658;\n    int64_t group_sizze_78661;\n    int32_t wave_sizze_78660;\n    int32_t group_tid_78659;\n    \n    global_tid_78657 = get_global_id(0);\n    local_tid_78658 = get_local_id(0);\n    group_sizze_78661 = get_local_size(0);\n    wave_sizze_78660 = LOCKSTEP_WIDTH;\n    group_tid_78659 = get_group_id(0);\n    \n    int32_t phys_tid_68313 = global_tid_78657;\n    __local unsigned char *red_arr_mem_78662;\n    \n    red_arr_mem_78662 = (__local unsigned char *) red_arr_mem_78662_backing_0;\n    \n    int32_t phys_group",
            "_id_78664;\n    \n    phys_group_id_78664 = get_group_id(0);\n    for (int32_t i_78665 = 0; i_78665 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_68306,\n                                                  segment_sizze_nonzzero_78655))) -\n                   phys_group_id_78664, sext_i64_i32(num_groups_68307));\n         i_78665++) {\n        int32_t virt_group_id_78666 = phys_group_id_78664 + i_78665 *\n                sext_i64_i32(num_groups_68307);\n        int64_t slice_78667 = n_m_65386;\n        int64_t slice_78668 = m_65377 * slice_78667;\n        int64_t gtid_68310 = squot64(squot64(sext_i32_i64(local_tid_78658),\n                                             segment_sizze_nonzzero_78655) +\n                                     sext_i32_i64(virt_group_id_78666) *\n                                     squot64(segred_group_sizze_68306,\n                                             segment_sizze_nonzzero_78655),\n                                     slice_78667);\n        int64_t remnant_78669 = squot64(sext_i32_i64(local_tid_78658),\n                                        segment_sizze_nonzzero_78655) +\n                sext_i32_i64(virt_group_id_78666) *\n                squot64(segred_group_sizze_68306,\n                        segment_sizze_nonzzero_78655) - gtid_68310 *\n                slice_78667;\n        int64_t gtid_68311 = remnant_78669;\n        int64_t remnant_78670 = remnant_78669 - gtid_68311;\n        int64_t gtid_68312 = srem64(sext_i32_i64(local_tid_78658), 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_78658),\n                                                      q_6538",
            "0 *\n                                                      squot64(segred_group_sizze_68306,\n                                                              segment_sizze_nonzzero_78655)))) {\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_r",
            "es_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_78662)[sext_i32_i64(local_tid_78658)] =\n                        defunc_9_fit_fun_res_68350;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658)] =\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_78671;\n                double x_78672;\n                bool ltid_in_bounds_78674 = slt64(sext_i32_i64(local_tid_78658),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_68306,\n                                                          segment_sizze_nonzzero_78655));\n                int32_t skip_threads_78675;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_78674) {\n                        x_68315 = ((volatile __local\n                                    double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658)];\n                        if ((local_tid_78658 - squot32(local_tid_78658, 32) *\n                             32) == 0) {\n                            x_68314 = x_68315;\n                        }\n                    }\n          ",
            "      }\n                // in-block scan (hopefully no barriers needed)\n                {\n                    skip_threads_78675 = 1;\n                    while (slt32(skip_threads_78675, 32)) {\n                        bool thread_active_78676 = sle32(skip_threads_78675,\n                                                         local_tid_78658 -\n                                                         squot32(local_tid_78658,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_78674;\n                        \n                        if (thread_active_78676) {\n                            // read operands\n                            {\n                                x_68314 = ((volatile __local\n                                            double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658) -\n                                                                         sext_i32_i64(skip_threads_78675)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_78677 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78658),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_78658) -\n                                       sext_i32_i64(local_tid_78658 -\n                                       skip_threads_78675));\n                            \n                            if (thread_active_78676 && inactive_78677) {\n                                x_68314 = x_68315;\n                            }\n                            if (thread_active_78676) {\n                                if (!inactive_78677) {\n                                    double defunc_1_op_res_68316 = x_68314 +\n                                           x_68315;\n                                    \n                                    x_68314 = d",
            "efunc_1_op_res_68316;\n                                }\n                            }\n                        }\n                        if (sle32(wave_sizze_78660, skip_threads_78675)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_78676) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658)] =\n                                    x_68314;\n                                x_68315 = x_68314;\n                            }\n                        }\n                        if (sle32(wave_sizze_78660, skip_threads_78675)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_78675 *= 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_78658 - squot32(local_tid_78658, 32) * 32) ==\n                        31 && ltid_in_bounds_78674) {\n                        ((volatile __local\n                          double *) red_arr_mem_78662)[sext_i32_i64(squot32(local_tid_78658,\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_78678;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_78658, 32) == 0 &&\n                            ltid_in_bounds_78674) {\n                            x_78672 = ((volatile __local\n      ",
            "                                  double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658)];\n                            if ((local_tid_78658 - squot32(local_tid_78658,\n                                                           32) * 32) == 0) {\n                                x_78671 = x_78672;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_78678 = 1;\n                        while (slt32(skip_threads_78678, 32)) {\n                            bool thread_active_78679 = sle32(skip_threads_78678,\n                                                             local_tid_78658 -\n                                                             squot32(local_tid_78658,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_78658, 32) == 0 &&\n                                  ltid_in_bounds_78674);\n                            \n                            if (thread_active_78679) {\n                                // read operands\n                                {\n                                    x_78671 = ((volatile __local\n                                                double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658) -\n                                                                             sext_i32_i64(skip_threads_78678)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_78680 =\n                                     slt64(srem64(sext_i32_i64(local_tid_78658 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_78658 * 32 +\n                    ",
            "                       32 - 1) -\n                                           sext_i32_i64((local_tid_78658 -\n                                                         skip_threads_78678) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_78679 && inactive_78680) {\n                                    x_78671 = x_78672;\n                                }\n                                if (thread_active_78679) {\n                                    if (!inactive_78680) {\n                                        double defunc_1_op_res_78673 = x_78671 +\n                                               x_78672;\n                                        \n                                        x_78671 = defunc_1_op_res_78673;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_78660, skip_threads_78678)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_78679) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658)] =\n                                        x_78671;\n                                    x_78672 = x_78671;\n                                }\n                            }\n                            if (sle32(wave_sizze_78660, skip_threads_78678)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_78678 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_78681 = squot32(local_tid_78658, 32) == 0 ||\n                     !l",
            "tid_in_bounds_78674;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_78681) {\n                            x_68315 = x_68314;\n                            x_68314 = ((__local\n                                        double *) red_arr_mem_78662)[sext_i32_i64(squot32(local_tid_78658,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78682 =\n                             slt64(srem64(sext_i32_i64(local_tid_78658),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_78658) -\n                                   sext_i32_i64(squot32(local_tid_78658, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_78681) {\n                            if (inactive_78682) {\n                                x_68314 = x_68315;\n                            }\n                        }\n                        if (!no_carry_in_78681) {\n                            if (!inactive_78682) {\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_78681) {\n                            ((__local\n                              double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658)] =\n                                x_68314;\n    ",
            "                    }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // restore correct values for first block\n                {\n                    if (squot32(local_tid_78658, 32) == 0 &&\n                        ltid_in_bounds_78674) {\n                        ((__local\n                          double *) red_arr_mem_78662)[sext_i32_i64(local_tid_78658)] =\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_78666) *\n                      squot64(segred_group_sizze_68306,\n                              segment_sizze_nonzzero_78655) +\n                      sext_i32_i64(local_tid_78658), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_78658),\n                      squot64(segred_group_sizze_68306,\n                              segment_sizze_nonzzero_78655))) {\n                double tmp_78683;\n                \n                tmp_78683 = ((__local\n                              double *) red_arr_mem_78662)[(sext_i32_i64(local_tid_78658) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78655 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77223)[squot64(sext_i32_i64(virt_group_id_78666) *\n                                               squot64(segred_group_sizze_68306,\n                                                       segment_sizze_nonzzero_78655) +\n                                               sext_i32_i64(local_tid_78658),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78666) *\n",
            "                                        squot64(segred_group_sizze_68306,\n                                                segment_sizze_nonzzero_78655) +\n                                        sext_i32_i64(local_tid_78658) -\n                                        squot64(sext_i32_i64(virt_group_id_78666) *\n                                                squot64(segred_group_sizze_68306,\n                                                        segment_sizze_nonzzero_78655) +\n                                                sext_i32_i64(local_tid_78658),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_78683;\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                                       uint red_arr_mem_78995_backing_offset_0,\n                                       uint red_arr_mem_78993_backing_offset_1,\n                                       uint red_arr_mem_78991_backing_offset_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_78984,\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{\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    volatile unsigned char *red_arr_mem_78995_backing_2 =\n                           &shared_mem[red_arr_mem_78995_backing_offset_0];\n    volatile unsigned char *red_arr_mem_78993_backing_1 =\n                           &shared_mem[red_arr_mem_78993_backing_offset_1];\n    volatile unsigned char *red_arr_mem_78991_backing_0 =\n                           &shared_mem[red_arr_mem_78991_backing_offset_2];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78986;\n    int32_t local_tid_78987;\n    int64_t group_sizze_78990;\n    int32_t wave_sizze_78989;\n    int32_t group_tid_78988;\n    \n    global_tid_78986 = get_global_id(0);\n    local_tid_78987 = get_local_id(0);\n    group_sizze_78990 = get_local_size(0);\n    wave_sizze_78989 = LOCKSTEP_WIDTH;\n    group_tid_78988 = get_group_id(0);\n    \n    int32_t phys_tid_70086 = global_tid_78986;\n    __local unsigned char *red_arr_mem_78991;\n    \n    red_arr_mem_78991 = (__local unsigned char *) red_arr_mem_78991_backing_0;\n    \n    __local unsigned char *red_arr_mem_78993;\n    \n    red_arr_mem_78993 = (__local unsigned char *) red_arr_mem_78993_backing_1;\n    \n    __local unsigned char *red_arr_mem_78995;\n    \n    red_arr_mem_78995 = (__local unsigned char *) red_arr_mem_78995_backing_2;\n    \n    int32_t phys_group_id_78997;\n    \n    phys_group_id_78997 = get_group_id(0);\n    for (int32_t i_78998 = 0; i_78998 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_70077,\n                                                  segment_sizze_nonzzero_78984))) -\n                   phys_group_id_78997, sext_i64_i32(num_groups_70078));\n         i_78998++)",
            " {\n        int32_t virt_group_id_78999 = phys_group_id_78997 + i_78998 *\n                sext_i64_i32(num_groups_70078);\n        int64_t slice_79000 = n_m_65386;\n        int64_t slice_79001 = m_65377 * slice_79000;\n        int64_t gtid_70083 = squot64(squot64(sext_i32_i64(local_tid_78987),\n                                             segment_sizze_nonzzero_78984) +\n                                     sext_i32_i64(virt_group_id_78999) *\n                                     squot64(segred_group_sizze_70077,\n                                             segment_sizze_nonzzero_78984),\n                                     slice_79000);\n        int64_t remnant_79002 = squot64(sext_i32_i64(local_tid_78987),\n                                        segment_sizze_nonzzero_78984) +\n                sext_i32_i64(virt_group_id_78999) *\n                squot64(segred_group_sizze_70077,\n                        segment_sizze_nonzzero_78984) - gtid_70083 *\n                slice_79000;\n        int64_t gtid_70084 = remnant_79002;\n        int64_t remnant_79003 = remnant_79002 - gtid_70084;\n        int64_t gtid_70085 = srem64(sext_i32_i64(local_tid_78987), 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_78987),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_70077,\n                                                              segment_sizze_nonzzero_78984)))) {\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_a",
            "dd_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_78991)[sext_i32_i64(local_tid_78987)] =\n                        w_j_70121;\n                    ((__local\n                      double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987)] =\n                        xw_j_70122;\n                    ((__local\n                      double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)] =\n                        x2w_j_70123;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)] =\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_79004;\n                double x_79005;\n                double x_79006;\n                double x_79007;\n                double x_79008;\n                double x_79009;\n                bool ltid_in_bounds_79013 = slt64(sext_i32_i64(local_tid_78987),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_70077,\n                                                          segment_sizze_nonzzero_78984));\n                int32_t skip_threads_79014;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_79013) {\n                        x_70090 = ((volatile __local\n                                    double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987)];\n                        x_70091 = ((volatile __local\n                                    double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987)];\n                        x_70092 = ((volatile __local\n                                    double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)];\n                        if ((local_tid_78987 - squot32(local_tid_78987, 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_79014 = 1;\n                    while (slt32(skip_threads_79014,",
            " 32)) {\n                        bool thread_active_79015 = sle32(skip_threads_79014,\n                                                         local_tid_78987 -\n                                                         squot32(local_tid_78987,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_79013;\n                        \n                        if (thread_active_79015) {\n                            // read operands\n                            {\n                                x_70087 = ((volatile __local\n                                            double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987) -\n                                                                         sext_i32_i64(skip_threads_79014)];\n                                x_70088 = ((volatile __local\n                                            double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987) -\n                                                                         sext_i32_i64(skip_threads_79014)];\n                                x_70089 = ((volatile __local\n                                            double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987) -\n                                                                         sext_i32_i64(skip_threads_79014)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79016 =\n                                 slt64(srem64(sext_i32_i64(local_tid_78987),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_78987) -\n                                       sext_i32_i64(local_tid_78987 -\n                                       skip_threads_79014));\n                            \n                            if (thread_active_79015 && inactive_79016) {\n                                x_70087 = ",
            "x_70090;\n                                x_70088 = x_70091;\n                                x_70089 = x_70092;\n                            }\n                            if (thread_active_79015) {\n                                if (!inactive_79016) {\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_78989, skip_threads_79014)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79015) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987)] =\n                                    x_70087;\n                                x_70090 = x_70087;\n                                ((volatile __local\n                                  double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987)] =\n                                    x_70088;\n                                x_70091 = x_70088;\n                                ((volatile __local\n                                  double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)] =\n                                    x_70089;\n                                x_70092 = x_70089;\n               ",
            "             }\n                        }\n                        if (sle32(wave_sizze_78989, skip_threads_79014)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79014 *= 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_78987 - squot32(local_tid_78987, 32) * 32) ==\n                        31 && ltid_in_bounds_79013) {\n                        ((volatile __local\n                          double *) red_arr_mem_78991)[sext_i32_i64(squot32(local_tid_78987,\n                                                                            32))] =\n                            x_70087;\n                        ((volatile __local\n                          double *) red_arr_mem_78993)[sext_i32_i64(squot32(local_tid_78987,\n                                                                            32))] =\n                            x_70088;\n                        ((volatile __local\n                          double *) red_arr_mem_78995)[sext_i32_i64(squot32(local_tid_78987,\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_79017;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_78987, 32) == 0 &&\n                            ltid_in_bounds_79013) {\n                            x_79007 = ((volatile __local\n                                        double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987)];\n                            x_79008 = ((volat",
            "ile __local\n                                        double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987)];\n                            x_79009 = ((volatile __local\n                                        double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)];\n                            if ((local_tid_78987 - squot32(local_tid_78987,\n                                                           32) * 32) == 0) {\n                                x_79004 = x_79007;\n                                x_79005 = x_79008;\n                                x_79006 = x_79009;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_79017 = 1;\n                        while (slt32(skip_threads_79017, 32)) {\n                            bool thread_active_79018 = sle32(skip_threads_79017,\n                                                             local_tid_78987 -\n                                                             squot32(local_tid_78987,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_78987, 32) == 0 &&\n                                  ltid_in_bounds_79013);\n                            \n                            if (thread_active_79018) {\n                                // read operands\n                                {\n                                    x_79004 = ((volatile __local\n                                                double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987) -\n                                                                             sext_i32_i64(skip_threads_79017)];\n                                    x_79005 = ((volatile __local\n                                                double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987) -",
            "\n                                                                             sext_i32_i64(skip_threads_79017)];\n                                    x_79006 = ((volatile __local\n                                                double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987) -\n                                                                             sext_i32_i64(skip_threads_79017)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_79019 =\n                                     slt64(srem64(sext_i32_i64(local_tid_78987 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_78987 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_78987 -\n                                                         skip_threads_79017) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_79018 && inactive_79019) {\n                                    x_79004 = x_79007;\n                                    x_79005 = x_79008;\n                                    x_79006 = x_79009;\n                                }\n                                if (thread_active_79018) {\n                                    if (!inactive_79019) {\n                                        double defunc_1_op_res_79010 = x_79004 +\n                                               x_79007;\n                                        double defunc_1_op_res_79011 = x_79005 +\n                                               x_79008;\n                                        double defunc_1_op_res_79012 = x_79006 +\n                                               x_79009;\n                                        \n                          ",
            "              x_79004 = defunc_1_op_res_79010;\n                                        x_79005 = defunc_1_op_res_79011;\n                                        x_79006 = defunc_1_op_res_79012;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_78989, skip_threads_79017)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_79018) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987)] =\n                                        x_79004;\n                                    x_79007 = x_79004;\n                                    ((volatile __local\n                                      double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987)] =\n                                        x_79005;\n                                    x_79008 = x_79005;\n                                    ((volatile __local\n                                      double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)] =\n                                        x_79006;\n                                    x_79009 = x_79006;\n                                }\n                            }\n                            if (sle32(wave_sizze_78989, skip_threads_79017)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_79017 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_79020 = squot32(local_tid_78987, 32) == 0 ||\n                     !ltid_in_bounds_79013;\n                \n                // carry-in for every block except the first\n   ",
            "             {\n                    // read operands\n                    {\n                        if (!no_carry_in_79020) {\n                            x_70090 = x_70087;\n                            x_70091 = x_70088;\n                            x_70092 = x_70089;\n                            x_70087 = ((__local\n                                        double *) red_arr_mem_78991)[sext_i32_i64(squot32(local_tid_78987,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_70088 = ((__local\n                                        double *) red_arr_mem_78993)[sext_i32_i64(squot32(local_tid_78987,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_70089 = ((__local\n                                        double *) red_arr_mem_78995)[sext_i32_i64(squot32(local_tid_78987,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79021 =\n                             slt64(srem64(sext_i32_i64(local_tid_78987),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_78987) -\n                                   sext_i32_i64(squot32(local_tid_78987, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_79020) {\n                            if (inactive_79021) {\n                                x_70087 = x_70090;\n                                x_70088 = x_70091;\n                              ",
            "  x_70089 = x_70092;\n                            }\n                        }\n                        if (!no_carry_in_79020) {\n                            if (!inactive_79021) {\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_79020) {\n                            ((__local\n                              double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987)] =\n                                x_70087;\n                            ((__local\n                              double *) red_arr_mem_78993)[sext_i32_i64(local_tid_78987)] =\n                                x_70088;\n                            ((__local\n                              double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)] =\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_78987, 32) == 0 &&\n                        ltid_in_bounds_79013) {\n                        ((__local\n                          double *) red_arr_mem_78991)[sext_i32_i64(local_tid_78987)] =\n                            x_70090;\n                        ((__local\n                          double *) ",
            "red_arr_mem_78993)[sext_i32_i64(local_tid_78987)] =\n                            x_70091;\n                        ((__local\n                          double *) red_arr_mem_78995)[sext_i32_i64(local_tid_78987)] =\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_78999) *\n                      squot64(segred_group_sizze_70077,\n                              segment_sizze_nonzzero_78984) +\n                      sext_i32_i64(local_tid_78987), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_78987),\n                      squot64(segred_group_sizze_70077,\n                              segment_sizze_nonzzero_78984))) {\n                double tmp_79022;\n                \n                tmp_79022 = ((__local\n                              double *) red_arr_mem_78991)[(sext_i32_i64(local_tid_78987) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78984 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77478)[squot64(sext_i32_i64(virt_group_id_78999) *\n                                               squot64(segred_group_sizze_70077,\n                                                       segment_sizze_nonzzero_78984) +\n                                               sext_i32_i64(local_tid_78987),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78999) *\n                                        squot64(segred_group_sizze_70077,\n                                                segment_sizze_nonzzero_78984) +\n                                        sext_i32_i",
            "64(local_tid_78987) -\n                                        squot64(sext_i32_i64(virt_group_id_78999) *\n                                                squot64(segred_group_sizze_70077,\n                                                        segment_sizze_nonzzero_78984) +\n                                                sext_i32_i64(local_tid_78987),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79022;\n                \n                double tmp_79023;\n                \n                tmp_79023 = ((__local\n                              double *) red_arr_mem_78993)[(sext_i32_i64(local_tid_78987) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78984 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77482)[squot64(sext_i32_i64(virt_group_id_78999) *\n                                               squot64(segred_group_sizze_70077,\n                                                       segment_sizze_nonzzero_78984) +\n                                               sext_i32_i64(local_tid_78987),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78999) *\n                                        squot64(segred_group_sizze_70077,\n                                                segment_sizze_nonzzero_78984) +\n                                        sext_i32_i64(local_tid_78987) -\n                                        squot64(sext_i32_i64(virt_group_id_78999) *\n                                                squot64(segred_group_sizze_70077,\n                                                        segment_sizze_nonzzero_78984) +\n                                                sext_i32_i64(local_tid_78987),\n                                        ",
            "        n_m_65386) * n_m_65386)] =\n                    tmp_79023;\n                \n                double tmp_79024;\n                \n                tmp_79024 = ((__local\n                              double *) red_arr_mem_78995)[(sext_i32_i64(local_tid_78987) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_78984 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77486)[squot64(sext_i32_i64(virt_group_id_78999) *\n                                               squot64(segred_group_sizze_70077,\n                                                       segment_sizze_nonzzero_78984) +\n                                               sext_i32_i64(local_tid_78987),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_78999) *\n                                        squot64(segred_group_sizze_70077,\n                                                segment_sizze_nonzzero_78984) +\n                                        sext_i32_i64(local_tid_78987) -\n                                        squot64(sext_i32_i64(virt_group_id_78999) *\n                                                squot64(segred_group_sizze_70077,\n                                                        segment_sizze_nonzzero_78984) +\n                                                sext_i32_i64(local_tid_78987),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79024;\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_70077\n}\n__kernel void mainzisegred_small_70156(__global int *global_failure,\n                                       uint red_arr_mem_79103_bac",
            "king_offset_0,\n                                       uint red_arr_mem_79101_backing_offset_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_79094,\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    volatile unsigned char *red_arr_mem_79103_backing_1 =\n                           &shared_mem[red_arr_mem_79103_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79101_backing_0 =\n                           &shared_mem[red_arr_mem_79101_backing_offset_1];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79096;\n    int32_t local_tid_79097;\n    int64_t group_sizze_79100;\n    int32_t wave_sizze_79099;\n    int32_t group_tid_79098;\n    \n    global_tid_79096 = get_global_id(0);\n    local_tid_79097 = get_local_id(0);\n",
            "    group_sizze_79100 = get_local_size(0);\n    wave_sizze_79099 = LOCKSTEP_WIDTH;\n    group_tid_79098 = get_group_id(0);\n    \n    int32_t phys_tid_70156 = global_tid_79096;\n    __local unsigned char *red_arr_mem_79101;\n    \n    red_arr_mem_79101 = (__local unsigned char *) red_arr_mem_79101_backing_0;\n    \n    __local unsigned char *red_arr_mem_79103;\n    \n    red_arr_mem_79103 = (__local unsigned char *) red_arr_mem_79103_backing_1;\n    \n    int32_t phys_group_id_79105;\n    \n    phys_group_id_79105 = get_group_id(0);\n    for (int32_t i_79106 = 0; i_79106 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_70148,\n                                                  segment_sizze_nonzzero_79094))) -\n                   phys_group_id_79105, sext_i64_i32(num_groups_70149));\n         i_79106++) {\n        int32_t virt_group_id_79107 = phys_group_id_79105 + i_79106 *\n                sext_i64_i32(num_groups_70149);\n        int64_t slice_79108 = n_m_65386;\n        int64_t slice_79109 = m_65377 * slice_79108;\n        int64_t gtid_70153 = squot64(squot64(sext_i32_i64(local_tid_79097),\n                                             segment_sizze_nonzzero_79094) +\n                                     sext_i32_i64(virt_group_id_79107) *\n                                     squot64(segred_group_sizze_70148,\n                                             segment_sizze_nonzzero_79094),\n                                     slice_79108);\n        int64_t remnant_79110 = squot64(sext_i32_i64(local_tid_79097),\n                                        segment_sizze_nonzzero_79094) +\n                sext_i32_i64(virt_group_id_79107) *\n                squot64(segred_group_sizze_70148,\n                        segment_sizze_nonzzero_79094) - gtid_70153 *\n                slice_79108;\n        int64_t gtid_70154 = remnant_79110;\n        int64_t remnant_79111 = remnant_79110 - gtid_70154;\n        int64_t gtid_70155 = srem64",
            "(sext_i32_i64(local_tid_79097), 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_79097),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_70148,\n                                                              segment_sizze_nonzzero_79094)))) {\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 reduc",
            "ed\n                {\n                    ((__local\n                      double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)] =\n                        defunc_9_fit_fun_res_70203;\n                    ((__local\n                      double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)] =\n                        defunc_9_slope_fun_res_70207;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)] =\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_79112;\n                double x_79113;\n                double x_79114;\n                double x_79115;\n                bool ltid_in_bounds_79118 = slt64(sext_i32_i64(local_tid_79097),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_70148,\n                                                          segment_sizze_nonzzero_79094));\n                int32_t skip_threads_79119;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_79118) {\n                        x_70159 = ((volatile __local\n                                    double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)];\n                        x_70160 = ((volatile __local\n                                    double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)];\n                        if ((local_tid_79097 - squot32(local_tid_79097, 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_79119 = 1;\n                    while (slt32(skip_threads_79119, 32)) {\n                        bool thread_active_79120 = sle32(skip_threads_79119,\n                                                         local_tid_79097 -\n                                                         squot32(local_tid_79097,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_79118;\n                        \n                        if (thread_active_79120) {\n                            // read operands\n                            {\n                                x_70157 = ((volatile __local\n                                            double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097) -\n                                                                         sext_i32_i64(skip_threads_79119)];\n                                x_70158 = ((volatile __local\n                                            double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097) -\n                                                                         sext_i32_i64(skip_threads_79119)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79121 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79097),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_79097) -\n                                       sext_i32_i64(local_tid_79097 -\n                                       skip_threads_79119));\n                            \n                            if (thread_active_79120 ",
            "&& inactive_79121) {\n                                x_70157 = x_70159;\n                                x_70158 = x_70160;\n                            }\n                            if (thread_active_79120) {\n                                if (!inactive_79121) {\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_79099, skip_threads_79119)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79120) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)] =\n                                    x_70157;\n                                x_70159 = x_70157;\n                                ((volatile __local\n                                  double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)] =\n                                    x_70158;\n                                x_70160 = x_70158;\n                            }\n                        }\n                        if (sle32(wave_sizze_79099, skip_threads_79119)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79119 *= 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_79097 - squot32(local_tid_79097, 32) * 32) ==\n                        31 && ltid_in_bounds_79118) {\n                        ((volatile __local\n                          double *) red_arr_mem_79101)[sext_i32_i64(squot32(local_tid_79097,\n                                                                            32))] =\n                            x_70157;\n                        ((volatile __local\n                          double *) red_arr_mem_79103)[sext_i32_i64(squot32(local_tid_79097,\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_79122;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_79097, 32) == 0 &&\n                            ltid_in_bounds_79118) {\n                            x_79114 = ((volatile __local\n                                        double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)];\n                            x_79115 = ((volatile __local\n                                        double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)];\n                            if ((local_tid_79097 - squot32(local_tid_79097,\n                                                           32) * 32) == 0) {\n                                x_79112 = x_79114;\n                                x_79113 = x_79115;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_79122 = 1;\n                        while (slt32(skip_threads_79122, 32)) {\n                            bool threa",
            "d_active_79123 = sle32(skip_threads_79122,\n                                                             local_tid_79097 -\n                                                             squot32(local_tid_79097,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_79097, 32) == 0 &&\n                                  ltid_in_bounds_79118);\n                            \n                            if (thread_active_79123) {\n                                // read operands\n                                {\n                                    x_79112 = ((volatile __local\n                                                double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097) -\n                                                                             sext_i32_i64(skip_threads_79122)];\n                                    x_79113 = ((volatile __local\n                                                double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097) -\n                                                                             sext_i32_i64(skip_threads_79122)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_79124 =\n                                     slt64(srem64(sext_i32_i64(local_tid_79097 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_79097 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_79097 -\n                                                         skip_threads_79122) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_791",
            "23 && inactive_79124) {\n                                    x_79112 = x_79114;\n                                    x_79113 = x_79115;\n                                }\n                                if (thread_active_79123) {\n                                    if (!inactive_79124) {\n                                        double defunc_1_op_res_79116 = x_79112 +\n                                               x_79114;\n                                        double defunc_1_op_res_79117 = x_79113 +\n                                               x_79115;\n                                        \n                                        x_79112 = defunc_1_op_res_79116;\n                                        x_79113 = defunc_1_op_res_79117;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_79099, skip_threads_79122)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_79123) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)] =\n                                        x_79112;\n                                    x_79114 = x_79112;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)] =\n                                        x_79113;\n                                    x_79115 = x_79113;\n                                }\n                            }\n                            if (sle32(wave_sizze_79099, skip_threads_79122)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_79122 *= 2;\n                        }\n           ",
            "         }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_79125 = squot32(local_tid_79097, 32) == 0 ||\n                     !ltid_in_bounds_79118;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_79125) {\n                            x_70159 = x_70157;\n                            x_70160 = x_70158;\n                            x_70157 = ((__local\n                                        double *) red_arr_mem_79101)[sext_i32_i64(squot32(local_tid_79097,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_70158 = ((__local\n                                        double *) red_arr_mem_79103)[sext_i32_i64(squot32(local_tid_79097,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79126 =\n                             slt64(srem64(sext_i32_i64(local_tid_79097),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_79097) -\n                                   sext_i32_i64(squot32(local_tid_79097, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_79125) {\n                            if (inactive_79126) {\n                                x_70157 = x_70159;\n                                x_70158 = x_70160;\n                            }\n                        }\n                        if (!no_carry_in_79125) {\n           ",
            "                 if (!inactive_79126) {\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_79125) {\n                            ((__local\n                              double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)] =\n                                x_70157;\n                            ((__local\n                              double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)] =\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_79097, 32) == 0 &&\n                        ltid_in_bounds_79118) {\n                        ((__local\n                          double *) red_arr_mem_79101)[sext_i32_i64(local_tid_79097)] =\n                            x_70159;\n                        ((__local\n                          double *) red_arr_mem_79103)[sext_i32_i64(local_tid_79097)] =\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_79107) *\n                      squot64(segred_group_sizze_70148,\n                              segment_sizze_nonzzero_79094) +\n                      sext_i32_",
            "i64(local_tid_79097), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_79097),\n                      squot64(segred_group_sizze_70148,\n                              segment_sizze_nonzzero_79094))) {\n                double tmp_79127;\n                \n                tmp_79127 = ((__local\n                              double *) red_arr_mem_79101)[(sext_i32_i64(local_tid_79097) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79094 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77504)[squot64(sext_i32_i64(virt_group_id_79107) *\n                                               squot64(segred_group_sizze_70148,\n                                                       segment_sizze_nonzzero_79094) +\n                                               sext_i32_i64(local_tid_79097),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79107) *\n                                        squot64(segred_group_sizze_70148,\n                                                segment_sizze_nonzzero_79094) +\n                                        sext_i32_i64(local_tid_79097) -\n                                        squot64(sext_i32_i64(virt_group_id_79107) *\n                                                squot64(segred_group_sizze_70148,\n                                                        segment_sizze_nonzzero_79094) +\n                                                sext_i32_i64(local_tid_79097),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79127;\n                \n                double tmp_79128;\n                \n                tmp_79128 = ((__local\n                              double *) red_arr_mem_79103)[(sext_i32_i64(local_tid_7909",
            "7) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79094 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77508)[squot64(sext_i32_i64(virt_group_id_79107) *\n                                               squot64(segred_group_sizze_70148,\n                                                       segment_sizze_nonzzero_79094) +\n                                               sext_i32_i64(local_tid_79097),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79107) *\n                                        squot64(segred_group_sizze_70148,\n                                                segment_sizze_nonzzero_79094) +\n                                        sext_i32_i64(local_tid_79097) -\n                                        squot64(sext_i32_i64(virt_group_id_79107) *\n                                                squot64(segred_group_sizze_70148,\n                                                        segment_sizze_nonzzero_79094) +\n                                                sext_i32_i64(local_tid_79097),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79128;\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                                       uint red_arr_mem_79470_backing_offset_0,\n                                       uint red_arr_mem_79468_backing_offset_1,\n                                       uint red_arr_mem_79466_backing_offset_2,\n                                       uint red_arr_mem_79464_backing_offset_3,\n    ",
            "                                   uint red_arr_mem_79462_backing_offset_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_79455,\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    volatile unsigned char *red_arr_mem_79470_backing_4 =\n                           &shared_mem[red_arr_mem_79470_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79468_backing_3 =\n                           &shared_mem[red_arr_mem_79468_backing_offset_1];\n    volatile unsigned char *red_arr_mem_79466_backing_2 =\n                           &shared_mem[red_arr_mem_79466_backing_offset_2];\n    volatile unsigned char *red_arr_mem_79464_backing_1 =\n                           &shared_mem[red_arr_mem_79464_backing_offset_3];\n    volatile unsigned char *red_arr_mem_79462_backing_0 =\n                           &shared_mem[red_arr_mem_79462_",
            "backing_offset_4];\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_72159 = global_tid_79457;\n    __local unsigned char *red_arr_mem_79462;\n    \n    red_arr_mem_79462 = (__local unsigned char *) red_arr_mem_79462_backing_0;\n    \n    __local unsigned char *red_arr_mem_79464;\n    \n    red_arr_mem_79464 = (__local unsigned char *) red_arr_mem_79464_backing_1;\n    \n    __local unsigned char *red_arr_mem_79466;\n    \n    red_arr_mem_79466 = (__local unsigned char *) red_arr_mem_79466_backing_2;\n    \n    __local unsigned char *red_arr_mem_79468;\n    \n    red_arr_mem_79468 = (__local unsigned char *) red_arr_mem_79468_backing_3;\n    \n    __local unsigned char *red_arr_mem_79470;\n    \n    red_arr_mem_79470 = (__local unsigned char *) red_arr_mem_79470_backing_4;\n    \n    int32_t phys_group_id_79472;\n    \n    phys_group_id_79472 = get_group_id(0);\n    for (int32_t i_79473 = 0; i_79473 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_72148,\n                                                  segment_sizze_nonzzero_79455))) -\n                   phys_group_id_79472, sext_i64_i32(num_groups_72149));\n         i_79473++) {\n        int32_t virt_group_id_79474 = phys_group_id_79472 + i_79473 *\n                sext_i64_i32(num_groups_72149);\n        int64_t slice_79475 = n_m_65386;\n        int64_t slice_79476 = m_65377 * slice_79475;\n        int64_t gtid_72156 = squot64(squot64(sext_i32_i64(local_tid_79458),\n                                             segment_sizze_nonzzero_79455) +\n                                     se",
            "xt_i32_i64(virt_group_id_79474) *\n                                     squot64(segred_group_sizze_72148,\n                                             segment_sizze_nonzzero_79455),\n                                     slice_79475);\n        int64_t remnant_79477 = squot64(sext_i32_i64(local_tid_79458),\n                                        segment_sizze_nonzzero_79455) +\n                sext_i32_i64(virt_group_id_79474) *\n                squot64(segred_group_sizze_72148,\n                        segment_sizze_nonzzero_79455) - gtid_72156 *\n                slice_79475;\n        int64_t gtid_72157 = remnant_79477;\n        int64_t remnant_79478 = remnant_79477 - gtid_72157;\n        int64_t gtid_72158 = srem64(sext_i32_i64(local_tid_79458), 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_79458),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_72148,\n                                                              segment_sizze_nonzzero_79455)))) {\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_r",
            "es_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                // save results to be reduced\n                {\n                    ((__local\n                      double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458)] =\n                        w_j_72200;\n                    ((__local\n                      double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)] =\n                        xw_j_72201;\n                    ((__local\n                      double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458)] =\n                        x2w_j_72202;\n                    ((__local\n                      double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458)] =\n                        x3w_j_72203;\n                    ((__local\n                      double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458)] =\n                        x4w_j_72204;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79466)[sext_i32_i64(local_tid_",
            "79458)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458)] =\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_79479;\n                double x_79480;\n                double x_79481;\n                double x_79482;\n                double x_79483;\n                double x_79484;\n                double x_79485;\n                double x_79486;\n                double x_79487;\n                double x_79488;\n                bool ltid_in_bounds_79494 = slt64(sext_i32_i64(local_tid_79458),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_72148,\n                                                          segment_sizze_nonzzero_79455));\n                int32_t skip_threads_79495;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_79494) {\n                        x_72165 = ((volatile __local\n                                    double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458)];\n                        x_72166 = ((volatile __local\n                                    double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)];\n                        x_72167 = ((volatile __local\n                                    double",
            " *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458)];\n                        x_72168 = ((volatile __local\n                                    double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458)];\n                        x_72169 = ((volatile __local\n                                    double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458)];\n                        if ((local_tid_79458 - squot32(local_tid_79458, 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_79495 = 1;\n                    while (slt32(skip_threads_79495, 32)) {\n                        bool thread_active_79496 = sle32(skip_threads_79495,\n                                                         local_tid_79458 -\n                                                         squot32(local_tid_79458,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_79494;\n                        \n                        if (thread_active_79496) {\n                            // read operands\n                            {\n                                x_72160 = ((volatile __local\n                                            double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458) -\n                                                                         sext_i32_i64(skip_threads_79495)];\n                                x_72161 = ((volatile __local\n                                            double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458) -\n                                                                         sext_i32_i64",
            "(skip_threads_79495)];\n                                x_72162 = ((volatile __local\n                                            double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458) -\n                                                                         sext_i32_i64(skip_threads_79495)];\n                                x_72163 = ((volatile __local\n                                            double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458) -\n                                                                         sext_i32_i64(skip_threads_79495)];\n                                x_72164 = ((volatile __local\n                                            double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458) -\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_79458),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_79458) -\n                                       sext_i32_i64(local_tid_79458 -\n                                       skip_threads_79495));\n                            \n                            if (thread_active_79496 && inactive_79497) {\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_79496) {\n                                if (!inactive_79497) {\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_79460, 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_79462)[sext_i32_i64(local_tid_79458)] =\n                                    x_72160;\n                                x_72165 = x_72160;\n                                ((volatile __local\n                                  double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)] =\n                                    x_72161;\n                                x_72166 = x_72161;\n                                ((volatile __local\n                                  double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458)] =\n                                    x_72162;\n                                x_72167 = x_72162;\n                ",
            "                ((volatile __local\n                                  double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458)] =\n                                    x_72163;\n                                x_72168 = x_72163;\n                                ((volatile __local\n                                  double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458)] =\n                                    x_72164;\n                                x_72169 = x_72164;\n                            }\n                        }\n                        if (sle32(wave_sizze_79460, skip_threads_79495)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79495 *= 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_79458 - squot32(local_tid_79458, 32) * 32) ==\n                        31 && ltid_in_bounds_79494) {\n                        ((volatile __local\n                          double *) red_arr_mem_79462)[sext_i32_i64(squot32(local_tid_79458,\n                                                                            32))] =\n                            x_72160;\n                        ((volatile __local\n                          double *) red_arr_mem_79464)[sext_i32_i64(squot32(local_tid_79458,\n                                                                            32))] =\n                            x_72161;\n                        ((volatile __local\n                          double *) red_arr_mem_79466)[sext_i32_i64(squot32(local_tid_79458,\n                                                                            32))] =\n                            x_72162;\n                        ((volatile __local\n                          double *) red_arr_mem_79468)[sext_i32_i64(squot32(local_tid_79458,\n                                            ",
            "                                32))] =\n                            x_72163;\n                        ((volatile __local\n                          double *) red_arr_mem_79470)[sext_i32_i64(squot32(local_tid_79458,\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_79498;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_79458, 32) == 0 &&\n                            ltid_in_bounds_79494) {\n                            x_79484 = ((volatile __local\n                                        double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458)];\n                            x_79485 = ((volatile __local\n                                        double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)];\n                            x_79486 = ((volatile __local\n                                        double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458)];\n                            x_79487 = ((volatile __local\n                                        double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458)];\n                            x_79488 = ((volatile __local\n                                        double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458)];\n                            if ((local_tid_79458 - squot32(local_tid_79458,\n                                                           32) * 32) == 0) {\n                                x_79479 = x_79484;\n                                x_79480 = x_79485;\n                                x_79481 = x_79486;\n                                x_79482 = x_79487;\n                                x_79483 = x_79488;\n      ",
            "                      }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_79498 = 1;\n                        while (slt32(skip_threads_79498, 32)) {\n                            bool thread_active_79499 = sle32(skip_threads_79498,\n                                                             local_tid_79458 -\n                                                             squot32(local_tid_79458,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_79458, 32) == 0 &&\n                                  ltid_in_bounds_79494);\n                            \n                            if (thread_active_79499) {\n                                // read operands\n                                {\n                                    x_79479 = ((volatile __local\n                                                double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458) -\n                                                                             sext_i32_i64(skip_threads_79498)];\n                                    x_79480 = ((volatile __local\n                                                double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458) -\n                                                                             sext_i32_i64(skip_threads_79498)];\n                                    x_79481 = ((volatile __local\n                                                double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458) -\n                                                                             sext_i32_i64(skip_threads_79498)];\n                                    x_79482 = ((volatile __local\n                                                double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458) -\n          ",
            "                                                                   sext_i32_i64(skip_threads_79498)];\n                                    x_79483 = ((volatile __local\n                                                double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458) -\n                                                                             sext_i32_i64(skip_threads_79498)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_79500 =\n                                     slt64(srem64(sext_i32_i64(local_tid_79458 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_79458 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_79458 -\n                                                         skip_threads_79498) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_79499 && inactive_79500) {\n                                    x_79479 = x_79484;\n                                    x_79480 = x_79485;\n                                    x_79481 = x_79486;\n                                    x_79482 = x_79487;\n                                    x_79483 = x_79488;\n                                }\n                                if (thread_active_79499) {\n                                    if (!inactive_79500) {\n                                        double defunc_1_op_res_79489 = x_79479 +\n                                               x_79484;\n                                        double defunc_1_op_res_79490 = x_79480 +\n                                               x_79485;\n                                        double defunc_1_op_res_79491 = x_79481 +\n                        ",
            "                       x_79486;\n                                        double defunc_1_op_res_79492 = x_79482 +\n                                               x_79487;\n                                        double defunc_1_op_res_79493 = x_79483 +\n                                               x_79488;\n                                        \n                                        x_79479 = defunc_1_op_res_79489;\n                                        x_79480 = defunc_1_op_res_79490;\n                                        x_79481 = defunc_1_op_res_79491;\n                                        x_79482 = defunc_1_op_res_79492;\n                                        x_79483 = defunc_1_op_res_79493;\n                                    }\n                                }\n                            }\n                            if (sle32(wave_sizze_79460, skip_threads_79498)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_79499) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458)] =\n                                        x_79479;\n                                    x_79484 = x_79479;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)] =\n                                        x_79480;\n                                    x_79485 = x_79480;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458)] =\n                                        x_79481;\n                                    x_79486 = x_79481;\n                                    ((volatile __local\n                                      double *",
            ") red_arr_mem_79468)[sext_i32_i64(local_tid_79458)] =\n                                        x_79482;\n                                    x_79487 = x_79482;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458)] =\n                                        x_79483;\n                                    x_79488 = x_79483;\n                                }\n                            }\n                            if (sle32(wave_sizze_79460, skip_threads_79498)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_79498 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_79501 = squot32(local_tid_79458, 32) == 0 ||\n                     !ltid_in_bounds_79494;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_79501) {\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_79462)[sext_i32_i64(squot32(local_tid_79458,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_72161 = ((__local\n                                        double *) red_arr_mem_79464)[sext_i32_i64(squot32(local_tid_79458,\n                                                                                          32)) -\n                 ",
            "                                                    (int64_t) 1];\n                            x_72162 = ((__local\n                                        double *) red_arr_mem_79466)[sext_i32_i64(squot32(local_tid_79458,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_72163 = ((__local\n                                        double *) red_arr_mem_79468)[sext_i32_i64(squot32(local_tid_79458,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                            x_72164 = ((__local\n                                        double *) red_arr_mem_79470)[sext_i32_i64(squot32(local_tid_79458,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79502 =\n                             slt64(srem64(sext_i32_i64(local_tid_79458),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_79458) -\n                                   sext_i32_i64(squot32(local_tid_79458, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_79501) {\n                            if (inactive_79502) {\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_79501) {\n                            if (!inactive_79502) {\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                    // write final result\n                    {\n                        if (!no_carry_in_79501) {\n                            ((__local\n                              double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458)] =\n                                x_72160;\n                            ((__local\n                              double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)] =\n                                x_72161;\n                            ((__local\n                              double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458)] =\n                                x_72162;\n                            ((__local\n                              double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458)] =\n                                x_72163;\n                            ((__local\n                              double *) re",
            "d_arr_mem_79470)[sext_i32_i64(local_tid_79458)] =\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_79458, 32) == 0 &&\n                        ltid_in_bounds_79494) {\n                        ((__local\n                          double *) red_arr_mem_79462)[sext_i32_i64(local_tid_79458)] =\n                            x_72165;\n                        ((__local\n                          double *) red_arr_mem_79464)[sext_i32_i64(local_tid_79458)] =\n                            x_72166;\n                        ((__local\n                          double *) red_arr_mem_79466)[sext_i32_i64(local_tid_79458)] =\n                            x_72167;\n                        ((__local\n                          double *) red_arr_mem_79468)[sext_i32_i64(local_tid_79458)] =\n                            x_72168;\n                        ((__local\n                          double *) red_arr_mem_79470)[sext_i32_i64(local_tid_79458)] =\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_79474) *\n                      squot64(segred_group_sizze_72148,\n                              segment_sizze_nonzzero_79455) +\n                      sext_i32_i64(local_tid_79458), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_79458),\n                      squot64(segred_group_sizze_72148,\n                              segment_sizze_nonzzero_79455))) {\n                double tmp_79503;\n                \n                tmp_79503 = ((__local\n                              double *) red_arr_mem_79462)[(sext_i32_i64(local_tid_79458) +\n           ",
            "                                                 (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79455 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77794)[squot64(sext_i32_i64(virt_group_id_79474) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79455) +\n                                               sext_i32_i64(local_tid_79458),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79474) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79455) +\n                                        sext_i32_i64(local_tid_79458) -\n                                        squot64(sext_i32_i64(virt_group_id_79474) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79455) +\n                                                sext_i32_i64(local_tid_79458),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79503;\n                \n                double tmp_79504;\n                \n                tmp_79504 = ((__local\n                              double *) red_arr_mem_79464)[(sext_i32_i64(local_tid_79458) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79455 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77798)[squot64(sext_i32_i64(virt_group_id_79474) *\n                                               squot64(seg",
            "red_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79455) +\n                                               sext_i32_i64(local_tid_79458),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79474) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79455) +\n                                        sext_i32_i64(local_tid_79458) -\n                                        squot64(sext_i32_i64(virt_group_id_79474) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79455) +\n                                                sext_i32_i64(local_tid_79458),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79504;\n                \n                double tmp_79505;\n                \n                tmp_79505 = ((__local\n                              double *) red_arr_mem_79466)[(sext_i32_i64(local_tid_79458) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79455 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77802)[squot64(sext_i32_i64(virt_group_id_79474) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79455) +\n                                               sext_i32_i64(local_tid_79458),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79474) *\n                                        squot64(segred_grou",
            "p_sizze_72148,\n                                                segment_sizze_nonzzero_79455) +\n                                        sext_i32_i64(local_tid_79458) -\n                                        squot64(sext_i32_i64(virt_group_id_79474) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79455) +\n                                                sext_i32_i64(local_tid_79458),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79505;\n                \n                double tmp_79506;\n                \n                tmp_79506 = ((__local\n                              double *) red_arr_mem_79468)[(sext_i32_i64(local_tid_79458) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79455 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77806)[squot64(sext_i32_i64(virt_group_id_79474) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79455) +\n                                               sext_i32_i64(local_tid_79458),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79474) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79455) +\n                                        sext_i32_i64(local_tid_79458) -\n                                        squot64(sext_i32_i64(virt_group_id_79474) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segmen",
            "t_sizze_nonzzero_79455) +\n                                                sext_i32_i64(local_tid_79458),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79506;\n                \n                double tmp_79507;\n                \n                tmp_79507 = ((__local\n                              double *) red_arr_mem_79470)[(sext_i32_i64(local_tid_79458) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79455 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77810)[squot64(sext_i32_i64(virt_group_id_79474) *\n                                               squot64(segred_group_sizze_72148,\n                                                       segment_sizze_nonzzero_79455) +\n                                               sext_i32_i64(local_tid_79458),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79474) *\n                                        squot64(segred_group_sizze_72148,\n                                                segment_sizze_nonzzero_79455) +\n                                        sext_i32_i64(local_tid_79458) -\n                                        squot64(sext_i32_i64(virt_group_id_79474) *\n                                                squot64(segred_group_sizze_72148,\n                                                        segment_sizze_nonzzero_79455) +\n                                                sext_i32_i64(local_tid_79458),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79507;\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_siz",
            "ze_72148\n}\n__kernel void mainzisegred_small_72258(__global int *global_failure,\n                                       uint red_arr_mem_79602_backing_offset_0,\n                                       uint red_arr_mem_79600_backing_offset_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_79593,\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    volatile unsigned char *red_arr_mem_79602_backing_1 =\n                           &shared_mem[red_arr_mem_79602_backing_offset_0];\n    volatile unsigned char *red_arr_mem_79600_backing_0 =\n                           &shared_mem[red_arr_mem_79600_backing_offset_1",
            "];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79595;\n    int32_t local_tid_79596;\n    int64_t group_sizze_79599;\n    int32_t wave_sizze_79598;\n    int32_t group_tid_79597;\n    \n    global_tid_79595 = get_global_id(0);\n    local_tid_79596 = get_local_id(0);\n    group_sizze_79599 = get_local_size(0);\n    wave_sizze_79598 = LOCKSTEP_WIDTH;\n    group_tid_79597 = get_group_id(0);\n    \n    int32_t phys_tid_72258 = global_tid_79595;\n    __local unsigned char *red_arr_mem_79600;\n    \n    red_arr_mem_79600 = (__local unsigned char *) red_arr_mem_79600_backing_0;\n    \n    __local unsigned char *red_arr_mem_79602;\n    \n    red_arr_mem_79602 = (__local unsigned char *) red_arr_mem_79602_backing_1;\n    \n    int32_t phys_group_id_79604;\n    \n    phys_group_id_79604 = get_group_id(0);\n    for (int32_t i_79605 = 0; i_79605 <\n         sdiv_up32(sext_i64_i32(sdiv_up64(m_65377 * n_m_65386,\n                                          squot64(segred_group_sizze_72250,\n                                                  segment_sizze_nonzzero_79593))) -\n                   phys_group_id_79604, sext_i64_i32(num_groups_72251));\n         i_79605++) {\n        int32_t virt_group_id_79606 = phys_group_id_79604 + i_79605 *\n                sext_i64_i32(num_groups_72251);\n        int64_t slice_79607 = n_m_65386;\n        int64_t slice_79608 = m_65377 * slice_79607;\n        int64_t gtid_72255 = squot64(squot64(sext_i32_i64(local_tid_79596),\n                                             segment_sizze_nonzzero_79593) +\n                                     sext_i32_i64(virt_group_id_79606) *\n                                     squot64(segred_group_sizze_72250,\n                                             segment_sizze_nonzzero_79593),\n                                     slice_79607);\n        int64_t remnant_79609 = squot64(sext_i32_i64(local_tid_79596),\n                                        segment_sizze_nonzzero_79593) +\n                sext_i32_i64(virt_group_id_796",
            "06) *\n                squot64(segred_group_sizze_72250,\n                        segment_sizze_nonzzero_79593) - gtid_72255 *\n                slice_79607;\n        int64_t gtid_72256 = remnant_79609;\n        int64_t remnant_79610 = remnant_79609 - gtid_72256;\n        int64_t gtid_72257 = srem64(sext_i32_i64(local_tid_79596), 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_79596),\n                                                      q_65380 *\n                                                      squot64(segred_group_sizze_72250,\n                                                              segment_sizze_nonzzero_79593)))) {\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_7225",
            "7, 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_79600)[sext_i32_i64(local_tid_79596)] =\n                        defunc_9_fit_fun_res_72312;\n                    ((__local\n                      double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)] =\n                        defunc_9_slope_fun_res_72318;\n                }\n            } else {\n                ((__local\n                  double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596)] =\n                    0.0;\n                ((__local\n                  double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)] =\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_79611;\n                double x_79612;\n                double x_79613;\n                double x_79614;\n                bool ltid_in_bounds_79617 = slt64(sext_i32_i64(local_tid_79596),\n                                                  q_65380 *\n                                                  squot64(segred_group_sizze_72250,\n                                                          segment_sizze_nonzzero_79593));\n                int32_t skip_threads_79618;\n                \n                // read input for in-block scan\n                {\n                    if (ltid_in_bounds_79617) {\n                        x_72261 = ((volatile __local\n                                    double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596)];\n                        x_72262 = ((volatile __local\n                                    double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)];\n                        if ((local_tid_79596 - squot32(local_tid_79596, 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_79618 = 1;\n                    while (slt32(skip_threads_79618, 32)) {\n                        bool thread_active_79619 = sle32(skip_threads_79618,\n                                                         local_tid_79596 -\n                                                         squot32(local_tid_79596,\n                                                                 32) * 32) &&\n                             ltid_in_bounds_79617;\n                        \n                        if (thread_active_79619) {\n         ",
            "                   // read operands\n                            {\n                                x_72259 = ((volatile __local\n                                            double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596) -\n                                                                         sext_i32_i64(skip_threads_79618)];\n                                x_72260 = ((volatile __local\n                                            double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596) -\n                                                                         sext_i32_i64(skip_threads_79618)];\n                            }\n                        }\n                        // perform operation\n                        {\n                            bool inactive_79620 =\n                                 slt64(srem64(sext_i32_i64(local_tid_79596),\n                                              q_65380),\n                                       sext_i32_i64(local_tid_79596) -\n                                       sext_i32_i64(local_tid_79596 -\n                                       skip_threads_79618));\n                            \n                            if (thread_active_79619 && inactive_79620) {\n                                x_72259 = x_72261;\n                                x_72260 = x_72262;\n                            }\n                            if (thread_active_79619) {\n                                if (!inactive_79620) {\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_79598, skip_threads_79618)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        if (thread_active_79619) {\n                            // write result\n                            {\n                                ((volatile __local\n                                  double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596)] =\n                                    x_72259;\n                                x_72261 = x_72259;\n                                ((volatile __local\n                                  double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)] =\n                                    x_72260;\n                                x_72262 = x_72260;\n                            }\n                        }\n                        if (sle32(wave_sizze_79598, skip_threads_79618)) {\n                            barrier(CLK_LOCAL_MEM_FENCE);\n                        }\n                        skip_threads_79618 *= 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_79596 - squot32(local_tid_79596, 32) * 32) ==\n                        31 && ltid_in_bounds_79617) {\n                        ((volatile __local\n                          double *) red_arr_mem_79600)[sext_i32_i64(squot32(local_tid_79596,\n                                                                            32))] =\n                            x_72259;\n                        ((volatile __local\n                          double *) red_arr_mem_79602)[sext_i32_i64(squot32(local_tid_79596,\n                                                                            32))] =\n                            x_72260;\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                // scan the first block, after which offse",
            "t 'i' contains carry-in for block 'i+1'\n                {\n                    int32_t skip_threads_79621;\n                    \n                    // read input for in-block scan\n                    {\n                        if (squot32(local_tid_79596, 32) == 0 &&\n                            ltid_in_bounds_79617) {\n                            x_79613 = ((volatile __local\n                                        double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596)];\n                            x_79614 = ((volatile __local\n                                        double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)];\n                            if ((local_tid_79596 - squot32(local_tid_79596,\n                                                           32) * 32) == 0) {\n                                x_79611 = x_79613;\n                                x_79612 = x_79614;\n                            }\n                        }\n                    }\n                    // in-block scan (hopefully no barriers needed)\n                    {\n                        skip_threads_79621 = 1;\n                        while (slt32(skip_threads_79621, 32)) {\n                            bool thread_active_79622 = sle32(skip_threads_79621,\n                                                             local_tid_79596 -\n                                                             squot32(local_tid_79596,\n                                                                     32) *\n                                                             32) &&\n                                 (squot32(local_tid_79596, 32) == 0 &&\n                                  ltid_in_bounds_79617);\n                            \n                            if (thread_active_79622) {\n                                // read operands\n                                {\n                                    x_79611 = ((volatile __local\n                                                double *) red_arr_mem_79600)[sext_",
            "i32_i64(local_tid_79596) -\n                                                                             sext_i32_i64(skip_threads_79621)];\n                                    x_79612 = ((volatile __local\n                                                double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596) -\n                                                                             sext_i32_i64(skip_threads_79621)];\n                                }\n                            }\n                            // perform operation\n                            {\n                                bool inactive_79623 =\n                                     slt64(srem64(sext_i32_i64(local_tid_79596 *\n                                                  32 + 32 - 1), q_65380),\n                                           sext_i32_i64(local_tid_79596 * 32 +\n                                           32 - 1) -\n                                           sext_i32_i64((local_tid_79596 -\n                                                         skip_threads_79621) *\n                                           32 + 32 - 1));\n                                \n                                if (thread_active_79622 && inactive_79623) {\n                                    x_79611 = x_79613;\n                                    x_79612 = x_79614;\n                                }\n                                if (thread_active_79622) {\n                                    if (!inactive_79623) {\n                                        double defunc_1_op_res_79615 = x_79611 +\n                                               x_79613;\n                                        double defunc_1_op_res_79616 = x_79612 +\n                                               x_79614;\n                                        \n                                        x_79611 = defunc_1_op_res_79615;\n                                        x_79612 = defunc_1_op_res_79616;\n                                    }\n        ",
            "                        }\n                            }\n                            if (sle32(wave_sizze_79598, skip_threads_79621)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            if (thread_active_79622) {\n                                // write result\n                                {\n                                    ((volatile __local\n                                      double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596)] =\n                                        x_79611;\n                                    x_79613 = x_79611;\n                                    ((volatile __local\n                                      double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)] =\n                                        x_79612;\n                                    x_79614 = x_79612;\n                                }\n                            }\n                            if (sle32(wave_sizze_79598, skip_threads_79621)) {\n                                barrier(CLK_LOCAL_MEM_FENCE);\n                            }\n                            skip_threads_79621 *= 2;\n                        }\n                    }\n                }\n                barrier(CLK_LOCAL_MEM_FENCE);\n                \n                bool no_carry_in_79624 = squot32(local_tid_79596, 32) == 0 ||\n                     !ltid_in_bounds_79617;\n                \n                // carry-in for every block except the first\n                {\n                    // read operands\n                    {\n                        if (!no_carry_in_79624) {\n                            x_72261 = x_72259;\n                            x_72262 = x_72260;\n                            x_72259 = ((__local\n                                        double *) red_arr_mem_79600)[sext_i32_i64(squot32(local_tid_79596,\n                                                                                          32)) -\n                            ",
            "                                         (int64_t) 1];\n                            x_72260 = ((__local\n                                        double *) red_arr_mem_79602)[sext_i32_i64(squot32(local_tid_79596,\n                                                                                          32)) -\n                                                                     (int64_t) 1];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79625 =\n                             slt64(srem64(sext_i32_i64(local_tid_79596),\n                                          q_65380),\n                                   sext_i32_i64(local_tid_79596) -\n                                   sext_i32_i64(squot32(local_tid_79596, 32) *\n                                   32 - 1));\n                        \n                        if (!no_carry_in_79624) {\n                            if (inactive_79625) {\n                                x_72259 = x_72261;\n                                x_72260 = x_72262;\n                            }\n                        }\n                        if (!no_carry_in_79624) {\n                            if (!inactive_79625) {\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_79624) {\n                            ((__local\n                              double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596)] =\n                          ",
            "      x_72259;\n                            ((__local\n                              double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)] =\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_79596, 32) == 0 &&\n                        ltid_in_bounds_79617) {\n                        ((__local\n                          double *) red_arr_mem_79600)[sext_i32_i64(local_tid_79596)] =\n                            x_72261;\n                        ((__local\n                          double *) red_arr_mem_79602)[sext_i32_i64(local_tid_79596)] =\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_79606) *\n                      squot64(segred_group_sizze_72250,\n                              segment_sizze_nonzzero_79593) +\n                      sext_i32_i64(local_tid_79596), m_65377 * n_m_65386) &&\n                slt64(sext_i32_i64(local_tid_79596),\n                      squot64(segred_group_sizze_72250,\n                              segment_sizze_nonzzero_79593))) {\n                double tmp_79626;\n                \n                tmp_79626 = ((__local\n                              double *) red_arr_mem_79600)[(sext_i32_i64(local_tid_79596) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79593 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77836)[squot64(sext_i32_i64(virt_group_id_79606) *\n                                             ",
            "  squot64(segred_group_sizze_72250,\n                                                       segment_sizze_nonzzero_79593) +\n                                               sext_i32_i64(local_tid_79596),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79606) *\n                                        squot64(segred_group_sizze_72250,\n                                                segment_sizze_nonzzero_79593) +\n                                        sext_i32_i64(local_tid_79596) -\n                                        squot64(sext_i32_i64(virt_group_id_79606) *\n                                                squot64(segred_group_sizze_72250,\n                                                        segment_sizze_nonzzero_79593) +\n                                                sext_i32_i64(local_tid_79596),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79626;\n                \n                double tmp_79627;\n                \n                tmp_79627 = ((__local\n                              double *) red_arr_mem_79602)[(sext_i32_i64(local_tid_79596) +\n                                                            (int64_t) 1) *\n                                                           segment_sizze_nonzzero_79593 -\n                                                           (int64_t) 1];\n                ((__global\n                  double *) mem_77840)[squot64(sext_i32_i64(virt_group_id_79606) *\n                                               squot64(segred_group_sizze_72250,\n                                                       segment_sizze_nonzzero_79593) +\n                                               sext_i32_i64(local_tid_79596),\n                                               n_m_65386) * n_m_65386 +\n                                       (sext_i32_i64(virt_group_id_79606) *\n                                        squot6",
            "4(segred_group_sizze_72250,\n                                                segment_sizze_nonzzero_79593) +\n                                        sext_i32_i64(local_tid_79596) -\n                                        squot64(sext_i32_i64(virt_group_id_79606) *\n                                                squot64(segred_group_sizze_72250,\n                                                        segment_sizze_nonzzero_79593) +\n                                                sext_i32_i64(local_tid_79596),\n                                                n_m_65386) * n_m_65386)] =\n                    tmp_79627;\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__kernel void mainzisegscan_67884(__global int *global_failure,\n                                  uint local_mem_78388_backing_offset_0,\n                                  int64_t m_65377, int64_t n_65378, __global\n                                  unsigned char *Y_mem_77010, __global\n                                  unsigned char *mem_77116, __global\n                                  unsigned char *mainziid_counter_mem_78359,\n                                  __global\n                                  unsigned char *status_flags_mem_78361,\n                                  __global unsigned char *aggregates_mem_78363,\n                                  __global unsigned char *incprefixes_mem_78365)\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    volatile unsigned char *local_mem_78388_backing_0 =\n                           &shared_mem[local_mem_78388_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78379;\n    int32_t local_tid_78380;\n    int64_t group_sizze_78383;\n    int32_t wave_sizze_78382;\n   ",
            " int32_t group_tid_78381;\n    \n    global_tid_78379 = get_global_id(0);\n    local_tid_78380 = get_local_id(0);\n    group_sizze_78383 = get_local_size(0);\n    wave_sizze_78382 = LOCKSTEP_WIDTH;\n    group_tid_78381 = get_group_id(0);\n    \n    int32_t phys_tid_67884 = global_tid_78379;\n    int64_t byte_offsets_78384 = (int64_t) 0;\n    int64_t byte_offsets_78385 = segscan_group_sizze_67878 * (int64_t) 8;\n    int64_t warp_byte_offset_78386 = (int64_t) 32;\n    int64_t warp_byte_offset_78387 = (int64_t) 288;\n    \n    // Allocate reused shared memeory\n    { }\n    \n    __local unsigned char *local_mem_78388;\n    \n    local_mem_78388 = (__local unsigned char *) local_mem_78388_backing_0;\n    \n    int64_t trans_arr_len_78389 = (int64_t) 11 * segscan_group_sizze_67878;\n    int32_t dynamic_id_78395;\n    \n    if (local_tid_78380 == 0) {\n        dynamic_id_78395 = atomic_add_i32_global(&((volatile __global\n                                                    int *) mainziid_counter_mem_78359)[(int64_t) 0],\n                                                 (int) 1);\n        ((__local int32_t *) local_mem_78388)[(int64_t) 0] = dynamic_id_78395;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    dynamic_id_78395 = ((__local int32_t *) local_mem_78388)[(int64_t) 0];\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t blockOff_78396 = sext_i32_i64(dynamic_id_78395) * (int64_t) 11 *\n            segscan_group_sizze_67878;\n    int64_t sgm_idx_78397 = smod64(blockOff_78396, n_65378);\n    int32_t boundary_78398 = sext_i64_i32(smin64((int64_t) 11 *\n                                                 segscan_group_sizze_67878,\n                                                 n_65378 - sgm_idx_78397));\n    int32_t segsizze_compact_78399 = sext_i64_i32(smin64((int64_t) 11 *\n                                                         segscan_group_sizze_67878,\n                                                         n_65378));\n    int64_t private_mem_78400[(int64_t) 11];\n    \n    // Load and map\n    {\n        f",
            "or (int64_t i_78402 = 0; i_78402 < (int64_t) 11; i_78402++) {\n            int64_t phys_tid_78403 = blockOff_78396 +\n                    sext_i32_i64(local_tid_78380) + i_78402 *\n                    segscan_group_sizze_67878;\n            int64_t slice_78404 = n_65378;\n            int64_t slice_78405 = m_65377 * slice_78404;\n            int64_t gtid_67882 = squot64(phys_tid_78403, slice_78404);\n            int64_t remnant_78406 = phys_tid_78403 - gtid_67882 * slice_78404;\n            int64_t gtid_67883 = remnant_78406;\n            int64_t remnant_78407 = remnant_78406 - gtid_67883;\n            \n            if (slt64(phys_tid_78403, m_65377 * 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                private_mem_78400[i_78402] = defunc_0_f_res_67892;\n            } else {\n                private_mem_78400[i_78402] = (int64_t) 0;\n            }\n        }\n    }\n    // Transpose scan inputs\n    {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_78408 = 0; i_78408 < (int64_t) 11; i_78408++) {\n            int64_t sharedIdx_78409 = sext_i32_i64(local_tid_78380) + i_78408 *\n                    segscan_group_sizze_67878;\n            int64_t tmp_78410;\n            \n            tmp_78410 = private_mem_78400[i_78408];\n            ((__local int64_t *) local_mem_78388)[sharedIdx_78409] = tmp_78410;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int32_t i_78411 = 0; i_78411 < 11; i_78411++) {\n        ",
            "    int32_t sharedIdx_78412 = local_tid_78380 * 11 + i_78411;\n            int64_t tmp_78413;\n            \n            tmp_78413 = ((__local\n                          int64_t *) local_mem_78388)[sext_i32_i64(sharedIdx_78412)];\n            private_mem_78400[sext_i32_i64(i_78411)] = tmp_78413;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // Per thread scan\n    {\n        int32_t gidx_78414 = local_tid_78380 * 11 + 1;\n        \n        for (int64_t i_78415 = 0; i_78415 < (int64_t) 10; i_78415++) {\n            bool new_sgm_78416 = smod32(gidx_78414 + sext_i64_i32(i_78415) -\n                                        boundary_78398,\n                                        segsizze_compact_78399) == 0;\n            \n            if (!new_sgm_78416) {\n                int64_t x_67885;\n                int64_t x_67886;\n                \n                x_67885 = private_mem_78400[i_78415];\n                x_67886 = private_mem_78400[i_78415 + (int64_t) 1];\n                \n                int64_t defunc_1_op_res_67887 = add64(x_67885, x_67886);\n                \n                private_mem_78400[i_78415 + (int64_t) 1] =\n                    defunc_1_op_res_67887;\n            }\n        }\n    }\n    // Publish results in shared memory\n    {\n        int64_t tmp_78417;\n        \n        tmp_78417 = private_mem_78400[(int64_t) 10];\n        ((__local int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_78380)] =\n            tmp_78417;\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t acc_78421;\n    \n    // Scan results (with warp scan)\n    {\n        int64_t x_78418;\n        int64_t x_78419;\n        int64_t x_78422;\n        int64_t x_78423;\n        bool ltid_in_bounds_78425 = slt64(sext_i32_i64(local_tid_78380),\n                                          segscan_group_sizze_67878);\n        int32_t skip_threads_78426;\n        \n        ",
            "// read input for in-block scan\n        {\n            if (ltid_in_bounds_78425) {\n                x_78419 = ((volatile __local\n                            int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                                (int64_t) 8) +\n                                                        sext_i32_i64(local_tid_78380)];\n                if ((local_tid_78380 - squot32(local_tid_78380, 32) * 32) ==\n                    0) {\n                    x_78418 = x_78419;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_78426 = 1;\n            while (slt32(skip_threads_78426, 32)) {\n                bool thread_active_78427 = sle32(skip_threads_78426,\n                                                 local_tid_78380 -\n                                                 squot32(local_tid_78380, 32) *\n                                                 32) && ltid_in_bounds_78425;\n                \n                if (thread_active_78427) {\n                    // read operands\n                    {\n                        x_78418 = ((volatile __local\n                                    int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                                        (int64_t) 8) +\n                                                                (sext_i32_i64(local_tid_78380) -\n                                                                 sext_i32_i64(skip_threads_78426))];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_78428 = slt32(smod32((local_tid_78380 + 1) *\n                                                       11 - 1 +\n                                                       segsizze_compact_78399 -\n                                                       boundary_78398,\n                                                     ",
            "  segsizze_compact_78399),\n                                                (local_tid_78380 + 1) * 11 - 1 -\n                                                ((local_tid_78380 -\n                                                  skip_threads_78426 + 1) * 11 -\n                                                 1));\n                    \n                    if (thread_active_78427 && inactive_78428) {\n                        x_78418 = x_78419;\n                    }\n                    if (thread_active_78427) {\n                        if (!inactive_78428) {\n                            int64_t defunc_1_op_res_78420 = add64(x_78418,\n                                                                  x_78419);\n                            \n                            x_78418 = defunc_1_op_res_78420;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_78382, skip_threads_78426)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_78427) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                              (int64_t) 8) +\n                                                      sext_i32_i64(local_tid_78380)] =\n                            x_78418;\n                        x_78419 = x_78418;\n                    }\n                }\n                if (sle32(wave_sizze_78382, skip_threads_78426)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_78426 *= 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_78380 - squot32(local_tid_78380, 32) * 32) == 31 &&\n                ltid_in_bounds_78425) {\n                ((volatile __local\n                  int6",
            "4_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(squot32(local_tid_78380,\n                                                                   32))] =\n                    x_78418;\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_78429;\n            \n            // read input for in-block scan\n            {\n                if (squot32(local_tid_78380, 32) == 0 && ltid_in_bounds_78425) {\n                    x_78423 = ((volatile __local\n                                int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                                    (int64_t) 8) +\n                                                            sext_i32_i64(local_tid_78380)];\n                    if ((local_tid_78380 - squot32(local_tid_78380, 32) * 32) ==\n                        0) {\n                        x_78422 = x_78423;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_78429 = 1;\n                while (slt32(skip_threads_78429, 32)) {\n                    bool thread_active_78430 = sle32(skip_threads_78429,\n                                                     local_tid_78380 -\n                                                     squot32(local_tid_78380,\n                                                             32) * 32) &&\n                         (squot32(local_tid_78380, 32) == 0 &&\n                          ltid_in_bounds_78425);\n                    \n                    if (thread_active_78430) {\n                        // read operands\n                        {\n                            x_78422 = ((volatile __local\n                                        int64_t ",
            "*) local_mem_78388)[squot64(byte_offsets_78384,\n                                                                            (int64_t) 8) +\n                                                                    (sext_i32_i64(local_tid_78380) -\n                                                                     sext_i32_i64(skip_threads_78429))];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78431 = slt32(smod32((local_tid_78380 *\n                                                            32 + 32 - 1 + 1) *\n                                                           11 - 1 +\n                                                           segsizze_compact_78399 -\n                                                           boundary_78398,\n                                                           segsizze_compact_78399),\n                                                    (local_tid_78380 * 32 + 32 -\n                                                     1 + 1) * 11 - 1 -\n                                                    (((local_tid_78380 -\n                                                       skip_threads_78429) *\n                                                      32 + 32 - 1 + 1) * 11 -\n                                                     1));\n                        \n                        if (thread_active_78430 && inactive_78431) {\n                            x_78422 = x_78423;\n                        }\n                        if (thread_active_78430) {\n                            if (!inactive_78431) {\n                                int64_t defunc_1_op_res_78424 = add64(x_78422,\n                                                                      x_78423);\n                                \n                                x_78422 = defunc_1_op_res_78424;\n                            }\n                        }\n                    }\n                    if (sle32(wave",
            "_sizze_78382, skip_threads_78429)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_78430) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                                  (int64_t) 8) +\n                                                          sext_i32_i64(local_tid_78380)] =\n                                x_78422;\n                            x_78423 = x_78422;\n                        }\n                    }\n                    if (sle32(wave_sizze_78382, skip_threads_78429)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_78429 *= 2;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        bool no_carry_in_78432 = squot32(local_tid_78380, 32) == 0 ||\n             !ltid_in_bounds_78425;\n        \n        // carry-in for every block except the first\n        {\n            // read operands\n            {\n                if (!no_carry_in_78432) {\n                    x_78419 = x_78418;\n                    x_78418 = ((__local\n                                int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                                    (int64_t) 8) +\n                                                            (sext_i32_i64(squot32(local_tid_78380,\n                                                                                  32)) -\n                                                             (int64_t) 1)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_78433 = slt32(smod32((local_tid_78380 + 1) * 11 -\n                                                   1 + segsizze_compact_78399 -\n                                    ",
            "               boundary_78398,\n                                                   segsizze_compact_78399),\n                                            (local_tid_78380 + 1) * 11 - 1 -\n                                            ((squot32(local_tid_78380, 32) *\n                                              32 - 1 + 1) * 11 - 1));\n                \n                if (!no_carry_in_78432) {\n                    if (inactive_78433) {\n                        x_78418 = x_78419;\n                    }\n                }\n                if (!no_carry_in_78432) {\n                    if (!inactive_78433) {\n                        int64_t defunc_1_op_res_78420 = add64(x_78418, x_78419);\n                        \n                        x_78418 = defunc_1_op_res_78420;\n                    }\n                }\n            }\n            // write final result\n            {\n                if (!no_carry_in_78432) {\n                    ((__local\n                      int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_78380)] =\n                        x_78418;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // restore correct values for first block\n        {\n            if (squot32(local_tid_78380, 32) == 0 && ltid_in_bounds_78425) {\n                ((__local\n                  int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_78380)] =\n                    x_78419;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (local_tid_78380 == 0) {\n            acc_78421 = ((__local\n                          int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                  ",
            "            (int64_t) 8) +\n                                                      (segscan_group_sizze_67878 -\n                                                       (int64_t) 1)];\n        } else {\n            acc_78421 = ((__local\n                          int64_t *) local_mem_78388)[squot64(byte_offsets_78384,\n                                                              (int64_t) 8) +\n                                                      (sext_i32_i64(local_tid_78380) -\n                                                       (int64_t) 1)];\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t prefix_78434 = (int64_t) 0;\n    bool block_new_sgm_78435 = sgm_idx_78397 == (int64_t) 0;\n    \n    // Perform lookback\n    {\n        if (block_new_sgm_78435 && local_tid_78380 == 0) {\n            ((volatile __global\n              int64_t *) incprefixes_mem_78365)[dynamic_id_78395] = acc_78421;\n            mem_fence_global();\n            ((volatile __global\n              int8_t *) status_flags_mem_78361)[dynamic_id_78395] = (int8_t) 2;\n            acc_78421 = (int64_t) 0;\n        }\n        if (!block_new_sgm_78435 && slt32(local_tid_78380, wave_sizze_78382)) {\n            if (local_tid_78380 == 0) {\n                if (boundary_78398 == sext_i64_i32(segscan_group_sizze_67878 *\n                    (int64_t) 11)) {\n                    ((volatile __global\n                      int64_t *) aggregates_mem_78363)[dynamic_id_78395] =\n                        acc_78421;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_78361)[dynamic_id_78395] =\n                        (int8_t) 1;\n                } else {\n                    ((volatile __global\n                      int64_t *) incprefixes_mem_78365)[dynamic_id_78395] =\n                        acc_78421;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_78361)[dynamic",
            "_id_78395] =\n                        (int8_t) 2;\n                }\n                \n                int8_t tmp_78436;\n                \n                tmp_78436 = ((volatile __global\n                              int8_t *) status_flags_mem_78361)[dynamic_id_78395 -\n                                                                (int64_t) 1];\n                ((volatile __local int8_t *) local_mem_78388)[(int64_t) 0] =\n                    tmp_78436;\n            }\n            mem_fence_local();\n            \n            int8_t status_78437;\n            \n            status_78437 = ((__local int8_t *) local_mem_78388)[(int64_t) 0];\n            if (status_78437 == (int8_t) 2) {\n                if (local_tid_78380 == 0) {\n                    prefix_78434 = ((volatile __global\n                                     int64_t *) incprefixes_mem_78365)[dynamic_id_78395 -\n                                                                       (int64_t) 1];\n                }\n            } else {\n                int32_t readOffset_78438 = dynamic_id_78395 -\n                        sext_i32_i64(wave_sizze_78382);\n                \n                while (slt32(wave_sizze_78382 * -1, readOffset_78438)) {\n                    int32_t read_i_78439 = readOffset_78438 + local_tid_78380;\n                    int64_t aggr_78440 = (int64_t) 0;\n                    int8_t flag_78441 = (int8_t) 0;\n                    \n                    if (sle32(0, read_i_78439)) {\n                        if (sle64(blockOff_78396 - (sext_i32_i64(read_i_78439 +\n                                                    1) *\n                                                    segscan_group_sizze_67878 *\n                                                    (int64_t) 11 - (int64_t) 1),\n                                  sgm_idx_78397)) {\n                            flag_78441 = ((volatile __global\n                                           int8_t *) status_flags_mem_78361)[sext_i32_i64(read_i_78439)];\n                          ",
            "  if (flag_78441 == (int8_t) 2) {\n                                aggr_78440 = ((volatile __global\n                                               int64_t *) incprefixes_mem_78365)[sext_i32_i64(read_i_78439)];\n                            } else {\n                                if (flag_78441 == (int8_t) 1) {\n                                    aggr_78440 = ((volatile __global\n                                                   int64_t *) aggregates_mem_78363)[sext_i32_i64(read_i_78439)];\n                                }\n                            }\n                        } else {\n                            flag_78441 = (int8_t) 2;\n                        }\n                    }\n                    ((__local\n                      int64_t *) local_mem_78388)[squot64(warp_byte_offset_78386,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_78380)] =\n                        aggr_78440;\n                    ((__local\n                      int8_t *) local_mem_78388)[sext_i32_i64(local_tid_78380)] =\n                        flag_78441;\n                    flag_78441 = ((__local\n                                   int8_t *) local_mem_78388)[sext_i32_i64(wave_sizze_78382) -\n                                                              (int64_t) 1];\n                    if (slt8(flag_78441, (int8_t) 2)) {\n                        int8_t flg_x_78445;\n                        int8_t flg_y_78446;\n                        int64_t x_78442;\n                        int64_t x_78443;\n                        int32_t skip_threads_78447;\n                        \n                        // read input for in-block scan\n                        {\n                            flg_y_78446 = ((volatile __local\n                                            int8_t *) local_mem_78388)[sext_i32_i64(local_tid_78380)];\n                            x_78443 = ((volatile __local\n                                      ",
            "  int64_t *) local_mem_78388)[squot64(warp_byte_offset_78386,\n                                                                            (int64_t) 8) +\n                                                                    sext_i32_i64(local_tid_78380)];\n                            if ((local_tid_78380 - squot32(local_tid_78380,\n                                                           32) * 32) == 0) {\n                                x_78442 = x_78443;\n                                flg_x_78445 = flg_y_78446;\n                            }\n                        }\n                        // in-block scan (hopefully no barriers needed)\n                        {\n                            skip_threads_78447 = 1;\n                            while (slt32(skip_threads_78447, 32)) {\n                                if (sle32(skip_threads_78447, local_tid_78380 -\n                                          squot32(local_tid_78380, 32) * 32)) {\n                                    // read operands\n                                    {\n                                        flg_x_78445 = ((volatile __local\n                                                        int8_t *) local_mem_78388)[sext_i32_i64(local_tid_78380) -\n                                                                                   sext_i32_i64(skip_threads_78447)];\n                                        x_78442 = ((volatile __local\n                                                    int64_t *) local_mem_78388)[squot64(warp_byte_offset_78386,\n                                                                                        (int64_t) 8) +\n                                                                                (sext_i32_i64(local_tid_78380) -\n                                                                                 sext_i32_i64(skip_threads_78447))];\n                                    }\n                                    // perform operation\n                                    {\n      ",
            "                                  if (flg_y_78446 == (int8_t) 2 ||\n                                            flg_y_78446 == (int8_t) 0) {\n                                            flg_x_78445 = flg_y_78446;\n                                            x_78442 = x_78443;\n                                        } else {\n                                            int64_t defunc_1_op_res_78444 =\n                                                    add64(x_78442, x_78443);\n                                            \n                                            x_78442 = defunc_1_op_res_78444;\n                                        }\n                                    }\n                                    // write result\n                                    {\n                                        ((volatile __local\n                                          int8_t *) local_mem_78388)[sext_i32_i64(local_tid_78380)] =\n                                            flg_x_78445;\n                                        flg_y_78446 = flg_x_78445;\n                                        ((volatile __local\n                                          int64_t *) local_mem_78388)[squot64(warp_byte_offset_78386,\n                                                                              (int64_t) 8) +\n                                                                      sext_i32_i64(local_tid_78380)] =\n                                            x_78442;\n                                        x_78443 = x_78442;\n                                    }\n                                }\n                                skip_threads_78447 *= 2;\n                            }\n                        }\n                    }\n                    flag_78441 = ((__local\n                                   int8_t *) local_mem_78388)[sext_i32_i64(wave_sizze_78382) -\n                                                              (int64_t) 1];\n                    aggr_78440 = ((__local\n              ",
            "                     int64_t *) local_mem_78388)[squot64(warp_byte_offset_78386,\n                                                                       (int64_t) 8) +\n                                                               (sext_i32_i64(wave_sizze_78382) -\n                                                                (int64_t) 1)];\n                    if (flag_78441 == (int8_t) 2) {\n                        readOffset_78438 = wave_sizze_78382 * -1;\n                    } else {\n                        if (flag_78441 == (int8_t) 1) {\n                            readOffset_78438 -= wave_sizze_78382;\n                        }\n                    }\n                    if (slt8((int8_t) 0, flag_78441)) {\n                        int64_t x_78448 = aggr_78440;\n                        int64_t x_78449 = prefix_78434;\n                        int64_t defunc_1_op_res_78450 = add64(x_78448, x_78449);\n                        \n                        prefix_78434 = defunc_1_op_res_78450;\n                    }\n                    mem_fence_local();\n                }\n            }\n            if (local_tid_78380 == 0) {\n                if (boundary_78398 == sext_i64_i32(segscan_group_sizze_67878 *\n                    (int64_t) 11)) {\n                    int64_t x_78451 = prefix_78434;\n                    int64_t x_78452 = acc_78421;\n                    int64_t defunc_1_op_res_78453 = add64(x_78451, x_78452);\n                    \n                    ((volatile __global\n                      int64_t *) incprefixes_mem_78365)[dynamic_id_78395] =\n                        defunc_1_op_res_78453;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_78361)[dynamic_id_78395] =\n                        (int8_t) 2;\n                }\n                ((__local\n                  int64_t *) local_mem_78388)[squot64(warp_byte_offset_78386,\n                                                      (int64_t) 8)] =\n           ",
            "         prefix_78434;\n                acc_78421 = (int64_t) 0;\n            }\n        }\n        if (!(dynamic_id_78395 == (int64_t) 0)) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            prefix_78434 = ((__local\n                             int64_t *) local_mem_78388)[squot64(warp_byte_offset_78386,\n                                                                 (int64_t) 8)];\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    // Distribute results\n    {\n        int64_t x_78454;\n        int64_t x_78455;\n        int64_t x_78457 = prefix_78434;\n        int64_t x_78458 = acc_78421;\n        \n        if (slt32(local_tid_78380 * 11, boundary_78398) &&\n            !block_new_sgm_78435) {\n            int64_t defunc_1_op_res_78459 = add64(x_78457, x_78458);\n            \n            x_78454 = defunc_1_op_res_78459;\n        } else {\n            x_78454 = acc_78421;\n        }\n        \n        int32_t stopping_point_78460 = segsizze_compact_78399 -\n                srem32(local_tid_78380 * 11 - 1 + segsizze_compact_78399 -\n                       boundary_78398, segsizze_compact_78399);\n        \n        for (int64_t i_78461 = 0; i_78461 < (int64_t) 11; i_78461++) {\n            if (slt32(sext_i64_i32(i_78461), stopping_point_78460 - 1)) {\n                x_78455 = private_mem_78400[i_78461];\n                \n                int64_t defunc_1_op_res_78456 = add64(x_78454, x_78455);\n                \n                private_mem_78400[i_78461] = defunc_1_op_res_78456;\n            }\n        }\n    }\n    // Transpose scan output and Write it to global memory in coalesced fashion\n    {\n        for (int64_t i_78462 = 0; i_78462 < (int64_t) 11; i_78462++) {\n            int64_t sharedIdx_78463 = sext_i32_i64(local_tid_78380 * 11) +\n                    i_78462;\n            int64_t tmp_78464;\n            \n            tmp_78464 = private_mem_78400[i_78462];\n            ((__local int64_t *) local_mem_78388)[sharedIdx_78463] = tmp_78464;\n        }\n        barrier(CLK_LOCAL_MEM_FENC",
            "E);\n        for (int64_t i_78465 = 0; i_78465 < (int64_t) 11; i_78465++) {\n            int64_t flat_idx_78466 = blockOff_78396 +\n                    segscan_group_sizze_67878 * i_78465 +\n                    sext_i32_i64(local_tid_78380);\n            int64_t slice_78467 = n_65378;\n            int64_t slice_78468 = m_65377 * slice_78467;\n            int64_t gtid_67882 = squot64(flat_idx_78466, slice_78467);\n            int64_t remnant_78469 = flat_idx_78466 - gtid_67882 * slice_78467;\n            int64_t gtid_67883 = remnant_78469;\n            int64_t remnant_78470 = remnant_78469 - gtid_67883;\n            \n            if (slt64(flat_idx_78466, m_65377 * n_65378)) {\n                int64_t tmp_78471;\n                \n                tmp_78471 = ((__local\n                              int64_t *) local_mem_78388)[flat_idx_78466 -\n                                                          blockOff_78396];\n                ((__global int64_t *) mem_77116)[gtid_67882 * n_65378 +\n                                                 gtid_67883] = tmp_78471;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // If this is the last block, reset the dynamicId\n    {\n        if (dynamic_id_78395 == sdiv_up64(m_65377 * n_65378,\n                                          segscan_group_sizze_67878 *\n                                          (int64_t) 11) - (int64_t) 1) {\n            ((__global int32_t *) mainziid_counter_mem_78359)[(int64_t) 0] = 0;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_67878\n}\n__kernel void mainzisegscan_69675(__global int *global_failure,\n                                  uint local_mem_78791_backing_offset_0,\n                                  int64_t m_65377, int64_t n_65378, __global\n                                  unsigned char *Y_mem_77010, __global\n                                  unsigned char *mem_77350, __global\n                                  unsigned char *mainziid_counter_mem_78774,\n               ",
            "                   __global\n                                  unsigned char *status_flags_mem_78776,\n                                  __global unsigned char *aggregates_mem_78778,\n                                  __global unsigned char *incprefixes_mem_78780)\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    volatile unsigned char *local_mem_78791_backing_0 =\n                           &shared_mem[local_mem_78791_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_78782;\n    int32_t local_tid_78783;\n    int64_t group_sizze_78786;\n    int32_t wave_sizze_78785;\n    int32_t group_tid_78784;\n    \n    global_tid_78782 = get_global_id(0);\n    local_tid_78783 = get_local_id(0);\n    group_sizze_78786 = get_local_size(0);\n    wave_sizze_78785 = LOCKSTEP_WIDTH;\n    group_tid_78784 = get_group_id(0);\n    \n    int32_t phys_tid_69675 = global_tid_78782;\n    int64_t byte_offsets_78787 = (int64_t) 0;\n    int64_t byte_offsets_78788 = segscan_group_sizze_69669 * (int64_t) 8;\n    int64_t warp_byte_offset_78789 = (int64_t) 32;\n    int64_t warp_byte_offset_78790 = (int64_t) 288;\n    \n    // Allocate reused shared memeory\n    { }\n    \n    __local unsigned char *local_mem_78791;\n    \n    local_mem_78791 = (__local unsigned char *) local_mem_78791_backing_0;\n    \n    int64_t trans_arr_len_78792 = (int64_t) 11 * segscan_group_sizze_69669;\n    int32_t dynamic_id_78798;\n    \n    if (local_tid_78783 == 0) {\n        dynamic_id_78798 = atomic_add_i32_global(&((volatile __global\n                                                    int *) mainziid_counter_mem_78774)[(int64_t) 0],\n                                                 (int) 1);\n        ((__local int32_t *) local_mem_78791)[(int64_t) 0] = dynamic_id_78798;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    dynamic_id_78798 = ((__local int32_t *) local_mem_78791)[(int64_t) 0];\n ",
            "   barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t blockOff_78799 = sext_i32_i64(dynamic_id_78798) * (int64_t) 11 *\n            segscan_group_sizze_69669;\n    int64_t sgm_idx_78800 = smod64(blockOff_78799, n_65378);\n    int32_t boundary_78801 = sext_i64_i32(smin64((int64_t) 11 *\n                                                 segscan_group_sizze_69669,\n                                                 n_65378 - sgm_idx_78800));\n    int32_t segsizze_compact_78802 = sext_i64_i32(smin64((int64_t) 11 *\n                                                         segscan_group_sizze_69669,\n                                                         n_65378));\n    int64_t private_mem_78803[(int64_t) 11];\n    \n    // Load and map\n    {\n        for (int64_t i_78805 = 0; i_78805 < (int64_t) 11; i_78805++) {\n            int64_t phys_tid_78806 = blockOff_78799 +\n                    sext_i32_i64(local_tid_78783) + i_78805 *\n                    segscan_group_sizze_69669;\n            int64_t slice_78807 = n_65378;\n            int64_t slice_78808 = m_65377 * slice_78807;\n            int64_t gtid_69673 = squot64(phys_tid_78806, slice_78807);\n            int64_t remnant_78809 = phys_tid_78806 - gtid_69673 * slice_78807;\n            int64_t gtid_69674 = remnant_78809;\n            int64_t remnant_78810 = remnant_78809 - gtid_69674;\n            \n            if (slt64(phys_tid_78806, m_65377 * 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",
            "                private_mem_78803[i_78805] = defunc_0_f_res_69683;\n            } else {\n                private_mem_78803[i_78805] = (int64_t) 0;\n            }\n        }\n    }\n    // Transpose scan inputs\n    {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_78811 = 0; i_78811 < (int64_t) 11; i_78811++) {\n            int64_t sharedIdx_78812 = sext_i32_i64(local_tid_78783) + i_78811 *\n                    segscan_group_sizze_69669;\n            int64_t tmp_78813;\n            \n            tmp_78813 = private_mem_78803[i_78811];\n            ((__local int64_t *) local_mem_78791)[sharedIdx_78812] = tmp_78813;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int32_t i_78814 = 0; i_78814 < 11; i_78814++) {\n            int32_t sharedIdx_78815 = local_tid_78783 * 11 + i_78814;\n            int64_t tmp_78816;\n            \n            tmp_78816 = ((__local\n                          int64_t *) local_mem_78791)[sext_i32_i64(sharedIdx_78815)];\n            private_mem_78803[sext_i32_i64(i_78814)] = tmp_78816;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // Per thread scan\n    {\n        int32_t gidx_78817 = local_tid_78783 * 11 + 1;\n        \n        for (int64_t i_78818 = 0; i_78818 < (int64_t) 10; i_78818++) {\n            bool new_sgm_78819 = smod32(gidx_78817 + sext_i64_i32(i_78818) -\n                                        boundary_78801,\n                                        segsizze_compact_78802) == 0;\n            \n            if (!new_sgm_78819) {\n                int64_t x_69676;\n                int64_t x_69677;\n                \n                x_69676 = private_mem_78803[i_78818];\n                x_69677 = private_mem_78803[i_78818 + (int64_t) 1];\n                \n                int64_t defunc_1_op_res_69678 = add64(x_69676, x_69677);\n                \n                private_mem_78803[i_78818 + (int64_t) 1] =\n                    defunc_1_op_res_69678;\n            }\n        }\n    }\n    // Publish results in shared memory\n    {\n        in",
            "t64_t tmp_78820;\n        \n        tmp_78820 = private_mem_78803[(int64_t) 10];\n        ((__local int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_78783)] =\n            tmp_78820;\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t acc_78824;\n    \n    // Scan results (with warp scan)\n    {\n        int64_t x_78821;\n        int64_t x_78822;\n        int64_t x_78825;\n        int64_t x_78826;\n        bool ltid_in_bounds_78828 = slt64(sext_i32_i64(local_tid_78783),\n                                          segscan_group_sizze_69669);\n        int32_t skip_threads_78829;\n        \n        // read input for in-block scan\n        {\n            if (ltid_in_bounds_78828) {\n                x_78822 = ((volatile __local\n                            int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                                (int64_t) 8) +\n                                                        sext_i32_i64(local_tid_78783)];\n                if ((local_tid_78783 - squot32(local_tid_78783, 32) * 32) ==\n                    0) {\n                    x_78821 = x_78822;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_78829 = 1;\n            while (slt32(skip_threads_78829, 32)) {\n                bool thread_active_78830 = sle32(skip_threads_78829,\n                                                 local_tid_78783 -\n                                                 squot32(local_tid_78783, 32) *\n                                                 32) && ltid_in_bounds_78828;\n                \n                if (thread_active_78830) {\n                    // read operands\n                    {\n                        x_78821 = ((volatile __local\n                                    int64_t *) local_mem_78791)[squot64(byte_of",
            "fsets_78787,\n                                                                        (int64_t) 8) +\n                                                                (sext_i32_i64(local_tid_78783) -\n                                                                 sext_i32_i64(skip_threads_78829))];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_78831 = slt32(smod32((local_tid_78783 + 1) *\n                                                       11 - 1 +\n                                                       segsizze_compact_78802 -\n                                                       boundary_78801,\n                                                       segsizze_compact_78802),\n                                                (local_tid_78783 + 1) * 11 - 1 -\n                                                ((local_tid_78783 -\n                                                  skip_threads_78829 + 1) * 11 -\n                                                 1));\n                    \n                    if (thread_active_78830 && inactive_78831) {\n                        x_78821 = x_78822;\n                    }\n                    if (thread_active_78830) {\n                        if (!inactive_78831) {\n                            int64_t defunc_1_op_res_78823 = add64(x_78821,\n                                                                  x_78822);\n                            \n                            x_78821 = defunc_1_op_res_78823;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_78785, skip_threads_78829)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_78830) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                    ",
            "                          (int64_t) 8) +\n                                                      sext_i32_i64(local_tid_78783)] =\n                            x_78821;\n                        x_78822 = x_78821;\n                    }\n                }\n                if (sle32(wave_sizze_78785, skip_threads_78829)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_78829 *= 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_78783 - squot32(local_tid_78783, 32) * 32) == 31 &&\n                ltid_in_bounds_78828) {\n                ((volatile __local\n                  int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(squot32(local_tid_78783,\n                                                                   32))] =\n                    x_78821;\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_78832;\n            \n            // read input for in-block scan\n            {\n                if (squot32(local_tid_78783, 32) == 0 && ltid_in_bounds_78828) {\n                    x_78826 = ((volatile __local\n                                int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                                    (int64_t) 8) +\n                                                            sext_i32_i64(local_tid_78783)];\n                    if ((local_tid_78783 - squot32(local_tid_78783, 32) * 32) ==\n                        0) {\n                        x_78825 = x_78826;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n    ",
            "            skip_threads_78832 = 1;\n                while (slt32(skip_threads_78832, 32)) {\n                    bool thread_active_78833 = sle32(skip_threads_78832,\n                                                     local_tid_78783 -\n                                                     squot32(local_tid_78783,\n                                                             32) * 32) &&\n                         (squot32(local_tid_78783, 32) == 0 &&\n                          ltid_in_bounds_78828);\n                    \n                    if (thread_active_78833) {\n                        // read operands\n                        {\n                            x_78825 = ((volatile __local\n                                        int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                                            (int64_t) 8) +\n                                                                    (sext_i32_i64(local_tid_78783) -\n                                                                     sext_i32_i64(skip_threads_78832))];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_78834 = slt32(smod32((local_tid_78783 *\n                                                            32 + 32 - 1 + 1) *\n                                                           11 - 1 +\n                                                           segsizze_compact_78802 -\n                                                           boundary_78801,\n                                                           segsizze_compact_78802),\n                                                    (local_tid_78783 * 32 + 32 -\n                                                     1 + 1) * 11 - 1 -\n                                                    (((local_tid_78783 -\n                                                       skip_threads_78832) *\n                                  ",
            "                    32 + 32 - 1 + 1) * 11 -\n                                                     1));\n                        \n                        if (thread_active_78833 && inactive_78834) {\n                            x_78825 = x_78826;\n                        }\n                        if (thread_active_78833) {\n                            if (!inactive_78834) {\n                                int64_t defunc_1_op_res_78827 = add64(x_78825,\n                                                                      x_78826);\n                                \n                                x_78825 = defunc_1_op_res_78827;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_78785, skip_threads_78832)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_78833) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                                  (int64_t) 8) +\n                                                          sext_i32_i64(local_tid_78783)] =\n                                x_78825;\n                            x_78826 = x_78825;\n                        }\n                    }\n                    if (sle32(wave_sizze_78785, skip_threads_78832)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_78832 *= 2;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        bool no_carry_in_78835 = squot32(local_tid_78783, 32) == 0 ||\n             !ltid_in_bounds_78828;\n        \n        // carry-in for every block except the first\n        {\n            // read operands\n            {\n                if (!no_carry_in_78835) {\n                    x_78822 = x_78821;\n          ",
            "          x_78821 = ((__local\n                                int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                                    (int64_t) 8) +\n                                                            (sext_i32_i64(squot32(local_tid_78783,\n                                                                                  32)) -\n                                                             (int64_t) 1)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_78836 = slt32(smod32((local_tid_78783 + 1) * 11 -\n                                                   1 + segsizze_compact_78802 -\n                                                   boundary_78801,\n                                                   segsizze_compact_78802),\n                                            (local_tid_78783 + 1) * 11 - 1 -\n                                            ((squot32(local_tid_78783, 32) *\n                                              32 - 1 + 1) * 11 - 1));\n                \n                if (!no_carry_in_78835) {\n                    if (inactive_78836) {\n                        x_78821 = x_78822;\n                    }\n                }\n                if (!no_carry_in_78835) {\n                    if (!inactive_78836) {\n                        int64_t defunc_1_op_res_78823 = add64(x_78821, x_78822);\n                        \n                        x_78821 = defunc_1_op_res_78823;\n                    }\n                }\n            }\n            // write final result\n            {\n                if (!no_carry_in_78835) {\n                    ((__local\n                      int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_78783)] =\n                        x_78821;\n                }\n            }\n        }\n        barrie",
            "r(CLK_LOCAL_MEM_FENCE);\n        // restore correct values for first block\n        {\n            if (squot32(local_tid_78783, 32) == 0 && ltid_in_bounds_78828) {\n                ((__local\n                  int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_78783)] =\n                    x_78822;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (local_tid_78783 == 0) {\n            acc_78824 = ((__local\n                          int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                              (int64_t) 8) +\n                                                      (segscan_group_sizze_69669 -\n                                                       (int64_t) 1)];\n        } else {\n            acc_78824 = ((__local\n                          int64_t *) local_mem_78791)[squot64(byte_offsets_78787,\n                                                              (int64_t) 8) +\n                                                      (sext_i32_i64(local_tid_78783) -\n                                                       (int64_t) 1)];\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t prefix_78837 = (int64_t) 0;\n    bool block_new_sgm_78838 = sgm_idx_78800 == (int64_t) 0;\n    \n    // Perform lookback\n    {\n        if (block_new_sgm_78838 && local_tid_78783 == 0) {\n            ((volatile __global\n              int64_t *) incprefixes_mem_78780)[dynamic_id_78798] = acc_78824;\n            mem_fence_global();\n            ((volatile __global\n              int8_t *) status_flags_mem_78776)[dynamic_id_78798] = (int8_t) 2;\n            acc_78824 = (int64_t) 0;\n        }\n        if (!block_new_sgm_78838 && slt32(local_tid_78783, wave_sizze_78785)) {\n            if (local_tid_78783 == 0) {\n                if (boundary_78801 ==",
            " sext_i64_i32(segscan_group_sizze_69669 *\n                    (int64_t) 11)) {\n                    ((volatile __global\n                      int64_t *) aggregates_mem_78778)[dynamic_id_78798] =\n                        acc_78824;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_78776)[dynamic_id_78798] =\n                        (int8_t) 1;\n                } else {\n                    ((volatile __global\n                      int64_t *) incprefixes_mem_78780)[dynamic_id_78798] =\n                        acc_78824;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_78776)[dynamic_id_78798] =\n                        (int8_t) 2;\n                }\n                \n                int8_t tmp_78839;\n                \n                tmp_78839 = ((volatile __global\n                              int8_t *) status_flags_mem_78776)[dynamic_id_78798 -\n                                                                (int64_t) 1];\n                ((volatile __local int8_t *) local_mem_78791)[(int64_t) 0] =\n                    tmp_78839;\n            }\n            mem_fence_local();\n            \n            int8_t status_78840;\n            \n            status_78840 = ((__local int8_t *) local_mem_78791)[(int64_t) 0];\n            if (status_78840 == (int8_t) 2) {\n                if (local_tid_78783 == 0) {\n                    prefix_78837 = ((volatile __global\n                                     int64_t *) incprefixes_mem_78780)[dynamic_id_78798 -\n                                                                       (int64_t) 1];\n                }\n            } else {\n                int32_t readOffset_78841 = dynamic_id_78798 -\n                        sext_i32_i64(wave_sizze_78785);\n                \n                while (slt32(wave_sizze_78785 * -1, readOffset_78841)) {\n                    int32_t read_i_78842 = readOffset_78841",
            " + local_tid_78783;\n                    int64_t aggr_78843 = (int64_t) 0;\n                    int8_t flag_78844 = (int8_t) 0;\n                    \n                    if (sle32(0, read_i_78842)) {\n                        if (sle64(blockOff_78799 - (sext_i32_i64(read_i_78842 +\n                                                    1) *\n                                                    segscan_group_sizze_69669 *\n                                                    (int64_t) 11 - (int64_t) 1),\n                                  sgm_idx_78800)) {\n                            flag_78844 = ((volatile __global\n                                           int8_t *) status_flags_mem_78776)[sext_i32_i64(read_i_78842)];\n                            if (flag_78844 == (int8_t) 2) {\n                                aggr_78843 = ((volatile __global\n                                               int64_t *) incprefixes_mem_78780)[sext_i32_i64(read_i_78842)];\n                            } else {\n                                if (flag_78844 == (int8_t) 1) {\n                                    aggr_78843 = ((volatile __global\n                                                   int64_t *) aggregates_mem_78778)[sext_i32_i64(read_i_78842)];\n                                }\n                            }\n                        } else {\n                            flag_78844 = (int8_t) 2;\n                        }\n                    }\n                    ((__local\n                      int64_t *) local_mem_78791)[squot64(warp_byte_offset_78789,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_78783)] =\n                        aggr_78843;\n                    ((__local\n                      int8_t *) local_mem_78791)[sext_i32_i64(local_tid_78783)] =\n                        flag_78844;\n                    flag_78844 = ((__local\n                                   int8_t *) local_mem_78791)[sext_i32_i64(",
            "wave_sizze_78785) -\n                                                              (int64_t) 1];\n                    if (slt8(flag_78844, (int8_t) 2)) {\n                        int8_t flg_x_78848;\n                        int8_t flg_y_78849;\n                        int64_t x_78845;\n                        int64_t x_78846;\n                        int32_t skip_threads_78850;\n                        \n                        // read input for in-block scan\n                        {\n                            flg_y_78849 = ((volatile __local\n                                            int8_t *) local_mem_78791)[sext_i32_i64(local_tid_78783)];\n                            x_78846 = ((volatile __local\n                                        int64_t *) local_mem_78791)[squot64(warp_byte_offset_78789,\n                                                                            (int64_t) 8) +\n                                                                    sext_i32_i64(local_tid_78783)];\n                            if ((local_tid_78783 - squot32(local_tid_78783,\n                                                           32) * 32) == 0) {\n                                x_78845 = x_78846;\n                                flg_x_78848 = flg_y_78849;\n                            }\n                        }\n                        // in-block scan (hopefully no barriers needed)\n                        {\n                            skip_threads_78850 = 1;\n                            while (slt32(skip_threads_78850, 32)) {\n                                if (sle32(skip_threads_78850, local_tid_78783 -\n                                          squot32(local_tid_78783, 32) * 32)) {\n                                    // read operands\n                                    {\n                                        flg_x_78848 = ((volatile __local\n                                                        int8_t *) local_mem_78791)[sext_i32_i64(local_tid_78783) -\n                               ",
            "                                                    sext_i32_i64(skip_threads_78850)];\n                                        x_78845 = ((volatile __local\n                                                    int64_t *) local_mem_78791)[squot64(warp_byte_offset_78789,\n                                                                                        (int64_t) 8) +\n                                                                                (sext_i32_i64(local_tid_78783) -\n                                                                                 sext_i32_i64(skip_threads_78850))];\n                                    }\n                                    // perform operation\n                                    {\n                                        if (flg_y_78849 == (int8_t) 2 ||\n                                            flg_y_78849 == (int8_t) 0) {\n                                            flg_x_78848 = flg_y_78849;\n                                            x_78845 = x_78846;\n                                        } else {\n                                            int64_t defunc_1_op_res_78847 =\n                                                    add64(x_78845, x_78846);\n                                            \n                                            x_78845 = defunc_1_op_res_78847;\n                                        }\n                                    }\n                                    // write result\n                                    {\n                                        ((volatile __local\n                                          int8_t *) local_mem_78791)[sext_i32_i64(local_tid_78783)] =\n                                            flg_x_78848;\n                                        flg_y_78849 = flg_x_78848;\n                                        ((volatile __local\n                                          int64_t *) local_mem_78791)[squot64(warp_byte_offset_78789,\n                                              ",
            "                                (int64_t) 8) +\n                                                                      sext_i32_i64(local_tid_78783)] =\n                                            x_78845;\n                                        x_78846 = x_78845;\n                                    }\n                                }\n                                skip_threads_78850 *= 2;\n                            }\n                        }\n                    }\n                    flag_78844 = ((__local\n                                   int8_t *) local_mem_78791)[sext_i32_i64(wave_sizze_78785) -\n                                                              (int64_t) 1];\n                    aggr_78843 = ((__local\n                                   int64_t *) local_mem_78791)[squot64(warp_byte_offset_78789,\n                                                                       (int64_t) 8) +\n                                                               (sext_i32_i64(wave_sizze_78785) -\n                                                                (int64_t) 1)];\n                    if (flag_78844 == (int8_t) 2) {\n                        readOffset_78841 = wave_sizze_78785 * -1;\n                    } else {\n                        if (flag_78844 == (int8_t) 1) {\n                            readOffset_78841 -= wave_sizze_78785;\n                        }\n                    }\n                    if (slt8((int8_t) 0, flag_78844)) {\n                        int64_t x_78851 = aggr_78843;\n                        int64_t x_78852 = prefix_78837;\n                        int64_t defunc_1_op_res_78853 = add64(x_78851, x_78852);\n                        \n                        prefix_78837 = defunc_1_op_res_78853;\n                    }\n                    mem_fence_local();\n                }\n            }\n            if (local_tid_78783 == 0) {\n                if (boundary_78801 == sext_i64_i32(segscan_group_sizze_69669 *\n                    (int64_t) 11)) {\n                 ",
            "   int64_t x_78854 = prefix_78837;\n                    int64_t x_78855 = acc_78824;\n                    int64_t defunc_1_op_res_78856 = add64(x_78854, x_78855);\n                    \n                    ((volatile __global\n                      int64_t *) incprefixes_mem_78780)[dynamic_id_78798] =\n                        defunc_1_op_res_78856;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_78776)[dynamic_id_78798] =\n                        (int8_t) 2;\n                }\n                ((__local\n                  int64_t *) local_mem_78791)[squot64(warp_byte_offset_78789,\n                                                      (int64_t) 8)] =\n                    prefix_78837;\n                acc_78824 = (int64_t) 0;\n            }\n        }\n        if (!(dynamic_id_78798 == (int64_t) 0)) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            prefix_78837 = ((__local\n                             int64_t *) local_mem_78791)[squot64(warp_byte_offset_78789,\n                                                                 (int64_t) 8)];\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    // Distribute results\n    {\n        int64_t x_78857;\n        int64_t x_78858;\n        int64_t x_78860 = prefix_78837;\n        int64_t x_78861 = acc_78824;\n        \n        if (slt32(local_tid_78783 * 11, boundary_78801) &&\n            !block_new_sgm_78838) {\n            int64_t defunc_1_op_res_78862 = add64(x_78860, x_78861);\n            \n            x_78857 = defunc_1_op_res_78862;\n        } else {\n            x_78857 = acc_78824;\n        }\n        \n        int32_t stopping_point_78863 = segsizze_compact_78802 -\n                srem32(local_tid_78783 * 11 - 1 + segsizze_compact_78802 -\n                       boundary_78801, segsizze_compact_78802);\n        \n        for (int64_t i_78864 = 0; i_78864 < (int64_t) 11; i_78864++) {\n            if (slt32(sext_i64_i32(i_78864), stopping_point_78863 - 1)) {\n",
            "                x_78858 = private_mem_78803[i_78864];\n                \n                int64_t defunc_1_op_res_78859 = add64(x_78857, x_78858);\n                \n                private_mem_78803[i_78864] = defunc_1_op_res_78859;\n            }\n        }\n    }\n    // Transpose scan output and Write it to global memory in coalesced fashion\n    {\n        for (int64_t i_78865 = 0; i_78865 < (int64_t) 11; i_78865++) {\n            int64_t sharedIdx_78866 = sext_i32_i64(local_tid_78783 * 11) +\n                    i_78865;\n            int64_t tmp_78867;\n            \n            tmp_78867 = private_mem_78803[i_78865];\n            ((__local int64_t *) local_mem_78791)[sharedIdx_78866] = tmp_78867;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_78868 = 0; i_78868 < (int64_t) 11; i_78868++) {\n            int64_t flat_idx_78869 = blockOff_78799 +\n                    segscan_group_sizze_69669 * i_78868 +\n                    sext_i32_i64(local_tid_78783);\n            int64_t slice_78870 = n_65378;\n            int64_t slice_78871 = m_65377 * slice_78870;\n            int64_t gtid_69673 = squot64(flat_idx_78869, slice_78870);\n            int64_t remnant_78872 = flat_idx_78869 - gtid_69673 * slice_78870;\n            int64_t gtid_69674 = remnant_78872;\n            int64_t remnant_78873 = remnant_78872 - gtid_69674;\n            \n            if (slt64(flat_idx_78869, m_65377 * n_65378)) {\n                int64_t tmp_78874;\n                \n                tmp_78874 = ((__local\n                              int64_t *) local_mem_78791)[flat_idx_78869 -\n                                                          blockOff_78799];\n                ((__global int64_t *) mem_77350)[gtid_69673 * n_65378 +\n                                                 gtid_69674] = tmp_78874;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // If this is the last block, reset the dynamicId\n    {\n        if (dynamic_id_78798 == sdiv_up64(m_65377 * n_65378,\n            ",
            "                              segscan_group_sizze_69669 *\n                                          (int64_t) 11) - (int64_t) 1) {\n            ((__global int32_t *) mainziid_counter_mem_78774)[(int64_t) 0] = 0;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_69669\n}\n__kernel void mainzisegscan_71714(__global int *global_failure,\n                                  uint local_mem_79246_backing_offset_0,\n                                  int64_t m_65377, int64_t n_65378, __global\n                                  unsigned char *Y_mem_77010, __global\n                                  unsigned char *mem_77642, __global\n                                  unsigned char *mainziid_counter_mem_79229,\n                                  __global\n                                  unsigned char *status_flags_mem_79231,\n                                  __global unsigned char *aggregates_mem_79233,\n                                  __global unsigned char *incprefixes_mem_79235)\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    volatile unsigned char *local_mem_79246_backing_0 =\n                           &shared_mem[local_mem_79246_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79237;\n    int32_t local_tid_79238;\n    int64_t group_sizze_79241;\n    int32_t wave_sizze_79240;\n    int32_t group_tid_79239;\n    \n    global_tid_79237 = get_global_id(0);\n    local_tid_79238 = get_local_id(0);\n    group_sizze_79241 = get_local_size(0);\n    wave_sizze_79240 = LOCKSTEP_WIDTH;\n    group_tid_79239 = get_group_id(0);\n    \n    int32_t phys_tid_71714 = global_tid_79237;\n    int64_t byte_offsets_79242 = (int64_t) 0;\n    int64_t byte_offsets_79243 = segscan_group_sizze_71708 * (int64_t) 8;\n    int64_t warp_byte_offset_79244 = (int64_t) 32;\n    int64_t warp_byte_offset_79245 = (int64_t) 288;\n    \n    // A",
            "llocate reused shared memeory\n    { }\n    \n    __local unsigned char *local_mem_79246;\n    \n    local_mem_79246 = (__local unsigned char *) local_mem_79246_backing_0;\n    \n    int64_t trans_arr_len_79247 = (int64_t) 11 * segscan_group_sizze_71708;\n    int32_t dynamic_id_79253;\n    \n    if (local_tid_79238 == 0) {\n        dynamic_id_79253 = atomic_add_i32_global(&((volatile __global\n                                                    int *) mainziid_counter_mem_79229)[(int64_t) 0],\n                                                 (int) 1);\n        ((__local int32_t *) local_mem_79246)[(int64_t) 0] = dynamic_id_79253;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    dynamic_id_79253 = ((__local int32_t *) local_mem_79246)[(int64_t) 0];\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t blockOff_79254 = sext_i32_i64(dynamic_id_79253) * (int64_t) 11 *\n            segscan_group_sizze_71708;\n    int64_t sgm_idx_79255 = smod64(blockOff_79254, n_65378);\n    int32_t boundary_79256 = sext_i64_i32(smin64((int64_t) 11 *\n                                                 segscan_group_sizze_71708,\n                                                 n_65378 - sgm_idx_79255));\n    int32_t segsizze_compact_79257 = sext_i64_i32(smin64((int64_t) 11 *\n                                                         segscan_group_sizze_71708,\n                                                         n_65378));\n    int64_t private_mem_79258[(int64_t) 11];\n    \n    // Load and map\n    {\n        for (int64_t i_79260 = 0; i_79260 < (int64_t) 11; i_79260++) {\n            int64_t phys_tid_79261 = blockOff_79254 +\n                    sext_i32_i64(local_tid_79238) + i_79260 *\n                    segscan_group_sizze_71708;\n            int64_t slice_79262 = n_65378;\n            int64_t slice_79263 = m_65377 * slice_79262;\n            int64_t gtid_71712 = squot64(phys_tid_79261, slice_79262);\n            int64_t remnant_79264 = phys_tid_79261 - gtid_71712 * slice_79262;\n            int64_t gtid_71713 = remnant_7926",
            "4;\n            int64_t remnant_79265 = remnant_79264 - gtid_71713;\n            \n            if (slt64(phys_tid_79261, m_65377 * 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                private_mem_79258[i_79260] = defunc_0_f_res_71722;\n            } else {\n                private_mem_79258[i_79260] = (int64_t) 0;\n            }\n        }\n    }\n    // Transpose scan inputs\n    {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_79266 = 0; i_79266 < (int64_t) 11; i_79266++) {\n            int64_t sharedIdx_79267 = sext_i32_i64(local_tid_79238) + i_79266 *\n                    segscan_group_sizze_71708;\n            int64_t tmp_79268;\n            \n            tmp_79268 = private_mem_79258[i_79266];\n            ((__local int64_t *) local_mem_79246)[sharedIdx_79267] = tmp_79268;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int32_t i_79269 = 0; i_79269 < 11; i_79269++) {\n            int32_t sharedIdx_79270 = local_tid_79238 * 11 + i_79269;\n            int64_t tmp_79271;\n            \n            tmp_79271 = ((__local\n                          int64_t *) local_mem_79246)[sext_i32_i64(sharedIdx_79270)];\n            private_mem_79258[sext_i32_i64(i_79269)] = tmp_79271;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // Per thread scan\n    {\n        int32_t gidx_79272 = local_tid_79238 * 11 + 1;\n        \n        for (int64_t i_79273 = 0; i_79273 < (int64_t) 10; i_79273++) {\n          ",
            "  bool new_sgm_79274 = smod32(gidx_79272 + sext_i64_i32(i_79273) -\n                                        boundary_79256,\n                                        segsizze_compact_79257) == 0;\n            \n            if (!new_sgm_79274) {\n                int64_t x_71715;\n                int64_t x_71716;\n                \n                x_71715 = private_mem_79258[i_79273];\n                x_71716 = private_mem_79258[i_79273 + (int64_t) 1];\n                \n                int64_t defunc_1_op_res_71717 = add64(x_71715, x_71716);\n                \n                private_mem_79258[i_79273 + (int64_t) 1] =\n                    defunc_1_op_res_71717;\n            }\n        }\n    }\n    // Publish results in shared memory\n    {\n        int64_t tmp_79275;\n        \n        tmp_79275 = private_mem_79258[(int64_t) 10];\n        ((__local int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_79238)] =\n            tmp_79275;\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t acc_79279;\n    \n    // Scan results (with warp scan)\n    {\n        int64_t x_79276;\n        int64_t x_79277;\n        int64_t x_79280;\n        int64_t x_79281;\n        bool ltid_in_bounds_79283 = slt64(sext_i32_i64(local_tid_79238),\n                                          segscan_group_sizze_71708);\n        int32_t skip_threads_79284;\n        \n        // read input for in-block scan\n        {\n            if (ltid_in_bounds_79283) {\n                x_79277 = ((volatile __local\n                            int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                                (int64_t) 8) +\n                                                        sext_i32_i64(local_tid_79238)];\n                if ((local_tid_79238 - squot32(local_tid_79238, 32) * 32) ==\n                    0) {\n                    x_79276 = x_79277;\n ",
            "               }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_79284 = 1;\n            while (slt32(skip_threads_79284, 32)) {\n                bool thread_active_79285 = sle32(skip_threads_79284,\n                                                 local_tid_79238 -\n                                                 squot32(local_tid_79238, 32) *\n                                                 32) && ltid_in_bounds_79283;\n                \n                if (thread_active_79285) {\n                    // read operands\n                    {\n                        x_79276 = ((volatile __local\n                                    int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                                        (int64_t) 8) +\n                                                                (sext_i32_i64(local_tid_79238) -\n                                                                 sext_i32_i64(skip_threads_79284))];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79286 = slt32(smod32((local_tid_79238 + 1) *\n                                                       11 - 1 +\n                                                       segsizze_compact_79257 -\n                                                       boundary_79256,\n                                                       segsizze_compact_79257),\n                                                (local_tid_79238 + 1) * 11 - 1 -\n                                                ((local_tid_79238 -\n                                                  skip_threads_79284 + 1) * 11 -\n                                                 1));\n                    \n                    if (thread_active_79285 && inactive_79286) {\n                        x_79276 = x_79277;\n                    }\n                    if (thread_active_79285) {\n           ",
            "             if (!inactive_79286) {\n                            int64_t defunc_1_op_res_79278 = add64(x_79276,\n                                                                  x_79277);\n                            \n                            x_79276 = defunc_1_op_res_79278;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_79240, skip_threads_79284)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_79285) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                              (int64_t) 8) +\n                                                      sext_i32_i64(local_tid_79238)] =\n                            x_79276;\n                        x_79277 = x_79276;\n                    }\n                }\n                if (sle32(wave_sizze_79240, skip_threads_79284)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_79284 *= 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_79238 - squot32(local_tid_79238, 32) * 32) == 31 &&\n                ltid_in_bounds_79283) {\n                ((volatile __local\n                  int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(squot32(local_tid_79238,\n                                                                   32))] =\n                    x_79276;\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_79287;\n         ",
            "   \n            // read input for in-block scan\n            {\n                if (squot32(local_tid_79238, 32) == 0 && ltid_in_bounds_79283) {\n                    x_79281 = ((volatile __local\n                                int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                                    (int64_t) 8) +\n                                                            sext_i32_i64(local_tid_79238)];\n                    if ((local_tid_79238 - squot32(local_tid_79238, 32) * 32) ==\n                        0) {\n                        x_79280 = x_79281;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_79287 = 1;\n                while (slt32(skip_threads_79287, 32)) {\n                    bool thread_active_79288 = sle32(skip_threads_79287,\n                                                     local_tid_79238 -\n                                                     squot32(local_tid_79238,\n                                                             32) * 32) &&\n                         (squot32(local_tid_79238, 32) == 0 &&\n                          ltid_in_bounds_79283);\n                    \n                    if (thread_active_79288) {\n                        // read operands\n                        {\n                            x_79280 = ((volatile __local\n                                        int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                                            (int64_t) 8) +\n                                                                    (sext_i32_i64(local_tid_79238) -\n                                                                     sext_i32_i64(skip_threads_79287))];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79289 = slt32(smod32((loca",
            "l_tid_79238 *\n                                                            32 + 32 - 1 + 1) *\n                                                           11 - 1 +\n                                                           segsizze_compact_79257 -\n                                                           boundary_79256,\n                                                           segsizze_compact_79257),\n                                                    (local_tid_79238 * 32 + 32 -\n                                                     1 + 1) * 11 - 1 -\n                                                    (((local_tid_79238 -\n                                                       skip_threads_79287) *\n                                                      32 + 32 - 1 + 1) * 11 -\n                                                     1));\n                        \n                        if (thread_active_79288 && inactive_79289) {\n                            x_79280 = x_79281;\n                        }\n                        if (thread_active_79288) {\n                            if (!inactive_79289) {\n                                int64_t defunc_1_op_res_79282 = add64(x_79280,\n                                                                      x_79281);\n                                \n                                x_79280 = defunc_1_op_res_79282;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_79240, skip_threads_79287)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_79288) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                                  (int64_t) 8) +\n                                                          sext_i32_i64(local_tid",
            "_79238)] =\n                                x_79280;\n                            x_79281 = x_79280;\n                        }\n                    }\n                    if (sle32(wave_sizze_79240, skip_threads_79287)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_79287 *= 2;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        bool no_carry_in_79290 = squot32(local_tid_79238, 32) == 0 ||\n             !ltid_in_bounds_79283;\n        \n        // carry-in for every block except the first\n        {\n            // read operands\n            {\n                if (!no_carry_in_79290) {\n                    x_79277 = x_79276;\n                    x_79276 = ((__local\n                                int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                                    (int64_t) 8) +\n                                                            (sext_i32_i64(squot32(local_tid_79238,\n                                                                                  32)) -\n                                                             (int64_t) 1)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_79291 = slt32(smod32((local_tid_79238 + 1) * 11 -\n                                                   1 + segsizze_compact_79257 -\n                                                   boundary_79256,\n                                                   segsizze_compact_79257),\n                                            (local_tid_79238 + 1) * 11 - 1 -\n                                            ((squot32(local_tid_79238, 32) *\n                                              32 - 1 + 1) * 11 - 1));\n                \n                if (!no_carry_in_79290) {\n                    if (inactive_79291) {\n                        x_79276 = x_79277;\n                    }\n                }\n     ",
            "           if (!no_carry_in_79290) {\n                    if (!inactive_79291) {\n                        int64_t defunc_1_op_res_79278 = add64(x_79276, x_79277);\n                        \n                        x_79276 = defunc_1_op_res_79278;\n                    }\n                }\n            }\n            // write final result\n            {\n                if (!no_carry_in_79290) {\n                    ((__local\n                      int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_79238)] =\n                        x_79276;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // restore correct values for first block\n        {\n            if (squot32(local_tid_79238, 32) == 0 && ltid_in_bounds_79283) {\n                ((__local\n                  int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_79238)] =\n                    x_79277;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (local_tid_79238 == 0) {\n            acc_79279 = ((__local\n                          int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                              (int64_t) 8) +\n                                                      (segscan_group_sizze_71708 -\n                                                       (int64_t) 1)];\n        } else {\n            acc_79279 = ((__local\n                          int64_t *) local_mem_79246)[squot64(byte_offsets_79242,\n                                                              (int64_t) 8) +\n                                                      (sext_i32_i64(local_tid_79238) -\n                                           ",
            "            (int64_t) 1)];\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t prefix_79292 = (int64_t) 0;\n    bool block_new_sgm_79293 = sgm_idx_79255 == (int64_t) 0;\n    \n    // Perform lookback\n    {\n        if (block_new_sgm_79293 && local_tid_79238 == 0) {\n            ((volatile __global\n              int64_t *) incprefixes_mem_79235)[dynamic_id_79253] = acc_79279;\n            mem_fence_global();\n            ((volatile __global\n              int8_t *) status_flags_mem_79231)[dynamic_id_79253] = (int8_t) 2;\n            acc_79279 = (int64_t) 0;\n        }\n        if (!block_new_sgm_79293 && slt32(local_tid_79238, wave_sizze_79240)) {\n            if (local_tid_79238 == 0) {\n                if (boundary_79256 == sext_i64_i32(segscan_group_sizze_71708 *\n                    (int64_t) 11)) {\n                    ((volatile __global\n                      int64_t *) aggregates_mem_79233)[dynamic_id_79253] =\n                        acc_79279;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79231)[dynamic_id_79253] =\n                        (int8_t) 1;\n                } else {\n                    ((volatile __global\n                      int64_t *) incprefixes_mem_79235)[dynamic_id_79253] =\n                        acc_79279;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79231)[dynamic_id_79253] =\n                        (int8_t) 2;\n                }\n                \n                int8_t tmp_79294;\n                \n                tmp_79294 = ((volatile __global\n                              int8_t *) status_flags_mem_79231)[dynamic_id_79253 -\n                                                                (int64_t) 1];\n                ((volatile __local int8_t *) local_mem_79246)[(int64_t) 0] =\n                    tmp_79294;\n            }\n            mem_fence_local();\n            \n          ",
            "  int8_t status_79295;\n            \n            status_79295 = ((__local int8_t *) local_mem_79246)[(int64_t) 0];\n            if (status_79295 == (int8_t) 2) {\n                if (local_tid_79238 == 0) {\n                    prefix_79292 = ((volatile __global\n                                     int64_t *) incprefixes_mem_79235)[dynamic_id_79253 -\n                                                                       (int64_t) 1];\n                }\n            } else {\n                int32_t readOffset_79296 = dynamic_id_79253 -\n                        sext_i32_i64(wave_sizze_79240);\n                \n                while (slt32(wave_sizze_79240 * -1, readOffset_79296)) {\n                    int32_t read_i_79297 = readOffset_79296 + local_tid_79238;\n                    int64_t aggr_79298 = (int64_t) 0;\n                    int8_t flag_79299 = (int8_t) 0;\n                    \n                    if (sle32(0, read_i_79297)) {\n                        if (sle64(blockOff_79254 - (sext_i32_i64(read_i_79297 +\n                                                    1) *\n                                                    segscan_group_sizze_71708 *\n                                                    (int64_t) 11 - (int64_t) 1),\n                                  sgm_idx_79255)) {\n                            flag_79299 = ((volatile __global\n                                           int8_t *) status_flags_mem_79231)[sext_i32_i64(read_i_79297)];\n                            if (flag_79299 == (int8_t) 2) {\n                                aggr_79298 = ((volatile __global\n                                               int64_t *) incprefixes_mem_79235)[sext_i32_i64(read_i_79297)];\n                            } else {\n                                if (flag_79299 == (int8_t) 1) {\n                                    aggr_79298 = ((volatile __global\n                                                   int64_t *) aggregates_mem_79233)[sext_i32_i64(read_i_79297)];\n                            ",
            "    }\n                            }\n                        } else {\n                            flag_79299 = (int8_t) 2;\n                        }\n                    }\n                    ((__local\n                      int64_t *) local_mem_79246)[squot64(warp_byte_offset_79244,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_79238)] =\n                        aggr_79298;\n                    ((__local\n                      int8_t *) local_mem_79246)[sext_i32_i64(local_tid_79238)] =\n                        flag_79299;\n                    flag_79299 = ((__local\n                                   int8_t *) local_mem_79246)[sext_i32_i64(wave_sizze_79240) -\n                                                              (int64_t) 1];\n                    if (slt8(flag_79299, (int8_t) 2)) {\n                        int8_t flg_x_79303;\n                        int8_t flg_y_79304;\n                        int64_t x_79300;\n                        int64_t x_79301;\n                        int32_t skip_threads_79305;\n                        \n                        // read input for in-block scan\n                        {\n                            flg_y_79304 = ((volatile __local\n                                            int8_t *) local_mem_79246)[sext_i32_i64(local_tid_79238)];\n                            x_79301 = ((volatile __local\n                                        int64_t *) local_mem_79246)[squot64(warp_byte_offset_79244,\n                                                                            (int64_t) 8) +\n                                                                    sext_i32_i64(local_tid_79238)];\n                            if ((local_tid_79238 - squot32(local_tid_79238,\n                                                           32) * 32) == 0) {\n                                x_79300 = x_79301;\n                                flg_x_79303 = flg_y_79304;\n    ",
            "                        }\n                        }\n                        // in-block scan (hopefully no barriers needed)\n                        {\n                            skip_threads_79305 = 1;\n                            while (slt32(skip_threads_79305, 32)) {\n                                if (sle32(skip_threads_79305, local_tid_79238 -\n                                          squot32(local_tid_79238, 32) * 32)) {\n                                    // read operands\n                                    {\n                                        flg_x_79303 = ((volatile __local\n                                                        int8_t *) local_mem_79246)[sext_i32_i64(local_tid_79238) -\n                                                                                   sext_i32_i64(skip_threads_79305)];\n                                        x_79300 = ((volatile __local\n                                                    int64_t *) local_mem_79246)[squot64(warp_byte_offset_79244,\n                                                                                        (int64_t) 8) +\n                                                                                (sext_i32_i64(local_tid_79238) -\n                                                                                 sext_i32_i64(skip_threads_79305))];\n                                    }\n                                    // perform operation\n                                    {\n                                        if (flg_y_79304 == (int8_t) 2 ||\n                                            flg_y_79304 == (int8_t) 0) {\n                                            flg_x_79303 = flg_y_79304;\n                                            x_79300 = x_79301;\n                                        } else {\n                                            int64_t defunc_1_op_res_79302 =\n                                                    add64(x_79300, x_79301);\n                                            ",
            "\n                                            x_79300 = defunc_1_op_res_79302;\n                                        }\n                                    }\n                                    // write result\n                                    {\n                                        ((volatile __local\n                                          int8_t *) local_mem_79246)[sext_i32_i64(local_tid_79238)] =\n                                            flg_x_79303;\n                                        flg_y_79304 = flg_x_79303;\n                                        ((volatile __local\n                                          int64_t *) local_mem_79246)[squot64(warp_byte_offset_79244,\n                                                                              (int64_t) 8) +\n                                                                      sext_i32_i64(local_tid_79238)] =\n                                            x_79300;\n                                        x_79301 = x_79300;\n                                    }\n                                }\n                                skip_threads_79305 *= 2;\n                            }\n                        }\n                    }\n                    flag_79299 = ((__local\n                                   int8_t *) local_mem_79246)[sext_i32_i64(wave_sizze_79240) -\n                                                              (int64_t) 1];\n                    aggr_79298 = ((__local\n                                   int64_t *) local_mem_79246)[squot64(warp_byte_offset_79244,\n                                                                       (int64_t) 8) +\n                                                               (sext_i32_i64(wave_sizze_79240) -\n                                                                (int64_t) 1)];\n                    if (flag_79299 == (int8_t) 2) {\n                        readOffset_79296 = wave_sizze_79240 * -1;\n                    } else {\n                        if (fl",
            "ag_79299 == (int8_t) 1) {\n                            readOffset_79296 -= wave_sizze_79240;\n                        }\n                    }\n                    if (slt8((int8_t) 0, flag_79299)) {\n                        int64_t x_79306 = aggr_79298;\n                        int64_t x_79307 = prefix_79292;\n                        int64_t defunc_1_op_res_79308 = add64(x_79306, x_79307);\n                        \n                        prefix_79292 = defunc_1_op_res_79308;\n                    }\n                    mem_fence_local();\n                }\n            }\n            if (local_tid_79238 == 0) {\n                if (boundary_79256 == sext_i64_i32(segscan_group_sizze_71708 *\n                    (int64_t) 11)) {\n                    int64_t x_79309 = prefix_79292;\n                    int64_t x_79310 = acc_79279;\n                    int64_t defunc_1_op_res_79311 = add64(x_79309, x_79310);\n                    \n                    ((volatile __global\n                      int64_t *) incprefixes_mem_79235)[dynamic_id_79253] =\n                        defunc_1_op_res_79311;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79231)[dynamic_id_79253] =\n                        (int8_t) 2;\n                }\n                ((__local\n                  int64_t *) local_mem_79246)[squot64(warp_byte_offset_79244,\n                                                      (int64_t) 8)] =\n                    prefix_79292;\n                acc_79279 = (int64_t) 0;\n            }\n        }\n        if (!(dynamic_id_79253 == (int64_t) 0)) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            prefix_79292 = ((__local\n                             int64_t *) local_mem_79246)[squot64(warp_byte_offset_79244,\n                                                                 (int64_t) 8)];\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    // Distribute results\n    {\n        int64_t x_79312;\n        int64_t x_7",
            "9313;\n        int64_t x_79315 = prefix_79292;\n        int64_t x_79316 = acc_79279;\n        \n        if (slt32(local_tid_79238 * 11, boundary_79256) &&\n            !block_new_sgm_79293) {\n            int64_t defunc_1_op_res_79317 = add64(x_79315, x_79316);\n            \n            x_79312 = defunc_1_op_res_79317;\n        } else {\n            x_79312 = acc_79279;\n        }\n        \n        int32_t stopping_point_79318 = segsizze_compact_79257 -\n                srem32(local_tid_79238 * 11 - 1 + segsizze_compact_79257 -\n                       boundary_79256, segsizze_compact_79257);\n        \n        for (int64_t i_79319 = 0; i_79319 < (int64_t) 11; i_79319++) {\n            if (slt32(sext_i64_i32(i_79319), stopping_point_79318 - 1)) {\n                x_79313 = private_mem_79258[i_79319];\n                \n                int64_t defunc_1_op_res_79314 = add64(x_79312, x_79313);\n                \n                private_mem_79258[i_79319] = defunc_1_op_res_79314;\n            }\n        }\n    }\n    // Transpose scan output and Write it to global memory in coalesced fashion\n    {\n        for (int64_t i_79320 = 0; i_79320 < (int64_t) 11; i_79320++) {\n            int64_t sharedIdx_79321 = sext_i32_i64(local_tid_79238 * 11) +\n                    i_79320;\n            int64_t tmp_79322;\n            \n            tmp_79322 = private_mem_79258[i_79320];\n            ((__local int64_t *) local_mem_79246)[sharedIdx_79321] = tmp_79322;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_79323 = 0; i_79323 < (int64_t) 11; i_79323++) {\n            int64_t flat_idx_79324 = blockOff_79254 +\n                    segscan_group_sizze_71708 * i_79323 +\n                    sext_i32_i64(local_tid_79238);\n            int64_t slice_79325 = n_65378;\n            int64_t slice_79326 = m_65377 * slice_79325;\n            int64_t gtid_71712 = squot64(flat_idx_79324, slice_79325);\n            int64_t remnant_79327 = flat_idx_79324 - gtid_71712 * slice_79325;\n            int64_t gtid_71713 =",
            " remnant_79327;\n            int64_t remnant_79328 = remnant_79327 - gtid_71713;\n            \n            if (slt64(flat_idx_79324, m_65377 * n_65378)) {\n                int64_t tmp_79329;\n                \n                tmp_79329 = ((__local\n                              int64_t *) local_mem_79246)[flat_idx_79324 -\n                                                          blockOff_79254];\n                ((__global int64_t *) mem_77642)[gtid_71712 * n_65378 +\n                                                 gtid_71713] = tmp_79329;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // If this is the last block, reset the dynamicId\n    {\n        if (dynamic_id_79253 == sdiv_up64(m_65377 * n_65378,\n                                          segscan_group_sizze_71708 *\n                                          (int64_t) 11) - (int64_t) 1) {\n            ((__global int32_t *) mainziid_counter_mem_79229)[(int64_t) 0] = 0;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_71708\n}\n__kernel void mainzisegscan_72699(__global int *global_failure,\n                                  uint local_mem_79701_backing_offset_0,\n                                  int64_t m_65377, int64_t n_65378, __global\n                                  unsigned char *Y_mem_77010, __global\n                                  unsigned char *mem_77867, __global\n                                  unsigned char *mainziid_counter_mem_79684,\n                                  __global\n                                  unsigned char *status_flags_mem_79686,\n                                  __global unsigned char *aggregates_mem_79688,\n                                  __global unsigned char *incprefixes_mem_79690)\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    volatile unsigned char *local_mem_79701_backing_0 =\n                           &share",
            "d_mem[local_mem_79701_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79692;\n    int32_t local_tid_79693;\n    int64_t group_sizze_79696;\n    int32_t wave_sizze_79695;\n    int32_t group_tid_79694;\n    \n    global_tid_79692 = get_global_id(0);\n    local_tid_79693 = get_local_id(0);\n    group_sizze_79696 = get_local_size(0);\n    wave_sizze_79695 = LOCKSTEP_WIDTH;\n    group_tid_79694 = get_group_id(0);\n    \n    int32_t phys_tid_72699 = global_tid_79692;\n    int64_t byte_offsets_79697 = (int64_t) 0;\n    int64_t byte_offsets_79698 = segscan_group_sizze_72693 * (int64_t) 8;\n    int64_t warp_byte_offset_79699 = (int64_t) 32;\n    int64_t warp_byte_offset_79700 = (int64_t) 288;\n    \n    // Allocate reused shared memeory\n    { }\n    \n    __local unsigned char *local_mem_79701;\n    \n    local_mem_79701 = (__local unsigned char *) local_mem_79701_backing_0;\n    \n    int64_t trans_arr_len_79702 = (int64_t) 11 * segscan_group_sizze_72693;\n    int32_t dynamic_id_79708;\n    \n    if (local_tid_79693 == 0) {\n        dynamic_id_79708 = atomic_add_i32_global(&((volatile __global\n                                                    int *) mainziid_counter_mem_79684)[(int64_t) 0],\n                                                 (int) 1);\n        ((__local int32_t *) local_mem_79701)[(int64_t) 0] = dynamic_id_79708;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    dynamic_id_79708 = ((__local int32_t *) local_mem_79701)[(int64_t) 0];\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t blockOff_79709 = sext_i32_i64(dynamic_id_79708) * (int64_t) 11 *\n            segscan_group_sizze_72693;\n    int64_t sgm_idx_79710 = smod64(blockOff_79709, n_65378);\n    int32_t boundary_79711 = sext_i64_i32(smin64((int64_t) 11 *\n                                                 segscan_group_sizze_72693,\n                                                 n_65378 - sgm_idx_79710));\n    int32_t segsizze_compact_79712 = sext_i64_i32(smin64((int64_t) 11 *\n                 ",
            "                                        segscan_group_sizze_72693,\n                                                         n_65378));\n    int64_t private_mem_79713[(int64_t) 11];\n    \n    // Load and map\n    {\n        for (int64_t i_79715 = 0; i_79715 < (int64_t) 11; i_79715++) {\n            int64_t phys_tid_79716 = blockOff_79709 +\n                    sext_i32_i64(local_tid_79693) + i_79715 *\n                    segscan_group_sizze_72693;\n            int64_t slice_79717 = n_65378;\n            int64_t slice_79718 = m_65377 * slice_79717;\n            int64_t gtid_72697 = squot64(phys_tid_79716, slice_79717);\n            int64_t remnant_79719 = phys_tid_79716 - gtid_72697 * slice_79717;\n            int64_t gtid_72698 = remnant_79719;\n            int64_t remnant_79720 = remnant_79719 - gtid_72698;\n            \n            if (slt64(phys_tid_79716, m_65377 * 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                private_mem_79713[i_79715] = defunc_0_f_res_72707;\n            } else {\n                private_mem_79713[i_79715] = (int64_t) 0;\n            }\n        }\n    }\n    // Transpose scan inputs\n    {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_79721 = 0; i_79721 < (int64_t) 11; i_79721++) {\n            int64_t sharedIdx_79722 = sext_i32_i64(local_tid_79693) + i_79721 *\n                    segscan_group_sizze_72693;\n            int64_t tmp_79723;\n            \n            tmp_79723 = priva",
            "te_mem_79713[i_79721];\n            ((__local int64_t *) local_mem_79701)[sharedIdx_79722] = tmp_79723;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int32_t i_79724 = 0; i_79724 < 11; i_79724++) {\n            int32_t sharedIdx_79725 = local_tid_79693 * 11 + i_79724;\n            int64_t tmp_79726;\n            \n            tmp_79726 = ((__local\n                          int64_t *) local_mem_79701)[sext_i32_i64(sharedIdx_79725)];\n            private_mem_79713[sext_i32_i64(i_79724)] = tmp_79726;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // Per thread scan\n    {\n        int32_t gidx_79727 = local_tid_79693 * 11 + 1;\n        \n        for (int64_t i_79728 = 0; i_79728 < (int64_t) 10; i_79728++) {\n            bool new_sgm_79729 = smod32(gidx_79727 + sext_i64_i32(i_79728) -\n                                        boundary_79711,\n                                        segsizze_compact_79712) == 0;\n            \n            if (!new_sgm_79729) {\n                int64_t x_72700;\n                int64_t x_72701;\n                \n                x_72700 = private_mem_79713[i_79728];\n                x_72701 = private_mem_79713[i_79728 + (int64_t) 1];\n                \n                int64_t defunc_1_op_res_72702 = add64(x_72700, x_72701);\n                \n                private_mem_79713[i_79728 + (int64_t) 1] =\n                    defunc_1_op_res_72702;\n            }\n        }\n    }\n    // Publish results in shared memory\n    {\n        int64_t tmp_79730;\n        \n        tmp_79730 = private_mem_79713[(int64_t) 10];\n        ((__local int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_79693)] =\n            tmp_79730;\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t acc_79734;\n    \n    // Scan results (with warp scan)\n    {\n        int64_t x_79731;\n        int64_t x_79732;\n        int64_t x_79735;\n ",
            "       int64_t x_79736;\n        bool ltid_in_bounds_79738 = slt64(sext_i32_i64(local_tid_79693),\n                                          segscan_group_sizze_72693);\n        int32_t skip_threads_79739;\n        \n        // read input for in-block scan\n        {\n            if (ltid_in_bounds_79738) {\n                x_79732 = ((volatile __local\n                            int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                                (int64_t) 8) +\n                                                        sext_i32_i64(local_tid_79693)];\n                if ((local_tid_79693 - squot32(local_tid_79693, 32) * 32) ==\n                    0) {\n                    x_79731 = x_79732;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_79739 = 1;\n            while (slt32(skip_threads_79739, 32)) {\n                bool thread_active_79740 = sle32(skip_threads_79739,\n                                                 local_tid_79693 -\n                                                 squot32(local_tid_79693, 32) *\n                                                 32) && ltid_in_bounds_79738;\n                \n                if (thread_active_79740) {\n                    // read operands\n                    {\n                        x_79731 = ((volatile __local\n                                    int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                                        (int64_t) 8) +\n                                                                (sext_i32_i64(local_tid_79693) -\n                                                                 sext_i32_i64(skip_threads_79739))];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79741 = slt32(smod32((local_tid_79693 + 1) *\n                                                ",
            "       11 - 1 +\n                                                       segsizze_compact_79712 -\n                                                       boundary_79711,\n                                                       segsizze_compact_79712),\n                                                (local_tid_79693 + 1) * 11 - 1 -\n                                                ((local_tid_79693 -\n                                                  skip_threads_79739 + 1) * 11 -\n                                                 1));\n                    \n                    if (thread_active_79740 && inactive_79741) {\n                        x_79731 = x_79732;\n                    }\n                    if (thread_active_79740) {\n                        if (!inactive_79741) {\n                            int64_t defunc_1_op_res_79733 = add64(x_79731,\n                                                                  x_79732);\n                            \n                            x_79731 = defunc_1_op_res_79733;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_79695, skip_threads_79739)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_79740) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                              (int64_t) 8) +\n                                                      sext_i32_i64(local_tid_79693)] =\n                            x_79731;\n                        x_79732 = x_79731;\n                    }\n                }\n                if (sle32(wave_sizze_79695, skip_threads_79739)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_79739 *= 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_79693 - squot32(local_tid_79693, 32) * 32) == 31 &&\n                ltid_in_bounds_79738) {\n                ((volatile __local\n                  int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(squot32(local_tid_79693,\n                                                                   32))] =\n                    x_79731;\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_79742;\n            \n            // read input for in-block scan\n            {\n                if (squot32(local_tid_79693, 32) == 0 && ltid_in_bounds_79738) {\n                    x_79736 = ((volatile __local\n                                int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                                    (int64_t) 8) +\n                                                            sext_i32_i64(local_tid_79693)];\n                    if ((local_tid_79693 - squot32(local_tid_79693, 32) * 32) ==\n                        0) {\n                        x_79735 = x_79736;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_79742 = 1;\n                while (slt32(skip_threads_79742, 32)) {\n                    bool thread_active_79743 = sle32(skip_threads_79742,\n                                                     local_tid_79693 -\n                                                     squot32(local_tid_79693,\n                                                             32) * 32) &&\n                         (squot32(local_tid_79693, 32) == 0 &&\n                          ltid_in_bounds_79738);\n                    ",
            "\n                    if (thread_active_79743) {\n                        // read operands\n                        {\n                            x_79735 = ((volatile __local\n                                        int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                                            (int64_t) 8) +\n                                                                    (sext_i32_i64(local_tid_79693) -\n                                                                     sext_i32_i64(skip_threads_79742))];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79744 = slt32(smod32((local_tid_79693 *\n                                                            32 + 32 - 1 + 1) *\n                                                           11 - 1 +\n                                                           segsizze_compact_79712 -\n                                                           boundary_79711,\n                                                           segsizze_compact_79712),\n                                                    (local_tid_79693 * 32 + 32 -\n                                                     1 + 1) * 11 - 1 -\n                                                    (((local_tid_79693 -\n                                                       skip_threads_79742) *\n                                                      32 + 32 - 1 + 1) * 11 -\n                                                     1));\n                        \n                        if (thread_active_79743 && inactive_79744) {\n                            x_79735 = x_79736;\n                        }\n                        if (thread_active_79743) {\n                            if (!inactive_79744) {\n                                int64_t defunc_1_op_res_79737 = add64(x_79735,\n                                                                      ",
            "x_79736);\n                                \n                                x_79735 = defunc_1_op_res_79737;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_79695, skip_threads_79742)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_79743) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                                  (int64_t) 8) +\n                                                          sext_i32_i64(local_tid_79693)] =\n                                x_79735;\n                            x_79736 = x_79735;\n                        }\n                    }\n                    if (sle32(wave_sizze_79695, skip_threads_79742)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_79742 *= 2;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        bool no_carry_in_79745 = squot32(local_tid_79693, 32) == 0 ||\n             !ltid_in_bounds_79738;\n        \n        // carry-in for every block except the first\n        {\n            // read operands\n            {\n                if (!no_carry_in_79745) {\n                    x_79732 = x_79731;\n                    x_79731 = ((__local\n                                int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                                    (int64_t) 8) +\n                                                            (sext_i32_i64(squot32(local_tid_79693,\n                                                                                  32)) -\n                                                             (int64_t) 1)];\n                }\n            }\n            // perform ",
            "operation\n            {\n                bool inactive_79746 = slt32(smod32((local_tid_79693 + 1) * 11 -\n                                                   1 + segsizze_compact_79712 -\n                                                   boundary_79711,\n                                                   segsizze_compact_79712),\n                                            (local_tid_79693 + 1) * 11 - 1 -\n                                            ((squot32(local_tid_79693, 32) *\n                                              32 - 1 + 1) * 11 - 1));\n                \n                if (!no_carry_in_79745) {\n                    if (inactive_79746) {\n                        x_79731 = x_79732;\n                    }\n                }\n                if (!no_carry_in_79745) {\n                    if (!inactive_79746) {\n                        int64_t defunc_1_op_res_79733 = add64(x_79731, x_79732);\n                        \n                        x_79731 = defunc_1_op_res_79733;\n                    }\n                }\n            }\n            // write final result\n            {\n                if (!no_carry_in_79745) {\n                    ((__local\n                      int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_79693)] =\n                        x_79731;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // restore correct values for first block\n        {\n            if (squot32(local_tid_79693, 32) == 0 && ltid_in_bounds_79738) {\n                ((__local\n                  int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_79693)] =\n                    x_79732;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_",
            "LOCAL_MEM_FENCE);\n        if (local_tid_79693 == 0) {\n            acc_79734 = ((__local\n                          int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                              (int64_t) 8) +\n                                                      (segscan_group_sizze_72693 -\n                                                       (int64_t) 1)];\n        } else {\n            acc_79734 = ((__local\n                          int64_t *) local_mem_79701)[squot64(byte_offsets_79697,\n                                                              (int64_t) 8) +\n                                                      (sext_i32_i64(local_tid_79693) -\n                                                       (int64_t) 1)];\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t prefix_79747 = (int64_t) 0;\n    bool block_new_sgm_79748 = sgm_idx_79710 == (int64_t) 0;\n    \n    // Perform lookback\n    {\n        if (block_new_sgm_79748 && local_tid_79693 == 0) {\n            ((volatile __global\n              int64_t *) incprefixes_mem_79690)[dynamic_id_79708] = acc_79734;\n            mem_fence_global();\n            ((volatile __global\n              int8_t *) status_flags_mem_79686)[dynamic_id_79708] = (int8_t) 2;\n            acc_79734 = (int64_t) 0;\n        }\n        if (!block_new_sgm_79748 && slt32(local_tid_79693, wave_sizze_79695)) {\n            if (local_tid_79693 == 0) {\n                if (boundary_79711 == sext_i64_i32(segscan_group_sizze_72693 *\n                    (int64_t) 11)) {\n                    ((volatile __global\n                      int64_t *) aggregates_mem_79688)[dynamic_id_79708] =\n                        acc_79734;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79686)[dynamic_id_79708] =\n                        (int8_t) 1;\n                } else {\n                    ((volatile __global\n                      int64_t *) i",
            "ncprefixes_mem_79690)[dynamic_id_79708] =\n                        acc_79734;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79686)[dynamic_id_79708] =\n                        (int8_t) 2;\n                }\n                \n                int8_t tmp_79749;\n                \n                tmp_79749 = ((volatile __global\n                              int8_t *) status_flags_mem_79686)[dynamic_id_79708 -\n                                                                (int64_t) 1];\n                ((volatile __local int8_t *) local_mem_79701)[(int64_t) 0] =\n                    tmp_79749;\n            }\n            mem_fence_local();\n            \n            int8_t status_79750;\n            \n            status_79750 = ((__local int8_t *) local_mem_79701)[(int64_t) 0];\n            if (status_79750 == (int8_t) 2) {\n                if (local_tid_79693 == 0) {\n                    prefix_79747 = ((volatile __global\n                                     int64_t *) incprefixes_mem_79690)[dynamic_id_79708 -\n                                                                       (int64_t) 1];\n                }\n            } else {\n                int32_t readOffset_79751 = dynamic_id_79708 -\n                        sext_i32_i64(wave_sizze_79695);\n                \n                while (slt32(wave_sizze_79695 * -1, readOffset_79751)) {\n                    int32_t read_i_79752 = readOffset_79751 + local_tid_79693;\n                    int64_t aggr_79753 = (int64_t) 0;\n                    int8_t flag_79754 = (int8_t) 0;\n                    \n                    if (sle32(0, read_i_79752)) {\n                        if (sle64(blockOff_79709 - (sext_i32_i64(read_i_79752 +\n                                                    1) *\n                                                    segscan_group_sizze_72693 *\n                                                    (int64_t) 11 - (int64_t) 1),\n                         ",
            "         sgm_idx_79710)) {\n                            flag_79754 = ((volatile __global\n                                           int8_t *) status_flags_mem_79686)[sext_i32_i64(read_i_79752)];\n                            if (flag_79754 == (int8_t) 2) {\n                                aggr_79753 = ((volatile __global\n                                               int64_t *) incprefixes_mem_79690)[sext_i32_i64(read_i_79752)];\n                            } else {\n                                if (flag_79754 == (int8_t) 1) {\n                                    aggr_79753 = ((volatile __global\n                                                   int64_t *) aggregates_mem_79688)[sext_i32_i64(read_i_79752)];\n                                }\n                            }\n                        } else {\n                            flag_79754 = (int8_t) 2;\n                        }\n                    }\n                    ((__local\n                      int64_t *) local_mem_79701)[squot64(warp_byte_offset_79699,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_79693)] =\n                        aggr_79753;\n                    ((__local\n                      int8_t *) local_mem_79701)[sext_i32_i64(local_tid_79693)] =\n                        flag_79754;\n                    flag_79754 = ((__local\n                                   int8_t *) local_mem_79701)[sext_i32_i64(wave_sizze_79695) -\n                                                              (int64_t) 1];\n                    if (slt8(flag_79754, (int8_t) 2)) {\n                        int8_t flg_x_79758;\n                        int8_t flg_y_79759;\n                        int64_t x_79755;\n                        int64_t x_79756;\n                        int32_t skip_threads_79760;\n                        \n                        // read input for in-block scan\n                        {\n                            flg_y_79759",
            " = ((volatile __local\n                                            int8_t *) local_mem_79701)[sext_i32_i64(local_tid_79693)];\n                            x_79756 = ((volatile __local\n                                        int64_t *) local_mem_79701)[squot64(warp_byte_offset_79699,\n                                                                            (int64_t) 8) +\n                                                                    sext_i32_i64(local_tid_79693)];\n                            if ((local_tid_79693 - squot32(local_tid_79693,\n                                                           32) * 32) == 0) {\n                                x_79755 = x_79756;\n                                flg_x_79758 = flg_y_79759;\n                            }\n                        }\n                        // in-block scan (hopefully no barriers needed)\n                        {\n                            skip_threads_79760 = 1;\n                            while (slt32(skip_threads_79760, 32)) {\n                                if (sle32(skip_threads_79760, local_tid_79693 -\n                                          squot32(local_tid_79693, 32) * 32)) {\n                                    // read operands\n                                    {\n                                        flg_x_79758 = ((volatile __local\n                                                        int8_t *) local_mem_79701)[sext_i32_i64(local_tid_79693) -\n                                                                                   sext_i32_i64(skip_threads_79760)];\n                                        x_79755 = ((volatile __local\n                                                    int64_t *) local_mem_79701)[squot64(warp_byte_offset_79699,\n                                                                                        (int64_t) 8) +\n                                                                                (sext_i32_i64(local_tid_79693) -\n                                    ",
            "                                             sext_i32_i64(skip_threads_79760))];\n                                    }\n                                    // perform operation\n                                    {\n                                        if (flg_y_79759 == (int8_t) 2 ||\n                                            flg_y_79759 == (int8_t) 0) {\n                                            flg_x_79758 = flg_y_79759;\n                                            x_79755 = x_79756;\n                                        } else {\n                                            int64_t defunc_1_op_res_79757 =\n                                                    add64(x_79755, x_79756);\n                                            \n                                            x_79755 = defunc_1_op_res_79757;\n                                        }\n                                    }\n                                    // write result\n                                    {\n                                        ((volatile __local\n                                          int8_t *) local_mem_79701)[sext_i32_i64(local_tid_79693)] =\n                                            flg_x_79758;\n                                        flg_y_79759 = flg_x_79758;\n                                        ((volatile __local\n                                          int64_t *) local_mem_79701)[squot64(warp_byte_offset_79699,\n                                                                              (int64_t) 8) +\n                                                                      sext_i32_i64(local_tid_79693)] =\n                                            x_79755;\n                                        x_79756 = x_79755;\n                                    }\n                                }\n                                skip_threads_79760 *= 2;\n                            }\n                        }\n                    }\n                    flag_79754 = ((__local\n        ",
            "                           int8_t *) local_mem_79701)[sext_i32_i64(wave_sizze_79695) -\n                                                              (int64_t) 1];\n                    aggr_79753 = ((__local\n                                   int64_t *) local_mem_79701)[squot64(warp_byte_offset_79699,\n                                                                       (int64_t) 8) +\n                                                               (sext_i32_i64(wave_sizze_79695) -\n                                                                (int64_t) 1)];\n                    if (flag_79754 == (int8_t) 2) {\n                        readOffset_79751 = wave_sizze_79695 * -1;\n                    } else {\n                        if (flag_79754 == (int8_t) 1) {\n                            readOffset_79751 -= wave_sizze_79695;\n                        }\n                    }\n                    if (slt8((int8_t) 0, flag_79754)) {\n                        int64_t x_79761 = aggr_79753;\n                        int64_t x_79762 = prefix_79747;\n                        int64_t defunc_1_op_res_79763 = add64(x_79761, x_79762);\n                        \n                        prefix_79747 = defunc_1_op_res_79763;\n                    }\n                    mem_fence_local();\n                }\n            }\n            if (local_tid_79693 == 0) {\n                if (boundary_79711 == sext_i64_i32(segscan_group_sizze_72693 *\n                    (int64_t) 11)) {\n                    int64_t x_79764 = prefix_79747;\n                    int64_t x_79765 = acc_79734;\n                    int64_t defunc_1_op_res_79766 = add64(x_79764, x_79765);\n                    \n                    ((volatile __global\n                      int64_t *) incprefixes_mem_79690)[dynamic_id_79708] =\n                        defunc_1_op_res_79766;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79686)[dynamic_id_79708] =\n                   ",
            "     (int8_t) 2;\n                }\n                ((__local\n                  int64_t *) local_mem_79701)[squot64(warp_byte_offset_79699,\n                                                      (int64_t) 8)] =\n                    prefix_79747;\n                acc_79734 = (int64_t) 0;\n            }\n        }\n        if (!(dynamic_id_79708 == (int64_t) 0)) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            prefix_79747 = ((__local\n                             int64_t *) local_mem_79701)[squot64(warp_byte_offset_79699,\n                                                                 (int64_t) 8)];\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    // Distribute results\n    {\n        int64_t x_79767;\n        int64_t x_79768;\n        int64_t x_79770 = prefix_79747;\n        int64_t x_79771 = acc_79734;\n        \n        if (slt32(local_tid_79693 * 11, boundary_79711) &&\n            !block_new_sgm_79748) {\n            int64_t defunc_1_op_res_79772 = add64(x_79770, x_79771);\n            \n            x_79767 = defunc_1_op_res_79772;\n        } else {\n            x_79767 = acc_79734;\n        }\n        \n        int32_t stopping_point_79773 = segsizze_compact_79712 -\n                srem32(local_tid_79693 * 11 - 1 + segsizze_compact_79712 -\n                       boundary_79711, segsizze_compact_79712);\n        \n        for (int64_t i_79774 = 0; i_79774 < (int64_t) 11; i_79774++) {\n            if (slt32(sext_i64_i32(i_79774), stopping_point_79773 - 1)) {\n                x_79768 = private_mem_79713[i_79774];\n                \n                int64_t defunc_1_op_res_79769 = add64(x_79767, x_79768);\n                \n                private_mem_79713[i_79774] = defunc_1_op_res_79769;\n            }\n        }\n    }\n    // Transpose scan output and Write it to global memory in coalesced fashion\n    {\n        for (int64_t i_79775 = 0; i_79775 < (int64_t) 11; i_79775++) {\n            int64_t sharedIdx_79776 = sext_i32_i64(local_tid_79693 * 11) +\n                    i_79775;\n",
            "            int64_t tmp_79777;\n            \n            tmp_79777 = private_mem_79713[i_79775];\n            ((__local int64_t *) local_mem_79701)[sharedIdx_79776] = tmp_79777;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_79778 = 0; i_79778 < (int64_t) 11; i_79778++) {\n            int64_t flat_idx_79779 = blockOff_79709 +\n                    segscan_group_sizze_72693 * i_79778 +\n                    sext_i32_i64(local_tid_79693);\n            int64_t slice_79780 = n_65378;\n            int64_t slice_79781 = m_65377 * slice_79780;\n            int64_t gtid_72697 = squot64(flat_idx_79779, slice_79780);\n            int64_t remnant_79782 = flat_idx_79779 - gtid_72697 * slice_79780;\n            int64_t gtid_72698 = remnant_79782;\n            int64_t remnant_79783 = remnant_79782 - gtid_72698;\n            \n            if (slt64(flat_idx_79779, m_65377 * n_65378)) {\n                int64_t tmp_79784;\n                \n                tmp_79784 = ((__local\n                              int64_t *) local_mem_79701)[flat_idx_79779 -\n                                                          blockOff_79709];\n                ((__global int64_t *) mem_77867)[gtid_72697 * n_65378 +\n                                                 gtid_72698] = tmp_79784;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // If this is the last block, reset the dynamicId\n    {\n        if (dynamic_id_79708 == sdiv_up64(m_65377 * n_65378,\n                                          segscan_group_sizze_72693 *\n                                          (int64_t) 11) - (int64_t) 1) {\n            ((__global int32_t *) mainziid_counter_mem_79684)[(int64_t) 0] = 0;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_72693\n}\n__kernel void mainzisegscan_73366(__global int *global_failure,\n                                  uint local_mem_79870_backing_offset_0,\n                                  int64_t m_65377, int64_t n_65378, __global\n            ",
            "                      unsigned char *Y_mem_77010, __global\n                                  unsigned char *mem_77914, __global\n                                  unsigned char *mainziid_counter_mem_79853,\n                                  __global\n                                  unsigned char *status_flags_mem_79855,\n                                  __global unsigned char *aggregates_mem_79857,\n                                  __global unsigned char *incprefixes_mem_79859)\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    volatile unsigned char *local_mem_79870_backing_0 =\n                           &shared_mem[local_mem_79870_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_79861;\n    int32_t local_tid_79862;\n    int64_t group_sizze_79865;\n    int32_t wave_sizze_79864;\n    int32_t group_tid_79863;\n    \n    global_tid_79861 = get_global_id(0);\n    local_tid_79862 = get_local_id(0);\n    group_sizze_79865 = get_local_size(0);\n    wave_sizze_79864 = LOCKSTEP_WIDTH;\n    group_tid_79863 = get_group_id(0);\n    \n    int32_t phys_tid_73366 = global_tid_79861;\n    int64_t byte_offsets_79866 = (int64_t) 0;\n    int64_t byte_offsets_79867 = segscan_group_sizze_73360 * (int64_t) 8;\n    int64_t warp_byte_offset_79868 = (int64_t) 32;\n    int64_t warp_byte_offset_79869 = (int64_t) 288;\n    \n    // Allocate reused shared memeory\n    { }\n    \n    __local unsigned char *local_mem_79870;\n    \n    local_mem_79870 = (__local unsigned char *) local_mem_79870_backing_0;\n    \n    int64_t trans_arr_len_79871 = (int64_t) 11 * segscan_group_sizze_73360;\n    int32_t dynamic_id_79877;\n    \n    if (local_tid_79862 == 0) {\n        dynamic_id_79877 = atomic_add_i32_global(&((volatile __global\n                                                    int *) mainziid_counter_mem_79853)[(int64_t) 0],\n                                  ",
            "               (int) 1);\n        ((__local int32_t *) local_mem_79870)[(int64_t) 0] = dynamic_id_79877;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    dynamic_id_79877 = ((__local int32_t *) local_mem_79870)[(int64_t) 0];\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t blockOff_79878 = sext_i32_i64(dynamic_id_79877) * (int64_t) 11 *\n            segscan_group_sizze_73360;\n    int64_t sgm_idx_79879 = smod64(blockOff_79878, n_65378);\n    int32_t boundary_79880 = sext_i64_i32(smin64((int64_t) 11 *\n                                                 segscan_group_sizze_73360,\n                                                 n_65378 - sgm_idx_79879));\n    int32_t segsizze_compact_79881 = sext_i64_i32(smin64((int64_t) 11 *\n                                                         segscan_group_sizze_73360,\n                                                         n_65378));\n    int64_t private_mem_79882[(int64_t) 11];\n    \n    // Load and map\n    {\n        for (int64_t i_79884 = 0; i_79884 < (int64_t) 11; i_79884++) {\n            int64_t phys_tid_79885 = blockOff_79878 +\n                    sext_i32_i64(local_tid_79862) + i_79884 *\n                    segscan_group_sizze_73360;\n            int64_t slice_79886 = n_65378;\n            int64_t slice_79887 = m_65377 * slice_79886;\n            int64_t gtid_73364 = squot64(phys_tid_79885, slice_79886);\n            int64_t remnant_79888 = phys_tid_79885 - gtid_73364 * slice_79886;\n            int64_t gtid_73365 = remnant_79888;\n            int64_t remnant_79889 = remnant_79888 - gtid_73365;\n            \n            if (slt64(phys_tid_79885, m_65377 * 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_is",
            "nan64(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                private_mem_79882[i_79884] = defunc_0_f_res_73374;\n            } else {\n                private_mem_79882[i_79884] = (int64_t) 0;\n            }\n        }\n    }\n    // Transpose scan inputs\n    {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_79890 = 0; i_79890 < (int64_t) 11; i_79890++) {\n            int64_t sharedIdx_79891 = sext_i32_i64(local_tid_79862) + i_79890 *\n                    segscan_group_sizze_73360;\n            int64_t tmp_79892;\n            \n            tmp_79892 = private_mem_79882[i_79890];\n            ((__local int64_t *) local_mem_79870)[sharedIdx_79891] = tmp_79892;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int32_t i_79893 = 0; i_79893 < 11; i_79893++) {\n            int32_t sharedIdx_79894 = local_tid_79862 * 11 + i_79893;\n            int64_t tmp_79895;\n            \n            tmp_79895 = ((__local\n                          int64_t *) local_mem_79870)[sext_i32_i64(sharedIdx_79894)];\n            private_mem_79882[sext_i32_i64(i_79893)] = tmp_79895;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // Per thread scan\n    {\n        int32_t gidx_79896 = local_tid_79862 * 11 + 1;\n        \n        for (int64_t i_79897 = 0; i_79897 < (int64_t) 10; i_79897++) {\n            bool new_sgm_79898 = smod32(gidx_79896 + sext_i64_i32(i_79897) -\n                                        boundary_79880,\n                                        segsizze_compact_79881) == 0;\n            \n            if (!new_sgm_79898) {\n                int64_t x_73367;\n                int64_t x_73368;\n                \n                x_73367 = private_mem_79882[i_79897];\n                x_73368 = private_mem_79882[i_79897 + (int64_t) 1];\n                \n                int64_t defunc_1_op_res_73369 = add64(x_73",
            "367, x_73368);\n                \n                private_mem_79882[i_79897 + (int64_t) 1] =\n                    defunc_1_op_res_73369;\n            }\n        }\n    }\n    // Publish results in shared memory\n    {\n        int64_t tmp_79899;\n        \n        tmp_79899 = private_mem_79882[(int64_t) 10];\n        ((__local int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_79862)] =\n            tmp_79899;\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t acc_79903;\n    \n    // Scan results (with warp scan)\n    {\n        int64_t x_79900;\n        int64_t x_79901;\n        int64_t x_79904;\n        int64_t x_79905;\n        bool ltid_in_bounds_79907 = slt64(sext_i32_i64(local_tid_79862),\n                                          segscan_group_sizze_73360);\n        int32_t skip_threads_79908;\n        \n        // read input for in-block scan\n        {\n            if (ltid_in_bounds_79907) {\n                x_79901 = ((volatile __local\n                            int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                                (int64_t) 8) +\n                                                        sext_i32_i64(local_tid_79862)];\n                if ((local_tid_79862 - squot32(local_tid_79862, 32) * 32) ==\n                    0) {\n                    x_79900 = x_79901;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_79908 = 1;\n            while (slt32(skip_threads_79908, 32)) {\n                bool thread_active_79909 = sle32(skip_threads_79908,\n                                                 local_tid_79862 -\n                                                 squot32(local_tid_79862, 32) *\n                                                 32) && ltid_in_bounds_79907;\n                \n              ",
            "  if (thread_active_79909) {\n                    // read operands\n                    {\n                        x_79900 = ((volatile __local\n                                    int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                                        (int64_t) 8) +\n                                                                (sext_i32_i64(local_tid_79862) -\n                                                                 sext_i32_i64(skip_threads_79908))];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_79910 = slt32(smod32((local_tid_79862 + 1) *\n                                                       11 - 1 +\n                                                       segsizze_compact_79881 -\n                                                       boundary_79880,\n                                                       segsizze_compact_79881),\n                                                (local_tid_79862 + 1) * 11 - 1 -\n                                                ((local_tid_79862 -\n                                                  skip_threads_79908 + 1) * 11 -\n                                                 1));\n                    \n                    if (thread_active_79909 && inactive_79910) {\n                        x_79900 = x_79901;\n                    }\n                    if (thread_active_79909) {\n                        if (!inactive_79910) {\n                            int64_t defunc_1_op_res_79902 = add64(x_79900,\n                                                                  x_79901);\n                            \n                            x_79900 = defunc_1_op_res_79902;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_79864, skip_threads_79908)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_79909) {",
            "\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                              (int64_t) 8) +\n                                                      sext_i32_i64(local_tid_79862)] =\n                            x_79900;\n                        x_79901 = x_79900;\n                    }\n                }\n                if (sle32(wave_sizze_79864, skip_threads_79908)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_79908 *= 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_79862 - squot32(local_tid_79862, 32) * 32) == 31 &&\n                ltid_in_bounds_79907) {\n                ((volatile __local\n                  int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(squot32(local_tid_79862,\n                                                                   32))] =\n                    x_79900;\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_79911;\n            \n            // read input for in-block scan\n            {\n                if (squot32(local_tid_79862, 32) == 0 && ltid_in_bounds_79907) {\n                    x_79905 = ((volatile __local\n                                int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                                    (int64_t) 8) +\n                                                            sext_i32_i64(local_tid_79862)];\n                    if ((local_tid_79862 - squot32(local_tid_7986",
            "2, 32) * 32) ==\n                        0) {\n                        x_79904 = x_79905;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_79911 = 1;\n                while (slt32(skip_threads_79911, 32)) {\n                    bool thread_active_79912 = sle32(skip_threads_79911,\n                                                     local_tid_79862 -\n                                                     squot32(local_tid_79862,\n                                                             32) * 32) &&\n                         (squot32(local_tid_79862, 32) == 0 &&\n                          ltid_in_bounds_79907);\n                    \n                    if (thread_active_79912) {\n                        // read operands\n                        {\n                            x_79904 = ((volatile __local\n                                        int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                                            (int64_t) 8) +\n                                                                    (sext_i32_i64(local_tid_79862) -\n                                                                     sext_i32_i64(skip_threads_79911))];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_79913 = slt32(smod32((local_tid_79862 *\n                                                            32 + 32 - 1 + 1) *\n                                                           11 - 1 +\n                                                           segsizze_compact_79881 -\n                                                           boundary_79880,\n                                                           segsizze_compact_79881),\n                                                    (local_tid_79862 * 32 + 32 -\n                                   ",
            "                  1 + 1) * 11 - 1 -\n                                                    (((local_tid_79862 -\n                                                       skip_threads_79911) *\n                                                      32 + 32 - 1 + 1) * 11 -\n                                                     1));\n                        \n                        if (thread_active_79912 && inactive_79913) {\n                            x_79904 = x_79905;\n                        }\n                        if (thread_active_79912) {\n                            if (!inactive_79913) {\n                                int64_t defunc_1_op_res_79906 = add64(x_79904,\n                                                                      x_79905);\n                                \n                                x_79904 = defunc_1_op_res_79906;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_79864, skip_threads_79911)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_79912) {\n                        // write result\n                        {\n                            ((volatile __local\n                              int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                                  (int64_t) 8) +\n                                                          sext_i32_i64(local_tid_79862)] =\n                                x_79904;\n                            x_79905 = x_79904;\n                        }\n                    }\n                    if (sle32(wave_sizze_79864, skip_threads_79911)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_79911 *= 2;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        bool no_carry_in_79914 = squot32(local_tid_79862, 32) == 0 ||\n             !ltid_in_",
            "bounds_79907;\n        \n        // carry-in for every block except the first\n        {\n            // read operands\n            {\n                if (!no_carry_in_79914) {\n                    x_79901 = x_79900;\n                    x_79900 = ((__local\n                                int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                                    (int64_t) 8) +\n                                                            (sext_i32_i64(squot32(local_tid_79862,\n                                                                                  32)) -\n                                                             (int64_t) 1)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_79915 = slt32(smod32((local_tid_79862 + 1) * 11 -\n                                                   1 + segsizze_compact_79881 -\n                                                   boundary_79880,\n                                                   segsizze_compact_79881),\n                                            (local_tid_79862 + 1) * 11 - 1 -\n                                            ((squot32(local_tid_79862, 32) *\n                                              32 - 1 + 1) * 11 - 1));\n                \n                if (!no_carry_in_79914) {\n                    if (inactive_79915) {\n                        x_79900 = x_79901;\n                    }\n                }\n                if (!no_carry_in_79914) {\n                    if (!inactive_79915) {\n                        int64_t defunc_1_op_res_79902 = add64(x_79900, x_79901);\n                        \n                        x_79900 = defunc_1_op_res_79902;\n                    }\n                }\n            }\n            // write final result\n            {\n                if (!no_carry_in_79914) {\n                    ((__local\n                      int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                         ",
            "                                 (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_79862)] =\n                        x_79900;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // restore correct values for first block\n        {\n            if (squot32(local_tid_79862, 32) == 0 && ltid_in_bounds_79907) {\n                ((__local\n                  int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_79862)] =\n                    x_79901;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (local_tid_79862 == 0) {\n            acc_79903 = ((__local\n                          int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                              (int64_t) 8) +\n                                                      (segscan_group_sizze_73360 -\n                                                       (int64_t) 1)];\n        } else {\n            acc_79903 = ((__local\n                          int64_t *) local_mem_79870)[squot64(byte_offsets_79866,\n                                                              (int64_t) 8) +\n                                                      (sext_i32_i64(local_tid_79862) -\n                                                       (int64_t) 1)];\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t prefix_79916 = (int64_t) 0;\n    bool block_new_sgm_79917 = sgm_idx_79879 == (int64_t) 0;\n    \n    // Perform lookback\n    {\n        if (block_new_sgm_79917 && local_tid_79862 == 0) {\n            ((volatile __global\n              int64_t *) incprefixes_mem_79859)[dynamic_id_79877] = acc_79903;\n            mem_fence_global();\n            ((volatile __global\n              int8_t *) status_flags_mem_79855)[dynamic_id_79877",
            "] = (int8_t) 2;\n            acc_79903 = (int64_t) 0;\n        }\n        if (!block_new_sgm_79917 && slt32(local_tid_79862, wave_sizze_79864)) {\n            if (local_tid_79862 == 0) {\n                if (boundary_79880 == sext_i64_i32(segscan_group_sizze_73360 *\n                    (int64_t) 11)) {\n                    ((volatile __global\n                      int64_t *) aggregates_mem_79857)[dynamic_id_79877] =\n                        acc_79903;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79855)[dynamic_id_79877] =\n                        (int8_t) 1;\n                } else {\n                    ((volatile __global\n                      int64_t *) incprefixes_mem_79859)[dynamic_id_79877] =\n                        acc_79903;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79855)[dynamic_id_79877] =\n                        (int8_t) 2;\n                }\n                \n                int8_t tmp_79918;\n                \n                tmp_79918 = ((volatile __global\n                              int8_t *) status_flags_mem_79855)[dynamic_id_79877 -\n                                                                (int64_t) 1];\n                ((volatile __local int8_t *) local_mem_79870)[(int64_t) 0] =\n                    tmp_79918;\n            }\n            mem_fence_local();\n            \n            int8_t status_79919;\n            \n            status_79919 = ((__local int8_t *) local_mem_79870)[(int64_t) 0];\n            if (status_79919 == (int8_t) 2) {\n                if (local_tid_79862 == 0) {\n                    prefix_79916 = ((volatile __global\n                                     int64_t *) incprefixes_mem_79859)[dynamic_id_79877 -\n                                                                       (int64_t) 1];\n                }\n            } else {\n                int32_t readOffset_79920 = dyna",
            "mic_id_79877 -\n                        sext_i32_i64(wave_sizze_79864);\n                \n                while (slt32(wave_sizze_79864 * -1, readOffset_79920)) {\n                    int32_t read_i_79921 = readOffset_79920 + local_tid_79862;\n                    int64_t aggr_79922 = (int64_t) 0;\n                    int8_t flag_79923 = (int8_t) 0;\n                    \n                    if (sle32(0, read_i_79921)) {\n                        if (sle64(blockOff_79878 - (sext_i32_i64(read_i_79921 +\n                                                    1) *\n                                                    segscan_group_sizze_73360 *\n                                                    (int64_t) 11 - (int64_t) 1),\n                                  sgm_idx_79879)) {\n                            flag_79923 = ((volatile __global\n                                           int8_t *) status_flags_mem_79855)[sext_i32_i64(read_i_79921)];\n                            if (flag_79923 == (int8_t) 2) {\n                                aggr_79922 = ((volatile __global\n                                               int64_t *) incprefixes_mem_79859)[sext_i32_i64(read_i_79921)];\n                            } else {\n                                if (flag_79923 == (int8_t) 1) {\n                                    aggr_79922 = ((volatile __global\n                                                   int64_t *) aggregates_mem_79857)[sext_i32_i64(read_i_79921)];\n                                }\n                            }\n                        } else {\n                            flag_79923 = (int8_t) 2;\n                        }\n                    }\n                    ((__local\n                      int64_t *) local_mem_79870)[squot64(warp_byte_offset_79868,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_79862)] =\n                        aggr_79922;\n                    ((__local\n                ",
            "      int8_t *) local_mem_79870)[sext_i32_i64(local_tid_79862)] =\n                        flag_79923;\n                    flag_79923 = ((__local\n                                   int8_t *) local_mem_79870)[sext_i32_i64(wave_sizze_79864) -\n                                                              (int64_t) 1];\n                    if (slt8(flag_79923, (int8_t) 2)) {\n                        int8_t flg_x_79927;\n                        int8_t flg_y_79928;\n                        int64_t x_79924;\n                        int64_t x_79925;\n                        int32_t skip_threads_79929;\n                        \n                        // read input for in-block scan\n                        {\n                            flg_y_79928 = ((volatile __local\n                                            int8_t *) local_mem_79870)[sext_i32_i64(local_tid_79862)];\n                            x_79925 = ((volatile __local\n                                        int64_t *) local_mem_79870)[squot64(warp_byte_offset_79868,\n                                                                            (int64_t) 8) +\n                                                                    sext_i32_i64(local_tid_79862)];\n                            if ((local_tid_79862 - squot32(local_tid_79862,\n                                                           32) * 32) == 0) {\n                                x_79924 = x_79925;\n                                flg_x_79927 = flg_y_79928;\n                            }\n                        }\n                        // in-block scan (hopefully no barriers needed)\n                        {\n                            skip_threads_79929 = 1;\n                            while (slt32(skip_threads_79929, 32)) {\n                                if (sle32(skip_threads_79929, local_tid_79862 -\n                                          squot32(local_tid_79862, 32) * 32)) {\n                                    // read operands\n                                    {",
            "\n                                        flg_x_79927 = ((volatile __local\n                                                        int8_t *) local_mem_79870)[sext_i32_i64(local_tid_79862) -\n                                                                                   sext_i32_i64(skip_threads_79929)];\n                                        x_79924 = ((volatile __local\n                                                    int64_t *) local_mem_79870)[squot64(warp_byte_offset_79868,\n                                                                                        (int64_t) 8) +\n                                                                                (sext_i32_i64(local_tid_79862) -\n                                                                                 sext_i32_i64(skip_threads_79929))];\n                                    }\n                                    // perform operation\n                                    {\n                                        if (flg_y_79928 == (int8_t) 2 ||\n                                            flg_y_79928 == (int8_t) 0) {\n                                            flg_x_79927 = flg_y_79928;\n                                            x_79924 = x_79925;\n                                        } else {\n                                            int64_t defunc_1_op_res_79926 =\n                                                    add64(x_79924, x_79925);\n                                            \n                                            x_79924 = defunc_1_op_res_79926;\n                                        }\n                                    }\n                                    // write result\n                                    {\n                                        ((volatile __local\n                                          int8_t *) local_mem_79870)[sext_i32_i64(local_tid_79862)] =\n                                            flg_x_79927;\n                                        flg_y_79928 = ",
            "flg_x_79927;\n                                        ((volatile __local\n                                          int64_t *) local_mem_79870)[squot64(warp_byte_offset_79868,\n                                                                              (int64_t) 8) +\n                                                                      sext_i32_i64(local_tid_79862)] =\n                                            x_79924;\n                                        x_79925 = x_79924;\n                                    }\n                                }\n                                skip_threads_79929 *= 2;\n                            }\n                        }\n                    }\n                    flag_79923 = ((__local\n                                   int8_t *) local_mem_79870)[sext_i32_i64(wave_sizze_79864) -\n                                                              (int64_t) 1];\n                    aggr_79922 = ((__local\n                                   int64_t *) local_mem_79870)[squot64(warp_byte_offset_79868,\n                                                                       (int64_t) 8) +\n                                                               (sext_i32_i64(wave_sizze_79864) -\n                                                                (int64_t) 1)];\n                    if (flag_79923 == (int8_t) 2) {\n                        readOffset_79920 = wave_sizze_79864 * -1;\n                    } else {\n                        if (flag_79923 == (int8_t) 1) {\n                            readOffset_79920 -= wave_sizze_79864;\n                        }\n                    }\n                    if (slt8((int8_t) 0, flag_79923)) {\n                        int64_t x_79930 = aggr_79922;\n                        int64_t x_79931 = prefix_79916;\n                        int64_t defunc_1_op_res_79932 = add64(x_79930, x_79931);\n                        \n                        prefix_79916 = defunc_1_op_res_79932;\n                    }\n                    mem_",
            "fence_local();\n                }\n            }\n            if (local_tid_79862 == 0) {\n                if (boundary_79880 == sext_i64_i32(segscan_group_sizze_73360 *\n                    (int64_t) 11)) {\n                    int64_t x_79933 = prefix_79916;\n                    int64_t x_79934 = acc_79903;\n                    int64_t defunc_1_op_res_79935 = add64(x_79933, x_79934);\n                    \n                    ((volatile __global\n                      int64_t *) incprefixes_mem_79859)[dynamic_id_79877] =\n                        defunc_1_op_res_79935;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_79855)[dynamic_id_79877] =\n                        (int8_t) 2;\n                }\n                ((__local\n                  int64_t *) local_mem_79870)[squot64(warp_byte_offset_79868,\n                                                      (int64_t) 8)] =\n                    prefix_79916;\n                acc_79903 = (int64_t) 0;\n            }\n        }\n        if (!(dynamic_id_79877 == (int64_t) 0)) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            prefix_79916 = ((__local\n                             int64_t *) local_mem_79870)[squot64(warp_byte_offset_79868,\n                                                                 (int64_t) 8)];\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    // Distribute results\n    {\n        int64_t x_79936;\n        int64_t x_79937;\n        int64_t x_79939 = prefix_79916;\n        int64_t x_79940 = acc_79903;\n        \n        if (slt32(local_tid_79862 * 11, boundary_79880) &&\n            !block_new_sgm_79917) {\n            int64_t defunc_1_op_res_79941 = add64(x_79939, x_79940);\n            \n            x_79936 = defunc_1_op_res_79941;\n        } else {\n            x_79936 = acc_79903;\n        }\n        \n        int32_t stopping_point_79942 = segsizze_compact_79881 -\n                srem32(local_tid_79862 * 11 - 1 + segsizze_compact_79881 ",
            "-\n                       boundary_79880, segsizze_compact_79881);\n        \n        for (int64_t i_79943 = 0; i_79943 < (int64_t) 11; i_79943++) {\n            if (slt32(sext_i64_i32(i_79943), stopping_point_79942 - 1)) {\n                x_79937 = private_mem_79882[i_79943];\n                \n                int64_t defunc_1_op_res_79938 = add64(x_79936, x_79937);\n                \n                private_mem_79882[i_79943] = defunc_1_op_res_79938;\n            }\n        }\n    }\n    // Transpose scan output and Write it to global memory in coalesced fashion\n    {\n        for (int64_t i_79944 = 0; i_79944 < (int64_t) 11; i_79944++) {\n            int64_t sharedIdx_79945 = sext_i32_i64(local_tid_79862 * 11) +\n                    i_79944;\n            int64_t tmp_79946;\n            \n            tmp_79946 = private_mem_79882[i_79944];\n            ((__local int64_t *) local_mem_79870)[sharedIdx_79945] = tmp_79946;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_79947 = 0; i_79947 < (int64_t) 11; i_79947++) {\n            int64_t flat_idx_79948 = blockOff_79878 +\n                    segscan_group_sizze_73360 * i_79947 +\n                    sext_i32_i64(local_tid_79862);\n            int64_t slice_79949 = n_65378;\n            int64_t slice_79950 = m_65377 * slice_79949;\n            int64_t gtid_73364 = squot64(flat_idx_79948, slice_79949);\n            int64_t remnant_79951 = flat_idx_79948 - gtid_73364 * slice_79949;\n            int64_t gtid_73365 = remnant_79951;\n            int64_t remnant_79952 = remnant_79951 - gtid_73365;\n            \n            if (slt64(flat_idx_79948, m_65377 * n_65378)) {\n                int64_t tmp_79953;\n                \n                tmp_79953 = ((__local\n                              int64_t *) local_mem_79870)[flat_idx_79948 -\n                                                          blockOff_79878];\n                ((__global int64_t *) mem_77914)[gtid_73364 * n_65378 +\n                                                 gtid_7",
            "3365] = tmp_79953;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // If this is the last block, reset the dynamicId\n    {\n        if (dynamic_id_79877 == sdiv_up64(m_65377 * n_65378,\n                                          segscan_group_sizze_73360 *\n                                          (int64_t) 11) - (int64_t) 1) {\n            ((__global int32_t *) mainziid_counter_mem_79853)[(int64_t) 0] = 0;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_73360\n}\n__kernel void mainzisegscan_74123(__global int *global_failure,\n                                  uint local_mem_80045_backing_offset_0,\n                                  int64_t m_65377, int64_t n_65378, __global\n                                  unsigned char *Y_mem_77010, __global\n                                  unsigned char *mem_77968, __global\n                                  unsigned char *mainziid_counter_mem_80028,\n                                  __global\n                                  unsigned char *status_flags_mem_80030,\n                                  __global unsigned char *aggregates_mem_80032,\n                                  __global unsigned char *incprefixes_mem_80034)\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    volatile unsigned char *local_mem_80045_backing_0 =\n                           &shared_mem[local_mem_80045_backing_offset_0];\n    \n    if (*global_failure >= 0)\n        return;\n    \n    int32_t global_tid_80036;\n    int32_t local_tid_80037;\n    int64_t group_sizze_80040;\n    int32_t wave_sizze_80039;\n    int32_t group_tid_80038;\n    \n    global_tid_80036 = get_global_id(0);\n    local_tid_80037 = get_local_id(0);\n    group_sizze_80040 = get_local_size(0);\n    wave_sizze_80039 = LOCKSTEP_WIDTH;\n    group_tid_80038 = get_group_id(0);\n    \n    int32_t phys_tid_74123 = global_tid_80036;\n    int64_t byte",
            "_offsets_80041 = (int64_t) 0;\n    int64_t byte_offsets_80042 = segscan_group_sizze_74117 * (int64_t) 8;\n    int64_t warp_byte_offset_80043 = (int64_t) 32;\n    int64_t warp_byte_offset_80044 = (int64_t) 288;\n    \n    // Allocate reused shared memeory\n    { }\n    \n    __local unsigned char *local_mem_80045;\n    \n    local_mem_80045 = (__local unsigned char *) local_mem_80045_backing_0;\n    \n    int64_t trans_arr_len_80046 = (int64_t) 11 * segscan_group_sizze_74117;\n    int32_t dynamic_id_80052;\n    \n    if (local_tid_80037 == 0) {\n        dynamic_id_80052 = atomic_add_i32_global(&((volatile __global\n                                                    int *) mainziid_counter_mem_80028)[(int64_t) 0],\n                                                 (int) 1);\n        ((__local int32_t *) local_mem_80045)[(int64_t) 0] = dynamic_id_80052;\n    }\n    barrier(CLK_LOCAL_MEM_FENCE);\n    dynamic_id_80052 = ((__local int32_t *) local_mem_80045)[(int64_t) 0];\n    barrier(CLK_LOCAL_MEM_FENCE);\n    \n    int64_t blockOff_80053 = sext_i32_i64(dynamic_id_80052) * (int64_t) 11 *\n            segscan_group_sizze_74117;\n    int64_t sgm_idx_80054 = smod64(blockOff_80053, n_65378);\n    int32_t boundary_80055 = sext_i64_i32(smin64((int64_t) 11 *\n                                                 segscan_group_sizze_74117,\n                                                 n_65378 - sgm_idx_80054));\n    int32_t segsizze_compact_80056 = sext_i64_i32(smin64((int64_t) 11 *\n                                                         segscan_group_sizze_74117,\n                                                         n_65378));\n    int64_t private_mem_80057[(int64_t) 11];\n    \n    // Load and map\n    {\n        for (int64_t i_80059 = 0; i_80059 < (int64_t) 11; i_80059++) {\n            int64_t phys_tid_80060 = blockOff_80053 +\n                    sext_i32_i64(local_tid_80037) + i_80059 *\n                    segscan_group_sizze_74117;\n            int64_t slice_80061 = n_65378;\n            int64_t slice_80062 ",
            "= m_65377 * slice_80061;\n            int64_t gtid_74121 = squot64(phys_tid_80060, slice_80061);\n            int64_t remnant_80063 = phys_tid_80060 - gtid_74121 * slice_80061;\n            int64_t gtid_74122 = remnant_80063;\n            int64_t remnant_80064 = remnant_80063 - gtid_74122;\n            \n            if (slt64(phys_tid_80060, m_65377 * 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                private_mem_80057[i_80059] = defunc_0_f_res_74131;\n            } else {\n                private_mem_80057[i_80059] = (int64_t) 0;\n            }\n        }\n    }\n    // Transpose scan inputs\n    {\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_80065 = 0; i_80065 < (int64_t) 11; i_80065++) {\n            int64_t sharedIdx_80066 = sext_i32_i64(local_tid_80037) + i_80065 *\n                    segscan_group_sizze_74117;\n            int64_t tmp_80067;\n            \n            tmp_80067 = private_mem_80057[i_80065];\n            ((__local int64_t *) local_mem_80045)[sharedIdx_80066] = tmp_80067;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int32_t i_80068 = 0; i_80068 < 11; i_80068++) {\n            int32_t sharedIdx_80069 = local_tid_80037 * 11 + i_80068;\n            int64_t tmp_80070;\n            \n            tmp_80070 = ((__local\n                          int64_t *) local_mem_80045)[sext_i32_i64(sharedIdx_80069)];\n            private_mem_80057[sext_i32_i64(i_80068)] = tmp_80070;\n        ",
            "}\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // Per thread scan\n    {\n        int32_t gidx_80071 = local_tid_80037 * 11 + 1;\n        \n        for (int64_t i_80072 = 0; i_80072 < (int64_t) 10; i_80072++) {\n            bool new_sgm_80073 = smod32(gidx_80071 + sext_i64_i32(i_80072) -\n                                        boundary_80055,\n                                        segsizze_compact_80056) == 0;\n            \n            if (!new_sgm_80073) {\n                int64_t x_74124;\n                int64_t x_74125;\n                \n                x_74124 = private_mem_80057[i_80072];\n                x_74125 = private_mem_80057[i_80072 + (int64_t) 1];\n                \n                int64_t defunc_1_op_res_74126 = add64(x_74124, x_74125);\n                \n                private_mem_80057[i_80072 + (int64_t) 1] =\n                    defunc_1_op_res_74126;\n            }\n        }\n    }\n    // Publish results in shared memory\n    {\n        int64_t tmp_80074;\n        \n        tmp_80074 = private_mem_80057[(int64_t) 10];\n        ((__local int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_80037)] =\n            tmp_80074;\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t acc_80078;\n    \n    // Scan results (with warp scan)\n    {\n        int64_t x_80075;\n        int64_t x_80076;\n        int64_t x_80079;\n        int64_t x_80080;\n        bool ltid_in_bounds_80082 = slt64(sext_i32_i64(local_tid_80037),\n                                          segscan_group_sizze_74117);\n        int32_t skip_threads_80083;\n        \n        // read input for in-block scan\n        {\n            if (ltid_in_bounds_80082) {\n                x_80076 = ((volatile __local\n                            int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                                (int64_t) 8) +\n          ",
            "                                              sext_i32_i64(local_tid_80037)];\n                if ((local_tid_80037 - squot32(local_tid_80037, 32) * 32) ==\n                    0) {\n                    x_80075 = x_80076;\n                }\n            }\n        }\n        // in-block scan (hopefully no barriers needed)\n        {\n            skip_threads_80083 = 1;\n            while (slt32(skip_threads_80083, 32)) {\n                bool thread_active_80084 = sle32(skip_threads_80083,\n                                                 local_tid_80037 -\n                                                 squot32(local_tid_80037, 32) *\n                                                 32) && ltid_in_bounds_80082;\n                \n                if (thread_active_80084) {\n                    // read operands\n                    {\n                        x_80075 = ((volatile __local\n                                    int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                                        (int64_t) 8) +\n                                                                (sext_i32_i64(local_tid_80037) -\n                                                                 sext_i32_i64(skip_threads_80083))];\n                    }\n                }\n                // perform operation\n                {\n                    bool inactive_80085 = slt32(smod32((local_tid_80037 + 1) *\n                                                       11 - 1 +\n                                                       segsizze_compact_80056 -\n                                                       boundary_80055,\n                                                       segsizze_compact_80056),\n                                                (local_tid_80037 + 1) * 11 - 1 -\n                                                ((local_tid_80037 -\n                                                  skip_threads_80083 + 1) * 11 -\n                                           ",
            "      1));\n                    \n                    if (thread_active_80084 && inactive_80085) {\n                        x_80075 = x_80076;\n                    }\n                    if (thread_active_80084) {\n                        if (!inactive_80085) {\n                            int64_t defunc_1_op_res_80077 = add64(x_80075,\n                                                                  x_80076);\n                            \n                            x_80075 = defunc_1_op_res_80077;\n                        }\n                    }\n                }\n                if (sle32(wave_sizze_80039, skip_threads_80083)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                if (thread_active_80084) {\n                    // write result\n                    {\n                        ((volatile __local\n                          int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                              (int64_t) 8) +\n                                                      sext_i32_i64(local_tid_80037)] =\n                            x_80075;\n                        x_80076 = x_80075;\n                    }\n                }\n                if (sle32(wave_sizze_80039, skip_threads_80083)) {\n                    barrier(CLK_LOCAL_MEM_FENCE);\n                }\n                skip_threads_80083 *= 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_80037 - squot32(local_tid_80037, 32) * 32) == 31 &&\n                ltid_in_bounds_80082) {\n                ((volatile __local\n                  int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(squot32(local_tid_80037,\n                                                                   32))] =\n                    ",
            "x_80075;\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_80086;\n            \n            // read input for in-block scan\n            {\n                if (squot32(local_tid_80037, 32) == 0 && ltid_in_bounds_80082) {\n                    x_80080 = ((volatile __local\n                                int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                                    (int64_t) 8) +\n                                                            sext_i32_i64(local_tid_80037)];\n                    if ((local_tid_80037 - squot32(local_tid_80037, 32) * 32) ==\n                        0) {\n                        x_80079 = x_80080;\n                    }\n                }\n            }\n            // in-block scan (hopefully no barriers needed)\n            {\n                skip_threads_80086 = 1;\n                while (slt32(skip_threads_80086, 32)) {\n                    bool thread_active_80087 = sle32(skip_threads_80086,\n                                                     local_tid_80037 -\n                                                     squot32(local_tid_80037,\n                                                             32) * 32) &&\n                         (squot32(local_tid_80037, 32) == 0 &&\n                          ltid_in_bounds_80082);\n                    \n                    if (thread_active_80087) {\n                        // read operands\n                        {\n                            x_80079 = ((volatile __local\n                                        int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                                            (int64_t) 8) +\n                                                                    (sext_i32_i64(local_tid_80037) -\n                                                            ",
            "         sext_i32_i64(skip_threads_80086))];\n                        }\n                    }\n                    // perform operation\n                    {\n                        bool inactive_80088 = slt32(smod32((local_tid_80037 *\n                                                            32 + 32 - 1 + 1) *\n                                                           11 - 1 +\n                                                           segsizze_compact_80056 -\n                                                           boundary_80055,\n                                                           segsizze_compact_80056),\n                                                    (local_tid_80037 * 32 + 32 -\n                                                     1 + 1) * 11 - 1 -\n                                                    (((local_tid_80037 -\n                                                       skip_threads_80086) *\n                                                      32 + 32 - 1 + 1) * 11 -\n                                                     1));\n                        \n                        if (thread_active_80087 && inactive_80088) {\n                            x_80079 = x_80080;\n                        }\n                        if (thread_active_80087) {\n                            if (!inactive_80088) {\n                                int64_t defunc_1_op_res_80081 = add64(x_80079,\n                                                                      x_80080);\n                                \n                                x_80079 = defunc_1_op_res_80081;\n                            }\n                        }\n                    }\n                    if (sle32(wave_sizze_80039, skip_threads_80086)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    if (thread_active_80087) {\n                        // write result\n                        {\n                            ((volatile __local\n                           ",
            "   int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                                  (int64_t) 8) +\n                                                          sext_i32_i64(local_tid_80037)] =\n                                x_80079;\n                            x_80080 = x_80079;\n                        }\n                    }\n                    if (sle32(wave_sizze_80039, skip_threads_80086)) {\n                        barrier(CLK_LOCAL_MEM_FENCE);\n                    }\n                    skip_threads_80086 *= 2;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        \n        bool no_carry_in_80089 = squot32(local_tid_80037, 32) == 0 ||\n             !ltid_in_bounds_80082;\n        \n        // carry-in for every block except the first\n        {\n            // read operands\n            {\n                if (!no_carry_in_80089) {\n                    x_80076 = x_80075;\n                    x_80075 = ((__local\n                                int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                                    (int64_t) 8) +\n                                                            (sext_i32_i64(squot32(local_tid_80037,\n                                                                                  32)) -\n                                                             (int64_t) 1)];\n                }\n            }\n            // perform operation\n            {\n                bool inactive_80090 = slt32(smod32((local_tid_80037 + 1) * 11 -\n                                                   1 + segsizze_compact_80056 -\n                                                   boundary_80055,\n                                                   segsizze_compact_80056),\n                                            (local_tid_80037 + 1) * 11 - 1 -\n                                            ((squot32(local_tid_80037, 32) *\n                                       ",
            "       32 - 1 + 1) * 11 - 1));\n                \n                if (!no_carry_in_80089) {\n                    if (inactive_80090) {\n                        x_80075 = x_80076;\n                    }\n                }\n                if (!no_carry_in_80089) {\n                    if (!inactive_80090) {\n                        int64_t defunc_1_op_res_80077 = add64(x_80075, x_80076);\n                        \n                        x_80075 = defunc_1_op_res_80077;\n                    }\n                }\n            }\n            // write final result\n            {\n                if (!no_carry_in_80089) {\n                    ((__local\n                      int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_80037)] =\n                        x_80075;\n                }\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        // restore correct values for first block\n        {\n            if (squot32(local_tid_80037, 32) == 0 && ltid_in_bounds_80082) {\n                ((__local\n                  int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                      (int64_t) 8) +\n                                              sext_i32_i64(local_tid_80037)] =\n                    x_80076;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        barrier(CLK_LOCAL_MEM_FENCE);\n        if (local_tid_80037 == 0) {\n            acc_80078 = ((__local\n                          int64_t *) local_mem_80045)[squot64(byte_offsets_80041,\n                                                              (int64_t) 8) +\n                                                      (segscan_group_sizze_74117 -\n                                                       (int64_t) 1)];\n        } else {\n            acc_80078 = ((__local\n                          int64_t *) local_mem_80045)[squot64(byte_of",
            "fsets_80041,\n                                                              (int64_t) 8) +\n                                                      (sext_i32_i64(local_tid_80037) -\n                                                       (int64_t) 1)];\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    \n    int64_t prefix_80091 = (int64_t) 0;\n    bool block_new_sgm_80092 = sgm_idx_80054 == (int64_t) 0;\n    \n    // Perform lookback\n    {\n        if (block_new_sgm_80092 && local_tid_80037 == 0) {\n            ((volatile __global\n              int64_t *) incprefixes_mem_80034)[dynamic_id_80052] = acc_80078;\n            mem_fence_global();\n            ((volatile __global\n              int8_t *) status_flags_mem_80030)[dynamic_id_80052] = (int8_t) 2;\n            acc_80078 = (int64_t) 0;\n        }\n        if (!block_new_sgm_80092 && slt32(local_tid_80037, wave_sizze_80039)) {\n            if (local_tid_80037 == 0) {\n                if (boundary_80055 == sext_i64_i32(segscan_group_sizze_74117 *\n                    (int64_t) 11)) {\n                    ((volatile __global\n                      int64_t *) aggregates_mem_80032)[dynamic_id_80052] =\n                        acc_80078;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_80030)[dynamic_id_80052] =\n                        (int8_t) 1;\n                } else {\n                    ((volatile __global\n                      int64_t *) incprefixes_mem_80034)[dynamic_id_80052] =\n                        acc_80078;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_80030)[dynamic_id_80052] =\n                        (int8_t) 2;\n                }\n                \n                int8_t tmp_80093;\n                \n                tmp_80093 = ((volatile __global\n                              int8_t *) status_flags_mem_80030)[dynamic_id_80052 -\n                                  ",
            "                              (int64_t) 1];\n                ((volatile __local int8_t *) local_mem_80045)[(int64_t) 0] =\n                    tmp_80093;\n            }\n            mem_fence_local();\n            \n            int8_t status_80094;\n            \n            status_80094 = ((__local int8_t *) local_mem_80045)[(int64_t) 0];\n            if (status_80094 == (int8_t) 2) {\n                if (local_tid_80037 == 0) {\n                    prefix_80091 = ((volatile __global\n                                     int64_t *) incprefixes_mem_80034)[dynamic_id_80052 -\n                                                                       (int64_t) 1];\n                }\n            } else {\n                int32_t readOffset_80095 = dynamic_id_80052 -\n                        sext_i32_i64(wave_sizze_80039);\n                \n                while (slt32(wave_sizze_80039 * -1, readOffset_80095)) {\n                    int32_t read_i_80096 = readOffset_80095 + local_tid_80037;\n                    int64_t aggr_80097 = (int64_t) 0;\n                    int8_t flag_80098 = (int8_t) 0;\n                    \n                    if (sle32(0, read_i_80096)) {\n                        if (sle64(blockOff_80053 - (sext_i32_i64(read_i_80096 +\n                                                    1) *\n                                                    segscan_group_sizze_74117 *\n                                                    (int64_t) 11 - (int64_t) 1),\n                                  sgm_idx_80054)) {\n                            flag_80098 = ((volatile __global\n                                           int8_t *) status_flags_mem_80030)[sext_i32_i64(read_i_80096)];\n                            if (flag_80098 == (int8_t) 2) {\n                                aggr_80097 = ((volatile __global\n                                               int64_t *) incprefixes_mem_80034)[sext_i32_i64(read_i_80096)];\n                            } else {\n                                if (flag_80098 == (int",
            "8_t) 1) {\n                                    aggr_80097 = ((volatile __global\n                                                   int64_t *) aggregates_mem_80032)[sext_i32_i64(read_i_80096)];\n                                }\n                            }\n                        } else {\n                            flag_80098 = (int8_t) 2;\n                        }\n                    }\n                    ((__local\n                      int64_t *) local_mem_80045)[squot64(warp_byte_offset_80043,\n                                                          (int64_t) 8) +\n                                                  sext_i32_i64(local_tid_80037)] =\n                        aggr_80097;\n                    ((__local\n                      int8_t *) local_mem_80045)[sext_i32_i64(local_tid_80037)] =\n                        flag_80098;\n                    flag_80098 = ((__local\n                                   int8_t *) local_mem_80045)[sext_i32_i64(wave_sizze_80039) -\n                                                              (int64_t) 1];\n                    if (slt8(flag_80098, (int8_t) 2)) {\n                        int8_t flg_x_80102;\n                        int8_t flg_y_80103;\n                        int64_t x_80099;\n                        int64_t x_80100;\n                        int32_t skip_threads_80104;\n                        \n                        // read input for in-block scan\n                        {\n                            flg_y_80103 = ((volatile __local\n                                            int8_t *) local_mem_80045)[sext_i32_i64(local_tid_80037)];\n                            x_80100 = ((volatile __local\n                                        int64_t *) local_mem_80045)[squot64(warp_byte_offset_80043,\n                                                                            (int64_t) 8) +\n                                                                    sext_i32_i64(local_tid_80037)];\n                            if ((local_tid_8003",
            "7 - squot32(local_tid_80037,\n                                                           32) * 32) == 0) {\n                                x_80099 = x_80100;\n                                flg_x_80102 = flg_y_80103;\n                            }\n                        }\n                        // in-block scan (hopefully no barriers needed)\n                        {\n                            skip_threads_80104 = 1;\n                            while (slt32(skip_threads_80104, 32)) {\n                                if (sle32(skip_threads_80104, local_tid_80037 -\n                                          squot32(local_tid_80037, 32) * 32)) {\n                                    // read operands\n                                    {\n                                        flg_x_80102 = ((volatile __local\n                                                        int8_t *) local_mem_80045)[sext_i32_i64(local_tid_80037) -\n                                                                                   sext_i32_i64(skip_threads_80104)];\n                                        x_80099 = ((volatile __local\n                                                    int64_t *) local_mem_80045)[squot64(warp_byte_offset_80043,\n                                                                                        (int64_t) 8) +\n                                                                                (sext_i32_i64(local_tid_80037) -\n                                                                                 sext_i32_i64(skip_threads_80104))];\n                                    }\n                                    // perform operation\n                                    {\n                                        if (flg_y_80103 == (int8_t) 2 ||\n                                            flg_y_80103 == (int8_t) 0) {\n                                            flg_x_80102 = flg_y_80103;\n                                            x_80099 = x_80100;\n                          ",
            "              } else {\n                                            int64_t defunc_1_op_res_80101 =\n                                                    add64(x_80099, x_80100);\n                                            \n                                            x_80099 = defunc_1_op_res_80101;\n                                        }\n                                    }\n                                    // write result\n                                    {\n                                        ((volatile __local\n                                          int8_t *) local_mem_80045)[sext_i32_i64(local_tid_80037)] =\n                                            flg_x_80102;\n                                        flg_y_80103 = flg_x_80102;\n                                        ((volatile __local\n                                          int64_t *) local_mem_80045)[squot64(warp_byte_offset_80043,\n                                                                              (int64_t) 8) +\n                                                                      sext_i32_i64(local_tid_80037)] =\n                                            x_80099;\n                                        x_80100 = x_80099;\n                                    }\n                                }\n                                skip_threads_80104 *= 2;\n                            }\n                        }\n                    }\n                    flag_80098 = ((__local\n                                   int8_t *) local_mem_80045)[sext_i32_i64(wave_sizze_80039) -\n                                                              (int64_t) 1];\n                    aggr_80097 = ((__local\n                                   int64_t *) local_mem_80045)[squot64(warp_byte_offset_80043,\n                                                                       (int64_t) 8) +\n                                                               (sext_i32_i64(wave_sizze_80039) -\n                                    ",
            "                            (int64_t) 1)];\n                    if (flag_80098 == (int8_t) 2) {\n                        readOffset_80095 = wave_sizze_80039 * -1;\n                    } else {\n                        if (flag_80098 == (int8_t) 1) {\n                            readOffset_80095 -= wave_sizze_80039;\n                        }\n                    }\n                    if (slt8((int8_t) 0, flag_80098)) {\n                        int64_t x_80105 = aggr_80097;\n                        int64_t x_80106 = prefix_80091;\n                        int64_t defunc_1_op_res_80107 = add64(x_80105, x_80106);\n                        \n                        prefix_80091 = defunc_1_op_res_80107;\n                    }\n                    mem_fence_local();\n                }\n            }\n            if (local_tid_80037 == 0) {\n                if (boundary_80055 == sext_i64_i32(segscan_group_sizze_74117 *\n                    (int64_t) 11)) {\n                    int64_t x_80108 = prefix_80091;\n                    int64_t x_80109 = acc_80078;\n                    int64_t defunc_1_op_res_80110 = add64(x_80108, x_80109);\n                    \n                    ((volatile __global\n                      int64_t *) incprefixes_mem_80034)[dynamic_id_80052] =\n                        defunc_1_op_res_80110;\n                    mem_fence_global();\n                    ((volatile __global\n                      int8_t *) status_flags_mem_80030)[dynamic_id_80052] =\n                        (int8_t) 2;\n                }\n                ((__local\n                  int64_t *) local_mem_80045)[squot64(warp_byte_offset_80043,\n                                                      (int64_t) 8)] =\n                    prefix_80091;\n                acc_80078 = (int64_t) 0;\n            }\n        }\n        if (!(dynamic_id_80052 == (int64_t) 0)) {\n            barrier(CLK_LOCAL_MEM_FENCE);\n            prefix_80091 = ((__local\n                             int64_t *) local_mem_80045)[squot64(warp_byte_offset_8",
            "0043,\n                                                                 (int64_t) 8)];\n            barrier(CLK_LOCAL_MEM_FENCE);\n        }\n    }\n    // Distribute results\n    {\n        int64_t x_80111;\n        int64_t x_80112;\n        int64_t x_80114 = prefix_80091;\n        int64_t x_80115 = acc_80078;\n        \n        if (slt32(local_tid_80037 * 11, boundary_80055) &&\n            !block_new_sgm_80092) {\n            int64_t defunc_1_op_res_80116 = add64(x_80114, x_80115);\n            \n            x_80111 = defunc_1_op_res_80116;\n        } else {\n            x_80111 = acc_80078;\n        }\n        \n        int32_t stopping_point_80117 = segsizze_compact_80056 -\n                srem32(local_tid_80037 * 11 - 1 + segsizze_compact_80056 -\n                       boundary_80055, segsizze_compact_80056);\n        \n        for (int64_t i_80118 = 0; i_80118 < (int64_t) 11; i_80118++) {\n            if (slt32(sext_i64_i32(i_80118), stopping_point_80117 - 1)) {\n                x_80112 = private_mem_80057[i_80118];\n                \n                int64_t defunc_1_op_res_80113 = add64(x_80111, x_80112);\n                \n                private_mem_80057[i_80118] = defunc_1_op_res_80113;\n            }\n        }\n    }\n    // Transpose scan output and Write it to global memory in coalesced fashion\n    {\n        for (int64_t i_80119 = 0; i_80119 < (int64_t) 11; i_80119++) {\n            int64_t sharedIdx_80120 = sext_i32_i64(local_tid_80037 * 11) +\n                    i_80119;\n            int64_t tmp_80121;\n            \n            tmp_80121 = private_mem_80057[i_80119];\n            ((__local int64_t *) local_mem_80045)[sharedIdx_80120] = tmp_80121;\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n        for (int64_t i_80122 = 0; i_80122 < (int64_t) 11; i_80122++) {\n            int64_t flat_idx_80123 = blockOff_80053 +\n                    segscan_group_sizze_74117 * i_80122 +\n                    sext_i32_i64(local_tid_80037);\n            int64_t slice_80124 = n_65378;\n            int64_t",
            " slice_80125 = m_65377 * slice_80124;\n            int64_t gtid_74121 = squot64(flat_idx_80123, slice_80124);\n            int64_t remnant_80126 = flat_idx_80123 - gtid_74121 * slice_80124;\n            int64_t gtid_74122 = remnant_80126;\n            int64_t remnant_80127 = remnant_80126 - gtid_74122;\n            \n            if (slt64(flat_idx_80123, m_65377 * n_65378)) {\n                int64_t tmp_80128;\n                \n                tmp_80128 = ((__local\n                              int64_t *) local_mem_80045)[flat_idx_80123 -\n                                                          blockOff_80053];\n                ((__global int64_t *) mem_77968)[gtid_74121 * n_65378 +\n                                                 gtid_74122] = tmp_80128;\n            }\n        }\n        barrier(CLK_LOCAL_MEM_FENCE);\n    }\n    // If this is the last block, reset the dynamicId\n    {\n        if (dynamic_id_80052 == sdiv_up64(m_65377 * n_65378,\n                                          segscan_group_sizze_74117 *\n                                          (int64_t) 11) - (int64_t) 1) {\n            ((__global int32_t *) mainziid_counter_mem_80028)[(int64_t) 0] = 0;\n        }\n    }\n    \n  error_0:\n    return;\n    #undef segscan_group_sizze_74117\n}\n",
            NULL};
static const char *tuning_param_names[] =
                  {"builtin#replicate_f64.group_size_78315",
                   "builtin#replicate_i64.group_size_78479",
                   "builtin#replicate_i8.group_size_78374",
                   "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_78479",
                   "builtinzhreplicate_i8zigroup_sizze_78374",
                   "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",
                                             "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_78479;
    int64_t *builtinzhreplicate_i8zigroup_sizze_78374;
    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 cuda_config cu_cfg;
    int profiling;
    int64_t tuning_params[73];
    int num_nvrtc_opts;
    const char **nvrtc_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->profiling = 0;
    cfg->num_nvrtc_opts = 0;
    cfg->nvrtc_opts = (const char **) malloc(sizeof(const char *));
    cfg->nvrtc_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;
    cfg->tuning_params[72] = 0;
    cuda_config_init(&cfg->cu_cfg, 73, 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->nvrtc_opts);
    free(cfg);
}
void futhark_context_config_add_nvrtc_option(struct futhark_context_config *cfg,
                                             const char *opt)
{
    cfg->nvrtc_opts[cfg->num_nvrtc_opts] = opt;
    cfg->num_nvrtc_opts++;
    cfg->nvrtc_opts = (const char **) realloc(cfg->nvrtc_opts,
                                              (cfg->num_nvrtc_opts + 1) *
                                              sizeof(const char *));
    cfg->nvrtc_opts[cfg->num_nvrtc_opts] = NULL;
}
void futhark_context_config_set_debugging(struct futhark_context_config *cfg,
                                          int flag)
{
    cfg->cu_cfg.logging = cfg->cu_cfg.debugging = flag;
}
void futhark_context_config_set_profiling(struct futhark_context_config *cfg,
                                          int flag)
{
    cfg->profiling = flag;
}
void futhark_context_config_set_logging(struct futhark_context_config *cfg,
                                        int flag)
{
    cfg->cu_cfg.logging = flag;
}
void futhark_context_config_set_device(struct futhark_context_config *cfg, const
                                       char *s)
{
    set_preferred_device(&cfg->cu_cfg, s);
}
void futhark_context_config_dump_program_to(struct futhark_context_config *cfg,
                                            const char *path)
{
    cfg->cu_cfg.dump_program_to = path;
}
void futhark_context_config_load_program_from(struct futhark_context_config *cfg,
                                              const char *path)
{
    cfg->cu_cfg.load_program_from = path;
}
void futhark_context_config_dump_ptx_to(struct futhark_context_config *cfg,
                                        const char *path)
{
    cfg->cu_cfg.dump_ptx_to = path;
}
void futhark_context_config_load_ptx_from(struct futhark_context_config *cfg,
                                          const char *path)
{
    cfg->cu_cfg.load_ptx_from = path;
}
void futhark_context_config_set_default_group_size(struct futhark_context_config *cfg,
                                                   int size)
{
    cfg->cu_cfg.default_block_size = size;
    cfg->cu_cfg.default_block_size_changed = 1;
}
void futhark_context_config_set_default_num_groups(struct futhark_context_config *cfg,
                                                   int num)
{
    cfg->cu_cfg.default_grid_size = num;
    cfg->cu_cfg.default_grid_size_changed = 1;
}
void futhark_context_config_set_default_tile_size(struct futhark_context_config *cfg,
                                                  int size)
{
    cfg->cu_cfg.default_tile_size = size;
    cfg->cu_cfg.default_tile_size_changed = 1;
}
void futhark_context_config_set_default_reg_tile_size(struct futhark_context_config *cfg,
                                                      int size)
{
    cfg->cu_cfg.default_reg_tile_size = size;
}
void futhark_context_config_set_default_threshold(struct futhark_context_config *cfg,
                                                  int size)
{
    cfg->cu_cfg.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 < 73; 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->cu_cfg.default_block_size = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_num_groups") == 0) {
        cfg->cu_cfg.default_grid_size = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_threshold") == 0) {
        cfg->cu_cfg.default_threshold = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_tile_size") == 0) {
        cfg->cu_cfg.default_tile_size = new_value;
        return 0;
    }
    if (strcmp(param_name, "default_reg_tile_size") == 0) {
        cfg->cu_cfg.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 mainziid_counter_mem_78359;
    struct memblock_device mainzicounter_mem_78609;
    struct memblock_device mainzicounter_mem_78691;
    struct memblock_device mainziid_counter_mem_78774;
    struct memblock_device mainzicounter_mem_79036;
    struct memblock_device mainzicounter_mem_79138;
    struct memblock_device mainziid_counter_mem_79229;
    struct memblock_device mainzicounter_mem_79523;
    struct memblock_device mainzicounter_mem_79637;
    struct memblock_device mainziid_counter_mem_79684;
    struct memblock_device mainziid_counter_mem_79853;
    struct memblock_device mainziid_counter_mem_80028;
    CUfunction builtinzhreplicate_f64zireplicate_78312;
    int64_t builtinzhreplicate_f64zireplicate_78312_total_runtime;
    int builtinzhreplicate_f64zireplicate_78312_runs;
    CUfunction builtinzhreplicate_i64zireplicate_78476;
    int64_t builtinzhreplicate_i64zireplicate_78476_total_runtime;
    int builtinzhreplicate_i64zireplicate_78476_runs;
    CUfunction builtinzhreplicate_i8zireplicate_78371;
    int64_t builtinzhreplicate_i8zireplicate_78371_total_runtime;
    int builtinzhreplicate_i8zireplicate_78371_runs;
    CUfunction gpu_map_transpose_f64;
    int64_t gpu_map_transpose_f64_total_runtime;
    int gpu_map_transpose_f64_runs;
    CUfunction gpu_map_transpose_f64_low_height;
    int64_t gpu_map_transpose_f64_low_height_total_runtime;
    int gpu_map_transpose_f64_low_height_runs;
    CUfunction gpu_map_transpose_f64_low_width;
    int64_t gpu_map_transpose_f64_low_width_total_runtime;
    int gpu_map_transpose_f64_low_width_runs;
    CUfunction gpu_map_transpose_f64_small;
    int64_t gpu_map_transpose_f64_small_total_runtime;
    int gpu_map_transpose_f64_small_runs;
    CUfunction mainzisegmap_66915;
    int64_t mainzisegmap_66915_total_runtime;
    int mainzisegmap_66915_runs;
    CUfunction mainzisegmap_67937;
    int64_t mainzisegmap_67937_total_runtime;
    int mainzisegmap_67937_runs;
    CUfunction mainzisegmap_67956;
    int64_t mainzisegmap_67956_total_runtime;
    int mainzisegmap_67956_runs;
    CUfunction mainzisegmap_67968;
    int64_t mainzisegmap_67968_total_runtime;
    int mainzisegmap_67968_runs;
    CUfunction mainzisegmap_67988;
    int64_t mainzisegmap_67988_total_runtime;
    int mainzisegmap_67988_runs;
    CUfunction mainzisegmap_68159;
    int64_t mainzisegmap_68159_total_runtime;
    int mainzisegmap_68159_runs;
    CUfunction mainzisegmap_68300;
    int64_t mainzisegmap_68300_total_runtime;
    int mainzisegmap_68300_runs;
    CUfunction mainzisegmap_68572;
    int64_t mainzisegmap_68572_total_runtime;
    int mainzisegmap_68572_runs;
    CUfunction mainzisegmap_69728;
    int64_t mainzisegmap_69728_total_runtime;
    int mainzisegmap_69728_runs;
    CUfunction mainzisegmap_69747;
    int64_t mainzisegmap_69747_total_runtime;
    int mainzisegmap_69747_runs;
    CUfunction mainzisegmap_69759;
    int64_t mainzisegmap_69759_total_runtime;
    int mainzisegmap_69759_runs;
    CUfunction mainzisegmap_69779;
    int64_t mainzisegmap_69779_total_runtime;
    int mainzisegmap_69779_runs;
    CUfunction mainzisegmap_69980;
    int64_t mainzisegmap_69980_total_runtime;
    int mainzisegmap_69980_runs;
    CUfunction mainzisegmap_70133;
    int64_t mainzisegmap_70133_total_runtime;
    int mainzisegmap_70133_runs;
    CUfunction mainzisegmap_70463;
    int64_t mainzisegmap_70463_total_runtime;
    int mainzisegmap_70463_runs;
    CUfunction mainzisegmap_71767;
    int64_t mainzisegmap_71767_total_runtime;
    int mainzisegmap_71767_runs;
    CUfunction mainzisegmap_71786;
    int64_t mainzisegmap_71786_total_runtime;
    int mainzisegmap_71786_runs;
    CUfunction mainzisegmap_71798;
    int64_t mainzisegmap_71798_total_runtime;
    int mainzisegmap_71798_runs;
    CUfunction mainzisegmap_71818;
    int64_t mainzisegmap_71818_total_runtime;
    int mainzisegmap_71818_runs;
    CUfunction mainzisegmap_72051;
    int64_t mainzisegmap_72051_total_runtime;
    int mainzisegmap_72051_runs;
    CUfunction mainzisegmap_72216;
    int64_t mainzisegmap_72216_total_runtime;
    int mainzisegmap_72216_runs;
    CUfunction mainzisegmap_72752;
    int64_t mainzisegmap_72752_total_runtime;
    int mainzisegmap_72752_runs;
    CUfunction mainzisegmap_72771;
    int64_t mainzisegmap_72771_total_runtime;
    int mainzisegmap_72771_runs;
    CUfunction mainzisegmap_72783;
    int64_t mainzisegmap_72783_total_runtime;
    int mainzisegmap_72783_runs;
    CUfunction mainzisegmap_72803;
    int64_t mainzisegmap_72803_total_runtime;
    int mainzisegmap_72803_runs;
    CUfunction mainzisegmap_73419;
    int64_t mainzisegmap_73419_total_runtime;
    int mainzisegmap_73419_runs;
    CUfunction mainzisegmap_73438;
    int64_t mainzisegmap_73438_total_runtime;
    int mainzisegmap_73438_runs;
    CUfunction mainzisegmap_73450;
    int64_t mainzisegmap_73450_total_runtime;
    int mainzisegmap_73450_runs;
    CUfunction mainzisegmap_73470;
    int64_t mainzisegmap_73470_total_runtime;
    int mainzisegmap_73470_runs;
    CUfunction mainzisegmap_74176;
    int64_t mainzisegmap_74176_total_runtime;
    int mainzisegmap_74176_runs;
    CUfunction mainzisegmap_74195;
    int64_t mainzisegmap_74195_total_runtime;
    int mainzisegmap_74195_runs;
    CUfunction mainzisegmap_74207;
    int64_t mainzisegmap_74207_total_runtime;
    int mainzisegmap_74207_runs;
    CUfunction mainzisegmap_74227;
    int64_t mainzisegmap_74227_total_runtime;
    int mainzisegmap_74227_runs;
    CUfunction mainzisegmap_74589;
    int64_t mainzisegmap_74589_total_runtime;
    int mainzisegmap_74589_runs;
    CUfunction mainzisegmap_intragroup_72819;
    int64_t mainzisegmap_intragroup_72819_total_runtime;
    int mainzisegmap_intragroup_72819_runs;
    CUfunction mainzisegmap_intragroup_73487;
    int64_t mainzisegmap_intragroup_73487_total_runtime;
    int mainzisegmap_intragroup_73487_runs;
    CUfunction mainzisegmap_intragroup_74244;
    int64_t mainzisegmap_intragroup_74244_total_runtime;
    int mainzisegmap_intragroup_74244_runs;
    CUfunction mainzisegmap_intragroup_74792;
    int64_t mainzisegmap_intragroup_74792_total_runtime;
    int mainzisegmap_intragroup_74792_runs;
    CUfunction mainzisegmap_intragroup_75346;
    int64_t mainzisegmap_intragroup_75346_total_runtime;
    int mainzisegmap_intragroup_75346_runs;
    CUfunction mainzisegmap_intragroup_76017;
    int64_t mainzisegmap_intragroup_76017_total_runtime;
    int mainzisegmap_intragroup_76017_runs;
    CUfunction mainzisegred_large_68263;
    int64_t mainzisegred_large_68263_total_runtime;
    int mainzisegred_large_68263_runs;
    CUfunction mainzisegred_large_68313;
    int64_t mainzisegred_large_68313_total_runtime;
    int mainzisegred_large_68313_runs;
    CUfunction mainzisegred_large_70086;
    int64_t mainzisegred_large_70086_total_runtime;
    int mainzisegred_large_70086_runs;
    CUfunction mainzisegred_large_70156;
    int64_t mainzisegred_large_70156_total_runtime;
    int mainzisegred_large_70156_runs;
    CUfunction mainzisegred_large_72159;
    int64_t mainzisegred_large_72159_total_runtime;
    int mainzisegred_large_72159_runs;
    CUfunction mainzisegred_large_72258;
    int64_t mainzisegred_large_72258_total_runtime;
    int mainzisegred_large_72258_runs;
    CUfunction mainzisegred_small_68263;
    int64_t mainzisegred_small_68263_total_runtime;
    int mainzisegred_small_68263_runs;
    CUfunction mainzisegred_small_68313;
    int64_t mainzisegred_small_68313_total_runtime;
    int mainzisegred_small_68313_runs;
    CUfunction mainzisegred_small_70086;
    int64_t mainzisegred_small_70086_total_runtime;
    int mainzisegred_small_70086_runs;
    CUfunction mainzisegred_small_70156;
    int64_t mainzisegred_small_70156_total_runtime;
    int mainzisegred_small_70156_runs;
    CUfunction mainzisegred_small_72159;
    int64_t mainzisegred_small_72159_total_runtime;
    int mainzisegred_small_72159_runs;
    CUfunction mainzisegred_small_72258;
    int64_t mainzisegred_small_72258_total_runtime;
    int mainzisegred_small_72258_runs;
    CUfunction mainzisegscan_67884;
    int64_t mainzisegscan_67884_total_runtime;
    int mainzisegscan_67884_runs;
    CUfunction mainzisegscan_69675;
    int64_t mainzisegscan_69675_total_runtime;
    int mainzisegscan_69675_runs;
    CUfunction mainzisegscan_71714;
    int64_t mainzisegscan_71714_total_runtime;
    int mainzisegscan_71714_runs;
    CUfunction mainzisegscan_72699;
    int64_t mainzisegscan_72699_total_runtime;
    int mainzisegscan_72699_runs;
    CUfunction mainzisegscan_73366;
    int64_t mainzisegscan_73366_total_runtime;
    int mainzisegscan_73366_runs;
    CUfunction mainzisegscan_74123;
    int64_t mainzisegscan_74123_total_runtime;
    int mainzisegscan_74123_runs;
    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;
    CUdeviceptr global_failure;
    CUdeviceptr global_failure_args;
    struct cuda_context cuda;
    struct tuning_params tuning_params;
    int32_t failure_is_an_option;
    int total_runs;
    long total_runtime;
};
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;
    ctx->debugging = ctx->detail_memory = cfg->cu_cfg.debugging;
    ctx->profiling = cfg->profiling;
    ctx->profiling_paused = 0;
    ctx->logging = cfg->cu_cfg.logging;
    ctx->error = NULL;
    ctx->log = stderr;
    ctx->cuda.profiling_records_capacity = 200;
    ctx->cuda.profiling_records_used = 0;
    ctx->cuda.profiling_records = malloc(ctx->cuda.profiling_records_capacity *
        sizeof(struct profiling_record));
    ctx->cuda.cfg = cfg->cu_cfg;
    create_lock(&ctx->lock);
    ctx->failure_is_an_option = 0;
    ctx->total_runs = 0;
    ctx->total_runtime = 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->error = cuda_setup(&ctx->cuda, cuda_program, cfg->nvrtc_opts);
    if (ctx->error != NULL)
        return NULL;
    
    int32_t no_error = -1;
    
    CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->global_failure, sizeof(no_error)));
    CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->global_failure, &no_error,
                                    sizeof(no_error)));
    // The +1 is to avoid zero-byte allocations.
    CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->global_failure_args, sizeof(int64_t) *
                                  (2 + 1)));
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->builtinzhreplicate_f64zireplicate_78312,
                                           ctx->cuda.module,
                                           "builtinzhreplicate_f64zireplicate_78312"));
    ctx->builtinzhreplicate_f64zireplicate_78312_total_runtime = 0;
    ctx->builtinzhreplicate_f64zireplicate_78312_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->builtinzhreplicate_i64zireplicate_78476,
                                           ctx->cuda.module,
                                           "builtinzhreplicate_i64zireplicate_78476"));
    ctx->builtinzhreplicate_i64zireplicate_78476_total_runtime = 0;
    ctx->builtinzhreplicate_i64zireplicate_78476_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->builtinzhreplicate_i8zireplicate_78371,
                                           ctx->cuda.module,
                                           "builtinzhreplicate_i8zireplicate_78371"));
    ctx->builtinzhreplicate_i8zireplicate_78371_total_runtime = 0;
    ctx->builtinzhreplicate_i8zireplicate_78371_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->gpu_map_transpose_f64,
                                           ctx->cuda.module,
                                           "gpu_map_transpose_f64"));
    ctx->gpu_map_transpose_f64_total_runtime = 0;
    ctx->gpu_map_transpose_f64_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->gpu_map_transpose_f64_low_height,
                                           ctx->cuda.module,
                                           "gpu_map_transpose_f64_low_height"));
    ctx->gpu_map_transpose_f64_low_height_total_runtime = 0;
    ctx->gpu_map_transpose_f64_low_height_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->gpu_map_transpose_f64_low_width,
                                           ctx->cuda.module,
                                           "gpu_map_transpose_f64_low_width"));
    ctx->gpu_map_transpose_f64_low_width_total_runtime = 0;
    ctx->gpu_map_transpose_f64_low_width_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->gpu_map_transpose_f64_small,
                                           ctx->cuda.module,
                                           "gpu_map_transpose_f64_small"));
    ctx->gpu_map_transpose_f64_small_total_runtime = 0;
    ctx->gpu_map_transpose_f64_small_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_66915,
                                           ctx->cuda.module,
                                           "mainzisegmap_66915"));
    ctx->mainzisegmap_66915_total_runtime = 0;
    ctx->mainzisegmap_66915_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_67937,
                                           ctx->cuda.module,
                                           "mainzisegmap_67937"));
    ctx->mainzisegmap_67937_total_runtime = 0;
    ctx->mainzisegmap_67937_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_67956,
                                           ctx->cuda.module,
                                           "mainzisegmap_67956"));
    ctx->mainzisegmap_67956_total_runtime = 0;
    ctx->mainzisegmap_67956_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_67968,
                                           ctx->cuda.module,
                                           "mainzisegmap_67968"));
    ctx->mainzisegmap_67968_total_runtime = 0;
    ctx->mainzisegmap_67968_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_67988,
                                           ctx->cuda.module,
                                           "mainzisegmap_67988"));
    ctx->mainzisegmap_67988_total_runtime = 0;
    ctx->mainzisegmap_67988_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_68159,
                                           ctx->cuda.module,
                                           "mainzisegmap_68159"));
    ctx->mainzisegmap_68159_total_runtime = 0;
    ctx->mainzisegmap_68159_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_68300,
                                           ctx->cuda.module,
                                           "mainzisegmap_68300"));
    ctx->mainzisegmap_68300_total_runtime = 0;
    ctx->mainzisegmap_68300_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_68572,
                                           ctx->cuda.module,
                                           "mainzisegmap_68572"));
    ctx->mainzisegmap_68572_total_runtime = 0;
    ctx->mainzisegmap_68572_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_69728,
                                           ctx->cuda.module,
                                           "mainzisegmap_69728"));
    ctx->mainzisegmap_69728_total_runtime = 0;
    ctx->mainzisegmap_69728_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_69747,
                                           ctx->cuda.module,
                                           "mainzisegmap_69747"));
    ctx->mainzisegmap_69747_total_runtime = 0;
    ctx->mainzisegmap_69747_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_69759,
                                           ctx->cuda.module,
                                           "mainzisegmap_69759"));
    ctx->mainzisegmap_69759_total_runtime = 0;
    ctx->mainzisegmap_69759_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_69779,
                                           ctx->cuda.module,
                                           "mainzisegmap_69779"));
    ctx->mainzisegmap_69779_total_runtime = 0;
    ctx->mainzisegmap_69779_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_69980,
                                           ctx->cuda.module,
                                           "mainzisegmap_69980"));
    ctx->mainzisegmap_69980_total_runtime = 0;
    ctx->mainzisegmap_69980_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_70133,
                                           ctx->cuda.module,
                                           "mainzisegmap_70133"));
    ctx->mainzisegmap_70133_total_runtime = 0;
    ctx->mainzisegmap_70133_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_70463,
                                           ctx->cuda.module,
                                           "mainzisegmap_70463"));
    ctx->mainzisegmap_70463_total_runtime = 0;
    ctx->mainzisegmap_70463_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_71767,
                                           ctx->cuda.module,
                                           "mainzisegmap_71767"));
    ctx->mainzisegmap_71767_total_runtime = 0;
    ctx->mainzisegmap_71767_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_71786,
                                           ctx->cuda.module,
                                           "mainzisegmap_71786"));
    ctx->mainzisegmap_71786_total_runtime = 0;
    ctx->mainzisegmap_71786_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_71798,
                                           ctx->cuda.module,
                                           "mainzisegmap_71798"));
    ctx->mainzisegmap_71798_total_runtime = 0;
    ctx->mainzisegmap_71798_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_71818,
                                           ctx->cuda.module,
                                           "mainzisegmap_71818"));
    ctx->mainzisegmap_71818_total_runtime = 0;
    ctx->mainzisegmap_71818_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_72051,
                                           ctx->cuda.module,
                                           "mainzisegmap_72051"));
    ctx->mainzisegmap_72051_total_runtime = 0;
    ctx->mainzisegmap_72051_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_72216,
                                           ctx->cuda.module,
                                           "mainzisegmap_72216"));
    ctx->mainzisegmap_72216_total_runtime = 0;
    ctx->mainzisegmap_72216_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_72752,
                                           ctx->cuda.module,
                                           "mainzisegmap_72752"));
    ctx->mainzisegmap_72752_total_runtime = 0;
    ctx->mainzisegmap_72752_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_72771,
                                           ctx->cuda.module,
                                           "mainzisegmap_72771"));
    ctx->mainzisegmap_72771_total_runtime = 0;
    ctx->mainzisegmap_72771_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_72783,
                                           ctx->cuda.module,
                                           "mainzisegmap_72783"));
    ctx->mainzisegmap_72783_total_runtime = 0;
    ctx->mainzisegmap_72783_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_72803,
                                           ctx->cuda.module,
                                           "mainzisegmap_72803"));
    ctx->mainzisegmap_72803_total_runtime = 0;
    ctx->mainzisegmap_72803_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_73419,
                                           ctx->cuda.module,
                                           "mainzisegmap_73419"));
    ctx->mainzisegmap_73419_total_runtime = 0;
    ctx->mainzisegmap_73419_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_73438,
                                           ctx->cuda.module,
                                           "mainzisegmap_73438"));
    ctx->mainzisegmap_73438_total_runtime = 0;
    ctx->mainzisegmap_73438_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_73450,
                                           ctx->cuda.module,
                                           "mainzisegmap_73450"));
    ctx->mainzisegmap_73450_total_runtime = 0;
    ctx->mainzisegmap_73450_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_73470,
                                           ctx->cuda.module,
                                           "mainzisegmap_73470"));
    ctx->mainzisegmap_73470_total_runtime = 0;
    ctx->mainzisegmap_73470_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_74176,
                                           ctx->cuda.module,
                                           "mainzisegmap_74176"));
    ctx->mainzisegmap_74176_total_runtime = 0;
    ctx->mainzisegmap_74176_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_74195,
                                           ctx->cuda.module,
                                           "mainzisegmap_74195"));
    ctx->mainzisegmap_74195_total_runtime = 0;
    ctx->mainzisegmap_74195_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_74207,
                                           ctx->cuda.module,
                                           "mainzisegmap_74207"));
    ctx->mainzisegmap_74207_total_runtime = 0;
    ctx->mainzisegmap_74207_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_74227,
                                           ctx->cuda.module,
                                           "mainzisegmap_74227"));
    ctx->mainzisegmap_74227_total_runtime = 0;
    ctx->mainzisegmap_74227_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_74589,
                                           ctx->cuda.module,
                                           "mainzisegmap_74589"));
    ctx->mainzisegmap_74589_total_runtime = 0;
    ctx->mainzisegmap_74589_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_intragroup_72819,
                                           ctx->cuda.module,
                                           "mainzisegmap_intragroup_72819"));
    ctx->mainzisegmap_intragroup_72819_total_runtime = 0;
    ctx->mainzisegmap_intragroup_72819_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_intragroup_73487,
                                           ctx->cuda.module,
                                           "mainzisegmap_intragroup_73487"));
    ctx->mainzisegmap_intragroup_73487_total_runtime = 0;
    ctx->mainzisegmap_intragroup_73487_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_intragroup_74244,
                                           ctx->cuda.module,
                                           "mainzisegmap_intragroup_74244"));
    ctx->mainzisegmap_intragroup_74244_total_runtime = 0;
    ctx->mainzisegmap_intragroup_74244_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_intragroup_74792,
                                           ctx->cuda.module,
                                           "mainzisegmap_intragroup_74792"));
    ctx->mainzisegmap_intragroup_74792_total_runtime = 0;
    ctx->mainzisegmap_intragroup_74792_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_intragroup_75346,
                                           ctx->cuda.module,
                                           "mainzisegmap_intragroup_75346"));
    ctx->mainzisegmap_intragroup_75346_total_runtime = 0;
    ctx->mainzisegmap_intragroup_75346_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegmap_intragroup_76017,
                                           ctx->cuda.module,
                                           "mainzisegmap_intragroup_76017"));
    ctx->mainzisegmap_intragroup_76017_total_runtime = 0;
    ctx->mainzisegmap_intragroup_76017_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_large_68263,
                                           ctx->cuda.module,
                                           "mainzisegred_large_68263"));
    ctx->mainzisegred_large_68263_total_runtime = 0;
    ctx->mainzisegred_large_68263_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_large_68313,
                                           ctx->cuda.module,
                                           "mainzisegred_large_68313"));
    ctx->mainzisegred_large_68313_total_runtime = 0;
    ctx->mainzisegred_large_68313_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_large_70086,
                                           ctx->cuda.module,
                                           "mainzisegred_large_70086"));
    ctx->mainzisegred_large_70086_total_runtime = 0;
    ctx->mainzisegred_large_70086_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_large_70156,
                                           ctx->cuda.module,
                                           "mainzisegred_large_70156"));
    ctx->mainzisegred_large_70156_total_runtime = 0;
    ctx->mainzisegred_large_70156_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_large_72159,
                                           ctx->cuda.module,
                                           "mainzisegred_large_72159"));
    ctx->mainzisegred_large_72159_total_runtime = 0;
    ctx->mainzisegred_large_72159_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_large_72258,
                                           ctx->cuda.module,
                                           "mainzisegred_large_72258"));
    ctx->mainzisegred_large_72258_total_runtime = 0;
    ctx->mainzisegred_large_72258_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_small_68263,
                                           ctx->cuda.module,
                                           "mainzisegred_small_68263"));
    ctx->mainzisegred_small_68263_total_runtime = 0;
    ctx->mainzisegred_small_68263_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_small_68313,
                                           ctx->cuda.module,
                                           "mainzisegred_small_68313"));
    ctx->mainzisegred_small_68313_total_runtime = 0;
    ctx->mainzisegred_small_68313_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_small_70086,
                                           ctx->cuda.module,
                                           "mainzisegred_small_70086"));
    ctx->mainzisegred_small_70086_total_runtime = 0;
    ctx->mainzisegred_small_70086_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_small_70156,
                                           ctx->cuda.module,
                                           "mainzisegred_small_70156"));
    ctx->mainzisegred_small_70156_total_runtime = 0;
    ctx->mainzisegred_small_70156_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_small_72159,
                                           ctx->cuda.module,
                                           "mainzisegred_small_72159"));
    ctx->mainzisegred_small_72159_total_runtime = 0;
    ctx->mainzisegred_small_72159_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegred_small_72258,
                                           ctx->cuda.module,
                                           "mainzisegred_small_72258"));
    ctx->mainzisegred_small_72258_total_runtime = 0;
    ctx->mainzisegred_small_72258_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegscan_67884,
                                           ctx->cuda.module,
                                           "mainzisegscan_67884"));
    ctx->mainzisegscan_67884_total_runtime = 0;
    ctx->mainzisegscan_67884_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegscan_69675,
                                           ctx->cuda.module,
                                           "mainzisegscan_69675"));
    ctx->mainzisegscan_69675_total_runtime = 0;
    ctx->mainzisegscan_69675_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegscan_71714,
                                           ctx->cuda.module,
                                           "mainzisegscan_71714"));
    ctx->mainzisegscan_71714_total_runtime = 0;
    ctx->mainzisegscan_71714_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegscan_72699,
                                           ctx->cuda.module,
                                           "mainzisegscan_72699"));
    ctx->mainzisegscan_72699_total_runtime = 0;
    ctx->mainzisegscan_72699_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegscan_73366,
                                           ctx->cuda.module,
                                           "mainzisegscan_73366"));
    ctx->mainzisegscan_73366_total_runtime = 0;
    ctx->mainzisegscan_73366_runs = 0;
    CUDA_SUCCEED_FATAL(cuModuleGetFunction(&ctx->mainzisegscan_74123,
                                           ctx->cuda.module,
                                           "mainzisegscan_74123"));
    ctx->mainzisegscan_74123_total_runtime = 0;
    ctx->mainzisegscan_74123_runs = 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->mainziid_counter_mem_78359.references = NULL;
        ctx->mainziid_counter_mem_78359.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainziid_counter_mem_78359.mem, (1 >
                                                                             0 ? 1 : 1) *
                                      sizeof(int32_t)));
        if (1 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainziid_counter_mem_78359.mem,
                                            mainziid_counter_mem_realtype_80265,
                                            1 * sizeof(int32_t)));
    }
    {
        ctx->mainzicounter_mem_78609.references = NULL;
        ctx->mainzicounter_mem_78609.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainzicounter_mem_78609.mem,
                                      (10240 > 0 ? 10240 : 1) *
                                      sizeof(int32_t)));
        if (10240 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainzicounter_mem_78609.mem,
                                            mainzicounter_mem_realtype_80340,
                                            10240 * sizeof(int32_t)));
    }
    {
        ctx->mainzicounter_mem_78691.references = NULL;
        ctx->mainzicounter_mem_78691.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainzicounter_mem_78691.mem,
                                      (10240 > 0 ? 10240 : 1) *
                                      sizeof(int32_t)));
        if (10240 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainzicounter_mem_78691.mem,
                                            mainzicounter_mem_realtype_80374,
                                            10240 * sizeof(int32_t)));
    }
    {
        ctx->mainziid_counter_mem_78774.references = NULL;
        ctx->mainziid_counter_mem_78774.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainziid_counter_mem_78774.mem, (1 >
                                                                             0 ? 1 : 1) *
                                      sizeof(int32_t)));
        if (1 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainziid_counter_mem_78774.mem,
                                            mainziid_counter_mem_realtype_80404,
                                            1 * sizeof(int32_t)));
    }
    {
        ctx->mainzicounter_mem_79036.references = NULL;
        ctx->mainzicounter_mem_79036.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainzicounter_mem_79036.mem,
                                      (10240 > 0 ? 10240 : 1) *
                                      sizeof(int32_t)));
        if (10240 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainzicounter_mem_79036.mem,
                                            mainzicounter_mem_realtype_80486,
                                            10240 * sizeof(int32_t)));
    }
    {
        ctx->mainzicounter_mem_79138.references = NULL;
        ctx->mainzicounter_mem_79138.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainzicounter_mem_79138.mem,
                                      (10240 > 0 ? 10240 : 1) *
                                      sizeof(int32_t)));
        if (10240 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainzicounter_mem_79138.mem,
                                            mainzicounter_mem_realtype_80537,
                                            10240 * sizeof(int32_t)));
    }
    {
        ctx->mainziid_counter_mem_79229.references = NULL;
        ctx->mainziid_counter_mem_79229.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainziid_counter_mem_79229.mem, (1 >
                                                                             0 ? 1 : 1) *
                                      sizeof(int32_t)));
        if (1 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainziid_counter_mem_79229.mem,
                                            mainziid_counter_mem_realtype_80573,
                                            1 * sizeof(int32_t)));
    }
    {
        ctx->mainzicounter_mem_79523.references = NULL;
        ctx->mainzicounter_mem_79523.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainzicounter_mem_79523.mem,
                                      (10240 > 0 ? 10240 : 1) *
                                      sizeof(int32_t)));
        if (10240 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainzicounter_mem_79523.mem,
                                            mainzicounter_mem_realtype_80661,
                                            10240 * sizeof(int32_t)));
    }
    {
        ctx->mainzicounter_mem_79637.references = NULL;
        ctx->mainzicounter_mem_79637.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainzicounter_mem_79637.mem,
                                      (10240 > 0 ? 10240 : 1) *
                                      sizeof(int32_t)));
        if (10240 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainzicounter_mem_79637.mem,
                                            mainzicounter_mem_realtype_80726,
                                            10240 * sizeof(int32_t)));
    }
    {
        ctx->mainziid_counter_mem_79684.references = NULL;
        ctx->mainziid_counter_mem_79684.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainziid_counter_mem_79684.mem, (1 >
                                                                             0 ? 1 : 1) *
                                      sizeof(int32_t)));
        if (1 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainziid_counter_mem_79684.mem,
                                            mainziid_counter_mem_realtype_80752,
                                            1 * sizeof(int32_t)));
    }
    {
        ctx->mainziid_counter_mem_79853.references = NULL;
        ctx->mainziid_counter_mem_79853.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainziid_counter_mem_79853.mem, (1 >
                                                                             0 ? 1 : 1) *
                                      sizeof(int32_t)));
        if (1 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainziid_counter_mem_79853.mem,
                                            mainziid_counter_mem_realtype_80808,
                                            1 * sizeof(int32_t)));
    }
    {
        ctx->mainziid_counter_mem_80028.references = NULL;
        ctx->mainziid_counter_mem_80028.size = 0;
        CUDA_SUCCEED_FATAL(cuMemAlloc(&ctx->mainziid_counter_mem_80028.mem, (1 >
                                                                             0 ? 1 : 1) *
                                      sizeof(int32_t)));
        if (1 > 0)
            CUDA_SUCCEED_FATAL(cuMemcpyHtoD(ctx->mainziid_counter_mem_80028.mem,
                                            mainziid_counter_mem_realtype_80873,
                                            1 * sizeof(int32_t)));
    }
    ctx->tuning_params.builtinzhreplicate_f64zigroup_sizze_78315 =
        &cfg->tuning_params[0];
    ctx->tuning_params.builtinzhreplicate_i64zigroup_sizze_78479 =
        &cfg->tuning_params[1];
    ctx->tuning_params.builtinzhreplicate_i8zigroup_sizze_78374 =
        &cfg->tuning_params[2];
    ctx->tuning_params.mainzisegmap_group_sizze_66731 = &cfg->tuning_params[3];
    ctx->tuning_params.mainzisegmap_group_sizze_67323 = &cfg->tuning_params[4];
    ctx->tuning_params.mainzisegmap_group_sizze_67381 = &cfg->tuning_params[5];
    ctx->tuning_params.mainzisegmap_group_sizze_67695 = &cfg->tuning_params[6];
    ctx->tuning_params.mainzisegmap_group_sizze_67720 = &cfg->tuning_params[7];
    ctx->tuning_params.mainzisegmap_group_sizze_67746 = &cfg->tuning_params[8];
    ctx->tuning_params.mainzisegmap_group_sizze_67772 = &cfg->tuning_params[9];
    ctx->tuning_params.mainzisegmap_group_sizze_68358 = &cfg->tuning_params[10];
    ctx->tuning_params.mainzisegmap_group_sizze_69060 = &cfg->tuning_params[11];
    ctx->tuning_params.mainzisegmap_group_sizze_69135 = &cfg->tuning_params[12];
    ctx->tuning_params.mainzisegmap_group_sizze_69486 = &cfg->tuning_params[13];
    ctx->tuning_params.mainzisegmap_group_sizze_69511 = &cfg->tuning_params[14];
    ctx->tuning_params.mainzisegmap_group_sizze_69537 = &cfg->tuning_params[15];
    ctx->tuning_params.mainzisegmap_group_sizze_69563 = &cfg->tuning_params[16];
    ctx->tuning_params.mainzisegmap_group_sizze_70217 = &cfg->tuning_params[17];
    ctx->tuning_params.mainzisegmap_group_sizze_71032 = &cfg->tuning_params[18];
    ctx->tuning_params.mainzisegmap_group_sizze_71134 = &cfg->tuning_params[19];
    ctx->tuning_params.mainzisegmap_group_sizze_71525 = &cfg->tuning_params[20];
    ctx->tuning_params.mainzisegmap_group_sizze_71550 = &cfg->tuning_params[21];
    ctx->tuning_params.mainzisegmap_group_sizze_71576 = &cfg->tuning_params[22];
    ctx->tuning_params.mainzisegmap_group_sizze_71602 = &cfg->tuning_params[23];
    ctx->tuning_params.mainzisegmap_group_sizze_72510 = &cfg->tuning_params[24];
    ctx->tuning_params.mainzisegmap_group_sizze_72535 = &cfg->tuning_params[25];
    ctx->tuning_params.mainzisegmap_group_sizze_72561 = &cfg->tuning_params[26];
    ctx->tuning_params.mainzisegmap_group_sizze_72587 = &cfg->tuning_params[27];
    ctx->tuning_params.mainzisegmap_group_sizze_73177 = &cfg->tuning_params[28];
    ctx->tuning_params.mainzisegmap_group_sizze_73202 = &cfg->tuning_params[29];
    ctx->tuning_params.mainzisegmap_group_sizze_73228 = &cfg->tuning_params[30];
    ctx->tuning_params.mainzisegmap_group_sizze_73254 = &cfg->tuning_params[31];
    ctx->tuning_params.mainzisegmap_group_sizze_73934 = &cfg->tuning_params[32];
    ctx->tuning_params.mainzisegmap_group_sizze_73959 = &cfg->tuning_params[33];
    ctx->tuning_params.mainzisegmap_group_sizze_73985 = &cfg->tuning_params[34];
    ctx->tuning_params.mainzisegmap_group_sizze_74011 = &cfg->tuning_params[35];
    ctx->tuning_params.mainzisegmap_group_sizze_74466 = &cfg->tuning_params[36];
    ctx->tuning_params.mainzisegmap_num_groups_66733 = &cfg->tuning_params[37];
    ctx->tuning_params.mainzisegmap_num_groups_68360 = &cfg->tuning_params[38];
    ctx->tuning_params.mainzisegmap_num_groups_70219 = &cfg->tuning_params[39];
    ctx->tuning_params.mainzisegred_group_sizze_67268 = &cfg->tuning_params[40];
    ctx->tuning_params.mainzisegred_group_sizze_67336 = &cfg->tuning_params[41];
    ctx->tuning_params.mainzisegred_group_sizze_68987 = &cfg->tuning_params[42];
    ctx->tuning_params.mainzisegred_group_sizze_69082 = &cfg->tuning_params[43];
    ctx->tuning_params.mainzisegred_group_sizze_70946 = &cfg->tuning_params[44];
    ctx->tuning_params.mainzisegred_group_sizze_71073 = &cfg->tuning_params[45];
    ctx->tuning_params.mainzisegred_num_groups_67270 = &cfg->tuning_params[46];
    ctx->tuning_params.mainzisegred_num_groups_67338 = &cfg->tuning_params[47];
    ctx->tuning_params.mainzisegred_num_groups_68989 = &cfg->tuning_params[48];
    ctx->tuning_params.mainzisegred_num_groups_69084 = &cfg->tuning_params[49];
    ctx->tuning_params.mainzisegred_num_groups_70948 = &cfg->tuning_params[50];
    ctx->tuning_params.mainzisegred_num_groups_71075 = &cfg->tuning_params[51];
    ctx->tuning_params.mainzisegscan_group_sizze_67858 =
        &cfg->tuning_params[52];
    ctx->tuning_params.mainzisegscan_group_sizze_69649 =
        &cfg->tuning_params[53];
    ctx->tuning_params.mainzisegscan_group_sizze_71688 =
        &cfg->tuning_params[54];
    ctx->tuning_params.mainzisegscan_group_sizze_72673 =
        &cfg->tuning_params[55];
    ctx->tuning_params.mainzisegscan_group_sizze_73340 =
        &cfg->tuning_params[56];
    ctx->tuning_params.mainzisegscan_group_sizze_74097 =
        &cfg->tuning_params[57];
    ctx->tuning_params.mainzisegscan_num_groups_67860 = &cfg->tuning_params[58];
    ctx->tuning_params.mainzisegscan_num_groups_69651 = &cfg->tuning_params[59];
    ctx->tuning_params.mainzisegscan_num_groups_71690 = &cfg->tuning_params[60];
    ctx->tuning_params.mainzisegscan_num_groups_72675 = &cfg->tuning_params[61];
    ctx->tuning_params.mainzisegscan_num_groups_73342 = &cfg->tuning_params[62];
    ctx->tuning_params.mainzisegscan_num_groups_74099 = &cfg->tuning_params[63];
    ctx->tuning_params.mainzisuff_outer_par_0 = &cfg->tuning_params[64];
    ctx->tuning_params.mainzisuff_outer_par_1 = &cfg->tuning_params[65];
    ctx->tuning_params.mainzisuff_outer_par_2 = &cfg->tuning_params[66];
    ctx->tuning_params.mainzisuff_outer_par_3 = &cfg->tuning_params[67];
    ctx->tuning_params.mainzisuff_outer_par_4 = &cfg->tuning_params[68];
    ctx->tuning_params.mainzisuff_outer_par_5 = &cfg->tuning_params[69];
    ctx->tuning_params.mainzitile_sizze_74786 = &cfg->tuning_params[70];
    ctx->tuning_params.mainzitile_sizze_75340 = &cfg->tuning_params[71];
    ctx->tuning_params.mainzitile_sizze_76011 = &cfg->tuning_params[72];
    init_constants(ctx);
    // Clear the free list of any deallocations that occurred while initialising constants.
    CUDA_SUCCEED_FATAL(cuda_free_all(&ctx->cuda));
    futhark_context_sync(ctx);
    return ctx;
}
void futhark_context_free(struct futhark_context *ctx)
{
    free_constants(ctx);
    cuda_cleanup(&ctx->cuda);
    free_lock(&ctx->lock);
    ctx->cfg->in_use = 0;
    free(ctx);
}
int futhark_context_sync(struct futhark_context *ctx)
{
    CUDA_SUCCEED_OR_RETURN(cuCtxPushCurrent(ctx->cuda.cu_ctx));
    CUDA_SUCCEED_OR_RETURN(cuCtxSynchronize());
    if (ctx->failure_is_an_option) {
        int32_t failure_idx;
        
        CUDA_SUCCEED_OR_RETURN(cuMemcpyDtoH(&failure_idx, ctx->global_failure,
                                            sizeof(int32_t)));
        ctx->failure_is_an_option = 0;
        if (failure_idx >= 0) {
            int32_t no_failure = -1;
            
            CUDA_SUCCEED_OR_RETURN(cuMemcpyHtoD(ctx->global_failure,
                                                &no_failure, sizeof(int32_t)));
            
            int64_t args[2 + 1];
            
            CUDA_SUCCEED_OR_RETURN(cuMemcpyDtoH(&args, ctx->global_failure_args,
                                                sizeof(args)));
            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;
        }
    }
    CUDA_SUCCEED_OR_RETURN(cuCtxPopCurrent(&ctx->cuda.cu_ctx));
    return 0;
}
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;
            CUDA_SUCCEED_OR_RETURN(cuda_free(&ctx->cuda, 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");
    CUDA_SUCCEED_OR_RETURN(cuda_alloc(&ctx->cuda, (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) {
        CUDA_SUCCEED_FATAL(cuda_tally_profiling_records(&ctx->cuda));
        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_78476 ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->builtinzhreplicate_i64zireplicate_78476_runs,
                    (long) ctx->builtinzhreplicate_i64zireplicate_78476_total_runtime /
                    (ctx->builtinzhreplicate_i64zireplicate_78476_runs !=
                     0 ? ctx->builtinzhreplicate_i64zireplicate_78476_runs : 1),
                    (long) ctx->builtinzhreplicate_i64zireplicate_78476_total_runtime);
        ctx->total_runtime +=
            ctx->builtinzhreplicate_i64zireplicate_78476_total_runtime;
        ctx->total_runs += ctx->builtinzhreplicate_i64zireplicate_78476_runs;
        str_builder(&builder,
                    "builtin#replicate_i8.replicate_78371  ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->builtinzhreplicate_i8zireplicate_78371_runs,
                    (long) ctx->builtinzhreplicate_i8zireplicate_78371_total_runtime /
                    (ctx->builtinzhreplicate_i8zireplicate_78371_runs !=
                     0 ? ctx->builtinzhreplicate_i8zireplicate_78371_runs : 1),
                    (long) ctx->builtinzhreplicate_i8zireplicate_78371_total_runtime);
        ctx->total_runtime +=
            ctx->builtinzhreplicate_i8zireplicate_78371_total_runtime;
        ctx->total_runs += ctx->builtinzhreplicate_i8zireplicate_78371_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.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,
                    "main.segscan_67884                    ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegscan_67884_runs,
                    (long) ctx->mainzisegscan_67884_total_runtime /
                    (ctx->mainzisegscan_67884_runs !=
                     0 ? ctx->mainzisegscan_67884_runs : 1),
                    (long) ctx->mainzisegscan_67884_total_runtime);
        ctx->total_runtime += ctx->mainzisegscan_67884_total_runtime;
        ctx->total_runs += ctx->mainzisegscan_67884_runs;
        str_builder(&builder,
                    "main.segscan_69675                    ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegscan_69675_runs,
                    (long) ctx->mainzisegscan_69675_total_runtime /
                    (ctx->mainzisegscan_69675_runs !=
                     0 ? ctx->mainzisegscan_69675_runs : 1),
                    (long) ctx->mainzisegscan_69675_total_runtime);
        ctx->total_runtime += ctx->mainzisegscan_69675_total_runtime;
        ctx->total_runs += ctx->mainzisegscan_69675_runs;
        str_builder(&builder,
                    "main.segscan_71714                    ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegscan_71714_runs,
                    (long) ctx->mainzisegscan_71714_total_runtime /
                    (ctx->mainzisegscan_71714_runs !=
                     0 ? ctx->mainzisegscan_71714_runs : 1),
                    (long) ctx->mainzisegscan_71714_total_runtime);
        ctx->total_runtime += ctx->mainzisegscan_71714_total_runtime;
        ctx->total_runs += ctx->mainzisegscan_71714_runs;
        str_builder(&builder,
                    "main.segscan_72699                    ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegscan_72699_runs,
                    (long) ctx->mainzisegscan_72699_total_runtime /
                    (ctx->mainzisegscan_72699_runs !=
                     0 ? ctx->mainzisegscan_72699_runs : 1),
                    (long) ctx->mainzisegscan_72699_total_runtime);
        ctx->total_runtime += ctx->mainzisegscan_72699_total_runtime;
        ctx->total_runs += ctx->mainzisegscan_72699_runs;
        str_builder(&builder,
                    "main.segscan_73366                    ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegscan_73366_runs,
                    (long) ctx->mainzisegscan_73366_total_runtime /
                    (ctx->mainzisegscan_73366_runs !=
                     0 ? ctx->mainzisegscan_73366_runs : 1),
                    (long) ctx->mainzisegscan_73366_total_runtime);
        ctx->total_runtime += ctx->mainzisegscan_73366_total_runtime;
        ctx->total_runs += ctx->mainzisegscan_73366_runs;
        str_builder(&builder,
                    "main.segscan_74123                    ran %5d times; avg: %8ldus; total: %8ldus\n",
                    ctx->mainzisegscan_74123_runs,
                    (long) ctx->mainzisegscan_74123_total_runtime /
                    (ctx->mainzisegscan_74123_runs !=
                     0 ? ctx->mainzisegscan_74123_runs : 1),
                    (long) ctx->mainzisegscan_74123_total_runtime);
        ctx->total_runtime += ctx->mainzisegscan_74123_total_runtime;
        ctx->total_runs += ctx->mainzisegscan_74123_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);
    CUDA_SUCCEED_FATAL(cuCtxPushCurrent(ctx->cuda.cu_ctx));
    ctx->peak_mem_usage_device = 0;
    ctx->peak_mem_usage_default = 0;
    if (ctx->error == NULL)
        CUDA_SUCCEED_NONFATAL(cuda_free_all(&ctx->cuda));
    CUDA_SUCCEED_FATAL(cuCtxPopCurrent(&ctx->cuda.cu_ctx));
    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_78472,
                                         int32_t num_elems_78473,
                                         int64_t val_78474);
static int futrts_builtinzhreplicate_i8(struct futhark_context *ctx,
                                        struct memblock_device mem_78367,
                                        int32_t num_elems_78368,
                                        int8_t val_78369);
static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock_device *mem_out_p_80254,
                             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);
    CUDA_SUCCEED_FATAL(cuCtxPushCurrent(ctx->cuda.cu_ctx));
    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;
    {
        cudaEvent_t *pevents = NULL;
        
        if (ctx->profiling && !ctx->profiling_paused) {
            pevents = cuda_get_events(&ctx->cuda, &ctx->copy_host_to_dev_runs,
                                      &ctx->copy_host_to_dev_total_runtime);
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
        }
        CUDA_SUCCEED_OR_RETURN(cuMemcpyHtoD(arr->mem.mem + 0, data + 0,
                                            (size_t) (dim0 * dim1) * 8));
        if (pevents != NULL)
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
    }
    CUDA_SUCCEED_FATAL(cuCtxPopCurrent(&ctx->cuda.cu_ctx));
    lock_unlock(&ctx->lock);
    return arr;
}
struct futhark_f64_2d *futhark_new_raw_f64_2d(struct futhark_context *ctx, const
                                              CUdeviceptr 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);
    CUDA_SUCCEED_FATAL(cuCtxPushCurrent(ctx->cuda.cu_ctx));
    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;
    {
        cudaEvent_t *pevents = NULL;
        
        if (ctx->profiling && !ctx->profiling_paused) {
            pevents = cuda_get_events(&ctx->cuda, &ctx->copy_dev_to_dev_runs,
                                      &ctx->copy_dev_to_dev_total_runtime);
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
        }
        CUDA_SUCCEED_OR_RETURN(cuMemcpy(arr->mem.mem + 0, data + offset,
                                        (size_t) (dim0 * dim1) * 8));
        if (pevents != NULL)
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
    }
    CUDA_SUCCEED_FATAL(cuCtxPopCurrent(&ctx->cuda.cu_ctx));
    lock_unlock(&ctx->lock);
    return arr;
}
int futhark_free_f64_2d(struct futhark_context *ctx, struct futhark_f64_2d *arr)
{
    lock_lock(&ctx->lock);
    CUDA_SUCCEED_FATAL(cuCtxPushCurrent(ctx->cuda.cu_ctx));
    if (memblock_unref_device(ctx, &arr->mem, "arr->mem") != 0)
        return 1;
    CUDA_SUCCEED_FATAL(cuCtxPopCurrent(&ctx->cuda.cu_ctx));
    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);
    CUDA_SUCCEED_FATAL(cuCtxPushCurrent(ctx->cuda.cu_ctx));
    {
        cudaEvent_t *pevents = NULL;
        
        if (ctx->profiling && !ctx->profiling_paused) {
            pevents = cuda_get_events(&ctx->cuda, &ctx->copy_dev_to_host_runs,
                                      &ctx->copy_dev_to_host_total_runtime);
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
        }
        CUDA_SUCCEED_OR_RETURN(cuMemcpyDtoH(data + 0, arr->mem.mem + 0,
                                            (size_t) (arr->shape[0] *
                                                      arr->shape[1]) * 8));
        if (pevents != NULL)
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
    }
    CUDA_SUCCEED_FATAL(cuCtxPopCurrent(&ctx->cuda.cu_ctx));
    lock_unlock(&ctx->lock);
    return 0;
}
CUdeviceptr 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)) {
            {
                cudaEvent_t *pevents = NULL;
                
                if (ctx->profiling && !ctx->profiling_paused) {
                    pevents = cuda_get_events(&ctx->cuda,
                                              &ctx->copy_dev_to_dev_runs,
                                              &ctx->copy_dev_to_dev_total_runtime);
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                }
                CUDA_SUCCEED_OR_RETURN(cuMemcpy(destmem_0.mem +
                                                sext_i32_i64(destoffset_1),
                                                srcmem_2.mem +
                                                sext_i32_i64(srcoffset_3),
                                                sext_i32_i64(x_elems_5 *
                                                y_elems_6 * 8)));
                if (pevents != NULL)
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
            }
        } else {
            if (sle32(x_elems_5, 8) && slt32(16, y_elems_6)) {
                unsigned int shared_sizze_80217 = (int64_t) 2176;
                CUdeviceptr kernel_arg_80219 = destmem_0.mem;
                CUdeviceptr kernel_arg_80220 = srcmem_2.mem;
                unsigned int shared_offset_80218 = 0;
                
                if ((((((1 && sdiv_up32(x_elems_5, 16) != 0) &&
                        sdiv_up32(sdiv_up32(y_elems_6, muly_8), 16) != 0) &&
                       num_arrays_4 != 0) && 16 != 0) && 16 != 0) && 1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (sdiv_up32(sdiv_up32(y_elems_6, muly_8), 16) >= 1 <<
                        16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (num_arrays_4 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = sdiv_up32(x_elems_5, 16);
                    grid[perm[1]] = sdiv_up32(sdiv_up32(y_elems_6, muly_8), 16);
                    grid[perm[2]] = num_arrays_4;
                    
                    void *kernel_args_80214[] = {&perm[0], &perm[1], &perm[2],
                                                 &shared_offset_80218,
                                                 &destoffset_1, &srcoffset_3,
                                                 &num_arrays_4, &x_elems_5,
                                                 &y_elems_6, &mulx_7, &muly_8,
                                                 &kernel_arg_80219,
                                                 &kernel_arg_80220};
                    int64_t time_start_80215 = 0, time_end_80216 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "gpu_map_transpose_f64_low_width",
                                (long) sdiv_up32(x_elems_5, 16),
                                (long) sdiv_up32(sdiv_up32(y_elems_6, muly_8),
                                                 16), (long) num_arrays_4,
                                (long) 16, (long) 16, (long) 1, (int) (0 +
                                                                       (shared_sizze_80217 +
                                                                        (8 -
                                                                         shared_sizze_80217 %
                                                                         8) %
                                                                        8)));
                        time_start_80215 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->gpu_map_transpose_f64_low_width_runs,
                                                  &ctx->gpu_map_transpose_f64_low_width_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->gpu_map_transpose_f64_low_width,
                                                          grid[0], grid[1],
                                                          grid[2], 16, 16, 1,
                                                          0 +
                                                          (shared_sizze_80217 +
                                                           (8 -
                                                            shared_sizze_80217 %
                                                            8) % 8), NULL,
                                                          kernel_args_80214,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80216 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "gpu_map_transpose_f64_low_width",
                                time_end_80216 - time_start_80215);
                    }
                }
            } else {
                if (sle32(y_elems_6, 8) && slt32(16, x_elems_5)) {
                    unsigned int shared_sizze_80224 = (int64_t) 2176;
                    CUdeviceptr kernel_arg_80226 = destmem_0.mem;
                    CUdeviceptr kernel_arg_80227 = srcmem_2.mem;
                    unsigned int shared_offset_80225 = 0;
                    
                    if ((((((1 && sdiv_up32(sdiv_up32(x_elems_5, mulx_7), 16) !=
                             0) && sdiv_up32(y_elems_6, 16) != 0) &&
                           num_arrays_4 != 0) && 16 != 0) && 16 != 0) && 1 !=
                        0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (sdiv_up32(y_elems_6, 16) >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (num_arrays_4 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = sdiv_up32(sdiv_up32(x_elems_5, mulx_7),
                                                  16);
                        grid[perm[1]] = sdiv_up32(y_elems_6, 16);
                        grid[perm[2]] = num_arrays_4;
                        
                        void *kernel_args_80221[] = {&perm[0], &perm[1],
                                                     &perm[2],
                                                     &shared_offset_80225,
                                                     &destoffset_1,
                                                     &srcoffset_3,
                                                     &num_arrays_4, &x_elems_5,
                                                     &y_elems_6, &mulx_7,
                                                     &muly_8, &kernel_arg_80226,
                                                     &kernel_arg_80227};
                        int64_t time_start_80222 = 0, time_end_80223 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "gpu_map_transpose_f64_low_height",
                                    (long) sdiv_up32(sdiv_up32(x_elems_5,
                                                               mulx_7), 16),
                                    (long) sdiv_up32(y_elems_6, 16),
                                    (long) num_arrays_4, (long) 16, (long) 16,
                                    (long) 1, (int) (0 + (shared_sizze_80224 +
                                                          (8 -
                                                           shared_sizze_80224 %
                                                           8) % 8)));
                            time_start_80222 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->gpu_map_transpose_f64_low_height_runs,
                                                      &ctx->gpu_map_transpose_f64_low_height_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->gpu_map_transpose_f64_low_height,
                                                              grid[0], grid[1],
                                                              grid[2], 16, 16,
                                                              1, 0 +
                                                              (shared_sizze_80224 +
                                                               (8 -
                                                                shared_sizze_80224 %
                                                                8) % 8), NULL,
                                                              kernel_args_80221,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80223 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "gpu_map_transpose_f64_low_height",
                                    time_end_80223 - time_start_80222);
                        }
                    }
                } else {
                    if (sle32(x_elems_5, 8) && sle32(y_elems_6, 8)) {
                        unsigned int shared_sizze_80231 = (int64_t) 1;
                        CUdeviceptr kernel_arg_80233 = destmem_0.mem;
                        CUdeviceptr kernel_arg_80234 = srcmem_2.mem;
                        unsigned int shared_offset_80232 = 0;
                        
                        if ((((((1 && sdiv_up32(num_arrays_4 * x_elems_5 *
                                                y_elems_6, 256) != 0) && 1 !=
                                0) && 1 != 0) && 256 != 0) && 1 != 0) && 1 !=
                            0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = sdiv_up32(num_arrays_4 * x_elems_5 *
                                                      y_elems_6, 256);
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80228[] = {&shared_offset_80232,
                                                         &destoffset_1,
                                                         &srcoffset_3,
                                                         &num_arrays_4,
                                                         &x_elems_5, &y_elems_6,
                                                         &mulx_7, &muly_8,
                                                         &kernel_arg_80233,
                                                         &kernel_arg_80234};
                            int64_t time_start_80229 = 0, time_end_80230 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "gpu_map_transpose_f64_small",
                                        (long) sdiv_up32(num_arrays_4 *
                                                         x_elems_5 * y_elems_6,
                                                         256), (long) 1,
                                        (long) 1, (long) 256, (long) 1,
                                        (long) 1, (int) (0 +
                                                         (shared_sizze_80231 +
                                                          (8 -
                                                           shared_sizze_80231 %
                                                           8) % 8)));
                                time_start_80229 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->gpu_map_transpose_f64_small_runs,
                                                          &ctx->gpu_map_transpose_f64_small_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->gpu_map_transpose_f64_small,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2], 256,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80231 +
                                                                   (8 -
                                                                    shared_sizze_80231 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80228,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80230 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "gpu_map_transpose_f64_small",
                                        time_end_80230 - time_start_80229);
                            }
                        }
                    } else {
                        unsigned int shared_sizze_80238 = (int64_t) 8448;
                        CUdeviceptr kernel_arg_80240 = destmem_0.mem;
                        CUdeviceptr kernel_arg_80241 = srcmem_2.mem;
                        unsigned int shared_offset_80239 = 0;
                        
                        if ((((((1 && sdiv_up32(x_elems_5, 32) != 0) &&
                                sdiv_up32(y_elems_6, 32) != 0) &&
                               num_arrays_4 != 0) && 32 != 0) && 8 != 0) && 1 !=
                            0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (sdiv_up32(y_elems_6, 32) >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (num_arrays_4 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = sdiv_up32(x_elems_5, 32);
                            grid[perm[1]] = sdiv_up32(y_elems_6, 32);
                            grid[perm[2]] = num_arrays_4;
                            
                            void *kernel_args_80235[] = {&perm[0], &perm[1],
                                                         &perm[2],
                                                         &shared_offset_80239,
                                                         &destoffset_1,
                                                         &srcoffset_3,
                                                         &num_arrays_4,
                                                         &x_elems_5, &y_elems_6,
                                                         &mulx_7, &muly_8,
                                                         &kernel_arg_80240,
                                                         &kernel_arg_80241};
                            int64_t time_start_80236 = 0, time_end_80237 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "gpu_map_transpose_f64",
                                        (long) sdiv_up32(x_elems_5, 32),
                                        (long) sdiv_up32(y_elems_6, 32),
                                        (long) num_arrays_4, (long) 32,
                                        (long) 8, (long) 1, (int) (0 +
                                                                   (shared_sizze_80238 +
                                                                    (8 -
                                                                     shared_sizze_80238 %
                                                                     8) % 8)));
                                time_start_80236 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->gpu_map_transpose_f64_runs,
                                                          &ctx->gpu_map_transpose_f64_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->gpu_map_transpose_f64,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2], 32,
                                                                  8, 1, 0 +
                                                                  (shared_sizze_80238 +
                                                                   (8 -
                                                                    shared_sizze_80238 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80235,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80237 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "gpu_map_transpose_f64",
                                        time_end_80237 - time_start_80236);
                            }
                        }
                    }
                }
            }
        }
    }
    
  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);
    CUdeviceptr kernel_arg_80245 = mem_78308.mem;
    
    if ((((((1 && num_groups_78316 != 0) && 1 != 0) && 1 != 0) &&
          group_sizze_78315 != 0) && 1 != 0) && 1 != 0) {
        int perm[3] = {0, 1, 2};
        
        if (1 >= 1 << 16) {
            perm[1] = perm[0];
            perm[0] = 1;
        }
        if (1 >= 1 << 16) {
            perm[2] = perm[0];
            perm[0] = 2;
        }
        
        size_t grid[3];
        
        grid[perm[0]] = num_groups_78316;
        grid[perm[1]] = 1;
        grid[perm[2]] = 1;
        
        void *kernel_args_80242[] = {&num_elems_78309, &val_78310,
                                     &kernel_arg_80245};
        int64_t time_start_80243 = 0, time_end_80244 = 0;
        
        if (ctx->debugging) {
            fprintf(ctx->log,
                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                    "builtin#replicate_f64.replicate_78312",
                    (long) num_groups_78316, (long) 1, (long) 1,
                    (long) group_sizze_78315, (long) 1, (long) 1, (int) 0);
            time_start_80243 = get_wall_time();
        }
        
        cudaEvent_t *pevents = NULL;
        
        if (ctx->profiling && !ctx->profiling_paused) {
            pevents = cuda_get_events(&ctx->cuda,
                                      &ctx->builtinzhreplicate_f64zireplicate_78312_runs,
                                      &ctx->builtinzhreplicate_f64zireplicate_78312_total_runtime);
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
        }
        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->builtinzhreplicate_f64zireplicate_78312,
                                              grid[0], grid[1], grid[2],
                                              group_sizze_78315, 1, 1, 0, NULL,
                                              kernel_args_80242, NULL));
        if (pevents != NULL)
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
        if (ctx->debugging) {
            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
            time_end_80244 = get_wall_time();
            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                    "builtin#replicate_f64.replicate_78312", time_end_80244 -
                    time_start_80243);
        }
    }
    
  cleanup:
    { }
    return err;
}
static int futrts_builtinzhreplicate_i64(struct futhark_context *ctx,
                                         struct memblock_device mem_78472,
                                         int32_t num_elems_78473,
                                         int64_t val_78474)
{
    (void) ctx;
    
    int err = 0;
    int64_t group_sizze_78479;
    
    group_sizze_78479 =
        *ctx->tuning_params.builtinzhreplicate_i64zigroup_sizze_78479;
    
    int64_t num_groups_78480 = sdiv_up64(num_elems_78473, group_sizze_78479);
    CUdeviceptr kernel_arg_80249 = mem_78472.mem;
    
    if ((((((1 && num_groups_78480 != 0) && 1 != 0) && 1 != 0) &&
          group_sizze_78479 != 0) && 1 != 0) && 1 != 0) {
        int perm[3] = {0, 1, 2};
        
        if (1 >= 1 << 16) {
            perm[1] = perm[0];
            perm[0] = 1;
        }
        if (1 >= 1 << 16) {
            perm[2] = perm[0];
            perm[0] = 2;
        }
        
        size_t grid[3];
        
        grid[perm[0]] = num_groups_78480;
        grid[perm[1]] = 1;
        grid[perm[2]] = 1;
        
        void *kernel_args_80246[] = {&num_elems_78473, &val_78474,
                                     &kernel_arg_80249};
        int64_t time_start_80247 = 0, time_end_80248 = 0;
        
        if (ctx->debugging) {
            fprintf(ctx->log,
                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                    "builtin#replicate_i64.replicate_78476",
                    (long) num_groups_78480, (long) 1, (long) 1,
                    (long) group_sizze_78479, (long) 1, (long) 1, (int) 0);
            time_start_80247 = get_wall_time();
        }
        
        cudaEvent_t *pevents = NULL;
        
        if (ctx->profiling && !ctx->profiling_paused) {
            pevents = cuda_get_events(&ctx->cuda,
                                      &ctx->builtinzhreplicate_i64zireplicate_78476_runs,
                                      &ctx->builtinzhreplicate_i64zireplicate_78476_total_runtime);
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
        }
        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->builtinzhreplicate_i64zireplicate_78476,
                                              grid[0], grid[1], grid[2],
                                              group_sizze_78479, 1, 1, 0, NULL,
                                              kernel_args_80246, NULL));
        if (pevents != NULL)
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
        if (ctx->debugging) {
            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
            time_end_80248 = get_wall_time();
            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                    "builtin#replicate_i64.replicate_78476", time_end_80248 -
                    time_start_80247);
        }
    }
    
  cleanup:
    { }
    return err;
}
static int futrts_builtinzhreplicate_i8(struct futhark_context *ctx,
                                        struct memblock_device mem_78367,
                                        int32_t num_elems_78368,
                                        int8_t val_78369)
{
    (void) ctx;
    
    int err = 0;
    int64_t group_sizze_78374;
    
    group_sizze_78374 =
        *ctx->tuning_params.builtinzhreplicate_i8zigroup_sizze_78374;
    
    int64_t num_groups_78375 = sdiv_up64(num_elems_78368, group_sizze_78374);
    CUdeviceptr kernel_arg_80253 = mem_78367.mem;
    
    if ((((((1 && num_groups_78375 != 0) && 1 != 0) && 1 != 0) &&
          group_sizze_78374 != 0) && 1 != 0) && 1 != 0) {
        int perm[3] = {0, 1, 2};
        
        if (1 >= 1 << 16) {
            perm[1] = perm[0];
            perm[0] = 1;
        }
        if (1 >= 1 << 16) {
            perm[2] = perm[0];
            perm[0] = 2;
        }
        
        size_t grid[3];
        
        grid[perm[0]] = num_groups_78375;
        grid[perm[1]] = 1;
        grid[perm[2]] = 1;
        
        void *kernel_args_80250[] = {&num_elems_78368, &val_78369,
                                     &kernel_arg_80253};
        int64_t time_start_80251 = 0, time_end_80252 = 0;
        
        if (ctx->debugging) {
            fprintf(ctx->log,
                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                    "builtin#replicate_i8.replicate_78371",
                    (long) num_groups_78375, (long) 1, (long) 1,
                    (long) group_sizze_78374, (long) 1, (long) 1, (int) 0);
            time_start_80251 = get_wall_time();
        }
        
        cudaEvent_t *pevents = NULL;
        
        if (ctx->profiling && !ctx->profiling_paused) {
            pevents = cuda_get_events(&ctx->cuda,
                                      &ctx->builtinzhreplicate_i8zireplicate_78371_runs,
                                      &ctx->builtinzhreplicate_i8zireplicate_78371_total_runtime);
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
        }
        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->builtinzhreplicate_i8zireplicate_78371,
                                              grid[0], grid[1], grid[2],
                                              group_sizze_78374, 1, 1, 0, NULL,
                                              kernel_args_80250, NULL));
        if (pevents != NULL)
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
        if (ctx->debugging) {
            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
            time_end_80252 = get_wall_time();
            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                    "builtin#replicate_i8.replicate_78371", time_end_80252 -
                    time_start_80251);
        }
    }
    
  cleanup:
    { }
    return err;
}
static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock_device *mem_out_p_80254,
                             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_78728;
            
            local_memory_capacity_78728 = ctx->cuda.max_shared_memory;
            if (sle64((int64_t) 0, sext_i32_i64(local_memory_capacity_78728)) &&
                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");
                
                CUdeviceptr kernel_arg_80258 = mem_77017.mem;
                CUdeviceptr kernel_arg_80259 = mem_77111.mem;
                CUdeviceptr kernel_arg_80260 = color_78164.mem;
                CUdeviceptr kernel_arg_80261 = color_78165.mem;
                CUdeviceptr kernel_arg_80262 = color_78166.mem;
                CUdeviceptr kernel_arg_80263 = color_78167.mem;
                CUdeviceptr kernel_arg_80264 = color_78168.mem;
                
                if ((((((1 && num_groups_66911 != 0) && 1 != 0) && 1 != 0) &&
                      segmap_group_sizze_66910 != 0) && 1 != 0) && 1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = num_groups_66911;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80255[] = {&ctx->global_failure,
                                                 &ctx->failure_is_an_option,
                                                 &ctx->global_failure_args,
                                                 &m_65377, &n_65378, &q_65380,
                                                 &jump_65382, &n_m_65386,
                                                 &i_65392, &x_65393,
                                                 &min_res_65398,
                                                 &loop_cond_65403,
                                                 &i64_res_65404,
                                                 &num_groups_66911,
                                                 &num_threads_78238,
                                                 &kernel_arg_80258,
                                                 &kernel_arg_80259,
                                                 &kernel_arg_80260,
                                                 &kernel_arg_80261,
                                                 &kernel_arg_80262,
                                                 &kernel_arg_80263,
                                                 &kernel_arg_80264};
                    int64_t time_start_80256 = 0, time_end_80257 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_66915", (long) num_groups_66911,
                                (long) 1, (long) 1,
                                (long) segmap_group_sizze_66910, (long) 1,
                                (long) 1, (int) 0);
                        time_start_80256 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_66915_runs,
                                                  &ctx->mainzisegmap_66915_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_66915,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_66910,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80255,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80257 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_66915", time_end_80257 -
                                time_start_80256);
                    }
                }
                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");
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: number of elements processed sequentially per thread is m:",
                                (long long) 11, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: memory constraints is: ",
                                (long long) 11, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: register constraints is: ",
                                (long long) 15, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c", "SegScan: sumT' is: ",
                                (long long) 2, '\n');
                    
                    int64_t numThreads_78357 = sdiv_up64(m_65377 * n_65378,
                                                         segscan_group_sizze_67878 *
                                                         (int64_t) 11) *
                            segscan_group_sizze_67878;
                    int64_t numGroups_78358 = sdiv_up64(m_65377 * n_65378,
                                                        segscan_group_sizze_67878 *
                                                        (int64_t) 11);
                    struct memblock_device mainziid_counter_mem_78359 =
                                           ctx->mainziid_counter_mem_78359;
                    struct memblock_device status_flags_mem_78361;
                    
                    status_flags_mem_78361.references = NULL;
                    if (memblock_alloc_device(ctx, &status_flags_mem_78361,
                                              numGroups_78358,
                                              "status_flags_mem_78361")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device aggregates_mem_78363;
                    
                    aggregates_mem_78363.references = NULL;
                    if (memblock_alloc_device(ctx, &aggregates_mem_78363,
                                              (int64_t) 8 * numGroups_78358,
                                              "aggregates_mem_78363")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device incprefixes_mem_78365;
                    
                    incprefixes_mem_78365.references = NULL;
                    if (memblock_alloc_device(ctx, &incprefixes_mem_78365,
                                              (int64_t) 8 * numGroups_78358,
                                              "incprefixes_mem_78365")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhreplicate_i8(ctx,
                                                     status_flags_mem_78361,
                                                     numGroups_78358,
                                                     (int8_t) 0) != 0) {
                        if (memblock_unref_device(ctx, &incprefixes_mem_78365,
                                                  "incprefixes_mem_78365") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &aggregates_mem_78363,
                                                  "aggregates_mem_78363") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &status_flags_mem_78361,
                                                  "status_flags_mem_78361") !=
                            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;
                    }
                    
                    unsigned int shared_sizze_80269 =
                                 smax64(smax64((int64_t) 288, (int64_t) 8 *
                                               segscan_group_sizze_67878),
                                        (int64_t) 11 *
                                        segscan_group_sizze_67878 *
                                        (int64_t) 8);
                    CUdeviceptr kernel_arg_80271 = Y_mem_77010.mem;
                    CUdeviceptr kernel_arg_80272 = mem_77116.mem;
                    CUdeviceptr kernel_arg_80273 =
                                mainziid_counter_mem_78359.mem;
                    CUdeviceptr kernel_arg_80274 = status_flags_mem_78361.mem;
                    CUdeviceptr kernel_arg_80275 = aggregates_mem_78363.mem;
                    CUdeviceptr kernel_arg_80276 = incprefixes_mem_78365.mem;
                    unsigned int shared_offset_80270 = 0;
                    
                    if ((((((1 && sdiv_up64(m_65377 * n_65378,
                                            segscan_group_sizze_67878 *
                                            (int64_t) 11) != 0) && 1 != 0) &&
                           1 != 0) && segscan_group_sizze_67878 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = sdiv_up64(m_65377 * n_65378,
                                                  segscan_group_sizze_67878 *
                                                  (int64_t) 11);
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80266[] = {&ctx->global_failure,
                                                     &shared_offset_80270,
                                                     &m_65377, &n_65378,
                                                     &kernel_arg_80271,
                                                     &kernel_arg_80272,
                                                     &kernel_arg_80273,
                                                     &kernel_arg_80274,
                                                     &kernel_arg_80275,
                                                     &kernel_arg_80276};
                        int64_t time_start_80267 = 0, time_end_80268 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segscan_67884",
                                    (long) sdiv_up64(m_65377 * n_65378,
                                                     segscan_group_sizze_67878 *
                                                     (int64_t) 11), (long) 1,
                                    (long) 1, (long) segscan_group_sizze_67878,
                                    (long) 1, (long) 1, (int) (0 +
                                                               (shared_sizze_80269 +
                                                                (8 -
                                                                 shared_sizze_80269 %
                                                                 8) % 8)));
                            time_start_80267 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegscan_67884_runs,
                                                      &ctx->mainzisegscan_67884_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegscan_67884,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segscan_group_sizze_67878,
                                                              1, 1, 0 +
                                                              (shared_sizze_80269 +
                                                               (8 -
                                                                shared_sizze_80269 %
                                                                8) % 8), NULL,
                                                              kernel_args_80266,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80268 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segscan_67884", time_end_80268 -
                                    time_start_80267);
                        }
                    }
                    if (memblock_unref_device(ctx, &incprefixes_mem_78365,
                                              "incprefixes_mem_78365") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &aggregates_mem_78363,
                                              "aggregates_mem_78363") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &status_flags_mem_78361,
                                              "status_flags_mem_78361") != 0)
                        return 1;
                }
                
                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");
                
                CUdeviceptr kernel_arg_80280 = Y_mem_77010.mem;
                CUdeviceptr kernel_arg_80281 = mem_77116.mem;
                CUdeviceptr kernel_arg_80282 = mem_77120.mem;
                CUdeviceptr kernel_arg_80283 = mem_77124.mem;
                
                if ((((((1 && segmap_usable_groups_67932 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_67931 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_67932;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80277[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &kernel_arg_80280,
                                                 &kernel_arg_80281,
                                                 &kernel_arg_80282,
                                                 &kernel_arg_80283};
                    int64_t time_start_80278 = 0, time_end_80279 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_67937",
                                (long) segmap_usable_groups_67932, (long) 1,
                                (long) 1, (long) segmap_group_sizze_67931,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80278 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_67937_runs,
                                                  &ctx->mainzisegmap_67937_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_67937,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_67931,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80277,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80279 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_67937", time_end_80279 -
                                time_start_80278);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80287 = mem_77124.mem;
                CUdeviceptr kernel_arg_80288 = mem_77130.mem;
                
                if ((((((1 && segmap_usable_groups_67952 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_67951 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_67952;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80284[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &kernel_arg_80287,
                                                 &kernel_arg_80288};
                    int64_t time_start_80285 = 0, time_end_80286 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_67956",
                                (long) segmap_usable_groups_67952, (long) 1,
                                (long) 1, (long) segmap_group_sizze_67951,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80285 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_67956_runs,
                                                  &ctx->mainzisegmap_67956_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_67956,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_67951,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80284,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80286 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_67956", time_end_80286 -
                                time_start_80285);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80292 = mem_77116.mem;
                CUdeviceptr kernel_arg_80293 = mem_77134.mem;
                CUdeviceptr kernel_arg_80294 = mem_77137.mem;
                CUdeviceptr kernel_arg_80295 = mem_77140.mem;
                CUdeviceptr kernel_arg_80296 = mem_77143.mem;
                
                if ((((((1 && segmap_usable_groups_67962 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_67961 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_67962;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80289[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &q_65380, &i_65392,
                                                 &min_res_65398, &i64_res_65404,
                                                 &kernel_arg_80292,
                                                 &kernel_arg_80293,
                                                 &kernel_arg_80294,
                                                 &kernel_arg_80295,
                                                 &kernel_arg_80296};
                    int64_t time_start_80290 = 0, time_end_80291 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_67968",
                                (long) segmap_usable_groups_67962, (long) 1,
                                (long) 1, (long) segmap_group_sizze_67961,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80290 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_67968_runs,
                                                  &ctx->mainzisegmap_67968_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_67968,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_67961,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80289,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80291 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_67968", time_end_80291 -
                                time_start_80290);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80300 = mem_77116.mem;
                CUdeviceptr kernel_arg_80301 = mem_77148.mem;
                
                if ((((((1 && segmap_usable_groups_67984 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_67983 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_67984;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80297[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &q_65380, &i_65392,
                                                 &kernel_arg_80300,
                                                 &kernel_arg_80301};
                    int64_t time_start_80298 = 0, time_end_80299 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_67988",
                                (long) segmap_usable_groups_67984, (long) 1,
                                (long) 1, (long) segmap_group_sizze_67983,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80298 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_67988_runs,
                                                  &ctx->mainzisegmap_67988_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_67988,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_67983,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80297,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80299 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_67988", time_end_80299 -
                                time_start_80298);
                    }
                }
                if (ctx->debugging)
                    fprintf(ctx->log, "%s\n", "");
                
                struct memblock_device ext_mem_77224;
                
                ext_mem_77224.references = NULL;
                
                int32_t local_memory_capacity_78727;
                
                local_memory_capacity_78727 = ctx->cuda.max_shared_memory;
                if (sle64(bytes_77171 + srem64((int64_t) 8 - srem64(bytes_77171,
                                                                    (int64_t) 8),
                                               (int64_t) 8),
                          sext_i32_i64(local_memory_capacity_78727)) &&
                    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");
                    
                    unsigned int shared_sizze_80305 = bytes_77171;
                    CUdeviceptr kernel_arg_80307 = mem_77116.mem;
                    CUdeviceptr kernel_arg_80308 = mem_77120.mem;
                    CUdeviceptr kernel_arg_80309 = mem_77124.mem;
                    CUdeviceptr kernel_arg_80310 = mem_77130.mem;
                    CUdeviceptr kernel_arg_80311 = mem_77134.mem;
                    CUdeviceptr kernel_arg_80312 = mem_77137.mem;
                    CUdeviceptr kernel_arg_80313 = mem_77140.mem;
                    CUdeviceptr kernel_arg_80314 = mem_77143.mem;
                    CUdeviceptr kernel_arg_80315 = mem_77148.mem;
                    CUdeviceptr kernel_arg_80316 = mem_77195.mem;
                    unsigned int shared_offset_80306 = 0;
                    
                    if ((((((1 && num_groups_top_74791 != 0) && 1 != 0) && 1 !=
                           0) && group_sizze_74788 != 0) && 1 != 0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = num_groups_top_74791;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80302[] = {&ctx->global_failure,
                                                     &ctx->failure_is_an_option,
                                                     &ctx->global_failure_args,
                                                     &shared_offset_80306,
                                                     &m_65377, &n_65378,
                                                     &q_65380, &jump_65382,
                                                     &n_m_65386, &i_65392,
                                                     &x_65393, &min_res_65398,
                                                     &loop_cond_65403,
                                                     &num_groups_x_74789,
                                                     &num_groups_y_74790,
                                                     &num_whole_tiles_74922,
                                                     &residual_input_75118,
                                                     &cond_75119,
                                                     &kernel_arg_80307,
                                                     &kernel_arg_80308,
                                                     &kernel_arg_80309,
                                                     &kernel_arg_80310,
                                                     &kernel_arg_80311,
                                                     &kernel_arg_80312,
                                                     &kernel_arg_80313,
                                                     &kernel_arg_80314,
                                                     &kernel_arg_80315,
                                                     &kernel_arg_80316};
                        int64_t time_start_80303 = 0, time_end_80304 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_intragroup_74792",
                                    (long) num_groups_top_74791, (long) 1,
                                    (long) 1, (long) group_sizze_74788,
                                    (long) 1, (long) 1, (int) (0 +
                                                               (shared_sizze_80305 +
                                                                (8 -
                                                                 shared_sizze_80305 %
                                                                 8) % 8)));
                            time_start_80303 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_intragroup_74792_runs,
                                                      &ctx->mainzisegmap_intragroup_74792_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_intragroup_74792,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              group_sizze_74788,
                                                              1, 1, 0 +
                                                              (shared_sizze_80305 +
                                                               (8 -
                                                                shared_sizze_80305 %
                                                                8) % 8), NULL,
                                                              kernel_args_80302,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80304 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_intragroup_74792",
                                    time_end_80304 - time_start_80303);
                        }
                    }
                    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");
                    
                    CUdeviceptr kernel_arg_80320 = mem_77124.mem;
                    CUdeviceptr kernel_arg_80321 = mem_77130.mem;
                    CUdeviceptr kernel_arg_80322 = mem_77134.mem;
                    CUdeviceptr kernel_arg_80323 = mem_77137.mem;
                    CUdeviceptr kernel_arg_80324 = mem_77140.mem;
                    CUdeviceptr kernel_arg_80325 = mem_77143.mem;
                    CUdeviceptr kernel_arg_80326 = mem_77200.mem;
                    CUdeviceptr kernel_arg_80327 = mem_77204.mem;
                    CUdeviceptr kernel_arg_80328 = mem_77208.mem;
                    
                    if ((((((1 && segmap_usable_groups_68153 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_68152 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_68153;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80317[] = {&ctx->global_failure,
                                                     &ctx->failure_is_an_option,
                                                     &ctx->global_failure_args,
                                                     &m_65377, &n_65378,
                                                     &jump_65382, &n_m_65386,
                                                     &i_65392, &x_65393,
                                                     &min_res_65398,
                                                     &loop_cond_65403,
                                                     &kernel_arg_80320,
                                                     &kernel_arg_80321,
                                                     &kernel_arg_80322,
                                                     &kernel_arg_80323,
                                                     &kernel_arg_80324,
                                                     &kernel_arg_80325,
                                                     &kernel_arg_80326,
                                                     &kernel_arg_80327,
                                                     &kernel_arg_80328};
                        int64_t time_start_80318 = 0, time_end_80319 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_68159",
                                    (long) segmap_usable_groups_68153, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_68152,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80318 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_68159_runs,
                                                      &ctx->mainzisegmap_68159_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_68159,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_68152,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80317,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80319 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_68159", time_end_80319 -
                                    time_start_80318);
                        }
                    }
                    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_78573 =
                                smax64((int64_t) 1, q_65380);
                        int64_t num_threads_78574 = 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_78573),
                                    '\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_78573))),
                                    '\n');
                        
                        unsigned int shared_sizze_80332 = (int64_t) 8 *
                                     segred_group_sizze_68256;
                        CUdeviceptr kernel_arg_80334 = mem_77116.mem;
                        CUdeviceptr kernel_arg_80335 = mem_77124.mem;
                        CUdeviceptr kernel_arg_80336 = mem_77148.mem;
                        CUdeviceptr kernel_arg_80337 = mem_77204.mem;
                        CUdeviceptr kernel_arg_80338 = mem_77208.mem;
                        CUdeviceptr kernel_arg_80339 = mem_77213.mem;
                        unsigned int shared_offset_80333 = 0;
                        
                        if ((((((1 && num_groups_68257 != 0) && 1 != 0) && 1 !=
                               0) && segred_group_sizze_68256 != 0) && 1 !=
                             0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = num_groups_68257;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80329[] = {&ctx->global_failure,
                                                         &shared_offset_80333,
                                                         &m_65377, &n_65378,
                                                         &q_65380, &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &num_groups_68257,
                                                         &segment_sizze_nonzzero_78573,
                                                         &kernel_arg_80334,
                                                         &kernel_arg_80335,
                                                         &kernel_arg_80336,
                                                         &kernel_arg_80337,
                                                         &kernel_arg_80338,
                                                         &kernel_arg_80339};
                            int64_t time_start_80330 = 0, time_end_80331 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segred_small_68263",
                                        (long) num_groups_68257, (long) 1,
                                        (long) 1,
                                        (long) segred_group_sizze_68256,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80332 +
                                                                    (8 -
                                                                     shared_sizze_80332 %
                                                                     8) % 8)));
                                time_start_80330 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegred_small_68263_runs,
                                                          &ctx->mainzisegred_small_68263_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_small_68263,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segred_group_sizze_68256,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80332 +
                                                                   (8 -
                                                                    shared_sizze_80332 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80329,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80331 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segred_small_68263",
                                        time_end_80331 - time_start_80330);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                    } else {
                        int64_t groups_per_segment_78602 =
                                sdiv_up64(num_groups_68257, smax64((int64_t) 1,
                                                                   m_65377 *
                                                                   n_m_65386));
                        int64_t elements_per_thread_78603 = sdiv_up64(q_65380,
                                                                      segred_group_sizze_68256 *
                                                                      groups_per_segment_78602);
                        int64_t virt_num_groups_78604 =
                                groups_per_segment_78602 * (m_65377 *
                                                            n_m_65386);
                        int64_t num_threads_78605 = num_groups_68257 *
                                segred_group_sizze_68256;
                        int64_t threads_per_segment_78606 =
                                groups_per_segment_78602 *
                                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_78604, '\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_78603,
                                    '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "groups_per_segment",
                                    (long long) groups_per_segment_78602, '\n');
                        
                        struct memblock_device segred_tmp_mem_78607;
                        
                        segred_tmp_mem_78607.references = NULL;
                        if (memblock_alloc_device(ctx, &segred_tmp_mem_78607,
                                                  (int64_t) 8 *
                                                  virt_num_groups_78604,
                                                  "segred_tmp_mem_78607")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mainzicounter_mem_78609 =
                                               ctx->mainzicounter_mem_78609;
                        unsigned int shared_sizze_80344 = 1;
                        unsigned int shared_sizze_80346 = (int64_t) 8 *
                                     segred_group_sizze_68256;
                        CUdeviceptr kernel_arg_80348 = mem_77116.mem;
                        CUdeviceptr kernel_arg_80349 = mem_77124.mem;
                        CUdeviceptr kernel_arg_80350 = mem_77148.mem;
                        CUdeviceptr kernel_arg_80351 = mem_77204.mem;
                        CUdeviceptr kernel_arg_80352 = mem_77208.mem;
                        CUdeviceptr kernel_arg_80353 = mem_77213.mem;
                        CUdeviceptr kernel_arg_80354 = segred_tmp_mem_78607.mem;
                        CUdeviceptr kernel_arg_80355 =
                                    mainzicounter_mem_78609.mem;
                        unsigned int shared_offset_80345 = 0;
                        unsigned int shared_offset_80347 = 0 +
                                     (shared_sizze_80344 + (8 -
                                                            shared_sizze_80344 %
                                                            8) % 8);
                        
                        if ((((((1 && num_groups_68257 != 0) && 1 != 0) && 1 !=
                               0) && segred_group_sizze_68256 != 0) && 1 !=
                             0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = num_groups_68257;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80341[] = {&ctx->global_failure,
                                                         &shared_offset_80345,
                                                         &shared_offset_80347,
                                                         &m_65377, &n_65378,
                                                         &q_65380, &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &num_groups_68257,
                                                         &groups_per_segment_78602,
                                                         &elements_per_thread_78603,
                                                         &virt_num_groups_78604,
                                                         &threads_per_segment_78606,
                                                         &kernel_arg_80348,
                                                         &kernel_arg_80349,
                                                         &kernel_arg_80350,
                                                         &kernel_arg_80351,
                                                         &kernel_arg_80352,
                                                         &kernel_arg_80353,
                                                         &kernel_arg_80354,
                                                         &kernel_arg_80355};
                            int64_t time_start_80342 = 0, time_end_80343 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segred_large_68263",
                                        (long) num_groups_68257, (long) 1,
                                        (long) 1,
                                        (long) segred_group_sizze_68256,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80344 +
                                                                    (8 -
                                                                     shared_sizze_80344 %
                                                                     8) % 8) +
                                                                   (shared_sizze_80346 +
                                                                    (8 -
                                                                     shared_sizze_80346 %
                                                                     8) % 8)));
                                time_start_80342 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegred_large_68263_runs,
                                                          &ctx->mainzisegred_large_68263_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_large_68263,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segred_group_sizze_68256,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80344 +
                                                                   (8 -
                                                                    shared_sizze_80344 %
                                                                    8) % 8) +
                                                                  (shared_sizze_80346 +
                                                                   (8 -
                                                                    shared_sizze_80346 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80341,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80343 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segred_large_68263",
                                        time_end_80343 - time_start_80342);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &segred_tmp_mem_78607,
                                                  "segred_tmp_mem_78607") != 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");
                    
                    CUdeviceptr kernel_arg_80359 = mem_77213.mem;
                    CUdeviceptr kernel_arg_80360 = mem_77218.mem;
                    
                    if ((((((1 && segmap_usable_groups_68296 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_68295 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_68296;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80356[] = {&ctx->global_failure,
                                                     &m_65377, &n_m_65386,
                                                     &kernel_arg_80359,
                                                     &kernel_arg_80360};
                        int64_t time_start_80357 = 0, time_end_80358 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_68300",
                                    (long) segmap_usable_groups_68296, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_68295,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80357 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_68300_runs,
                                                      &ctx->mainzisegmap_68300_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_68300,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_68295,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80356,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80358 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_68300", time_end_80358 -
                                    time_start_80357);
                        }
                    }
                    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_78655 =
                                smax64((int64_t) 1, q_65380);
                        int64_t num_threads_78656 = 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_78655),
                                    '\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_78655))),
                                    '\n');
                        
                        unsigned int shared_sizze_80364 = (int64_t) 8 *
                                     segred_group_sizze_68306;
                        CUdeviceptr kernel_arg_80366 = mem_77116.mem;
                        CUdeviceptr kernel_arg_80367 = mem_77120.mem;
                        CUdeviceptr kernel_arg_80368 = mem_77124.mem;
                        CUdeviceptr kernel_arg_80369 = mem_77148.mem;
                        CUdeviceptr kernel_arg_80370 = mem_77204.mem;
                        CUdeviceptr kernel_arg_80371 = mem_77208.mem;
                        CUdeviceptr kernel_arg_80372 = mem_77218.mem;
                        CUdeviceptr kernel_arg_80373 = mem_77223.mem;
                        unsigned int shared_offset_80365 = 0;
                        
                        if ((((((1 && num_groups_68307 != 0) && 1 != 0) && 1 !=
                               0) && segred_group_sizze_68306 != 0) && 1 !=
                             0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = num_groups_68307;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80361[] = {&ctx->global_failure,
                                                         &shared_offset_80365,
                                                         &m_65377, &n_65378,
                                                         &q_65380, &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &num_groups_68307,
                                                         &segment_sizze_nonzzero_78655,
                                                         &kernel_arg_80366,
                                                         &kernel_arg_80367,
                                                         &kernel_arg_80368,
                                                         &kernel_arg_80369,
                                                         &kernel_arg_80370,
                                                         &kernel_arg_80371,
                                                         &kernel_arg_80372,
                                                         &kernel_arg_80373};
                            int64_t time_start_80362 = 0, time_end_80363 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segred_small_68313",
                                        (long) num_groups_68307, (long) 1,
                                        (long) 1,
                                        (long) segred_group_sizze_68306,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80364 +
                                                                    (8 -
                                                                     shared_sizze_80364 %
                                                                     8) % 8)));
                                time_start_80362 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegred_small_68313_runs,
                                                          &ctx->mainzisegred_small_68313_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_small_68313,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segred_group_sizze_68306,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80364 +
                                                                   (8 -
                                                                    shared_sizze_80364 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80361,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80363 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segred_small_68313",
                                        time_end_80363 - time_start_80362);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                    } else {
                        int64_t groups_per_segment_78684 =
                                sdiv_up64(num_groups_68307, smax64((int64_t) 1,
                                                                   m_65377 *
                                                                   n_m_65386));
                        int64_t elements_per_thread_78685 = sdiv_up64(q_65380,
                                                                      segred_group_sizze_68306 *
                                                                      groups_per_segment_78684);
                        int64_t virt_num_groups_78686 =
                                groups_per_segment_78684 * (m_65377 *
                                                            n_m_65386);
                        int64_t num_threads_78687 = num_groups_68307 *
                                segred_group_sizze_68306;
                        int64_t threads_per_segment_78688 =
                                groups_per_segment_78684 *
                                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_78686, '\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_78685,
                                    '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "groups_per_segment",
                                    (long long) groups_per_segment_78684, '\n');
                        
                        struct memblock_device segred_tmp_mem_78689;
                        
                        segred_tmp_mem_78689.references = NULL;
                        if (memblock_alloc_device(ctx, &segred_tmp_mem_78689,
                                                  (int64_t) 8 *
                                                  virt_num_groups_78686,
                                                  "segred_tmp_mem_78689")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device mainzicounter_mem_78691 =
                                               ctx->mainzicounter_mem_78691;
                        unsigned int shared_sizze_80378 = 1;
                        unsigned int shared_sizze_80380 = (int64_t) 8 *
                                     segred_group_sizze_68306;
                        CUdeviceptr kernel_arg_80382 = mem_77116.mem;
                        CUdeviceptr kernel_arg_80383 = mem_77120.mem;
                        CUdeviceptr kernel_arg_80384 = mem_77124.mem;
                        CUdeviceptr kernel_arg_80385 = mem_77148.mem;
                        CUdeviceptr kernel_arg_80386 = mem_77204.mem;
                        CUdeviceptr kernel_arg_80387 = mem_77208.mem;
                        CUdeviceptr kernel_arg_80388 = mem_77218.mem;
                        CUdeviceptr kernel_arg_80389 = mem_77223.mem;
                        CUdeviceptr kernel_arg_80390 = segred_tmp_mem_78689.mem;
                        CUdeviceptr kernel_arg_80391 =
                                    mainzicounter_mem_78691.mem;
                        unsigned int shared_offset_80379 = 0;
                        unsigned int shared_offset_80381 = 0 +
                                     (shared_sizze_80378 + (8 -
                                                            shared_sizze_80378 %
                                                            8) % 8);
                        
                        if ((((((1 && num_groups_68307 != 0) && 1 != 0) && 1 !=
                               0) && segred_group_sizze_68306 != 0) && 1 !=
                             0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = num_groups_68307;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80375[] = {&ctx->global_failure,
                                                         &shared_offset_80379,
                                                         &shared_offset_80381,
                                                         &m_65377, &n_65378,
                                                         &q_65380, &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &num_groups_68307,
                                                         &groups_per_segment_78684,
                                                         &elements_per_thread_78685,
                                                         &virt_num_groups_78686,
                                                         &threads_per_segment_78688,
                                                         &kernel_arg_80382,
                                                         &kernel_arg_80383,
                                                         &kernel_arg_80384,
                                                         &kernel_arg_80385,
                                                         &kernel_arg_80386,
                                                         &kernel_arg_80387,
                                                         &kernel_arg_80388,
                                                         &kernel_arg_80389,
                                                         &kernel_arg_80390,
                                                         &kernel_arg_80391};
                            int64_t time_start_80376 = 0, time_end_80377 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segred_large_68313",
                                        (long) num_groups_68307, (long) 1,
                                        (long) 1,
                                        (long) segred_group_sizze_68306,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80378 +
                                                                    (8 -
                                                                     shared_sizze_80378 %
                                                                     8) % 8) +
                                                                   (shared_sizze_80380 +
                                                                    (8 -
                                                                     shared_sizze_80380 %
                                                                     8) % 8)));
                                time_start_80376 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegred_large_68313_runs,
                                                          &ctx->mainzisegred_large_68313_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_large_68313,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segred_group_sizze_68306,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80378 +
                                                                   (8 -
                                                                    shared_sizze_80378 %
                                                                    8) % 8) +
                                                                  (shared_sizze_80380 +
                                                                   (8 -
                                                                    shared_sizze_80380 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80375,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80377 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segred_large_68313",
                                        time_end_80377 - time_start_80376);
                            }
                        }
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s\n", "");
                        if (memblock_unref_device(ctx, &segred_tmp_mem_78689,
                                                  "segred_tmp_mem_78689") != 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_78729;
                
                max_num_groups_78729 =
                    *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_78729))));
                
                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_78730;
                
                max_num_groups_78730 =
                    *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_78730))));
                
                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_78731;
                
                max_num_groups_78731 =
                    *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_78731))));
                
                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_78732;
                
                max_num_groups_78732 =
                    *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_78732))));
                
                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_79181;
                
                local_memory_capacity_79181 = ctx->cuda.max_shared_memory;
                if (sle64((int64_t) 0,
                          sext_i32_i64(local_memory_capacity_79181)) &&
                    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");
                    
                    CUdeviceptr kernel_arg_80395 = mem_77233.mem;
                    CUdeviceptr kernel_arg_80396 = mem_77342.mem;
                    CUdeviceptr kernel_arg_80397 = mem_77345.mem;
                    CUdeviceptr kernel_arg_80398 = color_78178.mem;
                    CUdeviceptr kernel_arg_80399 = color_78179.mem;
                    CUdeviceptr kernel_arg_80400 = color_78180.mem;
                    CUdeviceptr kernel_arg_80401 = color_78181.mem;
                    CUdeviceptr kernel_arg_80402 = color_78182.mem;
                    CUdeviceptr kernel_arg_80403 = color_78183.mem;
                    
                    if ((((((1 && num_groups_68567 != 0) && 1 != 0) && 1 !=
                           0) && segmap_group_sizze_68566 != 0) && 1 != 0) &&
                        1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = num_groups_68567;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80392[] = {&ctx->global_failure,
                                                     &ctx->failure_is_an_option,
                                                     &ctx->global_failure_args,
                                                     &m_65377, &n_65378,
                                                     &q_65380, &jump_65382,
                                                     &n_m_65386, &i_65392,
                                                     &x_65393, &min_res_65398,
                                                     &loop_cond_65403,
                                                     &i64_res_65404,
                                                     &num_groups_68567,
                                                     &num_threads_78254,
                                                     &kernel_arg_80395,
                                                     &kernel_arg_80396,
                                                     &kernel_arg_80397,
                                                     &kernel_arg_80398,
                                                     &kernel_arg_80399,
                                                     &kernel_arg_80400,
                                                     &kernel_arg_80401,
                                                     &kernel_arg_80402,
                                                     &kernel_arg_80403};
                        int64_t time_start_80393 = 0, time_end_80394 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_68572",
                                    (long) num_groups_68567, (long) 1, (long) 1,
                                    (long) segmap_group_sizze_68566, (long) 1,
                                    (long) 1, (int) 0);
                            time_start_80393 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_68572_runs,
                                                      &ctx->mainzisegmap_68572_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_68572,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_68566,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80392,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80394 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_68572", time_end_80394 -
                                    time_start_80393);
                        }
                    }
                    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");
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: number of elements processed sequentially per thread is m:",
                                    (long long) 11, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: memory constraints is: ",
                                    (long long) 11, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: register constraints is: ",
                                    (long long) 15, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: sumT' is: ", (long long) 2, '\n');
                        
                        int64_t numThreads_78772 = sdiv_up64(m_65377 * n_65378,
                                                             segscan_group_sizze_69669 *
                                                             (int64_t) 11) *
                                segscan_group_sizze_69669;
                        int64_t numGroups_78773 = sdiv_up64(m_65377 * n_65378,
                                                            segscan_group_sizze_69669 *
                                                            (int64_t) 11);
                        struct memblock_device mainziid_counter_mem_78774 =
                                               ctx->mainziid_counter_mem_78774;
                        struct memblock_device status_flags_mem_78776;
                        
                        status_flags_mem_78776.references = NULL;
                        if (memblock_alloc_device(ctx, &status_flags_mem_78776,
                                                  numGroups_78773,
                                                  "status_flags_mem_78776")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device aggregates_mem_78778;
                        
                        aggregates_mem_78778.references = NULL;
                        if (memblock_alloc_device(ctx, &aggregates_mem_78778,
                                                  (int64_t) 8 * numGroups_78773,
                                                  "aggregates_mem_78778")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device incprefixes_mem_78780;
                        
                        incprefixes_mem_78780.references = NULL;
                        if (memblock_alloc_device(ctx, &incprefixes_mem_78780,
                                                  (int64_t) 8 * numGroups_78773,
                                                  "incprefixes_mem_78780")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (futrts_builtinzhreplicate_i8(ctx,
                                                         status_flags_mem_78776,
                                                         numGroups_78773,
                                                         (int8_t) 0) != 0) {
                            if (memblock_unref_device(ctx,
                                                      &incprefixes_mem_78780,
                                                      "incprefixes_mem_78780") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &aggregates_mem_78778,
                                                      "aggregates_mem_78778") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &status_flags_mem_78776,
                                                      "status_flags_mem_78776") !=
                                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;
                        }
                        
                        unsigned int shared_sizze_80408 =
                                     smax64(smax64((int64_t) 288, (int64_t) 8 *
                                                   segscan_group_sizze_69669),
                                            (int64_t) 11 *
                                            segscan_group_sizze_69669 *
                                            (int64_t) 8);
                        CUdeviceptr kernel_arg_80410 = Y_mem_77010.mem;
                        CUdeviceptr kernel_arg_80411 = mem_77350.mem;
                        CUdeviceptr kernel_arg_80412 =
                                    mainziid_counter_mem_78774.mem;
                        CUdeviceptr kernel_arg_80413 =
                                    status_flags_mem_78776.mem;
                        CUdeviceptr kernel_arg_80414 = aggregates_mem_78778.mem;
                        CUdeviceptr kernel_arg_80415 =
                                    incprefixes_mem_78780.mem;
                        unsigned int shared_offset_80409 = 0;
                        
                        if ((((((1 && sdiv_up64(m_65377 * n_65378,
                                                segscan_group_sizze_69669 *
                                                (int64_t) 11) != 0) && 1 !=
                                0) && 1 != 0) && segscan_group_sizze_69669 !=
                              0) && 1 != 0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = sdiv_up64(m_65377 * n_65378,
                                                      segscan_group_sizze_69669 *
                                                      (int64_t) 11);
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80405[] = {&ctx->global_failure,
                                                         &shared_offset_80409,
                                                         &m_65377, &n_65378,
                                                         &kernel_arg_80410,
                                                         &kernel_arg_80411,
                                                         &kernel_arg_80412,
                                                         &kernel_arg_80413,
                                                         &kernel_arg_80414,
                                                         &kernel_arg_80415};
                            int64_t time_start_80406 = 0, time_end_80407 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segscan_69675",
                                        (long) sdiv_up64(m_65377 * n_65378,
                                                         segscan_group_sizze_69669 *
                                                         (int64_t) 11),
                                        (long) 1, (long) 1,
                                        (long) segscan_group_sizze_69669,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80408 +
                                                                    (8 -
                                                                     shared_sizze_80408 %
                                                                     8) % 8)));
                                time_start_80406 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegscan_69675_runs,
                                                          &ctx->mainzisegscan_69675_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegscan_69675,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segscan_group_sizze_69669,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80408 +
                                                                   (8 -
                                                                    shared_sizze_80408 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80405,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80407 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segscan_69675", time_end_80407 -
                                        time_start_80406);
                            }
                        }
                        if (memblock_unref_device(ctx, &incprefixes_mem_78780,
                                                  "incprefixes_mem_78780") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &aggregates_mem_78778,
                                                  "aggregates_mem_78778") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &status_flags_mem_78776,
                                                  "status_flags_mem_78776") !=
                            0)
                            return 1;
                    }
                    
                    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");
                    
                    CUdeviceptr kernel_arg_80419 = Y_mem_77010.mem;
                    CUdeviceptr kernel_arg_80420 = mem_77350.mem;
                    CUdeviceptr kernel_arg_80421 = mem_77354.mem;
                    CUdeviceptr kernel_arg_80422 = mem_77358.mem;
                    
                    if ((((((1 && segmap_usable_groups_69723 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_69722 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_69723;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80416[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &kernel_arg_80419,
                                                     &kernel_arg_80420,
                                                     &kernel_arg_80421,
                                                     &kernel_arg_80422};
                        int64_t time_start_80417 = 0, time_end_80418 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_69728",
                                    (long) segmap_usable_groups_69723, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_69722,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80417 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_69728_runs,
                                                      &ctx->mainzisegmap_69728_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_69728,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_69722,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80416,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80418 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_69728", time_end_80418 -
                                    time_start_80417);
                        }
                    }
                    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");
                    
                    CUdeviceptr kernel_arg_80426 = mem_77358.mem;
                    CUdeviceptr kernel_arg_80427 = mem_77364.mem;
                    
                    if ((((((1 && segmap_usable_groups_69743 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_69742 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_69743;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80423[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &kernel_arg_80426,
                                                     &kernel_arg_80427};
                        int64_t time_start_80424 = 0, time_end_80425 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_69747",
                                    (long) segmap_usable_groups_69743, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_69742,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80424 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_69747_runs,
                                                      &ctx->mainzisegmap_69747_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_69747,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_69742,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80423,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80425 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_69747", time_end_80425 -
                                    time_start_80424);
                        }
                    }
                    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");
                    
                    CUdeviceptr kernel_arg_80431 = mem_77350.mem;
                    CUdeviceptr kernel_arg_80432 = mem_77368.mem;
                    CUdeviceptr kernel_arg_80433 = mem_77371.mem;
                    CUdeviceptr kernel_arg_80434 = mem_77374.mem;
                    CUdeviceptr kernel_arg_80435 = mem_77377.mem;
                    
                    if ((((((1 && segmap_usable_groups_69753 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_69752 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_69753;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80428[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &q_65380, &i_65392,
                                                     &min_res_65398,
                                                     &i64_res_65404,
                                                     &kernel_arg_80431,
                                                     &kernel_arg_80432,
                                                     &kernel_arg_80433,
                                                     &kernel_arg_80434,
                                                     &kernel_arg_80435};
                        int64_t time_start_80429 = 0, time_end_80430 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_69759",
                                    (long) segmap_usable_groups_69753, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_69752,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80429 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_69759_runs,
                                                      &ctx->mainzisegmap_69759_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_69759,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_69752,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80428,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80430 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_69759", time_end_80430 -
                                    time_start_80429);
                        }
                    }
                    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");
                    
                    CUdeviceptr kernel_arg_80439 = mem_77350.mem;
                    CUdeviceptr kernel_arg_80440 = mem_77382.mem;
                    
                    if ((((((1 && segmap_usable_groups_69775 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_69774 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_69775;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80436[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &q_65380, &i_65392,
                                                     &kernel_arg_80439,
                                                     &kernel_arg_80440};
                        int64_t time_start_80437 = 0, time_end_80438 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_69779",
                                    (long) segmap_usable_groups_69775, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_69774,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80437 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_69779_runs,
                                                      &ctx->mainzisegmap_69779_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_69779,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_69774,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80436,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80438 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_69779", time_end_80438 -
                                    time_start_80437);
                        }
                    }
                    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_79180;
                    
                    local_memory_capacity_79180 = ctx->cuda.max_shared_memory;
                    if (sle64(bytes_77413 + srem64((int64_t) 8 -
                                                   srem64(bytes_77413,
                                                          (int64_t) 8),
                                                   (int64_t) 8),
                              sext_i32_i64(local_memory_capacity_79180)) &&
                        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");
                        
                        unsigned int shared_sizze_80444 = bytes_77413;
                        CUdeviceptr kernel_arg_80446 = mem_77350.mem;
                        CUdeviceptr kernel_arg_80447 = mem_77354.mem;
                        CUdeviceptr kernel_arg_80448 = mem_77358.mem;
                        CUdeviceptr kernel_arg_80449 = mem_77364.mem;
                        CUdeviceptr kernel_arg_80450 = mem_77368.mem;
                        CUdeviceptr kernel_arg_80451 = mem_77371.mem;
                        CUdeviceptr kernel_arg_80452 = mem_77374.mem;
                        CUdeviceptr kernel_arg_80453 = mem_77377.mem;
                        CUdeviceptr kernel_arg_80454 = mem_77382.mem;
                        CUdeviceptr kernel_arg_80455 = mem_77456.mem;
                        CUdeviceptr kernel_arg_80456 = mem_77460.mem;
                        unsigned int shared_offset_80445 = 0;
                        
                        if ((((((1 && num_groups_top_75345 != 0) && 1 != 0) &&
                               1 != 0) && group_sizze_75342 != 0) && 1 != 0) &&
                            1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = num_groups_top_75345;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80441[] = {&ctx->global_failure,
                                                         &ctx->failure_is_an_option,
                                                         &ctx->global_failure_args,
                                                         &shared_offset_80445,
                                                         &m_65377, &n_65378,
                                                         &q_65380, &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &x_65393,
                                                         &min_res_65398,
                                                         &loop_cond_65403,
                                                         &num_groups_x_75343,
                                                         &num_groups_y_75344,
                                                         &num_whole_tiles_75476,
                                                         &residual_input_75724,
                                                         &cond_75725,
                                                         &kernel_arg_80446,
                                                         &kernel_arg_80447,
                                                         &kernel_arg_80448,
                                                         &kernel_arg_80449,
                                                         &kernel_arg_80450,
                                                         &kernel_arg_80451,
                                                         &kernel_arg_80452,
                                                         &kernel_arg_80453,
                                                         &kernel_arg_80454,
                                                         &kernel_arg_80455,
                                                         &kernel_arg_80456};
                            int64_t time_start_80442 = 0, time_end_80443 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segmap_intragroup_75346",
                                        (long) num_groups_top_75345, (long) 1,
                                        (long) 1, (long) group_sizze_75342,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80444 +
                                                                    (8 -
                                                                     shared_sizze_80444 %
                                                                     8) % 8)));
                                time_start_80442 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegmap_intragroup_75346_runs,
                                                          &ctx->mainzisegmap_intragroup_75346_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_intragroup_75346,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  group_sizze_75342,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80444 +
                                                                   (8 -
                                                                    shared_sizze_80444 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80441,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80443 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segmap_intragroup_75346",
                                        time_end_80443 - time_start_80442);
                            }
                        }
                        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");
                        
                        CUdeviceptr kernel_arg_80460 = mem_77358.mem;
                        CUdeviceptr kernel_arg_80461 = mem_77364.mem;
                        CUdeviceptr kernel_arg_80462 = mem_77368.mem;
                        CUdeviceptr kernel_arg_80463 = mem_77371.mem;
                        CUdeviceptr kernel_arg_80464 = mem_77374.mem;
                        CUdeviceptr kernel_arg_80465 = mem_77377.mem;
                        CUdeviceptr kernel_arg_80466 = mem_77465.mem;
                        CUdeviceptr kernel_arg_80467 = mem_77469.mem;
                        CUdeviceptr kernel_arg_80468 = mem_77473.mem;
                        
                        if ((((((1 && segmap_usable_groups_69974 != 0) && 1 !=
                                0) && 1 != 0) && segmap_group_sizze_69973 !=
                              0) && 1 != 0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = segmap_usable_groups_69974;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80457[] = {&ctx->global_failure,
                                                         &ctx->failure_is_an_option,
                                                         &ctx->global_failure_args,
                                                         &m_65377, &n_65378,
                                                         &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &x_65393,
                                                         &min_res_65398,
                                                         &loop_cond_65403,
                                                         &kernel_arg_80460,
                                                         &kernel_arg_80461,
                                                         &kernel_arg_80462,
                                                         &kernel_arg_80463,
                                                         &kernel_arg_80464,
                                                         &kernel_arg_80465,
                                                         &kernel_arg_80466,
                                                         &kernel_arg_80467,
                                                         &kernel_arg_80468};
                            int64_t time_start_80458 = 0, time_end_80459 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segmap_69980",
                                        (long) segmap_usable_groups_69974,
                                        (long) 1, (long) 1,
                                        (long) segmap_group_sizze_69973,
                                        (long) 1, (long) 1, (int) 0);
                                time_start_80458 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegmap_69980_runs,
                                                          &ctx->mainzisegmap_69980_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_69980,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segmap_group_sizze_69973,
                                                                  1, 1, 0, NULL,
                                                                  kernel_args_80457,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80459 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segmap_69980", time_end_80459 -
                                        time_start_80458);
                            }
                        }
                        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_78984 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_78985 = 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_78984),
                                        '\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_78984))),
                                        '\n');
                            
                            unsigned int shared_sizze_80472 = (int64_t) 8 *
                                         segred_group_sizze_70077;
                            unsigned int shared_sizze_80474 = (int64_t) 8 *
                                         segred_group_sizze_70077;
                            unsigned int shared_sizze_80476 = (int64_t) 8 *
                                         segred_group_sizze_70077;
                            CUdeviceptr kernel_arg_80478 = mem_77350.mem;
                            CUdeviceptr kernel_arg_80479 = mem_77358.mem;
                            CUdeviceptr kernel_arg_80480 = mem_77382.mem;
                            CUdeviceptr kernel_arg_80481 = mem_77469.mem;
                            CUdeviceptr kernel_arg_80482 = mem_77473.mem;
                            CUdeviceptr kernel_arg_80483 = mem_77478.mem;
                            CUdeviceptr kernel_arg_80484 = mem_77482.mem;
                            CUdeviceptr kernel_arg_80485 = mem_77486.mem;
                            unsigned int shared_offset_80473 = 0;
                            unsigned int shared_offset_80475 = 0 +
                                         (shared_sizze_80472 + (8 -
                                                                shared_sizze_80472 %
                                                                8) % 8);
                            unsigned int shared_offset_80477 = 0 +
                                         (shared_sizze_80472 + (8 -
                                                                shared_sizze_80472 %
                                                                8) % 8) +
                                         (shared_sizze_80474 + (8 -
                                                                shared_sizze_80474 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_70078 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_70077 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_70078;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80469[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80473,
                                      &shared_offset_80475,
                                      &shared_offset_80477, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_70078,
                                      &segment_sizze_nonzzero_78984,
                                      &kernel_arg_80478, &kernel_arg_80479,
                                      &kernel_arg_80480, &kernel_arg_80481,
                                      &kernel_arg_80482, &kernel_arg_80483,
                                      &kernel_arg_80484, &kernel_arg_80485};
                                int64_t time_start_80470 = 0, time_end_80471 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_small_70086",
                                            (long) num_groups_70078, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_70077,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80472 +
                                                                        (8 -
                                                                         shared_sizze_80472 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80474 +
                                                                        (8 -
                                                                         shared_sizze_80474 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80476 +
                                                                        (8 -
                                                                         shared_sizze_80476 %
                                                                         8) %
                                                                        8)));
                                    time_start_80470 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_small_70086_runs,
                                                              &ctx->mainzisegred_small_70086_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_small_70086,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_70077,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80472 +
                                                                       (8 -
                                                                        shared_sizze_80472 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80474 +
                                                                       (8 -
                                                                        shared_sizze_80474 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80476 +
                                                                       (8 -
                                                                        shared_sizze_80476 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80469,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80471 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_small_70086",
                                            time_end_80471 - time_start_80470);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_79025 =
                                    sdiv_up64(num_groups_70078,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_79026 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_70077 *
                                              groups_per_segment_79025);
                            int64_t virt_num_groups_79027 =
                                    groups_per_segment_79025 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_79028 = num_groups_70078 *
                                    segred_group_sizze_70077;
                            int64_t threads_per_segment_79029 =
                                    groups_per_segment_79025 *
                                    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_79027,
                                        '\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_79026,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_79025,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_79030;
                            
                            segred_tmp_mem_79030.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79030,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79027,
                                                      "segred_tmp_mem_79030")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79032;
                            
                            segred_tmp_mem_79032.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79032,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79027,
                                                      "segred_tmp_mem_79032")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79034;
                            
                            segred_tmp_mem_79034.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79034,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79027,
                                                      "segred_tmp_mem_79034")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_79036 =
                                                   ctx->mainzicounter_mem_79036;
                            unsigned int shared_sizze_80490 = 1;
                            unsigned int shared_sizze_80492 = (int64_t) 8 *
                                         segred_group_sizze_70077;
                            unsigned int shared_sizze_80494 = (int64_t) 8 *
                                         segred_group_sizze_70077;
                            unsigned int shared_sizze_80496 = (int64_t) 8 *
                                         segred_group_sizze_70077;
                            CUdeviceptr kernel_arg_80498 = mem_77350.mem;
                            CUdeviceptr kernel_arg_80499 = mem_77358.mem;
                            CUdeviceptr kernel_arg_80500 = mem_77382.mem;
                            CUdeviceptr kernel_arg_80501 = mem_77469.mem;
                            CUdeviceptr kernel_arg_80502 = mem_77473.mem;
                            CUdeviceptr kernel_arg_80503 = mem_77478.mem;
                            CUdeviceptr kernel_arg_80504 = mem_77482.mem;
                            CUdeviceptr kernel_arg_80505 = mem_77486.mem;
                            CUdeviceptr kernel_arg_80506 =
                                        segred_tmp_mem_79030.mem;
                            CUdeviceptr kernel_arg_80507 =
                                        segred_tmp_mem_79032.mem;
                            CUdeviceptr kernel_arg_80508 =
                                        segred_tmp_mem_79034.mem;
                            CUdeviceptr kernel_arg_80509 =
                                        mainzicounter_mem_79036.mem;
                            unsigned int shared_offset_80491 = 0;
                            unsigned int shared_offset_80493 = 0 +
                                         (shared_sizze_80490 + (8 -
                                                                shared_sizze_80490 %
                                                                8) % 8);
                            unsigned int shared_offset_80495 = 0 +
                                         (shared_sizze_80490 + (8 -
                                                                shared_sizze_80490 %
                                                                8) % 8) +
                                         (shared_sizze_80492 + (8 -
                                                                shared_sizze_80492 %
                                                                8) % 8);
                            unsigned int shared_offset_80497 = 0 +
                                         (shared_sizze_80490 + (8 -
                                                                shared_sizze_80490 %
                                                                8) % 8) +
                                         (shared_sizze_80492 + (8 -
                                                                shared_sizze_80492 %
                                                                8) % 8) +
                                         (shared_sizze_80494 + (8 -
                                                                shared_sizze_80494 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_70078 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_70077 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_70078;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80487[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80491,
                                      &shared_offset_80493,
                                      &shared_offset_80495,
                                      &shared_offset_80497, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_70078,
                                      &groups_per_segment_79025,
                                      &elements_per_thread_79026,
                                      &virt_num_groups_79027,
                                      &threads_per_segment_79029,
                                      &kernel_arg_80498, &kernel_arg_80499,
                                      &kernel_arg_80500, &kernel_arg_80501,
                                      &kernel_arg_80502, &kernel_arg_80503,
                                      &kernel_arg_80504, &kernel_arg_80505,
                                      &kernel_arg_80506, &kernel_arg_80507,
                                      &kernel_arg_80508, &kernel_arg_80509};
                                int64_t time_start_80488 = 0, time_end_80489 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_large_70086",
                                            (long) num_groups_70078, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_70077,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80490 +
                                                                        (8 -
                                                                         shared_sizze_80490 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80492 +
                                                                        (8 -
                                                                         shared_sizze_80492 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80494 +
                                                                        (8 -
                                                                         shared_sizze_80494 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80496 +
                                                                        (8 -
                                                                         shared_sizze_80496 %
                                                                         8) %
                                                                        8)));
                                    time_start_80488 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_large_70086_runs,
                                                              &ctx->mainzisegred_large_70086_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_large_70086,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_70077,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80490 +
                                                                       (8 -
                                                                        shared_sizze_80490 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80492 +
                                                                       (8 -
                                                                        shared_sizze_80492 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80494 +
                                                                       (8 -
                                                                        shared_sizze_80494 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80496 +
                                                                       (8 -
                                                                        shared_sizze_80496 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80487,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80489 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_large_70086",
                                            time_end_80489 - time_start_80488);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79034,
                                                      "segred_tmp_mem_79034") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79032,
                                                      "segred_tmp_mem_79032") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79030,
                                                      "segred_tmp_mem_79030") !=
                                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");
                        
                        CUdeviceptr kernel_arg_80513 = mem_77478.mem;
                        CUdeviceptr kernel_arg_80514 = mem_77482.mem;
                        CUdeviceptr kernel_arg_80515 = mem_77486.mem;
                        CUdeviceptr kernel_arg_80516 = mem_77491.mem;
                        CUdeviceptr kernel_arg_80517 = mem_77495.mem;
                        CUdeviceptr kernel_arg_80518 = mem_77499.mem;
                        
                        if ((((((1 && segmap_usable_groups_70127 != 0) && 1 !=
                                0) && 1 != 0) && segmap_group_sizze_70126 !=
                              0) && 1 != 0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = segmap_usable_groups_70127;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80510[] = {&ctx->global_failure,
                                                         &m_65377, &n_m_65386,
                                                         &kernel_arg_80513,
                                                         &kernel_arg_80514,
                                                         &kernel_arg_80515,
                                                         &kernel_arg_80516,
                                                         &kernel_arg_80517,
                                                         &kernel_arg_80518};
                            int64_t time_start_80511 = 0, time_end_80512 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segmap_70133",
                                        (long) segmap_usable_groups_70127,
                                        (long) 1, (long) 1,
                                        (long) segmap_group_sizze_70126,
                                        (long) 1, (long) 1, (int) 0);
                                time_start_80511 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegmap_70133_runs,
                                                          &ctx->mainzisegmap_70133_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_70133,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segmap_group_sizze_70126,
                                                                  1, 1, 0, NULL,
                                                                  kernel_args_80510,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80512 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segmap_70133", time_end_80512 -
                                        time_start_80511);
                            }
                        }
                        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_79094 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_79095 = 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_79094),
                                        '\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_79094))),
                                        '\n');
                            
                            unsigned int shared_sizze_80522 = (int64_t) 8 *
                                         segred_group_sizze_70148;
                            unsigned int shared_sizze_80524 = (int64_t) 8 *
                                         segred_group_sizze_70148;
                            CUdeviceptr kernel_arg_80526 = mem_77350.mem;
                            CUdeviceptr kernel_arg_80527 = mem_77354.mem;
                            CUdeviceptr kernel_arg_80528 = mem_77358.mem;
                            CUdeviceptr kernel_arg_80529 = mem_77382.mem;
                            CUdeviceptr kernel_arg_80530 = mem_77469.mem;
                            CUdeviceptr kernel_arg_80531 = mem_77473.mem;
                            CUdeviceptr kernel_arg_80532 = mem_77491.mem;
                            CUdeviceptr kernel_arg_80533 = mem_77495.mem;
                            CUdeviceptr kernel_arg_80534 = mem_77499.mem;
                            CUdeviceptr kernel_arg_80535 = mem_77504.mem;
                            CUdeviceptr kernel_arg_80536 = mem_77508.mem;
                            unsigned int shared_offset_80523 = 0;
                            unsigned int shared_offset_80525 = 0 +
                                         (shared_sizze_80522 + (8 -
                                                                shared_sizze_80522 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_70149 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_70148 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_70149;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80519[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80523,
                                      &shared_offset_80525, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_70149,
                                      &segment_sizze_nonzzero_79094,
                                      &kernel_arg_80526, &kernel_arg_80527,
                                      &kernel_arg_80528, &kernel_arg_80529,
                                      &kernel_arg_80530, &kernel_arg_80531,
                                      &kernel_arg_80532, &kernel_arg_80533,
                                      &kernel_arg_80534, &kernel_arg_80535,
                                      &kernel_arg_80536};
                                int64_t time_start_80520 = 0, time_end_80521 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_small_70156",
                                            (long) num_groups_70149, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_70148,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80522 +
                                                                        (8 -
                                                                         shared_sizze_80522 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80524 +
                                                                        (8 -
                                                                         shared_sizze_80524 %
                                                                         8) %
                                                                        8)));
                                    time_start_80520 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_small_70156_runs,
                                                              &ctx->mainzisegred_small_70156_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_small_70156,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_70148,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80522 +
                                                                       (8 -
                                                                        shared_sizze_80522 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80524 +
                                                                       (8 -
                                                                        shared_sizze_80524 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80519,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80521 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_small_70156",
                                            time_end_80521 - time_start_80520);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_79129 =
                                    sdiv_up64(num_groups_70149,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_79130 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_70148 *
                                              groups_per_segment_79129);
                            int64_t virt_num_groups_79131 =
                                    groups_per_segment_79129 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_79132 = num_groups_70149 *
                                    segred_group_sizze_70148;
                            int64_t threads_per_segment_79133 =
                                    groups_per_segment_79129 *
                                    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_79131,
                                        '\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_79130,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_79129,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_79134;
                            
                            segred_tmp_mem_79134.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79134,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79131,
                                                      "segred_tmp_mem_79134")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79136;
                            
                            segred_tmp_mem_79136.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79136,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79131,
                                                      "segred_tmp_mem_79136")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_79138 =
                                                   ctx->mainzicounter_mem_79138;
                            unsigned int shared_sizze_80541 = 1;
                            unsigned int shared_sizze_80543 = (int64_t) 8 *
                                         segred_group_sizze_70148;
                            unsigned int shared_sizze_80545 = (int64_t) 8 *
                                         segred_group_sizze_70148;
                            CUdeviceptr kernel_arg_80547 = mem_77350.mem;
                            CUdeviceptr kernel_arg_80548 = mem_77354.mem;
                            CUdeviceptr kernel_arg_80549 = mem_77358.mem;
                            CUdeviceptr kernel_arg_80550 = mem_77382.mem;
                            CUdeviceptr kernel_arg_80551 = mem_77469.mem;
                            CUdeviceptr kernel_arg_80552 = mem_77473.mem;
                            CUdeviceptr kernel_arg_80553 = mem_77491.mem;
                            CUdeviceptr kernel_arg_80554 = mem_77495.mem;
                            CUdeviceptr kernel_arg_80555 = mem_77499.mem;
                            CUdeviceptr kernel_arg_80556 = mem_77504.mem;
                            CUdeviceptr kernel_arg_80557 = mem_77508.mem;
                            CUdeviceptr kernel_arg_80558 =
                                        segred_tmp_mem_79134.mem;
                            CUdeviceptr kernel_arg_80559 =
                                        segred_tmp_mem_79136.mem;
                            CUdeviceptr kernel_arg_80560 =
                                        mainzicounter_mem_79138.mem;
                            unsigned int shared_offset_80542 = 0;
                            unsigned int shared_offset_80544 = 0 +
                                         (shared_sizze_80541 + (8 -
                                                                shared_sizze_80541 %
                                                                8) % 8);
                            unsigned int shared_offset_80546 = 0 +
                                         (shared_sizze_80541 + (8 -
                                                                shared_sizze_80541 %
                                                                8) % 8) +
                                         (shared_sizze_80543 + (8 -
                                                                shared_sizze_80543 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_70149 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_70148 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_70149;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80538[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80542,
                                      &shared_offset_80544,
                                      &shared_offset_80546, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_70149,
                                      &groups_per_segment_79129,
                                      &elements_per_thread_79130,
                                      &virt_num_groups_79131,
                                      &threads_per_segment_79133,
                                      &kernel_arg_80547, &kernel_arg_80548,
                                      &kernel_arg_80549, &kernel_arg_80550,
                                      &kernel_arg_80551, &kernel_arg_80552,
                                      &kernel_arg_80553, &kernel_arg_80554,
                                      &kernel_arg_80555, &kernel_arg_80556,
                                      &kernel_arg_80557, &kernel_arg_80558,
                                      &kernel_arg_80559, &kernel_arg_80560};
                                int64_t time_start_80539 = 0, time_end_80540 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_large_70156",
                                            (long) num_groups_70149, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_70148,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80541 +
                                                                        (8 -
                                                                         shared_sizze_80541 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80543 +
                                                                        (8 -
                                                                         shared_sizze_80543 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80545 +
                                                                        (8 -
                                                                         shared_sizze_80545 %
                                                                         8) %
                                                                        8)));
                                    time_start_80539 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_large_70156_runs,
                                                              &ctx->mainzisegred_large_70156_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_large_70156,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_70148,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80541 +
                                                                       (8 -
                                                                        shared_sizze_80541 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80543 +
                                                                       (8 -
                                                                        shared_sizze_80543 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80545 +
                                                                       (8 -
                                                                        shared_sizze_80545 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80538,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80540 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_large_70156",
                                            time_end_80540 - time_start_80539);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79136,
                                                      "segred_tmp_mem_79136") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79134,
                                                      "segred_tmp_mem_79134") !=
                                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_79182;
                
                max_num_groups_79182 =
                    *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_79182))));
                
                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_79183;
                
                max_num_groups_79183 =
                    *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_79183))));
                
                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_79184;
                
                max_num_groups_79184 =
                    *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_79184))));
                
                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_79185;
                
                max_num_groups_79185 =
                    *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_79185))));
                
                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_79680;
                
                local_memory_capacity_79680 = ctx->cuda.max_shared_memory;
                if (sle64((int64_t) 0,
                          sext_i32_i64(local_memory_capacity_79680)) &&
                    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");
                    
                    CUdeviceptr kernel_arg_80564 = mem_77525.mem;
                    CUdeviceptr kernel_arg_80565 = mem_77634.mem;
                    CUdeviceptr kernel_arg_80566 = mem_77637.mem;
                    CUdeviceptr kernel_arg_80567 = color_78201.mem;
                    CUdeviceptr kernel_arg_80568 = color_78202.mem;
                    CUdeviceptr kernel_arg_80569 = color_78203.mem;
                    CUdeviceptr kernel_arg_80570 = color_78204.mem;
                    CUdeviceptr kernel_arg_80571 = color_78205.mem;
                    CUdeviceptr kernel_arg_80572 = color_78206.mem;
                    
                    if ((((((1 && num_groups_70458 != 0) && 1 != 0) && 1 !=
                           0) && segmap_group_sizze_70457 != 0) && 1 != 0) &&
                        1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = num_groups_70458;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80561[] = {&ctx->global_failure,
                                                     &ctx->failure_is_an_option,
                                                     &ctx->global_failure_args,
                                                     &m_65377, &n_65378,
                                                     &q_65380, &jump_65382,
                                                     &n_m_65386, &i_65392,
                                                     &x_65393, &min_res_65398,
                                                     &loop_cond_65403,
                                                     &i64_res_65404,
                                                     &num_groups_70458,
                                                     &num_threads_78271,
                                                     &kernel_arg_80564,
                                                     &kernel_arg_80565,
                                                     &kernel_arg_80566,
                                                     &kernel_arg_80567,
                                                     &kernel_arg_80568,
                                                     &kernel_arg_80569,
                                                     &kernel_arg_80570,
                                                     &kernel_arg_80571,
                                                     &kernel_arg_80572};
                        int64_t time_start_80562 = 0, time_end_80563 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_70463",
                                    (long) num_groups_70458, (long) 1, (long) 1,
                                    (long) segmap_group_sizze_70457, (long) 1,
                                    (long) 1, (int) 0);
                            time_start_80562 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_70463_runs,
                                                      &ctx->mainzisegmap_70463_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_70463,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_70457,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80561,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80563 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_70463", time_end_80563 -
                                    time_start_80562);
                        }
                    }
                    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");
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: number of elements processed sequentially per thread is m:",
                                    (long long) 11, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: memory constraints is: ",
                                    (long long) 11, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: register constraints is: ",
                                    (long long) 15, '\n');
                        if (ctx->debugging)
                            fprintf(ctx->log, "%s: %llu%c",
                                    "SegScan: sumT' is: ", (long long) 2, '\n');
                        
                        int64_t numThreads_79227 = sdiv_up64(m_65377 * n_65378,
                                                             segscan_group_sizze_71708 *
                                                             (int64_t) 11) *
                                segscan_group_sizze_71708;
                        int64_t numGroups_79228 = sdiv_up64(m_65377 * n_65378,
                                                            segscan_group_sizze_71708 *
                                                            (int64_t) 11);
                        struct memblock_device mainziid_counter_mem_79229 =
                                               ctx->mainziid_counter_mem_79229;
                        struct memblock_device status_flags_mem_79231;
                        
                        status_flags_mem_79231.references = NULL;
                        if (memblock_alloc_device(ctx, &status_flags_mem_79231,
                                                  numGroups_79228,
                                                  "status_flags_mem_79231")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device aggregates_mem_79233;
                        
                        aggregates_mem_79233.references = NULL;
                        if (memblock_alloc_device(ctx, &aggregates_mem_79233,
                                                  (int64_t) 8 * numGroups_79228,
                                                  "aggregates_mem_79233")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock_device incprefixes_mem_79235;
                        
                        incprefixes_mem_79235.references = NULL;
                        if (memblock_alloc_device(ctx, &incprefixes_mem_79235,
                                                  (int64_t) 8 * numGroups_79228,
                                                  "incprefixes_mem_79235")) {
                            err = 1;
                            goto cleanup;
                        }
                        if (futrts_builtinzhreplicate_i8(ctx,
                                                         status_flags_mem_79231,
                                                         numGroups_79228,
                                                         (int8_t) 0) != 0) {
                            if (memblock_unref_device(ctx,
                                                      &incprefixes_mem_79235,
                                                      "incprefixes_mem_79235") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &aggregates_mem_79233,
                                                      "aggregates_mem_79233") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &status_flags_mem_79231,
                                                      "status_flags_mem_79231") !=
                                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;
                        }
                        
                        unsigned int shared_sizze_80577 =
                                     smax64(smax64((int64_t) 288, (int64_t) 8 *
                                                   segscan_group_sizze_71708),
                                            (int64_t) 11 *
                                            segscan_group_sizze_71708 *
                                            (int64_t) 8);
                        CUdeviceptr kernel_arg_80579 = Y_mem_77010.mem;
                        CUdeviceptr kernel_arg_80580 = mem_77642.mem;
                        CUdeviceptr kernel_arg_80581 =
                                    mainziid_counter_mem_79229.mem;
                        CUdeviceptr kernel_arg_80582 =
                                    status_flags_mem_79231.mem;
                        CUdeviceptr kernel_arg_80583 = aggregates_mem_79233.mem;
                        CUdeviceptr kernel_arg_80584 =
                                    incprefixes_mem_79235.mem;
                        unsigned int shared_offset_80578 = 0;
                        
                        if ((((((1 && sdiv_up64(m_65377 * n_65378,
                                                segscan_group_sizze_71708 *
                                                (int64_t) 11) != 0) && 1 !=
                                0) && 1 != 0) && segscan_group_sizze_71708 !=
                              0) && 1 != 0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = sdiv_up64(m_65377 * n_65378,
                                                      segscan_group_sizze_71708 *
                                                      (int64_t) 11);
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80574[] = {&ctx->global_failure,
                                                         &shared_offset_80578,
                                                         &m_65377, &n_65378,
                                                         &kernel_arg_80579,
                                                         &kernel_arg_80580,
                                                         &kernel_arg_80581,
                                                         &kernel_arg_80582,
                                                         &kernel_arg_80583,
                                                         &kernel_arg_80584};
                            int64_t time_start_80575 = 0, time_end_80576 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segscan_71714",
                                        (long) sdiv_up64(m_65377 * n_65378,
                                                         segscan_group_sizze_71708 *
                                                         (int64_t) 11),
                                        (long) 1, (long) 1,
                                        (long) segscan_group_sizze_71708,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80577 +
                                                                    (8 -
                                                                     shared_sizze_80577 %
                                                                     8) % 8)));
                                time_start_80575 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegscan_71714_runs,
                                                          &ctx->mainzisegscan_71714_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegscan_71714,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segscan_group_sizze_71708,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80577 +
                                                                   (8 -
                                                                    shared_sizze_80577 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80574,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80576 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segscan_71714", time_end_80576 -
                                        time_start_80575);
                            }
                        }
                        if (memblock_unref_device(ctx, &incprefixes_mem_79235,
                                                  "incprefixes_mem_79235") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &aggregates_mem_79233,
                                                  "aggregates_mem_79233") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &status_flags_mem_79231,
                                                  "status_flags_mem_79231") !=
                            0)
                            return 1;
                    }
                    
                    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");
                    
                    CUdeviceptr kernel_arg_80588 = Y_mem_77010.mem;
                    CUdeviceptr kernel_arg_80589 = mem_77642.mem;
                    CUdeviceptr kernel_arg_80590 = mem_77646.mem;
                    CUdeviceptr kernel_arg_80591 = mem_77650.mem;
                    
                    if ((((((1 && segmap_usable_groups_71762 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_71761 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_71762;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80585[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &kernel_arg_80588,
                                                     &kernel_arg_80589,
                                                     &kernel_arg_80590,
                                                     &kernel_arg_80591};
                        int64_t time_start_80586 = 0, time_end_80587 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_71767",
                                    (long) segmap_usable_groups_71762, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_71761,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80586 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_71767_runs,
                                                      &ctx->mainzisegmap_71767_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_71767,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_71761,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80585,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80587 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_71767", time_end_80587 -
                                    time_start_80586);
                        }
                    }
                    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");
                    
                    CUdeviceptr kernel_arg_80595 = mem_77650.mem;
                    CUdeviceptr kernel_arg_80596 = mem_77656.mem;
                    
                    if ((((((1 && segmap_usable_groups_71782 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_71781 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_71782;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80592[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &kernel_arg_80595,
                                                     &kernel_arg_80596};
                        int64_t time_start_80593 = 0, time_end_80594 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_71786",
                                    (long) segmap_usable_groups_71782, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_71781,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80593 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_71786_runs,
                                                      &ctx->mainzisegmap_71786_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_71786,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_71781,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80592,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80594 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_71786", time_end_80594 -
                                    time_start_80593);
                        }
                    }
                    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");
                    
                    CUdeviceptr kernel_arg_80600 = mem_77642.mem;
                    CUdeviceptr kernel_arg_80601 = mem_77660.mem;
                    CUdeviceptr kernel_arg_80602 = mem_77663.mem;
                    CUdeviceptr kernel_arg_80603 = mem_77666.mem;
                    CUdeviceptr kernel_arg_80604 = mem_77669.mem;
                    
                    if ((((((1 && segmap_usable_groups_71792 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_71791 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_71792;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80597[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &q_65380, &i_65392,
                                                     &min_res_65398,
                                                     &i64_res_65404,
                                                     &kernel_arg_80600,
                                                     &kernel_arg_80601,
                                                     &kernel_arg_80602,
                                                     &kernel_arg_80603,
                                                     &kernel_arg_80604};
                        int64_t time_start_80598 = 0, time_end_80599 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_71798",
                                    (long) segmap_usable_groups_71792, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_71791,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80598 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_71798_runs,
                                                      &ctx->mainzisegmap_71798_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_71798,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_71791,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80597,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80599 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_71798", time_end_80599 -
                                    time_start_80598);
                        }
                    }
                    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");
                    
                    CUdeviceptr kernel_arg_80608 = mem_77642.mem;
                    CUdeviceptr kernel_arg_80609 = mem_77674.mem;
                    
                    if ((((((1 && segmap_usable_groups_71814 != 0) && 1 != 0) &&
                           1 != 0) && segmap_group_sizze_71813 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = segmap_usable_groups_71814;
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80605[] = {&ctx->global_failure,
                                                     &m_65377, &n_65378,
                                                     &q_65380, &i_65392,
                                                     &kernel_arg_80608,
                                                     &kernel_arg_80609};
                        int64_t time_start_80606 = 0, time_end_80607 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segmap_71818",
                                    (long) segmap_usable_groups_71814, (long) 1,
                                    (long) 1, (long) segmap_group_sizze_71813,
                                    (long) 1, (long) 1, (int) 0);
                            time_start_80606 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegmap_71818_runs,
                                                      &ctx->mainzisegmap_71818_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_71818,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segmap_group_sizze_71813,
                                                              1, 1, 0, NULL,
                                                              kernel_args_80605,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80607 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segmap_71818", time_end_80607 -
                                    time_start_80606);
                        }
                    }
                    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_79679;
                    
                    local_memory_capacity_79679 = ctx->cuda.max_shared_memory;
                    if (sle64(bytes_77713 + srem64((int64_t) 8 -
                                                   srem64(bytes_77713,
                                                          (int64_t) 8),
                                                   (int64_t) 8),
                              sext_i32_i64(local_memory_capacity_79679)) &&
                        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");
                        
                        unsigned int shared_sizze_80613 = bytes_77713;
                        CUdeviceptr kernel_arg_80615 = mem_77642.mem;
                        CUdeviceptr kernel_arg_80616 = mem_77646.mem;
                        CUdeviceptr kernel_arg_80617 = mem_77650.mem;
                        CUdeviceptr kernel_arg_80618 = mem_77656.mem;
                        CUdeviceptr kernel_arg_80619 = mem_77660.mem;
                        CUdeviceptr kernel_arg_80620 = mem_77663.mem;
                        CUdeviceptr kernel_arg_80621 = mem_77666.mem;
                        CUdeviceptr kernel_arg_80622 = mem_77669.mem;
                        CUdeviceptr kernel_arg_80623 = mem_77674.mem;
                        CUdeviceptr kernel_arg_80624 = mem_77772.mem;
                        CUdeviceptr kernel_arg_80625 = mem_77776.mem;
                        unsigned int shared_offset_80614 = 0;
                        
                        if ((((((1 && num_groups_top_76016 != 0) && 1 != 0) &&
                               1 != 0) && group_sizze_76013 != 0) && 1 != 0) &&
                            1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = num_groups_top_76016;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80610[] = {&ctx->global_failure,
                                                         &ctx->failure_is_an_option,
                                                         &ctx->global_failure_args,
                                                         &shared_offset_80614,
                                                         &m_65377, &n_65378,
                                                         &q_65380, &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &x_65393,
                                                         &min_res_65398,
                                                         &loop_cond_65403,
                                                         &num_groups_x_76014,
                                                         &num_groups_y_76015,
                                                         &num_whole_tiles_76147,
                                                         &residual_input_76447,
                                                         &cond_76448,
                                                         &kernel_arg_80615,
                                                         &kernel_arg_80616,
                                                         &kernel_arg_80617,
                                                         &kernel_arg_80618,
                                                         &kernel_arg_80619,
                                                         &kernel_arg_80620,
                                                         &kernel_arg_80621,
                                                         &kernel_arg_80622,
                                                         &kernel_arg_80623,
                                                         &kernel_arg_80624,
                                                         &kernel_arg_80625};
                            int64_t time_start_80611 = 0, time_end_80612 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segmap_intragroup_76017",
                                        (long) num_groups_top_76016, (long) 1,
                                        (long) 1, (long) group_sizze_76013,
                                        (long) 1, (long) 1, (int) (0 +
                                                                   (shared_sizze_80613 +
                                                                    (8 -
                                                                     shared_sizze_80613 %
                                                                     8) % 8)));
                                time_start_80611 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegmap_intragroup_76017_runs,
                                                          &ctx->mainzisegmap_intragroup_76017_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_intragroup_76017,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  group_sizze_76013,
                                                                  1, 1, 0 +
                                                                  (shared_sizze_80613 +
                                                                   (8 -
                                                                    shared_sizze_80613 %
                                                                    8) % 8),
                                                                  NULL,
                                                                  kernel_args_80610,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80612 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segmap_intragroup_76017",
                                        time_end_80612 - time_start_80611);
                            }
                        }
                        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");
                        
                        CUdeviceptr kernel_arg_80629 = mem_77650.mem;
                        CUdeviceptr kernel_arg_80630 = mem_77656.mem;
                        CUdeviceptr kernel_arg_80631 = mem_77660.mem;
                        CUdeviceptr kernel_arg_80632 = mem_77663.mem;
                        CUdeviceptr kernel_arg_80633 = mem_77666.mem;
                        CUdeviceptr kernel_arg_80634 = mem_77669.mem;
                        CUdeviceptr kernel_arg_80635 = mem_77781.mem;
                        CUdeviceptr kernel_arg_80636 = mem_77785.mem;
                        CUdeviceptr kernel_arg_80637 = mem_77789.mem;
                        
                        if ((((((1 && segmap_usable_groups_72045 != 0) && 1 !=
                                0) && 1 != 0) && segmap_group_sizze_72044 !=
                              0) && 1 != 0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = segmap_usable_groups_72045;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80626[] = {&ctx->global_failure,
                                                         &ctx->failure_is_an_option,
                                                         &ctx->global_failure_args,
                                                         &m_65377, &n_65378,
                                                         &jump_65382,
                                                         &n_m_65386, &i_65392,
                                                         &x_65393,
                                                         &min_res_65398,
                                                         &loop_cond_65403,
                                                         &kernel_arg_80629,
                                                         &kernel_arg_80630,
                                                         &kernel_arg_80631,
                                                         &kernel_arg_80632,
                                                         &kernel_arg_80633,
                                                         &kernel_arg_80634,
                                                         &kernel_arg_80635,
                                                         &kernel_arg_80636,
                                                         &kernel_arg_80637};
                            int64_t time_start_80627 = 0, time_end_80628 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segmap_72051",
                                        (long) segmap_usable_groups_72045,
                                        (long) 1, (long) 1,
                                        (long) segmap_group_sizze_72044,
                                        (long) 1, (long) 1, (int) 0);
                                time_start_80627 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegmap_72051_runs,
                                                          &ctx->mainzisegmap_72051_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_72051,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segmap_group_sizze_72044,
                                                                  1, 1, 0, NULL,
                                                                  kernel_args_80626,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80628 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segmap_72051", time_end_80628 -
                                        time_start_80627);
                            }
                        }
                        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_79455 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_79456 = 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_79455),
                                        '\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_79455))),
                                        '\n');
                            
                            unsigned int shared_sizze_80641 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80643 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80645 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80647 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80649 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            CUdeviceptr kernel_arg_80651 = mem_77642.mem;
                            CUdeviceptr kernel_arg_80652 = mem_77650.mem;
                            CUdeviceptr kernel_arg_80653 = mem_77674.mem;
                            CUdeviceptr kernel_arg_80654 = mem_77785.mem;
                            CUdeviceptr kernel_arg_80655 = mem_77789.mem;
                            CUdeviceptr kernel_arg_80656 = mem_77794.mem;
                            CUdeviceptr kernel_arg_80657 = mem_77798.mem;
                            CUdeviceptr kernel_arg_80658 = mem_77802.mem;
                            CUdeviceptr kernel_arg_80659 = mem_77806.mem;
                            CUdeviceptr kernel_arg_80660 = mem_77810.mem;
                            unsigned int shared_offset_80642 = 0;
                            unsigned int shared_offset_80644 = 0 +
                                         (shared_sizze_80641 + (8 -
                                                                shared_sizze_80641 %
                                                                8) % 8);
                            unsigned int shared_offset_80646 = 0 +
                                         (shared_sizze_80641 + (8 -
                                                                shared_sizze_80641 %
                                                                8) % 8) +
                                         (shared_sizze_80643 + (8 -
                                                                shared_sizze_80643 %
                                                                8) % 8);
                            unsigned int shared_offset_80648 = 0 +
                                         (shared_sizze_80641 + (8 -
                                                                shared_sizze_80641 %
                                                                8) % 8) +
                                         (shared_sizze_80643 + (8 -
                                                                shared_sizze_80643 %
                                                                8) % 8) +
                                         (shared_sizze_80645 + (8 -
                                                                shared_sizze_80645 %
                                                                8) % 8);
                            unsigned int shared_offset_80650 = 0 +
                                         (shared_sizze_80641 + (8 -
                                                                shared_sizze_80641 %
                                                                8) % 8) +
                                         (shared_sizze_80643 + (8 -
                                                                shared_sizze_80643 %
                                                                8) % 8) +
                                         (shared_sizze_80645 + (8 -
                                                                shared_sizze_80645 %
                                                                8) % 8) +
                                         (shared_sizze_80647 + (8 -
                                                                shared_sizze_80647 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_72149 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_72148 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_72149;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80638[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80642,
                                      &shared_offset_80644,
                                      &shared_offset_80646,
                                      &shared_offset_80648,
                                      &shared_offset_80650, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_72149,
                                      &segment_sizze_nonzzero_79455,
                                      &kernel_arg_80651, &kernel_arg_80652,
                                      &kernel_arg_80653, &kernel_arg_80654,
                                      &kernel_arg_80655, &kernel_arg_80656,
                                      &kernel_arg_80657, &kernel_arg_80658,
                                      &kernel_arg_80659, &kernel_arg_80660};
                                int64_t time_start_80639 = 0, time_end_80640 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_small_72159",
                                            (long) num_groups_72149, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_72148,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80641 +
                                                                        (8 -
                                                                         shared_sizze_80641 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80643 +
                                                                        (8 -
                                                                         shared_sizze_80643 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80645 +
                                                                        (8 -
                                                                         shared_sizze_80645 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80647 +
                                                                        (8 -
                                                                         shared_sizze_80647 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80649 +
                                                                        (8 -
                                                                         shared_sizze_80649 %
                                                                         8) %
                                                                        8)));
                                    time_start_80639 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_small_72159_runs,
                                                              &ctx->mainzisegred_small_72159_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_small_72159,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_72148,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80641 +
                                                                       (8 -
                                                                        shared_sizze_80641 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80643 +
                                                                       (8 -
                                                                        shared_sizze_80643 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80645 +
                                                                       (8 -
                                                                        shared_sizze_80645 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80647 +
                                                                       (8 -
                                                                        shared_sizze_80647 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80649 +
                                                                       (8 -
                                                                        shared_sizze_80649 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80638,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80640 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_small_72159",
                                            time_end_80640 - time_start_80639);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_79508 =
                                    sdiv_up64(num_groups_72149,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_79509 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_72148 *
                                              groups_per_segment_79508);
                            int64_t virt_num_groups_79510 =
                                    groups_per_segment_79508 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_79511 = num_groups_72149 *
                                    segred_group_sizze_72148;
                            int64_t threads_per_segment_79512 =
                                    groups_per_segment_79508 *
                                    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_79510,
                                        '\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_79509,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_79508,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_79513;
                            
                            segred_tmp_mem_79513.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79513,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79510,
                                                      "segred_tmp_mem_79513")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79515;
                            
                            segred_tmp_mem_79515.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79515,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79510,
                                                      "segred_tmp_mem_79515")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79517;
                            
                            segred_tmp_mem_79517.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79517,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79510,
                                                      "segred_tmp_mem_79517")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79519;
                            
                            segred_tmp_mem_79519.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79519,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79510,
                                                      "segred_tmp_mem_79519")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79521;
                            
                            segred_tmp_mem_79521.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79521,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79510,
                                                      "segred_tmp_mem_79521")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_79523 =
                                                   ctx->mainzicounter_mem_79523;
                            unsigned int shared_sizze_80665 = 1;
                            unsigned int shared_sizze_80667 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80669 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80671 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80673 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            unsigned int shared_sizze_80675 = (int64_t) 8 *
                                         segred_group_sizze_72148;
                            CUdeviceptr kernel_arg_80677 = mem_77642.mem;
                            CUdeviceptr kernel_arg_80678 = mem_77650.mem;
                            CUdeviceptr kernel_arg_80679 = mem_77674.mem;
                            CUdeviceptr kernel_arg_80680 = mem_77785.mem;
                            CUdeviceptr kernel_arg_80681 = mem_77789.mem;
                            CUdeviceptr kernel_arg_80682 = mem_77794.mem;
                            CUdeviceptr kernel_arg_80683 = mem_77798.mem;
                            CUdeviceptr kernel_arg_80684 = mem_77802.mem;
                            CUdeviceptr kernel_arg_80685 = mem_77806.mem;
                            CUdeviceptr kernel_arg_80686 = mem_77810.mem;
                            CUdeviceptr kernel_arg_80687 =
                                        segred_tmp_mem_79513.mem;
                            CUdeviceptr kernel_arg_80688 =
                                        segred_tmp_mem_79515.mem;
                            CUdeviceptr kernel_arg_80689 =
                                        segred_tmp_mem_79517.mem;
                            CUdeviceptr kernel_arg_80690 =
                                        segred_tmp_mem_79519.mem;
                            CUdeviceptr kernel_arg_80691 =
                                        segred_tmp_mem_79521.mem;
                            CUdeviceptr kernel_arg_80692 =
                                        mainzicounter_mem_79523.mem;
                            unsigned int shared_offset_80666 = 0;
                            unsigned int shared_offset_80668 = 0 +
                                         (shared_sizze_80665 + (8 -
                                                                shared_sizze_80665 %
                                                                8) % 8);
                            unsigned int shared_offset_80670 = 0 +
                                         (shared_sizze_80665 + (8 -
                                                                shared_sizze_80665 %
                                                                8) % 8) +
                                         (shared_sizze_80667 + (8 -
                                                                shared_sizze_80667 %
                                                                8) % 8);
                            unsigned int shared_offset_80672 = 0 +
                                         (shared_sizze_80665 + (8 -
                                                                shared_sizze_80665 %
                                                                8) % 8) +
                                         (shared_sizze_80667 + (8 -
                                                                shared_sizze_80667 %
                                                                8) % 8) +
                                         (shared_sizze_80669 + (8 -
                                                                shared_sizze_80669 %
                                                                8) % 8);
                            unsigned int shared_offset_80674 = 0 +
                                         (shared_sizze_80665 + (8 -
                                                                shared_sizze_80665 %
                                                                8) % 8) +
                                         (shared_sizze_80667 + (8 -
                                                                shared_sizze_80667 %
                                                                8) % 8) +
                                         (shared_sizze_80669 + (8 -
                                                                shared_sizze_80669 %
                                                                8) % 8) +
                                         (shared_sizze_80671 + (8 -
                                                                shared_sizze_80671 %
                                                                8) % 8);
                            unsigned int shared_offset_80676 = 0 +
                                         (shared_sizze_80665 + (8 -
                                                                shared_sizze_80665 %
                                                                8) % 8) +
                                         (shared_sizze_80667 + (8 -
                                                                shared_sizze_80667 %
                                                                8) % 8) +
                                         (shared_sizze_80669 + (8 -
                                                                shared_sizze_80669 %
                                                                8) % 8) +
                                         (shared_sizze_80671 + (8 -
                                                                shared_sizze_80671 %
                                                                8) % 8) +
                                         (shared_sizze_80673 + (8 -
                                                                shared_sizze_80673 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_72149 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_72148 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_72149;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80662[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80666,
                                      &shared_offset_80668,
                                      &shared_offset_80670,
                                      &shared_offset_80672,
                                      &shared_offset_80674,
                                      &shared_offset_80676, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_72149,
                                      &groups_per_segment_79508,
                                      &elements_per_thread_79509,
                                      &virt_num_groups_79510,
                                      &threads_per_segment_79512,
                                      &kernel_arg_80677, &kernel_arg_80678,
                                      &kernel_arg_80679, &kernel_arg_80680,
                                      &kernel_arg_80681, &kernel_arg_80682,
                                      &kernel_arg_80683, &kernel_arg_80684,
                                      &kernel_arg_80685, &kernel_arg_80686,
                                      &kernel_arg_80687, &kernel_arg_80688,
                                      &kernel_arg_80689, &kernel_arg_80690,
                                      &kernel_arg_80691, &kernel_arg_80692};
                                int64_t time_start_80663 = 0, time_end_80664 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_large_72159",
                                            (long) num_groups_72149, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_72148,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80665 +
                                                                        (8 -
                                                                         shared_sizze_80665 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80667 +
                                                                        (8 -
                                                                         shared_sizze_80667 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80669 +
                                                                        (8 -
                                                                         shared_sizze_80669 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80671 +
                                                                        (8 -
                                                                         shared_sizze_80671 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80673 +
                                                                        (8 -
                                                                         shared_sizze_80673 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80675 +
                                                                        (8 -
                                                                         shared_sizze_80675 %
                                                                         8) %
                                                                        8)));
                                    time_start_80663 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_large_72159_runs,
                                                              &ctx->mainzisegred_large_72159_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_large_72159,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_72148,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80665 +
                                                                       (8 -
                                                                        shared_sizze_80665 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80667 +
                                                                       (8 -
                                                                        shared_sizze_80667 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80669 +
                                                                       (8 -
                                                                        shared_sizze_80669 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80671 +
                                                                       (8 -
                                                                        shared_sizze_80671 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80673 +
                                                                       (8 -
                                                                        shared_sizze_80673 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80675 +
                                                                       (8 -
                                                                        shared_sizze_80675 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80662,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80664 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_large_72159",
                                            time_end_80664 - time_start_80663);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79521,
                                                      "segred_tmp_mem_79521") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79519,
                                                      "segred_tmp_mem_79519") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79517,
                                                      "segred_tmp_mem_79517") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79515,
                                                      "segred_tmp_mem_79515") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79513,
                                                      "segred_tmp_mem_79513") !=
                                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");
                        
                        CUdeviceptr kernel_arg_80696 = mem_77794.mem;
                        CUdeviceptr kernel_arg_80697 = mem_77798.mem;
                        CUdeviceptr kernel_arg_80698 = mem_77802.mem;
                        CUdeviceptr kernel_arg_80699 = mem_77806.mem;
                        CUdeviceptr kernel_arg_80700 = mem_77810.mem;
                        CUdeviceptr kernel_arg_80701 = mem_77815.mem;
                        CUdeviceptr kernel_arg_80702 = mem_77819.mem;
                        CUdeviceptr kernel_arg_80703 = mem_77823.mem;
                        CUdeviceptr kernel_arg_80704 = mem_77827.mem;
                        CUdeviceptr kernel_arg_80705 = mem_77831.mem;
                        
                        if ((((((1 && segmap_usable_groups_72208 != 0) && 1 !=
                                0) && 1 != 0) && segmap_group_sizze_72207 !=
                              0) && 1 != 0) && 1 != 0) {
                            int perm[3] = {0, 1, 2};
                            
                            if (1 >= 1 << 16) {
                                perm[1] = perm[0];
                                perm[0] = 1;
                            }
                            if (1 >= 1 << 16) {
                                perm[2] = perm[0];
                                perm[0] = 2;
                            }
                            
                            size_t grid[3];
                            
                            grid[perm[0]] = segmap_usable_groups_72208;
                            grid[perm[1]] = 1;
                            grid[perm[2]] = 1;
                            
                            void *kernel_args_80693[] = {&ctx->global_failure,
                                                         &m_65377, &n_m_65386,
                                                         &kernel_arg_80696,
                                                         &kernel_arg_80697,
                                                         &kernel_arg_80698,
                                                         &kernel_arg_80699,
                                                         &kernel_arg_80700,
                                                         &kernel_arg_80701,
                                                         &kernel_arg_80702,
                                                         &kernel_arg_80703,
                                                         &kernel_arg_80704,
                                                         &kernel_arg_80705};
                            int64_t time_start_80694 = 0, time_end_80695 = 0;
                            
                            if (ctx->debugging) {
                                fprintf(ctx->log,
                                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                        "main.segmap_72216",
                                        (long) segmap_usable_groups_72208,
                                        (long) 1, (long) 1,
                                        (long) segmap_group_sizze_72207,
                                        (long) 1, (long) 1, (int) 0);
                                time_start_80694 = get_wall_time();
                            }
                            
                            cudaEvent_t *pevents = NULL;
                            
                            if (ctx->profiling && !ctx->profiling_paused) {
                                pevents = cuda_get_events(&ctx->cuda,
                                                          &ctx->mainzisegmap_72216_runs,
                                                          &ctx->mainzisegmap_72216_total_runtime);
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                   0));
                            }
                            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_72216,
                                                                  grid[0],
                                                                  grid[1],
                                                                  grid[2],
                                                                  segmap_group_sizze_72207,
                                                                  1, 1, 0, NULL,
                                                                  kernel_args_80693,
                                                                  NULL));
                            if (pevents != NULL)
                                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                   0));
                            if (ctx->debugging) {
                                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                time_end_80695 = get_wall_time();
                                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                        "main.segmap_72216", time_end_80695 -
                                        time_start_80694);
                            }
                        }
                        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_79593 =
                                    smax64((int64_t) 1, q_65380);
                            int64_t num_threads_79594 = 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_79593),
                                        '\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_79593))),
                                        '\n');
                            
                            unsigned int shared_sizze_80709 = (int64_t) 8 *
                                         segred_group_sizze_72250;
                            unsigned int shared_sizze_80711 = (int64_t) 8 *
                                         segred_group_sizze_72250;
                            CUdeviceptr kernel_arg_80713 = mem_77642.mem;
                            CUdeviceptr kernel_arg_80714 = mem_77646.mem;
                            CUdeviceptr kernel_arg_80715 = mem_77650.mem;
                            CUdeviceptr kernel_arg_80716 = mem_77674.mem;
                            CUdeviceptr kernel_arg_80717 = mem_77785.mem;
                            CUdeviceptr kernel_arg_80718 = mem_77789.mem;
                            CUdeviceptr kernel_arg_80719 = mem_77815.mem;
                            CUdeviceptr kernel_arg_80720 = mem_77819.mem;
                            CUdeviceptr kernel_arg_80721 = mem_77823.mem;
                            CUdeviceptr kernel_arg_80722 = mem_77827.mem;
                            CUdeviceptr kernel_arg_80723 = mem_77831.mem;
                            CUdeviceptr kernel_arg_80724 = mem_77836.mem;
                            CUdeviceptr kernel_arg_80725 = mem_77840.mem;
                            unsigned int shared_offset_80710 = 0;
                            unsigned int shared_offset_80712 = 0 +
                                         (shared_sizze_80709 + (8 -
                                                                shared_sizze_80709 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_72251 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_72250 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_72251;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80706[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80710,
                                      &shared_offset_80712, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_72251,
                                      &segment_sizze_nonzzero_79593,
                                      &kernel_arg_80713, &kernel_arg_80714,
                                      &kernel_arg_80715, &kernel_arg_80716,
                                      &kernel_arg_80717, &kernel_arg_80718,
                                      &kernel_arg_80719, &kernel_arg_80720,
                                      &kernel_arg_80721, &kernel_arg_80722,
                                      &kernel_arg_80723, &kernel_arg_80724,
                                      &kernel_arg_80725};
                                int64_t time_start_80707 = 0, time_end_80708 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_small_72258",
                                            (long) num_groups_72251, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_72250,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80709 +
                                                                        (8 -
                                                                         shared_sizze_80709 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80711 +
                                                                        (8 -
                                                                         shared_sizze_80711 %
                                                                         8) %
                                                                        8)));
                                    time_start_80707 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_small_72258_runs,
                                                              &ctx->mainzisegred_small_72258_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_small_72258,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_72250,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80709 +
                                                                       (8 -
                                                                        shared_sizze_80709 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80711 +
                                                                       (8 -
                                                                        shared_sizze_80711 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80706,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80708 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_small_72258",
                                            time_end_80708 - time_start_80707);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                        } else {
                            int64_t groups_per_segment_79628 =
                                    sdiv_up64(num_groups_72251,
                                              smax64((int64_t) 1, m_65377 *
                                                     n_m_65386));
                            int64_t elements_per_thread_79629 =
                                    sdiv_up64(q_65380,
                                              segred_group_sizze_72250 *
                                              groups_per_segment_79628);
                            int64_t virt_num_groups_79630 =
                                    groups_per_segment_79628 * (m_65377 *
                                                                n_m_65386);
                            int64_t num_threads_79631 = num_groups_72251 *
                                    segred_group_sizze_72250;
                            int64_t threads_per_segment_79632 =
                                    groups_per_segment_79628 *
                                    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_79630,
                                        '\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_79629,
                                        '\n');
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s: %llu%c",
                                        "groups_per_segment",
                                        (long long) groups_per_segment_79628,
                                        '\n');
                            
                            struct memblock_device segred_tmp_mem_79633;
                            
                            segred_tmp_mem_79633.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79633,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79630,
                                                      "segred_tmp_mem_79633")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device segred_tmp_mem_79635;
                            
                            segred_tmp_mem_79635.references = NULL;
                            if (memblock_alloc_device(ctx,
                                                      &segred_tmp_mem_79635,
                                                      (int64_t) 8 *
                                                      virt_num_groups_79630,
                                                      "segred_tmp_mem_79635")) {
                                err = 1;
                                goto cleanup;
                            }
                            
                            struct memblock_device mainzicounter_mem_79637 =
                                                   ctx->mainzicounter_mem_79637;
                            unsigned int shared_sizze_80730 = 1;
                            unsigned int shared_sizze_80732 = (int64_t) 8 *
                                         segred_group_sizze_72250;
                            unsigned int shared_sizze_80734 = (int64_t) 8 *
                                         segred_group_sizze_72250;
                            CUdeviceptr kernel_arg_80736 = mem_77642.mem;
                            CUdeviceptr kernel_arg_80737 = mem_77646.mem;
                            CUdeviceptr kernel_arg_80738 = mem_77650.mem;
                            CUdeviceptr kernel_arg_80739 = mem_77674.mem;
                            CUdeviceptr kernel_arg_80740 = mem_77785.mem;
                            CUdeviceptr kernel_arg_80741 = mem_77789.mem;
                            CUdeviceptr kernel_arg_80742 = mem_77815.mem;
                            CUdeviceptr kernel_arg_80743 = mem_77819.mem;
                            CUdeviceptr kernel_arg_80744 = mem_77823.mem;
                            CUdeviceptr kernel_arg_80745 = mem_77827.mem;
                            CUdeviceptr kernel_arg_80746 = mem_77831.mem;
                            CUdeviceptr kernel_arg_80747 = mem_77836.mem;
                            CUdeviceptr kernel_arg_80748 = mem_77840.mem;
                            CUdeviceptr kernel_arg_80749 =
                                        segred_tmp_mem_79633.mem;
                            CUdeviceptr kernel_arg_80750 =
                                        segred_tmp_mem_79635.mem;
                            CUdeviceptr kernel_arg_80751 =
                                        mainzicounter_mem_79637.mem;
                            unsigned int shared_offset_80731 = 0;
                            unsigned int shared_offset_80733 = 0 +
                                         (shared_sizze_80730 + (8 -
                                                                shared_sizze_80730 %
                                                                8) % 8);
                            unsigned int shared_offset_80735 = 0 +
                                         (shared_sizze_80730 + (8 -
                                                                shared_sizze_80730 %
                                                                8) % 8) +
                                         (shared_sizze_80732 + (8 -
                                                                shared_sizze_80732 %
                                                                8) % 8);
                            
                            if ((((((1 && num_groups_72251 != 0) && 1 != 0) &&
                                   1 != 0) && segred_group_sizze_72250 != 0) &&
                                 1 != 0) && 1 != 0) {
                                int perm[3] = {0, 1, 2};
                                
                                if (1 >= 1 << 16) {
                                    perm[1] = perm[0];
                                    perm[0] = 1;
                                }
                                if (1 >= 1 << 16) {
                                    perm[2] = perm[0];
                                    perm[0] = 2;
                                }
                                
                                size_t grid[3];
                                
                                grid[perm[0]] = num_groups_72251;
                                grid[perm[1]] = 1;
                                grid[perm[2]] = 1;
                                
                                void *kernel_args_80727[] =
                                     {&ctx->global_failure,
                                      &shared_offset_80731,
                                      &shared_offset_80733,
                                      &shared_offset_80735, &m_65377, &n_65378,
                                      &q_65380, &jump_65382, &n_m_65386,
                                      &i_65392, &num_groups_72251,
                                      &groups_per_segment_79628,
                                      &elements_per_thread_79629,
                                      &virt_num_groups_79630,
                                      &threads_per_segment_79632,
                                      &kernel_arg_80736, &kernel_arg_80737,
                                      &kernel_arg_80738, &kernel_arg_80739,
                                      &kernel_arg_80740, &kernel_arg_80741,
                                      &kernel_arg_80742, &kernel_arg_80743,
                                      &kernel_arg_80744, &kernel_arg_80745,
                                      &kernel_arg_80746, &kernel_arg_80747,
                                      &kernel_arg_80748, &kernel_arg_80749,
                                      &kernel_arg_80750, &kernel_arg_80751};
                                int64_t time_start_80728 = 0, time_end_80729 =
                                        0;
                                
                                if (ctx->debugging) {
                                    fprintf(ctx->log,
                                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                            "main.segred_large_72258",
                                            (long) num_groups_72251, (long) 1,
                                            (long) 1,
                                            (long) segred_group_sizze_72250,
                                            (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80730 +
                                                                        (8 -
                                                                         shared_sizze_80730 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80732 +
                                                                        (8 -
                                                                         shared_sizze_80732 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80734 +
                                                                        (8 -
                                                                         shared_sizze_80734 %
                                                                         8) %
                                                                        8)));
                                    time_start_80728 = get_wall_time();
                                }
                                
                                cudaEvent_t *pevents = NULL;
                                
                                if (ctx->profiling && !ctx->profiling_paused) {
                                    pevents = cuda_get_events(&ctx->cuda,
                                                              &ctx->mainzisegred_large_72258_runs,
                                                              &ctx->mainzisegred_large_72258_total_runtime);
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0],
                                                                       0));
                                }
                                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegred_large_72258,
                                                                      grid[0],
                                                                      grid[1],
                                                                      grid[2],
                                                                      segred_group_sizze_72250,
                                                                      1, 1, 0 +
                                                                      (shared_sizze_80730 +
                                                                       (8 -
                                                                        shared_sizze_80730 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80732 +
                                                                       (8 -
                                                                        shared_sizze_80732 %
                                                                        8) %
                                                                       8) +
                                                                      (shared_sizze_80734 +
                                                                       (8 -
                                                                        shared_sizze_80734 %
                                                                        8) % 8),
                                                                      NULL,
                                                                      kernel_args_80727,
                                                                      NULL));
                                if (pevents != NULL)
                                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1],
                                                                       0));
                                if (ctx->debugging) {
                                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                                    time_end_80729 = get_wall_time();
                                    fprintf(ctx->log,
                                            "Kernel %s runtime: %ldus\n",
                                            "main.segred_large_72258",
                                            time_end_80729 - time_start_80728);
                                }
                            }
                            if (ctx->debugging)
                                fprintf(ctx->log, "%s\n", "");
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79635,
                                                      "segred_tmp_mem_79635") !=
                                0)
                                return 1;
                            if (memblock_unref_device(ctx,
                                                      &segred_tmp_mem_79633,
                                                      "segred_tmp_mem_79633") !=
                                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_79681;
            
            max_num_groups_79681 =
                *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_79681))));
            
            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");
                if (ctx->debugging)
                    fprintf(ctx->log, "%s: %llu%c",
                            "SegScan: number of elements processed sequentially per thread is m:",
                            (long long) 11, '\n');
                if (ctx->debugging)
                    fprintf(ctx->log, "%s: %llu%c",
                            "SegScan: memory constraints is: ", (long long) 11,
                            '\n');
                if (ctx->debugging)
                    fprintf(ctx->log, "%s: %llu%c",
                            "SegScan: register constraints is: ",
                            (long long) 15, '\n');
                if (ctx->debugging)
                    fprintf(ctx->log, "%s: %llu%c", "SegScan: sumT' is: ",
                            (long long) 2, '\n');
                
                int64_t numThreads_79682 = sdiv_up64(m_65377 * n_65378,
                                                     segscan_group_sizze_72693 *
                                                     (int64_t) 11) *
                        segscan_group_sizze_72693;
                int64_t numGroups_79683 = sdiv_up64(m_65377 * n_65378,
                                                    segscan_group_sizze_72693 *
                                                    (int64_t) 11);
                struct memblock_device mainziid_counter_mem_79684 =
                                       ctx->mainziid_counter_mem_79684;
                struct memblock_device status_flags_mem_79686;
                
                status_flags_mem_79686.references = NULL;
                if (memblock_alloc_device(ctx, &status_flags_mem_79686,
                                          numGroups_79683,
                                          "status_flags_mem_79686")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device aggregates_mem_79688;
                
                aggregates_mem_79688.references = NULL;
                if (memblock_alloc_device(ctx, &aggregates_mem_79688,
                                          (int64_t) 8 * numGroups_79683,
                                          "aggregates_mem_79688")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock_device incprefixes_mem_79690;
                
                incprefixes_mem_79690.references = NULL;
                if (memblock_alloc_device(ctx, &incprefixes_mem_79690,
                                          (int64_t) 8 * numGroups_79683,
                                          "incprefixes_mem_79690")) {
                    err = 1;
                    goto cleanup;
                }
                if (futrts_builtinzhreplicate_i8(ctx, status_flags_mem_79686,
                                                 numGroups_79683, (int8_t) 0) !=
                    0) {
                    if (memblock_unref_device(ctx, &incprefixes_mem_79690,
                                              "incprefixes_mem_79690") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &aggregates_mem_79688,
                                              "aggregates_mem_79688") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &status_flags_mem_79686,
                                              "status_flags_mem_79686") != 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;
                }
                
                unsigned int shared_sizze_80756 = smax64(smax64((int64_t) 288,
                                                                (int64_t) 8 *
                                                                segscan_group_sizze_72693),
                                                         (int64_t) 11 *
                                                         segscan_group_sizze_72693 *
                                                         (int64_t) 8);
                CUdeviceptr kernel_arg_80758 = Y_mem_77010.mem;
                CUdeviceptr kernel_arg_80759 = mem_77867.mem;
                CUdeviceptr kernel_arg_80760 = mainziid_counter_mem_79684.mem;
                CUdeviceptr kernel_arg_80761 = status_flags_mem_79686.mem;
                CUdeviceptr kernel_arg_80762 = aggregates_mem_79688.mem;
                CUdeviceptr kernel_arg_80763 = incprefixes_mem_79690.mem;
                unsigned int shared_offset_80757 = 0;
                
                if ((((((1 && sdiv_up64(m_65377 * n_65378,
                                        segscan_group_sizze_72693 *
                                        (int64_t) 11) != 0) && 1 != 0) && 1 !=
                       0) && segscan_group_sizze_72693 != 0) && 1 != 0) && 1 !=
                    0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = sdiv_up64(m_65377 * n_65378,
                                              segscan_group_sizze_72693 *
                                              (int64_t) 11);
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80753[] = {&ctx->global_failure,
                                                 &shared_offset_80757, &m_65377,
                                                 &n_65378, &kernel_arg_80758,
                                                 &kernel_arg_80759,
                                                 &kernel_arg_80760,
                                                 &kernel_arg_80761,
                                                 &kernel_arg_80762,
                                                 &kernel_arg_80763};
                    int64_t time_start_80754 = 0, time_end_80755 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segscan_72699", (long) sdiv_up64(m_65377 *
                                                                       n_65378,
                                                                       segscan_group_sizze_72693 *
                                                                       (int64_t) 11),
                                (long) 1, (long) 1,
                                (long) segscan_group_sizze_72693, (long) 1,
                                (long) 1, (int) (0 + (shared_sizze_80756 + (8 -
                                                                            shared_sizze_80756 %
                                                                            8) %
                                                      8)));
                        time_start_80754 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegscan_72699_runs,
                                                  &ctx->mainzisegscan_72699_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegscan_72699,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segscan_group_sizze_72693,
                                                          1, 1, 0 +
                                                          (shared_sizze_80756 +
                                                           (8 -
                                                            shared_sizze_80756 %
                                                            8) % 8), NULL,
                                                          kernel_args_80753,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80755 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segscan_72699", time_end_80755 -
                                time_start_80754);
                    }
                }
                if (memblock_unref_device(ctx, &incprefixes_mem_79690,
                                          "incprefixes_mem_79690") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &aggregates_mem_79688,
                                          "aggregates_mem_79688") != 0)
                    return 1;
                if (memblock_unref_device(ctx, &status_flags_mem_79686,
                                          "status_flags_mem_79686") != 0)
                    return 1;
            }
            
            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");
            
            CUdeviceptr kernel_arg_80767 = Y_mem_77010.mem;
            CUdeviceptr kernel_arg_80768 = mem_77867.mem;
            CUdeviceptr kernel_arg_80769 = mem_77871.mem;
            CUdeviceptr kernel_arg_80770 = mem_77875.mem;
            
            if ((((((1 && segmap_usable_groups_72747 != 0) && 1 != 0) && 1 !=
                   0) && segmap_group_sizze_72746 != 0) && 1 != 0) && 1 != 0) {
                int perm[3] = {0, 1, 2};
                
                if (1 >= 1 << 16) {
                    perm[1] = perm[0];
                    perm[0] = 1;
                }
                if (1 >= 1 << 16) {
                    perm[2] = perm[0];
                    perm[0] = 2;
                }
                
                size_t grid[3];
                
                grid[perm[0]] = segmap_usable_groups_72747;
                grid[perm[1]] = 1;
                grid[perm[2]] = 1;
                
                void *kernel_args_80764[] = {&ctx->global_failure, &m_65377,
                                             &n_65378, &kernel_arg_80767,
                                             &kernel_arg_80768,
                                             &kernel_arg_80769,
                                             &kernel_arg_80770};
                int64_t time_start_80765 = 0, time_end_80766 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                            "main.segmap_72752",
                            (long) segmap_usable_groups_72747, (long) 1,
                            (long) 1, (long) segmap_group_sizze_72746, (long) 1,
                            (long) 1, (int) 0);
                    time_start_80765 = get_wall_time();
                }
                
                cudaEvent_t *pevents = NULL;
                
                if (ctx->profiling && !ctx->profiling_paused) {
                    pevents = cuda_get_events(&ctx->cuda,
                                              &ctx->mainzisegmap_72752_runs,
                                              &ctx->mainzisegmap_72752_total_runtime);
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                }
                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_72752,
                                                      grid[0], grid[1], grid[2],
                                                      segmap_group_sizze_72746,
                                                      1, 1, 0, NULL,
                                                      kernel_args_80764, NULL));
                if (pevents != NULL)
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                if (ctx->debugging) {
                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                    time_end_80766 = get_wall_time();
                    fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                            "main.segmap_72752", time_end_80766 -
                            time_start_80765);
                }
            }
            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");
            
            CUdeviceptr kernel_arg_80774 = mem_77875.mem;
            CUdeviceptr kernel_arg_80775 = mem_77881.mem;
            
            if ((((((1 && segmap_usable_groups_72767 != 0) && 1 != 0) && 1 !=
                   0) && segmap_group_sizze_72766 != 0) && 1 != 0) && 1 != 0) {
                int perm[3] = {0, 1, 2};
                
                if (1 >= 1 << 16) {
                    perm[1] = perm[0];
                    perm[0] = 1;
                }
                if (1 >= 1 << 16) {
                    perm[2] = perm[0];
                    perm[0] = 2;
                }
                
                size_t grid[3];
                
                grid[perm[0]] = segmap_usable_groups_72767;
                grid[perm[1]] = 1;
                grid[perm[2]] = 1;
                
                void *kernel_args_80771[] = {&ctx->global_failure, &m_65377,
                                             &n_65378, &kernel_arg_80774,
                                             &kernel_arg_80775};
                int64_t time_start_80772 = 0, time_end_80773 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                            "main.segmap_72771",
                            (long) segmap_usable_groups_72767, (long) 1,
                            (long) 1, (long) segmap_group_sizze_72766, (long) 1,
                            (long) 1, (int) 0);
                    time_start_80772 = get_wall_time();
                }
                
                cudaEvent_t *pevents = NULL;
                
                if (ctx->profiling && !ctx->profiling_paused) {
                    pevents = cuda_get_events(&ctx->cuda,
                                              &ctx->mainzisegmap_72771_runs,
                                              &ctx->mainzisegmap_72771_total_runtime);
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                }
                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_72771,
                                                      grid[0], grid[1], grid[2],
                                                      segmap_group_sizze_72766,
                                                      1, 1, 0, NULL,
                                                      kernel_args_80771, NULL));
                if (pevents != NULL)
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                if (ctx->debugging) {
                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                    time_end_80773 = get_wall_time();
                    fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                            "main.segmap_72771", time_end_80773 -
                            time_start_80772);
                }
            }
            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");
            
            CUdeviceptr kernel_arg_80779 = mem_77867.mem;
            CUdeviceptr kernel_arg_80780 = mem_77885.mem;
            CUdeviceptr kernel_arg_80781 = mem_77888.mem;
            CUdeviceptr kernel_arg_80782 = mem_77891.mem;
            CUdeviceptr kernel_arg_80783 = mem_77894.mem;
            
            if ((((((1 && segmap_usable_groups_72777 != 0) && 1 != 0) && 1 !=
                   0) && segmap_group_sizze_72776 != 0) && 1 != 0) && 1 != 0) {
                int perm[3] = {0, 1, 2};
                
                if (1 >= 1 << 16) {
                    perm[1] = perm[0];
                    perm[0] = 1;
                }
                if (1 >= 1 << 16) {
                    perm[2] = perm[0];
                    perm[0] = 2;
                }
                
                size_t grid[3];
                
                grid[perm[0]] = segmap_usable_groups_72777;
                grid[perm[1]] = 1;
                grid[perm[2]] = 1;
                
                void *kernel_args_80776[] = {&ctx->global_failure, &m_65377,
                                             &n_65378, &q_65380, &i_65392,
                                             &min_res_65398, &i64_res_65404,
                                             &kernel_arg_80779,
                                             &kernel_arg_80780,
                                             &kernel_arg_80781,
                                             &kernel_arg_80782,
                                             &kernel_arg_80783};
                int64_t time_start_80777 = 0, time_end_80778 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                            "main.segmap_72783",
                            (long) segmap_usable_groups_72777, (long) 1,
                            (long) 1, (long) segmap_group_sizze_72776, (long) 1,
                            (long) 1, (int) 0);
                    time_start_80777 = get_wall_time();
                }
                
                cudaEvent_t *pevents = NULL;
                
                if (ctx->profiling && !ctx->profiling_paused) {
                    pevents = cuda_get_events(&ctx->cuda,
                                              &ctx->mainzisegmap_72783_runs,
                                              &ctx->mainzisegmap_72783_total_runtime);
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                }
                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_72783,
                                                      grid[0], grid[1], grid[2],
                                                      segmap_group_sizze_72776,
                                                      1, 1, 0, NULL,
                                                      kernel_args_80776, NULL));
                if (pevents != NULL)
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                if (ctx->debugging) {
                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                    time_end_80778 = get_wall_time();
                    fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                            "main.segmap_72783", time_end_80778 -
                            time_start_80777);
                }
            }
            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");
            
            CUdeviceptr kernel_arg_80787 = mem_77867.mem;
            CUdeviceptr kernel_arg_80788 = mem_77899.mem;
            
            if ((((((1 && segmap_usable_groups_72799 != 0) && 1 != 0) && 1 !=
                   0) && segmap_group_sizze_72798 != 0) && 1 != 0) && 1 != 0) {
                int perm[3] = {0, 1, 2};
                
                if (1 >= 1 << 16) {
                    perm[1] = perm[0];
                    perm[0] = 1;
                }
                if (1 >= 1 << 16) {
                    perm[2] = perm[0];
                    perm[0] = 2;
                }
                
                size_t grid[3];
                
                grid[perm[0]] = segmap_usable_groups_72799;
                grid[perm[1]] = 1;
                grid[perm[2]] = 1;
                
                void *kernel_args_80784[] = {&ctx->global_failure, &m_65377,
                                             &n_65378, &q_65380, &i_65392,
                                             &kernel_arg_80787,
                                             &kernel_arg_80788};
                int64_t time_start_80785 = 0, time_end_80786 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                            "main.segmap_72803",
                            (long) segmap_usable_groups_72799, (long) 1,
                            (long) 1, (long) segmap_group_sizze_72798, (long) 1,
                            (long) 1, (int) 0);
                    time_start_80785 = get_wall_time();
                }
                
                cudaEvent_t *pevents = NULL;
                
                if (ctx->profiling && !ctx->profiling_paused) {
                    pevents = cuda_get_events(&ctx->cuda,
                                              &ctx->mainzisegmap_72803_runs,
                                              &ctx->mainzisegmap_72803_total_runtime);
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                }
                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_72803,
                                                      grid[0], grid[1], grid[2],
                                                      segmap_group_sizze_72798,
                                                      1, 1, 0, NULL,
                                                      kernel_args_80784, NULL));
                if (pevents != NULL)
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                if (ctx->debugging) {
                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                    time_end_80786 = get_wall_time();
                    fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                            "main.segmap_72803", time_end_80786 -
                            time_start_80785);
                }
            }
            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");
            
            unsigned int shared_sizze_80792 = (int64_t) 8 * q_65380;
            unsigned int shared_sizze_80794 = (int64_t) 8 * q_65380;
            unsigned int shared_sizze_80796 = bytes_77903;
            CUdeviceptr kernel_arg_80798 = mem_77867.mem;
            CUdeviceptr kernel_arg_80799 = mem_77871.mem;
            CUdeviceptr kernel_arg_80800 = mem_77875.mem;
            CUdeviceptr kernel_arg_80801 = mem_77881.mem;
            CUdeviceptr kernel_arg_80802 = mem_77885.mem;
            CUdeviceptr kernel_arg_80803 = mem_77888.mem;
            CUdeviceptr kernel_arg_80804 = mem_77891.mem;
            CUdeviceptr kernel_arg_80805 = mem_77894.mem;
            CUdeviceptr kernel_arg_80806 = mem_77899.mem;
            CUdeviceptr kernel_arg_80807 = mem_77909.mem;
            unsigned int shared_offset_80793 = 0;
            unsigned int shared_offset_80795 = 0 + (shared_sizze_80792 + (8 -
                                                                          shared_sizze_80792 %
                                                                          8) %
                                                    8);
            unsigned int shared_offset_80797 = 0 + (shared_sizze_80792 + (8 -
                                                                          shared_sizze_80792 %
                                                                          8) %
                                                    8) + (shared_sizze_80794 +
                                                          (8 -
                                                           shared_sizze_80794 %
                                                           8) % 8);
            
            if ((((((1 && binop_x_77859 != 0) && 1 != 0) && 1 != 0) &&
                  q_65380 != 0) && 1 != 0) && 1 != 0) {
                int perm[3] = {0, 1, 2};
                
                if (1 >= 1 << 16) {
                    perm[1] = perm[0];
                    perm[0] = 1;
                }
                if (1 >= 1 << 16) {
                    perm[2] = perm[0];
                    perm[0] = 2;
                }
                
                size_t grid[3];
                
                grid[perm[0]] = binop_x_77859;
                grid[perm[1]] = 1;
                grid[perm[2]] = 1;
                
                void *kernel_args_80789[] = {&ctx->global_failure,
                                             &ctx->failure_is_an_option,
                                             &ctx->global_failure_args,
                                             &shared_offset_80793,
                                             &shared_offset_80795,
                                             &shared_offset_80797, &m_65377,
                                             &n_65378, &q_65380, &jump_65382,
                                             &n_m_65386, &i_65392, &x_65393,
                                             &min_res_65398, &loop_cond_65403,
                                             &kernel_arg_80798,
                                             &kernel_arg_80799,
                                             &kernel_arg_80800,
                                             &kernel_arg_80801,
                                             &kernel_arg_80802,
                                             &kernel_arg_80803,
                                             &kernel_arg_80804,
                                             &kernel_arg_80805,
                                             &kernel_arg_80806,
                                             &kernel_arg_80807};
                int64_t time_start_80790 = 0, time_end_80791 = 0;
                
                if (ctx->debugging) {
                    fprintf(ctx->log,
                            "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                            "main.segmap_intragroup_72819",
                            (long) binop_x_77859, (long) 1, (long) 1,
                            (long) q_65380, (long) 1, (long) 1, (int) (0 +
                                                                       (shared_sizze_80792 +
                                                                        (8 -
                                                                         shared_sizze_80792 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80794 +
                                                                        (8 -
                                                                         shared_sizze_80794 %
                                                                         8) %
                                                                        8) +
                                                                       (shared_sizze_80796 +
                                                                        (8 -
                                                                         shared_sizze_80796 %
                                                                         8) %
                                                                        8)));
                    time_start_80790 = get_wall_time();
                }
                
                cudaEvent_t *pevents = NULL;
                
                if (ctx->profiling && !ctx->profiling_paused) {
                    pevents = cuda_get_events(&ctx->cuda,
                                              &ctx->mainzisegmap_intragroup_72819_runs,
                                              &ctx->mainzisegmap_intragroup_72819_total_runtime);
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                }
                CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_intragroup_72819,
                                                      grid[0], grid[1], grid[2],
                                                      q_65380, 1, 1, 0 +
                                                      (shared_sizze_80792 + (8 -
                                                                             shared_sizze_80792 %
                                                                             8) %
                                                       8) +
                                                      (shared_sizze_80794 + (8 -
                                                                             shared_sizze_80794 %
                                                                             8) %
                                                       8) +
                                                      (shared_sizze_80796 + (8 -
                                                                             shared_sizze_80796 %
                                                                             8) %
                                                       8), NULL,
                                                      kernel_args_80789, NULL));
                if (pevents != NULL)
                    CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                if (ctx->debugging) {
                    CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                    time_end_80791 = get_wall_time();
                    fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                            "main.segmap_intragroup_72819", time_end_80791 -
                            time_start_80790);
                }
            }
            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_79850;
                
                max_num_groups_79850 =
                    *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_79850))));
                
                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");
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: number of elements processed sequentially per thread is m:",
                                (long long) 11, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: memory constraints is: ",
                                (long long) 11, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: register constraints is: ",
                                (long long) 15, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c", "SegScan: sumT' is: ",
                                (long long) 2, '\n');
                    
                    int64_t numThreads_79851 = sdiv_up64(m_65377 * n_65378,
                                                         segscan_group_sizze_73360 *
                                                         (int64_t) 11) *
                            segscan_group_sizze_73360;
                    int64_t numGroups_79852 = sdiv_up64(m_65377 * n_65378,
                                                        segscan_group_sizze_73360 *
                                                        (int64_t) 11);
                    struct memblock_device mainziid_counter_mem_79853 =
                                           ctx->mainziid_counter_mem_79853;
                    struct memblock_device status_flags_mem_79855;
                    
                    status_flags_mem_79855.references = NULL;
                    if (memblock_alloc_device(ctx, &status_flags_mem_79855,
                                              numGroups_79852,
                                              "status_flags_mem_79855")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device aggregates_mem_79857;
                    
                    aggregates_mem_79857.references = NULL;
                    if (memblock_alloc_device(ctx, &aggregates_mem_79857,
                                              (int64_t) 8 * numGroups_79852,
                                              "aggregates_mem_79857")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device incprefixes_mem_79859;
                    
                    incprefixes_mem_79859.references = NULL;
                    if (memblock_alloc_device(ctx, &incprefixes_mem_79859,
                                              (int64_t) 8 * numGroups_79852,
                                              "incprefixes_mem_79859")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhreplicate_i8(ctx,
                                                     status_flags_mem_79855,
                                                     numGroups_79852,
                                                     (int8_t) 0) != 0) {
                        if (memblock_unref_device(ctx, &incprefixes_mem_79859,
                                                  "incprefixes_mem_79859") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &aggregates_mem_79857,
                                                  "aggregates_mem_79857") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &status_flags_mem_79855,
                                                  "status_flags_mem_79855") !=
                            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;
                    }
                    
                    unsigned int shared_sizze_80812 =
                                 smax64(smax64((int64_t) 288, (int64_t) 8 *
                                               segscan_group_sizze_73360),
                                        (int64_t) 11 *
                                        segscan_group_sizze_73360 *
                                        (int64_t) 8);
                    CUdeviceptr kernel_arg_80814 = Y_mem_77010.mem;
                    CUdeviceptr kernel_arg_80815 = mem_77914.mem;
                    CUdeviceptr kernel_arg_80816 =
                                mainziid_counter_mem_79853.mem;
                    CUdeviceptr kernel_arg_80817 = status_flags_mem_79855.mem;
                    CUdeviceptr kernel_arg_80818 = aggregates_mem_79857.mem;
                    CUdeviceptr kernel_arg_80819 = incprefixes_mem_79859.mem;
                    unsigned int shared_offset_80813 = 0;
                    
                    if ((((((1 && sdiv_up64(m_65377 * n_65378,
                                            segscan_group_sizze_73360 *
                                            (int64_t) 11) != 0) && 1 != 0) &&
                           1 != 0) && segscan_group_sizze_73360 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = sdiv_up64(m_65377 * n_65378,
                                                  segscan_group_sizze_73360 *
                                                  (int64_t) 11);
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80809[] = {&ctx->global_failure,
                                                     &shared_offset_80813,
                                                     &m_65377, &n_65378,
                                                     &kernel_arg_80814,
                                                     &kernel_arg_80815,
                                                     &kernel_arg_80816,
                                                     &kernel_arg_80817,
                                                     &kernel_arg_80818,
                                                     &kernel_arg_80819};
                        int64_t time_start_80810 = 0, time_end_80811 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segscan_73366",
                                    (long) sdiv_up64(m_65377 * n_65378,
                                                     segscan_group_sizze_73360 *
                                                     (int64_t) 11), (long) 1,
                                    (long) 1, (long) segscan_group_sizze_73360,
                                    (long) 1, (long) 1, (int) (0 +
                                                               (shared_sizze_80812 +
                                                                (8 -
                                                                 shared_sizze_80812 %
                                                                 8) % 8)));
                            time_start_80810 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegscan_73366_runs,
                                                      &ctx->mainzisegscan_73366_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegscan_73366,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segscan_group_sizze_73360,
                                                              1, 1, 0 +
                                                              (shared_sizze_80812 +
                                                               (8 -
                                                                shared_sizze_80812 %
                                                                8) % 8), NULL,
                                                              kernel_args_80809,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80811 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segscan_73366", time_end_80811 -
                                    time_start_80810);
                        }
                    }
                    if (memblock_unref_device(ctx, &incprefixes_mem_79859,
                                              "incprefixes_mem_79859") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &aggregates_mem_79857,
                                              "aggregates_mem_79857") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &status_flags_mem_79855,
                                              "status_flags_mem_79855") != 0)
                        return 1;
                }
                
                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");
                
                CUdeviceptr kernel_arg_80823 = Y_mem_77010.mem;
                CUdeviceptr kernel_arg_80824 = mem_77914.mem;
                CUdeviceptr kernel_arg_80825 = mem_77918.mem;
                CUdeviceptr kernel_arg_80826 = mem_77922.mem;
                
                if ((((((1 && segmap_usable_groups_73414 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_73413 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_73414;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80820[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &kernel_arg_80823,
                                                 &kernel_arg_80824,
                                                 &kernel_arg_80825,
                                                 &kernel_arg_80826};
                    int64_t time_start_80821 = 0, time_end_80822 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_73419",
                                (long) segmap_usable_groups_73414, (long) 1,
                                (long) 1, (long) segmap_group_sizze_73413,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80821 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_73419_runs,
                                                  &ctx->mainzisegmap_73419_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_73419,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_73413,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80820,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80822 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_73419", time_end_80822 -
                                time_start_80821);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80830 = mem_77922.mem;
                CUdeviceptr kernel_arg_80831 = mem_77928.mem;
                
                if ((((((1 && segmap_usable_groups_73434 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_73433 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_73434;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80827[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &kernel_arg_80830,
                                                 &kernel_arg_80831};
                    int64_t time_start_80828 = 0, time_end_80829 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_73438",
                                (long) segmap_usable_groups_73434, (long) 1,
                                (long) 1, (long) segmap_group_sizze_73433,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80828 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_73438_runs,
                                                  &ctx->mainzisegmap_73438_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_73438,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_73433,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80827,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80829 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_73438", time_end_80829 -
                                time_start_80828);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80835 = mem_77914.mem;
                CUdeviceptr kernel_arg_80836 = mem_77932.mem;
                CUdeviceptr kernel_arg_80837 = mem_77935.mem;
                CUdeviceptr kernel_arg_80838 = mem_77938.mem;
                CUdeviceptr kernel_arg_80839 = mem_77941.mem;
                
                if ((((((1 && segmap_usable_groups_73444 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_73443 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_73444;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80832[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &q_65380, &i_65392,
                                                 &min_res_65398, &i64_res_65404,
                                                 &kernel_arg_80835,
                                                 &kernel_arg_80836,
                                                 &kernel_arg_80837,
                                                 &kernel_arg_80838,
                                                 &kernel_arg_80839};
                    int64_t time_start_80833 = 0, time_end_80834 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_73450",
                                (long) segmap_usable_groups_73444, (long) 1,
                                (long) 1, (long) segmap_group_sizze_73443,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80833 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_73450_runs,
                                                  &ctx->mainzisegmap_73450_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_73450,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_73443,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80832,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80834 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_73450", time_end_80834 -
                                time_start_80833);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80843 = mem_77914.mem;
                CUdeviceptr kernel_arg_80844 = mem_77946.mem;
                
                if ((((((1 && segmap_usable_groups_73466 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_73465 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_73466;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80840[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &q_65380, &i_65392,
                                                 &kernel_arg_80843,
                                                 &kernel_arg_80844};
                    int64_t time_start_80841 = 0, time_end_80842 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_73470",
                                (long) segmap_usable_groups_73466, (long) 1,
                                (long) 1, (long) segmap_group_sizze_73465,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80841 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_73470_runs,
                                                  &ctx->mainzisegmap_73470_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_73470,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_73465,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80840,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80842 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_73470", time_end_80842 -
                                time_start_80841);
                    }
                }
                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");
                
                unsigned int shared_sizze_80848 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80850 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80852 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80854 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80856 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80858 = bytes_77903;
                unsigned int shared_sizze_80860 = bytes_77903;
                CUdeviceptr kernel_arg_80862 = mem_77914.mem;
                CUdeviceptr kernel_arg_80863 = mem_77918.mem;
                CUdeviceptr kernel_arg_80864 = mem_77922.mem;
                CUdeviceptr kernel_arg_80865 = mem_77928.mem;
                CUdeviceptr kernel_arg_80866 = mem_77932.mem;
                CUdeviceptr kernel_arg_80867 = mem_77935.mem;
                CUdeviceptr kernel_arg_80868 = mem_77938.mem;
                CUdeviceptr kernel_arg_80869 = mem_77941.mem;
                CUdeviceptr kernel_arg_80870 = mem_77946.mem;
                CUdeviceptr kernel_arg_80871 = mem_77959.mem;
                CUdeviceptr kernel_arg_80872 = mem_77963.mem;
                unsigned int shared_offset_80849 = 0;
                unsigned int shared_offset_80851 = 0 + (shared_sizze_80848 +
                                                        (8 -
                                                         shared_sizze_80848 %
                                                         8) % 8);
                unsigned int shared_offset_80853 = 0 + (shared_sizze_80848 +
                                                        (8 -
                                                         shared_sizze_80848 %
                                                         8) % 8) +
                             (shared_sizze_80850 + (8 - shared_sizze_80850 %
                                                    8) % 8);
                unsigned int shared_offset_80855 = 0 + (shared_sizze_80848 +
                                                        (8 -
                                                         shared_sizze_80848 %
                                                         8) % 8) +
                             (shared_sizze_80850 + (8 - shared_sizze_80850 %
                                                    8) % 8) +
                             (shared_sizze_80852 + (8 - shared_sizze_80852 %
                                                    8) % 8);
                unsigned int shared_offset_80857 = 0 + (shared_sizze_80848 +
                                                        (8 -
                                                         shared_sizze_80848 %
                                                         8) % 8) +
                             (shared_sizze_80850 + (8 - shared_sizze_80850 %
                                                    8) % 8) +
                             (shared_sizze_80852 + (8 - shared_sizze_80852 %
                                                    8) % 8) +
                             (shared_sizze_80854 + (8 - shared_sizze_80854 %
                                                    8) % 8);
                unsigned int shared_offset_80859 = 0 + (shared_sizze_80848 +
                                                        (8 -
                                                         shared_sizze_80848 %
                                                         8) % 8) +
                             (shared_sizze_80850 + (8 - shared_sizze_80850 %
                                                    8) % 8) +
                             (shared_sizze_80852 + (8 - shared_sizze_80852 %
                                                    8) % 8) +
                             (shared_sizze_80854 + (8 - shared_sizze_80854 %
                                                    8) % 8) +
                             (shared_sizze_80856 + (8 - shared_sizze_80856 %
                                                    8) % 8);
                unsigned int shared_offset_80861 = 0 + (shared_sizze_80848 +
                                                        (8 -
                                                         shared_sizze_80848 %
                                                         8) % 8) +
                             (shared_sizze_80850 + (8 - shared_sizze_80850 %
                                                    8) % 8) +
                             (shared_sizze_80852 + (8 - shared_sizze_80852 %
                                                    8) % 8) +
                             (shared_sizze_80854 + (8 - shared_sizze_80854 %
                                                    8) % 8) +
                             (shared_sizze_80856 + (8 - shared_sizze_80856 %
                                                    8) % 8) +
                             (shared_sizze_80858 + (8 - shared_sizze_80858 %
                                                    8) % 8);
                
                if ((((((1 && binop_x_77859 != 0) && 1 != 0) && 1 != 0) &&
                      q_65380 != 0) && 1 != 0) && 1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = binop_x_77859;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80845[] = {&ctx->global_failure,
                                                 &ctx->failure_is_an_option,
                                                 &ctx->global_failure_args,
                                                 &shared_offset_80849,
                                                 &shared_offset_80851,
                                                 &shared_offset_80853,
                                                 &shared_offset_80855,
                                                 &shared_offset_80857,
                                                 &shared_offset_80859,
                                                 &shared_offset_80861, &m_65377,
                                                 &n_65378, &q_65380,
                                                 &jump_65382, &n_m_65386,
                                                 &i_65392, &x_65393,
                                                 &min_res_65398,
                                                 &loop_cond_65403,
                                                 &kernel_arg_80862,
                                                 &kernel_arg_80863,
                                                 &kernel_arg_80864,
                                                 &kernel_arg_80865,
                                                 &kernel_arg_80866,
                                                 &kernel_arg_80867,
                                                 &kernel_arg_80868,
                                                 &kernel_arg_80869,
                                                 &kernel_arg_80870,
                                                 &kernel_arg_80871,
                                                 &kernel_arg_80872};
                    int64_t time_start_80846 = 0, time_end_80847 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_intragroup_73487",
                                (long) binop_x_77859, (long) 1, (long) 1,
                                (long) q_65380, (long) 1, (long) 1, (int) (0 +
                                                                           (shared_sizze_80848 +
                                                                            (8 -
                                                                             shared_sizze_80848 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80850 +
                                                                            (8 -
                                                                             shared_sizze_80850 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80852 +
                                                                            (8 -
                                                                             shared_sizze_80852 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80854 +
                                                                            (8 -
                                                                             shared_sizze_80854 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80856 +
                                                                            (8 -
                                                                             shared_sizze_80856 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80858 +
                                                                            (8 -
                                                                             shared_sizze_80858 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80860 +
                                                                            (8 -
                                                                             shared_sizze_80860 %
                                                                             8) %
                                                                            8)));
                        time_start_80846 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_intragroup_73487_runs,
                                                  &ctx->mainzisegmap_intragroup_73487_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_intragroup_73487,
                                                          grid[0], grid[1],
                                                          grid[2], q_65380, 1,
                                                          1, 0 +
                                                          (shared_sizze_80848 +
                                                           (8 -
                                                            shared_sizze_80848 %
                                                            8) % 8) +
                                                          (shared_sizze_80850 +
                                                           (8 -
                                                            shared_sizze_80850 %
                                                            8) % 8) +
                                                          (shared_sizze_80852 +
                                                           (8 -
                                                            shared_sizze_80852 %
                                                            8) % 8) +
                                                          (shared_sizze_80854 +
                                                           (8 -
                                                            shared_sizze_80854 %
                                                            8) % 8) +
                                                          (shared_sizze_80856 +
                                                           (8 -
                                                            shared_sizze_80856 %
                                                            8) % 8) +
                                                          (shared_sizze_80858 +
                                                           (8 -
                                                            shared_sizze_80858 %
                                                            8) % 8) +
                                                          (shared_sizze_80860 +
                                                           (8 -
                                                            shared_sizze_80860 %
                                                            8) % 8), NULL,
                                                          kernel_args_80845,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80847 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_intragroup_73487", time_end_80847 -
                                time_start_80846);
                    }
                }
                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_80025;
                
                max_num_groups_80025 =
                    *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_80025))));
                
                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");
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: number of elements processed sequentially per thread is m:",
                                (long long) 11, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: memory constraints is: ",
                                (long long) 11, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c",
                                "SegScan: register constraints is: ",
                                (long long) 15, '\n');
                    if (ctx->debugging)
                        fprintf(ctx->log, "%s: %llu%c", "SegScan: sumT' is: ",
                                (long long) 2, '\n');
                    
                    int64_t numThreads_80026 = sdiv_up64(m_65377 * n_65378,
                                                         segscan_group_sizze_74117 *
                                                         (int64_t) 11) *
                            segscan_group_sizze_74117;
                    int64_t numGroups_80027 = sdiv_up64(m_65377 * n_65378,
                                                        segscan_group_sizze_74117 *
                                                        (int64_t) 11);
                    struct memblock_device mainziid_counter_mem_80028 =
                                           ctx->mainziid_counter_mem_80028;
                    struct memblock_device status_flags_mem_80030;
                    
                    status_flags_mem_80030.references = NULL;
                    if (memblock_alloc_device(ctx, &status_flags_mem_80030,
                                              numGroups_80027,
                                              "status_flags_mem_80030")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device aggregates_mem_80032;
                    
                    aggregates_mem_80032.references = NULL;
                    if (memblock_alloc_device(ctx, &aggregates_mem_80032,
                                              (int64_t) 8 * numGroups_80027,
                                              "aggregates_mem_80032")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    struct memblock_device incprefixes_mem_80034;
                    
                    incprefixes_mem_80034.references = NULL;
                    if (memblock_alloc_device(ctx, &incprefixes_mem_80034,
                                              (int64_t) 8 * numGroups_80027,
                                              "incprefixes_mem_80034")) {
                        err = 1;
                        goto cleanup;
                    }
                    if (futrts_builtinzhreplicate_i8(ctx,
                                                     status_flags_mem_80030,
                                                     numGroups_80027,
                                                     (int8_t) 0) != 0) {
                        if (memblock_unref_device(ctx, &incprefixes_mem_80034,
                                                  "incprefixes_mem_80034") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &aggregates_mem_80032,
                                                  "aggregates_mem_80032") != 0)
                            return 1;
                        if (memblock_unref_device(ctx, &status_flags_mem_80030,
                                                  "status_flags_mem_80030") !=
                            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;
                    }
                    
                    unsigned int shared_sizze_80877 =
                                 smax64(smax64((int64_t) 288, (int64_t) 8 *
                                               segscan_group_sizze_74117),
                                        (int64_t) 11 *
                                        segscan_group_sizze_74117 *
                                        (int64_t) 8);
                    CUdeviceptr kernel_arg_80879 = Y_mem_77010.mem;
                    CUdeviceptr kernel_arg_80880 = mem_77968.mem;
                    CUdeviceptr kernel_arg_80881 =
                                mainziid_counter_mem_80028.mem;
                    CUdeviceptr kernel_arg_80882 = status_flags_mem_80030.mem;
                    CUdeviceptr kernel_arg_80883 = aggregates_mem_80032.mem;
                    CUdeviceptr kernel_arg_80884 = incprefixes_mem_80034.mem;
                    unsigned int shared_offset_80878 = 0;
                    
                    if ((((((1 && sdiv_up64(m_65377 * n_65378,
                                            segscan_group_sizze_74117 *
                                            (int64_t) 11) != 0) && 1 != 0) &&
                           1 != 0) && segscan_group_sizze_74117 != 0) && 1 !=
                         0) && 1 != 0) {
                        int perm[3] = {0, 1, 2};
                        
                        if (1 >= 1 << 16) {
                            perm[1] = perm[0];
                            perm[0] = 1;
                        }
                        if (1 >= 1 << 16) {
                            perm[2] = perm[0];
                            perm[0] = 2;
                        }
                        
                        size_t grid[3];
                        
                        grid[perm[0]] = sdiv_up64(m_65377 * n_65378,
                                                  segscan_group_sizze_74117 *
                                                  (int64_t) 11);
                        grid[perm[1]] = 1;
                        grid[perm[2]] = 1;
                        
                        void *kernel_args_80874[] = {&ctx->global_failure,
                                                     &shared_offset_80878,
                                                     &m_65377, &n_65378,
                                                     &kernel_arg_80879,
                                                     &kernel_arg_80880,
                                                     &kernel_arg_80881,
                                                     &kernel_arg_80882,
                                                     &kernel_arg_80883,
                                                     &kernel_arg_80884};
                        int64_t time_start_80875 = 0, time_end_80876 = 0;
                        
                        if (ctx->debugging) {
                            fprintf(ctx->log,
                                    "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                    "main.segscan_74123",
                                    (long) sdiv_up64(m_65377 * n_65378,
                                                     segscan_group_sizze_74117 *
                                                     (int64_t) 11), (long) 1,
                                    (long) 1, (long) segscan_group_sizze_74117,
                                    (long) 1, (long) 1, (int) (0 +
                                                               (shared_sizze_80877 +
                                                                (8 -
                                                                 shared_sizze_80877 %
                                                                 8) % 8)));
                            time_start_80875 = get_wall_time();
                        }
                        
                        cudaEvent_t *pevents = NULL;
                        
                        if (ctx->profiling && !ctx->profiling_paused) {
                            pevents = cuda_get_events(&ctx->cuda,
                                                      &ctx->mainzisegscan_74123_runs,
                                                      &ctx->mainzisegscan_74123_total_runtime);
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                        }
                        CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegscan_74123,
                                                              grid[0], grid[1],
                                                              grid[2],
                                                              segscan_group_sizze_74117,
                                                              1, 1, 0 +
                                                              (shared_sizze_80877 +
                                                               (8 -
                                                                shared_sizze_80877 %
                                                                8) % 8), NULL,
                                                              kernel_args_80874,
                                                              NULL));
                        if (pevents != NULL)
                            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                        if (ctx->debugging) {
                            CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                            time_end_80876 = get_wall_time();
                            fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                    "main.segscan_74123", time_end_80876 -
                                    time_start_80875);
                        }
                    }
                    if (memblock_unref_device(ctx, &incprefixes_mem_80034,
                                              "incprefixes_mem_80034") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &aggregates_mem_80032,
                                              "aggregates_mem_80032") != 0)
                        return 1;
                    if (memblock_unref_device(ctx, &status_flags_mem_80030,
                                              "status_flags_mem_80030") != 0)
                        return 1;
                }
                
                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");
                
                CUdeviceptr kernel_arg_80888 = Y_mem_77010.mem;
                CUdeviceptr kernel_arg_80889 = mem_77968.mem;
                CUdeviceptr kernel_arg_80890 = mem_77972.mem;
                CUdeviceptr kernel_arg_80891 = mem_77976.mem;
                
                if ((((((1 && segmap_usable_groups_74171 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_74170 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_74171;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80885[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &kernel_arg_80888,
                                                 &kernel_arg_80889,
                                                 &kernel_arg_80890,
                                                 &kernel_arg_80891};
                    int64_t time_start_80886 = 0, time_end_80887 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_74176",
                                (long) segmap_usable_groups_74171, (long) 1,
                                (long) 1, (long) segmap_group_sizze_74170,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80886 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_74176_runs,
                                                  &ctx->mainzisegmap_74176_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_74176,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_74170,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80885,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80887 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_74176", time_end_80887 -
                                time_start_80886);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80895 = mem_77976.mem;
                CUdeviceptr kernel_arg_80896 = mem_77982.mem;
                
                if ((((((1 && segmap_usable_groups_74191 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_74190 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_74191;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80892[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &kernel_arg_80895,
                                                 &kernel_arg_80896};
                    int64_t time_start_80893 = 0, time_end_80894 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_74195",
                                (long) segmap_usable_groups_74191, (long) 1,
                                (long) 1, (long) segmap_group_sizze_74190,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80893 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_74195_runs,
                                                  &ctx->mainzisegmap_74195_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_74195,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_74190,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80892,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80894 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_74195", time_end_80894 -
                                time_start_80893);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80900 = mem_77968.mem;
                CUdeviceptr kernel_arg_80901 = mem_77986.mem;
                CUdeviceptr kernel_arg_80902 = mem_77989.mem;
                CUdeviceptr kernel_arg_80903 = mem_77992.mem;
                CUdeviceptr kernel_arg_80904 = mem_77995.mem;
                
                if ((((((1 && segmap_usable_groups_74201 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_74200 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_74201;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80897[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &q_65380, &i_65392,
                                                 &min_res_65398, &i64_res_65404,
                                                 &kernel_arg_80900,
                                                 &kernel_arg_80901,
                                                 &kernel_arg_80902,
                                                 &kernel_arg_80903,
                                                 &kernel_arg_80904};
                    int64_t time_start_80898 = 0, time_end_80899 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_74207",
                                (long) segmap_usable_groups_74201, (long) 1,
                                (long) 1, (long) segmap_group_sizze_74200,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80898 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_74207_runs,
                                                  &ctx->mainzisegmap_74207_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_74207,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_74200,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80897,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80899 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_74207", time_end_80899 -
                                time_start_80898);
                    }
                }
                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");
                
                CUdeviceptr kernel_arg_80908 = mem_77968.mem;
                CUdeviceptr kernel_arg_80909 = mem_78000.mem;
                
                if ((((((1 && segmap_usable_groups_74223 != 0) && 1 != 0) &&
                       1 != 0) && segmap_group_sizze_74222 != 0) && 1 != 0) &&
                    1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = segmap_usable_groups_74223;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80905[] = {&ctx->global_failure, &m_65377,
                                                 &n_65378, &q_65380, &i_65392,
                                                 &kernel_arg_80908,
                                                 &kernel_arg_80909};
                    int64_t time_start_80906 = 0, time_end_80907 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_74227",
                                (long) segmap_usable_groups_74223, (long) 1,
                                (long) 1, (long) segmap_group_sizze_74222,
                                (long) 1, (long) 1, (int) 0);
                        time_start_80906 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_74227_runs,
                                                  &ctx->mainzisegmap_74227_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_74227,
                                                          grid[0], grid[1],
                                                          grid[2],
                                                          segmap_group_sizze_74222,
                                                          1, 1, 0, NULL,
                                                          kernel_args_80905,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80907 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_74227", time_end_80907 -
                                time_start_80906);
                    }
                }
                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");
                
                unsigned int shared_sizze_80913 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80915 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80917 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80919 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80921 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80923 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80925 = (int64_t) 8 * q_65380;
                unsigned int shared_sizze_80927 = bytes_77903;
                unsigned int shared_sizze_80929 = bytes_77903;
                unsigned int shared_sizze_80931 = bytes_77903;
                unsigned int shared_sizze_80933 = bytes_77903;
                CUdeviceptr kernel_arg_80935 = mem_77968.mem;
                CUdeviceptr kernel_arg_80936 = mem_77972.mem;
                CUdeviceptr kernel_arg_80937 = mem_77976.mem;
                CUdeviceptr kernel_arg_80938 = mem_77982.mem;
                CUdeviceptr kernel_arg_80939 = mem_77986.mem;
                CUdeviceptr kernel_arg_80940 = mem_77989.mem;
                CUdeviceptr kernel_arg_80941 = mem_77992.mem;
                CUdeviceptr kernel_arg_80942 = mem_77995.mem;
                CUdeviceptr kernel_arg_80943 = mem_78000.mem;
                CUdeviceptr kernel_arg_80944 = mem_78020.mem;
                CUdeviceptr kernel_arg_80945 = mem_78024.mem;
                unsigned int shared_offset_80914 = 0;
                unsigned int shared_offset_80916 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8);
                unsigned int shared_offset_80918 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8);
                unsigned int shared_offset_80920 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8);
                unsigned int shared_offset_80922 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8) +
                             (shared_sizze_80919 + (8 - shared_sizze_80919 %
                                                    8) % 8);
                unsigned int shared_offset_80924 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8) +
                             (shared_sizze_80919 + (8 - shared_sizze_80919 %
                                                    8) % 8) +
                             (shared_sizze_80921 + (8 - shared_sizze_80921 %
                                                    8) % 8);
                unsigned int shared_offset_80926 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8) +
                             (shared_sizze_80919 + (8 - shared_sizze_80919 %
                                                    8) % 8) +
                             (shared_sizze_80921 + (8 - shared_sizze_80921 %
                                                    8) % 8) +
                             (shared_sizze_80923 + (8 - shared_sizze_80923 %
                                                    8) % 8);
                unsigned int shared_offset_80928 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8) +
                             (shared_sizze_80919 + (8 - shared_sizze_80919 %
                                                    8) % 8) +
                             (shared_sizze_80921 + (8 - shared_sizze_80921 %
                                                    8) % 8) +
                             (shared_sizze_80923 + (8 - shared_sizze_80923 %
                                                    8) % 8) +
                             (shared_sizze_80925 + (8 - shared_sizze_80925 %
                                                    8) % 8);
                unsigned int shared_offset_80930 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8) +
                             (shared_sizze_80919 + (8 - shared_sizze_80919 %
                                                    8) % 8) +
                             (shared_sizze_80921 + (8 - shared_sizze_80921 %
                                                    8) % 8) +
                             (shared_sizze_80923 + (8 - shared_sizze_80923 %
                                                    8) % 8) +
                             (shared_sizze_80925 + (8 - shared_sizze_80925 %
                                                    8) % 8) +
                             (shared_sizze_80927 + (8 - shared_sizze_80927 %
                                                    8) % 8);
                unsigned int shared_offset_80932 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8) +
                             (shared_sizze_80919 + (8 - shared_sizze_80919 %
                                                    8) % 8) +
                             (shared_sizze_80921 + (8 - shared_sizze_80921 %
                                                    8) % 8) +
                             (shared_sizze_80923 + (8 - shared_sizze_80923 %
                                                    8) % 8) +
                             (shared_sizze_80925 + (8 - shared_sizze_80925 %
                                                    8) % 8) +
                             (shared_sizze_80927 + (8 - shared_sizze_80927 %
                                                    8) % 8) +
                             (shared_sizze_80929 + (8 - shared_sizze_80929 %
                                                    8) % 8);
                unsigned int shared_offset_80934 = 0 + (shared_sizze_80913 +
                                                        (8 -
                                                         shared_sizze_80913 %
                                                         8) % 8) +
                             (shared_sizze_80915 + (8 - shared_sizze_80915 %
                                                    8) % 8) +
                             (shared_sizze_80917 + (8 - shared_sizze_80917 %
                                                    8) % 8) +
                             (shared_sizze_80919 + (8 - shared_sizze_80919 %
                                                    8) % 8) +
                             (shared_sizze_80921 + (8 - shared_sizze_80921 %
                                                    8) % 8) +
                             (shared_sizze_80923 + (8 - shared_sizze_80923 %
                                                    8) % 8) +
                             (shared_sizze_80925 + (8 - shared_sizze_80925 %
                                                    8) % 8) +
                             (shared_sizze_80927 + (8 - shared_sizze_80927 %
                                                    8) % 8) +
                             (shared_sizze_80929 + (8 - shared_sizze_80929 %
                                                    8) % 8) +
                             (shared_sizze_80931 + (8 - shared_sizze_80931 %
                                                    8) % 8);
                
                if ((((((1 && binop_x_77859 != 0) && 1 != 0) && 1 != 0) &&
                      q_65380 != 0) && 1 != 0) && 1 != 0) {
                    int perm[3] = {0, 1, 2};
                    
                    if (1 >= 1 << 16) {
                        perm[1] = perm[0];
                        perm[0] = 1;
                    }
                    if (1 >= 1 << 16) {
                        perm[2] = perm[0];
                        perm[0] = 2;
                    }
                    
                    size_t grid[3];
                    
                    grid[perm[0]] = binop_x_77859;
                    grid[perm[1]] = 1;
                    grid[perm[2]] = 1;
                    
                    void *kernel_args_80910[] = {&ctx->global_failure,
                                                 &ctx->failure_is_an_option,
                                                 &ctx->global_failure_args,
                                                 &shared_offset_80914,
                                                 &shared_offset_80916,
                                                 &shared_offset_80918,
                                                 &shared_offset_80920,
                                                 &shared_offset_80922,
                                                 &shared_offset_80924,
                                                 &shared_offset_80926,
                                                 &shared_offset_80928,
                                                 &shared_offset_80930,
                                                 &shared_offset_80932,
                                                 &shared_offset_80934, &m_65377,
                                                 &n_65378, &q_65380,
                                                 &jump_65382, &n_m_65386,
                                                 &i_65392, &x_65393,
                                                 &min_res_65398,
                                                 &loop_cond_65403,
                                                 &kernel_arg_80935,
                                                 &kernel_arg_80936,
                                                 &kernel_arg_80937,
                                                 &kernel_arg_80938,
                                                 &kernel_arg_80939,
                                                 &kernel_arg_80940,
                                                 &kernel_arg_80941,
                                                 &kernel_arg_80942,
                                                 &kernel_arg_80943,
                                                 &kernel_arg_80944,
                                                 &kernel_arg_80945};
                    int64_t time_start_80911 = 0, time_end_80912 = 0;
                    
                    if (ctx->debugging) {
                        fprintf(ctx->log,
                                "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                                "main.segmap_intragroup_74244",
                                (long) binop_x_77859, (long) 1, (long) 1,
                                (long) q_65380, (long) 1, (long) 1, (int) (0 +
                                                                           (shared_sizze_80913 +
                                                                            (8 -
                                                                             shared_sizze_80913 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80915 +
                                                                            (8 -
                                                                             shared_sizze_80915 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80917 +
                                                                            (8 -
                                                                             shared_sizze_80917 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80919 +
                                                                            (8 -
                                                                             shared_sizze_80919 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80921 +
                                                                            (8 -
                                                                             shared_sizze_80921 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80923 +
                                                                            (8 -
                                                                             shared_sizze_80923 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80925 +
                                                                            (8 -
                                                                             shared_sizze_80925 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80927 +
                                                                            (8 -
                                                                             shared_sizze_80927 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80929 +
                                                                            (8 -
                                                                             shared_sizze_80929 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80931 +
                                                                            (8 -
                                                                             shared_sizze_80931 %
                                                                             8) %
                                                                            8) +
                                                                           (shared_sizze_80933 +
                                                                            (8 -
                                                                             shared_sizze_80933 %
                                                                             8) %
                                                                            8)));
                        time_start_80911 = get_wall_time();
                    }
                    
                    cudaEvent_t *pevents = NULL;
                    
                    if (ctx->profiling && !ctx->profiling_paused) {
                        pevents = cuda_get_events(&ctx->cuda,
                                                  &ctx->mainzisegmap_intragroup_74244_runs,
                                                  &ctx->mainzisegmap_intragroup_74244_total_runtime);
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
                    }
                    CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_intragroup_74244,
                                                          grid[0], grid[1],
                                                          grid[2], q_65380, 1,
                                                          1, 0 +
                                                          (shared_sizze_80913 +
                                                           (8 -
                                                            shared_sizze_80913 %
                                                            8) % 8) +
                                                          (shared_sizze_80915 +
                                                           (8 -
                                                            shared_sizze_80915 %
                                                            8) % 8) +
                                                          (shared_sizze_80917 +
                                                           (8 -
                                                            shared_sizze_80917 %
                                                            8) % 8) +
                                                          (shared_sizze_80919 +
                                                           (8 -
                                                            shared_sizze_80919 %
                                                            8) % 8) +
                                                          (shared_sizze_80921 +
                                                           (8 -
                                                            shared_sizze_80921 %
                                                            8) % 8) +
                                                          (shared_sizze_80923 +
                                                           (8 -
                                                            shared_sizze_80923 %
                                                            8) % 8) +
                                                          (shared_sizze_80925 +
                                                           (8 -
                                                            shared_sizze_80925 %
                                                            8) % 8) +
                                                          (shared_sizze_80927 +
                                                           (8 -
                                                            shared_sizze_80927 %
                                                            8) % 8) +
                                                          (shared_sizze_80929 +
                                                           (8 -
                                                            shared_sizze_80929 %
                                                            8) % 8) +
                                                          (shared_sizze_80931 +
                                                           (8 -
                                                            shared_sizze_80931 %
                                                            8) % 8) +
                                                          (shared_sizze_80933 +
                                                           (8 -
                                                            shared_sizze_80933 %
                                                            8) % 8), NULL,
                                                          kernel_args_80910,
                                                          NULL));
                    if (pevents != NULL)
                        CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
                    if (ctx->debugging) {
                        CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                        time_end_80912 = get_wall_time();
                        fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                                "main.segmap_intragroup_74244", time_end_80912 -
                                time_start_80911);
                    }
                }
                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");
        
        CUdeviceptr kernel_arg_80949 = ext_mem_78029.mem;
        CUdeviceptr kernel_arg_80950 = ext_mem_78030.mem;
        CUdeviceptr kernel_arg_80951 = mem_78035.mem;
        
        if ((((((1 && segmap_usable_groups_74585 != 0) && 1 != 0) && 1 != 0) &&
              segmap_group_sizze_74584 != 0) && 1 != 0) && 1 != 0) {
            int perm[3] = {0, 1, 2};
            
            if (1 >= 1 << 16) {
                perm[1] = perm[0];
                perm[0] = 1;
            }
            if (1 >= 1 << 16) {
                perm[2] = perm[0];
                perm[0] = 2;
            }
            
            size_t grid[3];
            
            grid[perm[0]] = segmap_usable_groups_74585;
            grid[perm[1]] = 1;
            grid[perm[2]] = 1;
            
            void *kernel_args_80946[] = {&ctx->global_failure,
                                         &ctx->failure_is_an_option,
                                         &ctx->global_failure_args, &m_65377,
                                         &n_65378, &jump_65382, &n_m_65386,
                                         &i_65392, &y_66671, &kernel_arg_80949,
                                         &kernel_arg_80950, &kernel_arg_80951};
            int64_t time_start_80947 = 0, time_end_80948 = 0;
            
            if (ctx->debugging) {
                fprintf(ctx->log,
                        "Launching %s with grid size [%ld, %ld, %ld] and block size [%ld, %ld, %ld]; shared memory: %d bytes.\n",
                        "main.segmap_74589", (long) segmap_usable_groups_74585,
                        (long) 1, (long) 1, (long) segmap_group_sizze_74584,
                        (long) 1, (long) 1, (int) 0);
                time_start_80947 = get_wall_time();
            }
            
            cudaEvent_t *pevents = NULL;
            
            if (ctx->profiling && !ctx->profiling_paused) {
                pevents = cuda_get_events(&ctx->cuda,
                                          &ctx->mainzisegmap_74589_runs,
                                          &ctx->mainzisegmap_74589_total_runtime);
                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
            }
            CUDA_SUCCEED_OR_RETURN(cuLaunchKernel(ctx->mainzisegmap_74589,
                                                  grid[0], grid[1], grid[2],
                                                  segmap_group_sizze_74584, 1,
                                                  1, 0, NULL, kernel_args_80946,
                                                  NULL));
            if (pevents != NULL)
                CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
            if (ctx->debugging) {
                CUDA_SUCCEED_FATAL(cuCtxSynchronize());
                time_end_80948 = get_wall_time();
                fprintf(ctx->log, "Kernel %s runtime: %ldus\n",
                        "main.segmap_74589", time_end_80948 - time_start_80947);
            }
        }
        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;
    }
    {
        cudaEvent_t *pevents = NULL;
        
        if (ctx->profiling && !ctx->profiling_paused) {
            pevents = cuda_get_events(&ctx->cuda, &ctx->copy_dev_to_dev_runs,
                                      &ctx->copy_dev_to_dev_total_runtime);
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[0], 0));
        }
        CUDA_SUCCEED_OR_RETURN(cuMemcpy(mem_78041.mem + (int64_t) 0,
                                        ext_mem_78036.mem + (int64_t) 0,
                                        m_65377 * n_65378 * (int64_t) 8));
        if (pevents != NULL)
            CUDA_SUCCEED_FATAL(cudaEventRecord(pevents[1], 0));
    }
    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_80254).references = NULL;
    if (memblock_set_device(ctx, &*mem_out_p_80254, &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);
    CUDA_SUCCEED_FATAL(cuCtxPushCurrent(ctx->cuda.cu_ctx));
    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;
        }
    }
    CUDA_SUCCEED_FATAL(cuCtxPopCurrent(&ctx->cuda.cu_ctx));
    lock_unlock(&ctx->lock);
    return ret;
}
  
