// Generated by Futhark 0.22.0
// git: ed22762 (Sat Jan 15 01:09:59 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>

#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_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_num_threads(struct futhark_context_config *cfg,
                                            int n);
struct futhark_context;
struct futhark_context *futhark_context_new(struct futhark_context_config *cfg);
void futhark_context_free(struct futhark_context *ctx);
int futhark_context_sync(struct futhark_context *ctx);
int futhark_context_config_set_tuning_param(struct futhark_context_config *cfg,
                                            const char *param_name,
                                            size_t param_value);
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_f32_2d;
struct futhark_f32_2d *futhark_new_f32_2d(struct futhark_context *ctx, const
                                          float *data, int64_t dim0,
                                          int64_t dim1);
struct futhark_f32_2d *futhark_new_raw_f32_2d(struct futhark_context *ctx, const
                                              unsigned char *data,
                                              int64_t offset, int64_t dim0,
                                              int64_t dim1);
int futhark_free_f32_2d(struct futhark_context *ctx,
                        struct futhark_f32_2d *arr);
int futhark_values_f32_2d(struct futhark_context *ctx,
                          struct futhark_f32_2d *arr, float *data);
unsigned char *futhark_values_raw_f32_2d(struct futhark_context *ctx,
                                         struct futhark_f32_2d *arr);
const int64_t *futhark_shape_f32_2d(struct futhark_context *ctx,
                                    struct futhark_f32_2d *arr);

// Opaque values


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

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

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



// 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 *);
struct memblock {
    int *references;
    unsigned char *mem;
    int64_t size;
    const char *desc;
};
// start of scheduler.h

// First, the API that the generated code will access.  In principle,
// we could then compile the scheduler separately and link an object
// file with the generated code.  In practice, we will embed all of
// this in the generated code.

// Scheduler handle.
struct scheduler;

// Initialise a scheduler (and start worker threads).
static int scheduler_init(struct scheduler *scheduler,
                          int num_workers,
                          double kappa);

// Shut down a scheduler (and destroy worker threads).
static int scheduler_destroy(struct scheduler *scheduler);

// Figure out the smallest amount of work that amortises task
// creation.
static int determine_kappa(double *kappa);

// How a segop should be scheduled.
enum scheduling {
  DYNAMIC,
  STATIC
};

// How a given task should be executed.  Filled out by the scheduler
// and passed to the segop function
struct scheduler_info {
  int64_t iter_pr_subtask;
  int64_t remainder;
  int nsubtasks;
  enum scheduling sched;
  int wake_up_threads;

  int64_t *task_time;
  int64_t *task_iter;
};

// A segop function.  This is what you hand the scheduler for
// execution.
typedef int (*segop_fn)(void* args,
                        int64_t iterations,
                        int tid,
                        struct scheduler_info info);

// A task for the scheduler to execute.
struct scheduler_segop {
  void *args;
  segop_fn top_level_fn;
  segop_fn nested_fn;
  int64_t iterations;
  enum scheduling sched;

  // Pointers to timer and iter associated with the task
  int64_t *task_time;
  int64_t *task_iter;

  // For debugging
  const char* name;
};

static inline int scheduler_prepare_task(struct scheduler *scheduler,
                                         struct scheduler_segop *task);

typedef int (*parloop_fn)(void* args,
                          int64_t start,
                          int64_t end,
                          int subtask_id,
                          int tid);

// A parallel parloop task.
struct scheduler_parloop {
  void* args;
  parloop_fn fn;
  int64_t iterations;
  struct scheduler_info info;

  // For debugging
  const char* name;
};

static inline int scheduler_execute_task(struct scheduler *scheduler,
                                         struct scheduler_parloop *task);

// Then the API implementation.

#include <signal.h>

#if defined(_WIN32)
#include <windows.h>
#elif defined(__APPLE__)
#include <sys/sysctl.h>
// For getting cpu usage of threads
#include <mach/mach.h>
#include <sys/resource.h>
#elif defined(__linux__)
#include <sys/sysinfo.h>
#include <sys/resource.h>
#include <signal.h>
#elif defined(__EMSCRIPTEN__)
#include <emscripten/threading.h>
#include <sys/sysinfo.h>
#include <sys/resource.h>
#include <signal.h>
#endif

/* Multicore Utility functions */

/* A wrapper for getting rusage on Linux and MacOS */
/* TODO maybe figure out this for windows */
static inline int getrusage_thread(struct rusage *rusage)
{
  int err = -1;
#if  defined(__APPLE__)
    thread_basic_info_data_t info = { 0 };
    mach_msg_type_number_t info_count = THREAD_BASIC_INFO_COUNT;
    kern_return_t kern_err;

    kern_err = thread_info(mach_thread_self(),
                           THREAD_BASIC_INFO,
                           (thread_info_t)&info,
                           &info_count);
    if (kern_err == KERN_SUCCESS) {
        memset(rusage, 0, sizeof(struct rusage));
        rusage->ru_utime.tv_sec = info.user_time.seconds;
        rusage->ru_utime.tv_usec = info.user_time.microseconds;
        rusage->ru_stime.tv_sec = info.system_time.seconds;
        rusage->ru_stime.tv_usec = info.system_time.microseconds;
        err = 0;
    } else {
        errno = EINVAL;
    }
#elif defined(__linux__) || __EMSCRIPTEN__
    err = getrusage(RUSAGE_THREAD, rusage);
#endif
    return err;
}

/* returns the number of logical cores */
static int num_processors()
{
#if  defined(_WIN32)
/* https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info */
    SYSTEM_INFO sysinfo;
    GetSystemInfo(&sysinfo);
    int ncores = sysinfo.dwNumberOfProcessors;
    fprintf(stderr, "Found %d cores on your Windows machine\n Is that correct?\n", ncores);
    return ncores;
#elif defined(__APPLE__)
    int ncores;
    size_t ncores_size = sizeof(ncores);
    CHECK_ERRNO(sysctlbyname("hw.logicalcpu", &ncores, &ncores_size, NULL, 0),
                "sysctlbyname (hw.logicalcpu)");
    return ncores;
#elif defined(__linux__)
  return get_nprocs();
#elif __EMSCRIPTEN__
  return emscripten_num_logical_cores();
#else
  fprintf(stderr, "operating system not recognised\n");
  return -1;
#endif
}

static unsigned int g_seed;

// Used to seed the generator.
static inline void fast_srand(unsigned int seed) {
    g_seed = seed;
}

// Compute a pseudorandom integer.
// Output value in range [0, 32767]
static inline unsigned int fast_rand(void) {
    g_seed = (214013*g_seed+2531011);
    return (g_seed>>16)&0x7FFF;
}

struct subtask_queue {
  int capacity;             // Size of the buffer.
  int first;                // Index of the start of the ring buffer.
  int num_used;             // Number of used elements in the buffer.
  struct subtask **buffer;

  pthread_mutex_t mutex;    // Mutex used for synchronisation.
  pthread_cond_t cond;      // Condition variable used for synchronisation.
  int dead;

#if defined(MCPROFILE)
  /* Profiling fields */
  uint64_t time_enqueue;
  uint64_t time_dequeue;
  uint64_t n_dequeues;
  uint64_t n_enqueues;
#endif
};

/* A subtask that can be executed by a worker */
struct subtask {
  /* The parloop function */
  parloop_fn fn;
  /* Execution parameters */
  void* args;
  int64_t start, end;
  int id;

  /* Dynamic scheduling parameters */
  int chunkable;
  int64_t chunk_size;

  /* Shared variables across subtasks */
  volatile int *counter; // Counter for ongoing subtasks
  // Shared task timers and iterators
  int64_t *task_time;
  int64_t *task_iter;

  /* For debugging */
  const char *name;
};


struct worker {
  pthread_t thread;
  struct scheduler *scheduler;  /* Reference to the scheduler struct the worker belongs to*/
  struct subtask_queue q;
  int dead;
  int tid;                      /* Just a thread id */

  /* "thread local" time fields used for online algorithm */
  uint64_t timer;
  uint64_t total;
  int nested; /* How nested the current computation is */

  // Profiling fields
  int output_usage;            /* Whether to dump thread usage */
  uint64_t time_spent_working; /* Time spent in parloop functions */
};

static inline void output_worker_usage(struct worker *worker)
{
  struct rusage usage;
  CHECK_ERRNO(getrusage_thread(&usage), "getrusage_thread");
  struct timeval user_cpu_time = usage.ru_utime;
  struct timeval sys_cpu_time = usage.ru_stime;
  fprintf(stderr, "tid: %2d - work time %10llu us - user time: %10llu us - sys: %10llu us\n",
          worker->tid,
          (long long unsigned)worker->time_spent_working / 1000,
          (long long unsigned)(user_cpu_time.tv_sec * 1000000 + user_cpu_time.tv_usec),
          (long long unsigned)(sys_cpu_time.tv_sec * 1000000 + sys_cpu_time.tv_usec));
}

/* Doubles the size of the queue */
static inline int subtask_queue_grow_queue(struct subtask_queue *subtask_queue) {

  int new_capacity = 2 * subtask_queue->capacity;
#ifdef MCDEBUG
  fprintf(stderr, "Growing queue to %d\n", subtask_queue->capacity * 2);
#endif

  struct subtask **new_buffer = calloc(new_capacity, sizeof(struct subtask*));
  for (int i = 0; i < subtask_queue->num_used; i++) {
    new_buffer[i] = subtask_queue->buffer[(subtask_queue->first + i) % subtask_queue->capacity];
  }

  free(subtask_queue->buffer);
  subtask_queue->buffer = new_buffer;
  subtask_queue->capacity = new_capacity;
  subtask_queue->first = 0;

  return 0;
}

// Initialise a job queue with the given capacity.  The queue starts out
// empty.  Returns non-zero on error.
static inline int subtask_queue_init(struct subtask_queue *subtask_queue, int capacity)
{
  assert(subtask_queue != NULL);
  memset(subtask_queue, 0, sizeof(struct subtask_queue));

  subtask_queue->capacity = capacity;
  subtask_queue->buffer = calloc(capacity, sizeof(struct subtask*));
  if (subtask_queue->buffer == NULL) {
    return -1;
  }

  CHECK_ERRNO(pthread_mutex_init(&subtask_queue->mutex, NULL), "pthread_mutex_init");
  CHECK_ERRNO(pthread_cond_init(&subtask_queue->cond, NULL), "pthread_cond_init");

  return 0;
}

// Destroy the job queue.  Blocks until the queue is empty before it
// is destroyed.
static inline int subtask_queue_destroy(struct subtask_queue *subtask_queue)
{
  assert(subtask_queue != NULL);

  CHECK_ERR(pthread_mutex_lock(&subtask_queue->mutex), "pthread_mutex_lock");

  while (subtask_queue->num_used != 0) {
    CHECK_ERR(pthread_cond_wait(&subtask_queue->cond, &subtask_queue->mutex), "pthread_cond_wait");
  }

  // Queue is now empty.  Let's kill it!
  subtask_queue->dead = 1;
  free(subtask_queue->buffer);
  CHECK_ERR(pthread_cond_broadcast(&subtask_queue->cond), "pthread_cond_broadcast");
  CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");

  return 0;
}

static inline void dump_queue(struct worker *worker)
{
  struct subtask_queue *subtask_queue = &worker->q;
  CHECK_ERR(pthread_mutex_lock(&subtask_queue->mutex), "pthread_mutex_lock");
  for (int i = 0; i < subtask_queue->num_used; i++) {
    struct subtask * subtask = subtask_queue->buffer[(subtask_queue->first + i) % subtask_queue->capacity];
    printf("queue tid %d with %d task %s\n", worker->tid, i, subtask->name);
  }
  CHECK_ERR(pthread_cond_broadcast(&subtask_queue->cond), "pthread_cond_broadcast");
  CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");
}

// Push an element onto the end of the job queue.  Blocks if the
// subtask_queue is full (its size is equal to its capacity).  Returns
// non-zero on error.  It is an error to push a job onto a queue that
// has been destroyed.
static inline int subtask_queue_enqueue(struct worker *worker, struct subtask *subtask )
{
  assert(worker != NULL);
  struct subtask_queue *subtask_queue = &worker->q;

#ifdef MCPROFILE
  uint64_t start = get_wall_time();
#endif

  CHECK_ERR(pthread_mutex_lock(&subtask_queue->mutex), "pthread_mutex_lock");
  // Wait until there is room in the subtask_queue.
  while (subtask_queue->num_used == subtask_queue->capacity && !subtask_queue->dead) {
    if (subtask_queue->num_used == subtask_queue->capacity) {
      CHECK_ERR(subtask_queue_grow_queue(subtask_queue), "subtask_queue_grow_queue");
      continue;
    }
    CHECK_ERR(pthread_cond_wait(&subtask_queue->cond, &subtask_queue->mutex), "pthread_cond_wait");
  }

  if (subtask_queue->dead) {
    CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");
    return -1;
  }

  // If we made it past the loop, there is room in the subtask_queue.
  subtask_queue->buffer[(subtask_queue->first + subtask_queue->num_used) % subtask_queue->capacity] = subtask;
  subtask_queue->num_used++;

#ifdef MCPROFILE
  uint64_t end = get_wall_time();
  subtask_queue->time_enqueue += (end - start);
  subtask_queue->n_enqueues++;
#endif
  // Broadcast a reader (if any) that there is now an element.
  CHECK_ERR(pthread_cond_broadcast(&subtask_queue->cond), "pthread_cond_broadcast");
  CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");

  return 0;
}


/* Like subtask_queue_dequeue, but with two differences:
   1) the subtask is stolen from the __front__ of the queue
   2) returns immediately if there is no subtasks queued,
      as we dont' want to block on another workers queue and
*/
static inline int subtask_queue_steal(struct worker *worker,
                                      struct subtask **subtask)
{
  struct subtask_queue *subtask_queue = &worker->q;
  assert(subtask_queue != NULL);

#ifdef MCPROFILE
  uint64_t start = get_wall_time();
#endif
  CHECK_ERR(pthread_mutex_lock(&subtask_queue->mutex), "pthread_mutex_lock");

  if (subtask_queue->num_used == 0) {
    CHECK_ERR(pthread_cond_broadcast(&subtask_queue->cond), "pthread_cond_broadcast");
    CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");
    return 1;
  }

  if (subtask_queue->dead) {
    CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");
    return -1;
  }

  // Tasks gets stolen from the "front"
  struct subtask *cur_back = subtask_queue->buffer[subtask_queue->first];
  struct subtask *new_subtask = NULL;
  int remaining_iter = cur_back->end - cur_back->start;
  // If subtask is chunkable, we steal half of the iterations
  if (cur_back->chunkable && remaining_iter > 1) {
      int64_t half = remaining_iter / 2;
      new_subtask = malloc(sizeof(struct subtask));
      *new_subtask = *cur_back;
      new_subtask->start = cur_back->end - half;
      cur_back->end = new_subtask->start;
      __atomic_fetch_add(cur_back->counter, 1, __ATOMIC_RELAXED);
  } else {
    new_subtask = cur_back;
    subtask_queue->num_used--;
    subtask_queue->first = (subtask_queue->first + 1) % subtask_queue->capacity;
  }
  *subtask = new_subtask;

  if (*subtask == NULL) {
    CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthred_mutex_unlock");
    return 1;
  }

#ifdef MCPROFILE
  uint64_t end = get_wall_time();
  subtask_queue->time_dequeue += (end - start);
  subtask_queue->n_dequeues++;
#endif

  // Broadcast a writer (if any) that there is now room for more.
  CHECK_ERR(pthread_cond_broadcast(&subtask_queue->cond), "pthread_cond_broadcast");
  CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");

  return 0;
}


// Pop an element from the back of the job queue.
// Optional argument can be provided to block or not
static inline int subtask_queue_dequeue(struct worker *worker,
                                        struct subtask **subtask, int blocking)
{
  assert(worker != NULL);
  struct subtask_queue *subtask_queue = &worker->q;

#ifdef MCPROFILE
  uint64_t start = get_wall_time();
#endif

  CHECK_ERR(pthread_mutex_lock(&subtask_queue->mutex), "pthread_mutex_lock");
  if (subtask_queue->num_used == 0 && !blocking) {
    CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");
    return 1;
  }
  // Try to steal some work while the subtask_queue is empty
  while (subtask_queue->num_used == 0 && !subtask_queue->dead) {
    pthread_cond_wait(&subtask_queue->cond, &subtask_queue->mutex);
  }

  if (subtask_queue->dead) {
    CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");
    return -1;
  }

  // dequeue pops from the back
  *subtask = subtask_queue->buffer[(subtask_queue->first + subtask_queue->num_used - 1) % subtask_queue->capacity];
  subtask_queue->num_used--;

  if (*subtask == NULL) {
    assert(!"got NULL ptr");
    CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthred_mutex_unlock");
    return -1;
  }

#ifdef MCPROFILE
  uint64_t end = get_wall_time();
  subtask_queue->time_dequeue += (end - start);
  subtask_queue->n_dequeues++;
#endif

  // Broadcast a writer (if any) that there is now room for more.
  CHECK_ERR(pthread_cond_broadcast(&subtask_queue->cond), "pthread_cond_broadcast");
  CHECK_ERR(pthread_mutex_unlock(&subtask_queue->mutex), "pthread_mutex_unlock");

  return 0;
}

static inline int subtask_queue_is_empty(struct subtask_queue *subtask_queue)
{
  return subtask_queue->num_used == 0;
}

/* Scheduler definitions */

struct scheduler {
  struct worker *workers;
  int num_threads;

  // If there is work to steal => active_work > 0
  volatile int active_work;

  // Only one error can be returned at the time now.  Maybe we can
  // provide a stack like structure for pushing errors onto if we wish
  // to backpropagte multiple errors
  volatile int error;

  // kappa time unit in nanoseconds
  double kappa;
};


// Thread local variable worker struct
// Note that, accesses to tls variables are expensive
// Minimize direct references to this variable
__thread struct worker* worker_local = NULL;

static int64_t total_now(int64_t total, int64_t time) {
  return total + (get_wall_time_ns() - time);
}

static int random_other_worker(struct scheduler *scheduler, int my_id) {
  int my_num_workers = scheduler->num_threads;
  assert(my_num_workers != 1);
  int i = fast_rand() % (my_num_workers - 1);
  if (i >= my_id) {
    i++;
  }
#ifdef MCDEBUG
  assert(i >= 0);
  assert(i < my_num_workers);
  assert(i != my_id);
#endif

  return i;
}


static inline int64_t compute_chunk_size(double kappa, struct subtask* subtask)
{
  double C = (double)*subtask->task_time / (double)*subtask->task_iter;
  if (C == 0.0F) C += DBL_EPSILON;
  return smax64((int64_t)(kappa / C), 1);
}

/* Takes a chunk from subtask and enqueues the remaining iterations onto the worker's queue */
/* A no-op if the subtask is not chunkable */
static inline struct subtask* chunk_subtask(struct worker* worker, struct subtask *subtask)
{
  if (subtask->chunkable) {
    // Do we have information from previous runs avaliable
    if (*subtask->task_iter > 0) {
      subtask->chunk_size = compute_chunk_size(worker->scheduler->kappa, subtask);
      assert(subtask->chunk_size > 0);
    }
    int64_t remaining_iter = subtask->end - subtask->start;
    assert(remaining_iter > 0);
    if (remaining_iter > subtask->chunk_size) {
      struct subtask *new_subtask = malloc(sizeof(struct subtask));
      *new_subtask = *subtask;
      // increment the subtask join counter to account for new subtask
      __atomic_fetch_add(subtask->counter, 1, __ATOMIC_RELAXED);
      // Update range parameters
      subtask->end = subtask->start + subtask->chunk_size;
      new_subtask->start = subtask->end;
      subtask_queue_enqueue(worker, new_subtask);
    }
  }
  return subtask;
}

static inline int run_subtask(struct worker* worker, struct subtask* subtask)
{
  assert(subtask != NULL);
  assert(worker != NULL);

  subtask = chunk_subtask(worker, subtask);
  worker->total = 0;
  worker->timer = get_wall_time_ns();
#if defined(MCPROFILE)
  int64_t start = worker->timer;
#endif
  worker->nested++;
  int err = subtask->fn(subtask->args, subtask->start, subtask->end,
                        subtask->id,
                        worker->tid);
  worker->nested--;
  // Some error occured during some other subtask
  // so we just clean-up and return
  if (worker->scheduler->error != 0) {
    // Even a failed task counts as finished.
    __atomic_fetch_sub(subtask->counter, 1, __ATOMIC_RELAXED);
    free(subtask);
    return 0;
  }
  if (err != 0) {
    __atomic_store_n(&worker->scheduler->error, err, __ATOMIC_RELAXED);
  }
  // Total sequential time spent
  int64_t time_elapsed = total_now(worker->total, worker->timer);
#if defined(MCPROFILE)
  worker->time_spent_working += get_wall_time_ns() - start;
#endif
  int64_t iter = subtask->end - subtask->start;
  // report measurements
  // These updates should really be done using a single atomic CAS operation
  __atomic_fetch_add(subtask->task_time, time_elapsed, __ATOMIC_RELAXED);
  __atomic_fetch_add(subtask->task_iter, iter, __ATOMIC_RELAXED);
  // We need a fence here, since if the counter is decremented before either
  // of the two above are updated bad things can happen, e.g. if they are stack-allocated
  __atomic_thread_fence(__ATOMIC_SEQ_CST);
  __atomic_fetch_sub(subtask->counter, 1, __ATOMIC_RELAXED);
  free(subtask);
  return 0;
}


static inline int is_small(struct scheduler_segop *task, struct scheduler *scheduler, int *nsubtasks)
{
  int64_t time = *task->task_time;
  int64_t iter = *task->task_iter;

  if (task->sched == DYNAMIC || iter == 0) {
    *nsubtasks = scheduler->num_threads;
    return 0;
  }

  // Estimate the constant C
  double C = (double)time / (double)iter;
  double cur_task_iter = (double) task->iterations;

  // Returns true if the task is small i.e.
  // if the number of iterations times C is smaller
  // than the overhead of subtask creation
  if (C == 0.0F || C * cur_task_iter < scheduler->kappa) {
    *nsubtasks = 1;
    return 1;
  }

  // Else compute how many subtasks this tasks should create
  int64_t min_iter_pr_subtask = smax64(scheduler->kappa / C, 1);
  *nsubtasks = smin64(smax64(task->iterations / min_iter_pr_subtask, 1), scheduler->num_threads);

  return 0;
}

// TODO make this prettier
static inline struct subtask* create_subtask(parloop_fn fn,
                                             void* args,
                                             const char* name,
                                             volatile int* counter,
                                             int64_t *timer,
                                             int64_t *iter,
                                             int64_t start, int64_t end,
                                             int chunkable,
                                             int64_t chunk_size,
                                             int id)
{
  struct subtask* subtask = malloc(sizeof(struct subtask));
  if (subtask == NULL) {
    assert(!"malloc failed in create_subtask");
    return NULL;
  }
  subtask->fn         = fn;
  subtask->args       = args;

  subtask->counter    = counter;
  subtask->task_time  = timer;
  subtask->task_iter  = iter;

  subtask->start      = start;
  subtask->end        = end;
  subtask->id         = id;
  subtask->chunkable  = chunkable;
  subtask->chunk_size = chunk_size;

  subtask->name       = name;
  return subtask;
}

static int dummy_counter = 0;
static int64_t dummy_timer = 0;
static int64_t dummy_iter = 0;

static int dummy_fn(void *args, int64_t start, int64_t end, int subtask_id, int tid) {
  (void)args;
  (void)start;
  (void)end;
  (void)subtask_id;
  (void)tid;
  return 0;
}

// Wake up threads, who are blocking by pushing a dummy task
// onto their queue
static inline void wake_up_threads(struct scheduler *scheduler, int start_tid, int end_tid) {

#if defined(MCDEBUG)
  assert(start_tid >= 1);
  assert(end_tid <= scheduler->num_threads);
#endif
  for (int i = start_tid; i < end_tid; i++) {
    struct subtask *subtask = create_subtask(dummy_fn, NULL, "dummy_fn",
                                            &dummy_counter,
                                            &dummy_timer, &dummy_iter,
                                            0, 0,
                                            0, 0,
                                            0);
    CHECK_ERR(subtask_queue_enqueue(&scheduler->workers[i], subtask), "subtask_queue_enqueue");
  }
}

static inline int is_finished(struct worker *worker) {
  return worker->dead && subtask_queue_is_empty(&worker->q);
}

// Try to steal from a random queue
static inline int steal_from_random_worker(struct worker* worker)
{
  int my_id = worker->tid;
  struct scheduler* scheduler = worker->scheduler;
  int k = random_other_worker(scheduler, my_id);
  struct worker *worker_k = &scheduler->workers[k];
  struct subtask* subtask =  NULL;
  int retval = subtask_queue_steal(worker_k, &subtask);
  if (retval == 0) {
    subtask_queue_enqueue(worker, subtask);
    return 1;
  }
  return 0;
}


static inline void *scheduler_worker(void* args)
{
  struct worker *worker = (struct worker*) args;
  struct scheduler *scheduler = worker->scheduler;
  worker_local = worker;
  struct subtask *subtask = NULL;

  while(!is_finished(worker)) {
    if (!subtask_queue_is_empty(&worker->q)) {
      int retval = subtask_queue_dequeue(worker, &subtask, 0);
      if (retval == 0) {
        assert(subtask != NULL);
        CHECK_ERR(run_subtask(worker, subtask), "run_subtask");
      } // else someone stole our work

    } else if (scheduler->active_work) { /* steal */
      while (!is_finished(worker) && scheduler->active_work) {
        if (steal_from_random_worker(worker)) {
          break;
        }
      }
    } else { /* go back to sleep and wait for work */
      int retval = subtask_queue_dequeue(worker, &subtask, 1);
      if (retval == 0) {
        assert(subtask != NULL);
        CHECK_ERR(run_subtask(worker, subtask), "run_subtask");
      }
    }
  }

  assert(subtask_queue_is_empty(&worker->q));
#if defined(MCPROFILE)
  if (worker->output_usage)
    output_worker_usage(worker);
#endif
  return NULL;
}


static inline int scheduler_execute_parloop(struct scheduler *scheduler,
                                            struct scheduler_parloop *task,
                                            int64_t *timer)
{

  struct worker *worker = worker_local;

  struct scheduler_info info = task->info;
  int64_t iter_pr_subtask = info.iter_pr_subtask;
  int64_t remainder = info.remainder;
  int nsubtasks = info.nsubtasks;
  volatile int join_counter = nsubtasks;

  // Shared timer used to sum up all
  // sequential work from each subtask
  int64_t task_timer = 0;
  int64_t task_iter = 0;

  enum scheduling sched = info.sched;
  /* If each subtasks should be processed in chunks */
  int chunkable = sched == STATIC ? 0 : 1;
  int64_t chunk_size = 1; // The initial chunk size when no info is avaliable


  if (info.wake_up_threads || sched == DYNAMIC)
    __atomic_add_fetch(&scheduler->active_work, nsubtasks, __ATOMIC_RELAXED);

  int64_t start = 0;
  int64_t end = iter_pr_subtask + (int64_t)(remainder != 0);
  for (int subtask_id = 0; subtask_id < nsubtasks; subtask_id++) {
    struct subtask *subtask = create_subtask(task->fn, task->args, task->name,
                                              &join_counter,
                                              &task_timer, &task_iter,
                                              start, end,
                                              chunkable, chunk_size,
                                              subtask_id);
    assert(subtask != NULL);
    // In most cases we will never have more subtasks than workers,
    // but there can be exceptions (e.g. the kappa tuning function).
    struct worker *subtask_worker =
      worker->nested
      ? &scheduler->workers[worker->tid]
      : &scheduler->workers[subtask_id % scheduler->num_threads];
    CHECK_ERR(subtask_queue_enqueue(subtask_worker, subtask),
              "subtask_queue_enqueue");
    // Update range params
    start = end;
    end += iter_pr_subtask + ((subtask_id + 1) < remainder);
  }

  if (info.wake_up_threads) {
    wake_up_threads(scheduler, nsubtasks, scheduler->num_threads);
  }

  // Join (wait for subtasks to finish)
  while(join_counter != 0) {
    if (!subtask_queue_is_empty(&worker->q)) {
      struct subtask *subtask = NULL;
      int err = subtask_queue_dequeue(worker, &subtask, 0);
      if (err == 0 ) {
        CHECK_ERR(run_subtask(worker, subtask), "run_subtask");
      }
    } else {
      if (steal_from_random_worker(worker)) {
        struct subtask *subtask = NULL;
        int err = subtask_queue_dequeue(worker, &subtask, 0);
        if (err == 0) {
          CHECK_ERR(run_subtask(worker, subtask), "run_subtask");
        }
      }
    }
  }


  if (info.wake_up_threads || sched == DYNAMIC) {
    __atomic_sub_fetch(&scheduler->active_work, nsubtasks, __ATOMIC_RELAXED);
  }

  // Write back timing results of all sequential work
  (*timer) += task_timer;
  return scheduler->error;
}


static inline int scheduler_execute_task(struct scheduler *scheduler,
                                         struct scheduler_parloop *task)
{

  struct worker *worker = worker_local;

  int err = 0;

  // How much sequential work was performed by the task
  int64_t task_timer = 0;

  /* Execute task sequential or parallel based on decision made earlier */
  if (task->info.nsubtasks == 1) {
    int64_t start = get_wall_time_ns();
    err = task->fn(task->args, 0, task->iterations, 0, worker->tid);
    int64_t end = get_wall_time_ns();
    task_timer = end - start;
    worker->time_spent_working += task_timer;
    // Report time measurements
    // TODO the update of both of these should really be a single atomic!!
    __atomic_fetch_add(task->info.task_time, task_timer, __ATOMIC_RELAXED);
    __atomic_fetch_add(task->info.task_iter, task->iterations, __ATOMIC_RELAXED);
  } else {
    // Add "before" time if we already are inside a task
    int64_t time_before = 0;
    if (worker->nested > 0) {
      time_before = total_now(worker->total, worker->timer);
    }

    err = scheduler_execute_parloop(scheduler, task, &task_timer);

    // Report time measurements
    // TODO the update of both of these should really be a single atomic!!
    __atomic_fetch_add(task->info.task_time, task_timer, __ATOMIC_RELAXED);
    __atomic_fetch_add(task->info.task_iter, task->iterations, __ATOMIC_RELAXED);

    // Update timers to account for new timings
    worker->total = time_before + task_timer;
    worker->timer = get_wall_time_ns();
  }


  return err;
}

/* Decide on how schedule the incoming task i.e. how many subtasks and
   to run sequential or (potentially nested) parallel code body */
static inline int scheduler_prepare_task(struct scheduler* scheduler,
                                         struct scheduler_segop *task)
{
  assert(task != NULL);

  struct worker *worker = worker_local;
  struct scheduler_info info;
  info.task_time = task->task_time;
  info.task_iter = task->task_iter;

  int nsubtasks;
  // Decide if task should be scheduled sequentially
  if (is_small(task, scheduler, &nsubtasks)) {
    info.iter_pr_subtask = task->iterations;
    info.remainder = 0;
    info.nsubtasks = nsubtasks;
    return task->top_level_fn(task->args, task->iterations, worker->tid, info);
  } else {
    info.iter_pr_subtask = task->iterations / nsubtasks;
    info.remainder = task->iterations % nsubtasks;
    info.sched = task->sched;
    switch (task->sched) {
    case STATIC:
      info.nsubtasks = info.iter_pr_subtask == 0 ? info.remainder : ((task->iterations - info.remainder) / info.iter_pr_subtask);
      break;
    case DYNAMIC:
      // As any thread can take any subtasks, we are being safe with using
      // an upper bound on the number of tasks such that the task allocate enough memory
      info.nsubtasks = info.iter_pr_subtask == 0 ? info.remainder : nsubtasks;
      break;
    default:
      assert(!"Got unknown scheduling");
    }
  }

  info.wake_up_threads = 0;
  // We only use the nested parallel segop function if we can't exchaust all cores
  // using the outer most level
  if (task->nested_fn != NULL && info.nsubtasks < scheduler->num_threads && info.nsubtasks == task->iterations) {
    if (worker->nested == 0)
      info.wake_up_threads = 1;
    return task->nested_fn(task->args, task->iterations, worker->tid, info);
  }

  return task->top_level_fn(task->args, task->iterations, worker->tid, info);
}

// Now some code for finding the proper value of kappa on a given
// machine (the smallest amount of work that amortises the cost of
// task creation).

struct tuning_struct {
  int32_t *free_tuning_res;
  int32_t *array;
};

// Reduction function over an integer array
static int tuning_loop(void *args, int64_t start, int64_t end,
                                     int flat_tid, int tid) {
  (void)flat_tid;
  (void)tid;

  int err = 0;
  struct tuning_struct *tuning_struct = (struct tuning_struct *) args;
  int32_t *array = tuning_struct->array;
  int32_t *tuning_res = tuning_struct->free_tuning_res;

  int32_t sum = 0;
  for (int i = start; i < end; i++) {
    int32_t y = array[i];
    sum = add32(sum, y);
  }
  *tuning_res = sum;
  return err;
}

// The main entry point for the tuning process.  Sets the provided
// variable ``kappa``.
static int determine_kappa(double *kappa) {
  int err = 0;

  int64_t iterations = 100000000;
  int64_t tuning_time = 0;
  int64_t tuning_iter = 0;

  int32_t *array = malloc(sizeof(int32_t) * iterations);
  for (int64_t i = 0; i < iterations; i++) {
    array[i] = fast_rand();
  }

  int64_t start_tuning = get_wall_time_ns();
  /* **************************** */
  /* Run sequential reduce first' */
  /* **************************** */
  int64_t tuning_sequentiual_start = get_wall_time_ns();
  struct tuning_struct tuning_struct;
  int32_t tuning_res;
  tuning_struct.free_tuning_res = &tuning_res;
  tuning_struct.array = array;

  err = tuning_loop(&tuning_struct, 0, iterations, 0, 0);
  int64_t tuning_sequentiual_end = get_wall_time_ns();
  int64_t sequential_elapsed = tuning_sequentiual_end - tuning_sequentiual_start;

  double C = (double)sequential_elapsed / (double)iterations;
  fprintf(stderr, " Time for sequential run is %lld - Found C %f\n", (long long)sequential_elapsed, C);

  /* ********************** */
  /* Now run tuning process */
  /* ********************** */
  // Setup a scheduler with a single worker
  struct scheduler scheduler;
  scheduler.num_threads = 1;
  scheduler.workers = malloc(sizeof(struct worker));
  worker_local = &scheduler.workers[0];
  worker_local->tid = 0;
  CHECK_ERR(subtask_queue_init(&scheduler.workers[0].q, 1024),
            "failed to init queue for worker %d\n", 0);

  // Start tuning for kappa
  double kappa_tune = 1000; // Initial kappa is 1 us
  double ratio;
  int64_t time_elapsed;
  while(1) {
    int64_t min_iter_pr_subtask = (int64_t) (kappa_tune / C) == 0 ? 1 : (kappa_tune / C);
    int nsubtasks = iterations / min_iter_pr_subtask;
    struct scheduler_info info;
    info.iter_pr_subtask = min_iter_pr_subtask;

    info.nsubtasks = iterations / min_iter_pr_subtask;
    info.remainder = iterations % min_iter_pr_subtask;
    info.task_time = &tuning_time;
    info.task_iter = &tuning_iter;
    info.sched = STATIC;

    struct scheduler_parloop parloop;
    parloop.name = "tuning_loop";
    parloop.fn = tuning_loop;
    parloop.args = &tuning_struct;
    parloop.iterations = iterations;
    parloop.info = info;

    int64_t tuning_chunked_start = get_wall_time_ns();
    int determine_kappa_err =
      scheduler_execute_task(&scheduler,
                             &parloop);
    assert(determine_kappa_err == 0);
    int64_t tuning_chunked_end = get_wall_time_ns();
    time_elapsed =  tuning_chunked_end - tuning_chunked_start;

    ratio = (double)time_elapsed / (double)sequential_elapsed;
    if (ratio < 1.055) {
      break;
    }
    kappa_tune += 100; // Increase by 100 ns at the time
    fprintf(stderr, "nsubtask %d - kappa %f - ratio %f\n", nsubtasks, kappa_tune, ratio);
  }

  int64_t end_tuning = get_wall_time_ns();
  fprintf(stderr, "tuning took %lld ns and found kappa %f - time %lld - ratio %f\n",
          (long long)end_tuning - start_tuning,
          kappa_tune,
          (long long)time_elapsed,
          ratio);
  *kappa = kappa_tune;

  // Clean-up
  CHECK_ERR(subtask_queue_destroy(&scheduler.workers[0].q), "failed to destroy queue");
  free(array);
  free(scheduler.workers);
  return err;
}

static int scheduler_init(struct scheduler *scheduler,
                          int num_workers,
                          double kappa) {
  assert(num_workers > 0);

  scheduler->kappa = kappa;
  scheduler->num_threads = num_workers;
  scheduler->active_work = 0;
  scheduler->error = 0;

  scheduler->workers = calloc(num_workers, sizeof(struct worker));

  const int queue_capacity = 1024;

  worker_local = &scheduler->workers[0];
  worker_local->tid = 0;
  worker_local->scheduler = scheduler;
  CHECK_ERR(subtask_queue_init(&worker_local->q, queue_capacity),
            "failed to init queue for worker %d\n", 0);

  for (int i = 1; i < num_workers; i++) {
    struct worker *cur_worker = &scheduler->workers[i];
    memset(cur_worker, 0, sizeof(struct worker));
    cur_worker->tid = i;
    cur_worker->output_usage = 0;
    cur_worker->scheduler = scheduler;
    CHECK_ERR(subtask_queue_init(&cur_worker->q, queue_capacity),
              "failed to init queue for worker %d\n", i);

    CHECK_ERR(pthread_create(&cur_worker->thread,
                             NULL,
                             &scheduler_worker,
                             cur_worker),
              "Failed to create worker %d\n", i);
  }

  return 0;
}

static int scheduler_destroy(struct scheduler *scheduler) {
  // We assume that this function is called by the thread controlling
  // the first worker, which is why we treat scheduler->workers[0]
  // specially here.

  // First mark them all as dead.
  for (int i = 1; i < scheduler->num_threads; i++) {
    struct worker *cur_worker = &scheduler->workers[i];
    cur_worker->dead = 1;
  }

  // Then destroy their task queues (this will wake up the threads and
  // make them do their shutdown).
  for (int i = 1; i < scheduler->num_threads; i++) {
    struct worker *cur_worker = &scheduler->workers[i];
    subtask_queue_destroy(&cur_worker->q);
  }

  // Then actually wait for them to stop.
  for (int i = 1; i < scheduler->num_threads; i++) {
    struct worker *cur_worker = &scheduler->workers[i];
    CHECK_ERR(pthread_join(scheduler->workers[i].thread, NULL), "pthread_join");
  }

  // And then destroy our own queue.
  subtask_queue_destroy(&scheduler->workers[0].q);

  free(scheduler->workers);

  return 0;
}

// End of scheduler.h

struct futhark_context_config {
    int in_use;
    int debugging;
    int profiling;
    int num_threads;
};
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->debugging = 0;
    cfg->profiling = 0;
    cfg->num_threads = 0;
    return cfg;
}
void futhark_context_config_free(struct futhark_context_config *cfg)
{
    assert(!cfg->in_use);
    free(cfg);
}
void futhark_context_config_set_debugging(struct futhark_context_config *cfg,
                                          int detail)
{
    cfg->debugging = detail;
}
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 detail)
{
    // Does nothing for this backend.
    (void) cfg;
    (void) detail;
}
void futhark_context_config_set_num_threads(struct futhark_context_config *cfg,
                                            int n)
{
    cfg->num_threads = n;
}
struct futhark_context {
    struct futhark_context_config *cfg;
    struct scheduler scheduler;
    int detail_memory;
    int debugging;
    int profiling;
    int profiling_paused;
    int logging;
    lock_t lock;
    char *error;
    FILE *log;
    int total_runs;
    long total_runtime;
    int64_t peak_mem_usage_default;
    int64_t cur_mem_usage_default;
    struct {
        int dummy;
    } constants;
    int64_t *futhark_mc_segmap_parloop_77026_total_runtime;
    int *futhark_mc_segmap_parloop_77026_runs;
    int64_t *futhark_mc_segmap_parloop_77026_iter;
    int64_t futhark_mc_segmap_parloop_77026_total_total_runtime;
    int futhark_mc_segmap_parloop_77026_total_runs;
    int64_t futhark_mc_segmap_parloop_77026_total_iter;
    int64_t *futhark_mc_segmap_task_77024_total_runtime;
    int *futhark_mc_segmap_task_77024_runs;
    int64_t *futhark_mc_segmap_task_77024_iter;
    int64_t futhark_mc_segmap_task_77024_total_time;
    int64_t futhark_mc_segmap_task_77024_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_77046_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_77046_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_77046_iter;
    int64_t futhark_mc_scan_stage_1_parloop_77046_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_77046_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_77046_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_77048_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_77048_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_77048_iter;
    int64_t futhark_mc_scan_stage_3_parloop_77048_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_77048_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_77048_total_iter;
    int64_t *futhark_mc_segscan_task_77043_total_runtime;
    int *futhark_mc_segscan_task_77043_runs;
    int64_t *futhark_mc_segscan_task_77043_iter;
    int64_t futhark_mc_segscan_task_77043_total_time;
    int64_t futhark_mc_segscan_task_77043_total_iter;
    int64_t *futhark_mc_segmap_parloop_77052_total_runtime;
    int *futhark_mc_segmap_parloop_77052_runs;
    int64_t *futhark_mc_segmap_parloop_77052_iter;
    int64_t futhark_mc_segmap_parloop_77052_total_total_runtime;
    int futhark_mc_segmap_parloop_77052_total_runs;
    int64_t futhark_mc_segmap_parloop_77052_total_iter;
    int64_t *futhark_mc_segmap_task_77050_total_runtime;
    int *futhark_mc_segmap_task_77050_runs;
    int64_t *futhark_mc_segmap_task_77050_iter;
    int64_t futhark_mc_segmap_task_77050_total_time;
    int64_t futhark_mc_segmap_task_77050_total_iter;
    int64_t *futhark_mc_segmap_parloop_77056_total_runtime;
    int *futhark_mc_segmap_parloop_77056_runs;
    int64_t *futhark_mc_segmap_parloop_77056_iter;
    int64_t futhark_mc_segmap_parloop_77056_total_total_runtime;
    int futhark_mc_segmap_parloop_77056_total_runs;
    int64_t futhark_mc_segmap_parloop_77056_total_iter;
    int64_t *futhark_mc_segmap_task_77054_total_runtime;
    int *futhark_mc_segmap_task_77054_runs;
    int64_t *futhark_mc_segmap_task_77054_iter;
    int64_t futhark_mc_segmap_task_77054_total_time;
    int64_t futhark_mc_segmap_task_77054_total_iter;
    int64_t *futhark_mc_segmap_parloop_77060_total_runtime;
    int *futhark_mc_segmap_parloop_77060_runs;
    int64_t *futhark_mc_segmap_parloop_77060_iter;
    int64_t futhark_mc_segmap_parloop_77060_total_total_runtime;
    int futhark_mc_segmap_parloop_77060_total_runs;
    int64_t futhark_mc_segmap_parloop_77060_total_iter;
    int64_t *futhark_mc_segmap_task_77058_total_runtime;
    int *futhark_mc_segmap_task_77058_runs;
    int64_t *futhark_mc_segmap_task_77058_iter;
    int64_t futhark_mc_segmap_task_77058_total_time;
    int64_t futhark_mc_segmap_task_77058_total_iter;
    int64_t *futhark_mc_segmap_parloop_77064_total_runtime;
    int *futhark_mc_segmap_parloop_77064_runs;
    int64_t *futhark_mc_segmap_parloop_77064_iter;
    int64_t futhark_mc_segmap_parloop_77064_total_total_runtime;
    int futhark_mc_segmap_parloop_77064_total_runs;
    int64_t futhark_mc_segmap_parloop_77064_total_iter;
    int64_t *futhark_mc_segmap_task_77062_total_runtime;
    int *futhark_mc_segmap_task_77062_runs;
    int64_t *futhark_mc_segmap_task_77062_iter;
    int64_t futhark_mc_segmap_task_77062_total_time;
    int64_t futhark_mc_segmap_task_77062_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77072_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77072_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77072_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77072_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77072_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77072_total_iter;
    int64_t *futhark_mc_segred_task_77069_total_runtime;
    int *futhark_mc_segred_task_77069_runs;
    int64_t *futhark_mc_segred_task_77069_iter;
    int64_t futhark_mc_segred_task_77069_total_time;
    int64_t futhark_mc_segred_task_77069_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77077_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77077_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77077_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77077_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77077_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77077_total_iter;
    int64_t *futhark_mc_segred_task_77074_total_runtime;
    int *futhark_mc_segred_task_77074_runs;
    int64_t *futhark_mc_segred_task_77074_iter;
    int64_t futhark_mc_segred_task_77074_total_time;
    int64_t futhark_mc_segred_task_77074_total_iter;
    int64_t *futhark_mc_segmap_parloop_77067_total_runtime;
    int *futhark_mc_segmap_parloop_77067_runs;
    int64_t *futhark_mc_segmap_parloop_77067_iter;
    int64_t futhark_mc_segmap_parloop_77067_total_total_runtime;
    int futhark_mc_segmap_parloop_77067_total_runs;
    int64_t futhark_mc_segmap_parloop_77067_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77065_total_runtime;
    int *futhark_mc_segmap_nested_task_77065_runs;
    int64_t *futhark_mc_segmap_nested_task_77065_iter;
    int64_t *futhark_mc_segmap_parloop_77035_total_runtime;
    int *futhark_mc_segmap_parloop_77035_runs;
    int64_t *futhark_mc_segmap_parloop_77035_iter;
    int64_t futhark_mc_segmap_parloop_77035_total_total_runtime;
    int futhark_mc_segmap_parloop_77035_total_runs;
    int64_t futhark_mc_segmap_parloop_77035_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77033_total_runtime;
    int *futhark_mc_segmap_nested_task_77033_runs;
    int64_t *futhark_mc_segmap_nested_task_77033_iter;
    int64_t *futhark_mc_segmap_parloop_77081_total_runtime;
    int *futhark_mc_segmap_parloop_77081_runs;
    int64_t *futhark_mc_segmap_parloop_77081_iter;
    int64_t futhark_mc_segmap_parloop_77081_total_total_runtime;
    int futhark_mc_segmap_parloop_77081_total_runs;
    int64_t futhark_mc_segmap_parloop_77081_total_iter;
    int64_t *futhark_mc_segmap_task_77079_total_runtime;
    int *futhark_mc_segmap_task_77079_runs;
    int64_t *futhark_mc_segmap_task_77079_iter;
    int64_t futhark_mc_segmap_task_77079_total_time;
    int64_t futhark_mc_segmap_task_77079_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_77103_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_77103_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_77103_iter;
    int64_t futhark_mc_scan_stage_1_parloop_77103_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_77103_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_77103_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_77105_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_77105_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_77105_iter;
    int64_t futhark_mc_scan_stage_3_parloop_77105_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_77105_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_77105_total_iter;
    int64_t *futhark_mc_segscan_task_77100_total_runtime;
    int *futhark_mc_segscan_task_77100_runs;
    int64_t *futhark_mc_segscan_task_77100_iter;
    int64_t futhark_mc_segscan_task_77100_total_time;
    int64_t futhark_mc_segscan_task_77100_total_iter;
    int64_t *futhark_mc_segmap_parloop_77109_total_runtime;
    int *futhark_mc_segmap_parloop_77109_runs;
    int64_t *futhark_mc_segmap_parloop_77109_iter;
    int64_t futhark_mc_segmap_parloop_77109_total_total_runtime;
    int futhark_mc_segmap_parloop_77109_total_runs;
    int64_t futhark_mc_segmap_parloop_77109_total_iter;
    int64_t *futhark_mc_segmap_task_77107_total_runtime;
    int *futhark_mc_segmap_task_77107_runs;
    int64_t *futhark_mc_segmap_task_77107_iter;
    int64_t futhark_mc_segmap_task_77107_total_time;
    int64_t futhark_mc_segmap_task_77107_total_iter;
    int64_t *futhark_mc_segmap_parloop_77113_total_runtime;
    int *futhark_mc_segmap_parloop_77113_runs;
    int64_t *futhark_mc_segmap_parloop_77113_iter;
    int64_t futhark_mc_segmap_parloop_77113_total_total_runtime;
    int futhark_mc_segmap_parloop_77113_total_runs;
    int64_t futhark_mc_segmap_parloop_77113_total_iter;
    int64_t *futhark_mc_segmap_task_77111_total_runtime;
    int *futhark_mc_segmap_task_77111_runs;
    int64_t *futhark_mc_segmap_task_77111_iter;
    int64_t futhark_mc_segmap_task_77111_total_time;
    int64_t futhark_mc_segmap_task_77111_total_iter;
    int64_t *futhark_mc_segmap_parloop_77117_total_runtime;
    int *futhark_mc_segmap_parloop_77117_runs;
    int64_t *futhark_mc_segmap_parloop_77117_iter;
    int64_t futhark_mc_segmap_parloop_77117_total_total_runtime;
    int futhark_mc_segmap_parloop_77117_total_runs;
    int64_t futhark_mc_segmap_parloop_77117_total_iter;
    int64_t *futhark_mc_segmap_task_77115_total_runtime;
    int *futhark_mc_segmap_task_77115_runs;
    int64_t *futhark_mc_segmap_task_77115_iter;
    int64_t futhark_mc_segmap_task_77115_total_time;
    int64_t futhark_mc_segmap_task_77115_total_iter;
    int64_t *futhark_mc_segmap_parloop_77121_total_runtime;
    int *futhark_mc_segmap_parloop_77121_runs;
    int64_t *futhark_mc_segmap_parloop_77121_iter;
    int64_t futhark_mc_segmap_parloop_77121_total_total_runtime;
    int futhark_mc_segmap_parloop_77121_total_runs;
    int64_t futhark_mc_segmap_parloop_77121_total_iter;
    int64_t *futhark_mc_segmap_task_77119_total_runtime;
    int *futhark_mc_segmap_task_77119_runs;
    int64_t *futhark_mc_segmap_task_77119_iter;
    int64_t futhark_mc_segmap_task_77119_total_time;
    int64_t futhark_mc_segmap_task_77119_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77131_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77131_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77131_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77131_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77131_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77131_total_iter;
    int64_t *futhark_mc_segred_task_77126_total_runtime;
    int *futhark_mc_segred_task_77126_runs;
    int64_t *futhark_mc_segred_task_77126_iter;
    int64_t futhark_mc_segred_task_77126_total_time;
    int64_t futhark_mc_segred_task_77126_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77137_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77137_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77137_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77137_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77137_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77137_total_iter;
    int64_t *futhark_mc_segred_task_77133_total_runtime;
    int *futhark_mc_segred_task_77133_runs;
    int64_t *futhark_mc_segred_task_77133_iter;
    int64_t futhark_mc_segred_task_77133_total_time;
    int64_t futhark_mc_segred_task_77133_total_iter;
    int64_t *futhark_mc_segmap_parloop_77124_total_runtime;
    int *futhark_mc_segmap_parloop_77124_runs;
    int64_t *futhark_mc_segmap_parloop_77124_iter;
    int64_t futhark_mc_segmap_parloop_77124_total_total_runtime;
    int futhark_mc_segmap_parloop_77124_total_runs;
    int64_t futhark_mc_segmap_parloop_77124_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77122_total_runtime;
    int *futhark_mc_segmap_nested_task_77122_runs;
    int64_t *futhark_mc_segmap_nested_task_77122_iter;
    int64_t *futhark_mc_segmap_parloop_77091_total_runtime;
    int *futhark_mc_segmap_parloop_77091_runs;
    int64_t *futhark_mc_segmap_parloop_77091_iter;
    int64_t futhark_mc_segmap_parloop_77091_total_total_runtime;
    int futhark_mc_segmap_parloop_77091_total_runs;
    int64_t futhark_mc_segmap_parloop_77091_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77089_total_runtime;
    int *futhark_mc_segmap_nested_task_77089_runs;
    int64_t *futhark_mc_segmap_nested_task_77089_iter;
    int64_t *futhark_mc_segmap_parloop_77141_total_runtime;
    int *futhark_mc_segmap_parloop_77141_runs;
    int64_t *futhark_mc_segmap_parloop_77141_iter;
    int64_t futhark_mc_segmap_parloop_77141_total_total_runtime;
    int futhark_mc_segmap_parloop_77141_total_runs;
    int64_t futhark_mc_segmap_parloop_77141_total_iter;
    int64_t *futhark_mc_segmap_task_77139_total_runtime;
    int *futhark_mc_segmap_task_77139_runs;
    int64_t *futhark_mc_segmap_task_77139_iter;
    int64_t futhark_mc_segmap_task_77139_total_time;
    int64_t futhark_mc_segmap_task_77139_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_77163_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_77163_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_77163_iter;
    int64_t futhark_mc_scan_stage_1_parloop_77163_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_77163_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_77163_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_77165_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_77165_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_77165_iter;
    int64_t futhark_mc_scan_stage_3_parloop_77165_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_77165_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_77165_total_iter;
    int64_t *futhark_mc_segscan_task_77160_total_runtime;
    int *futhark_mc_segscan_task_77160_runs;
    int64_t *futhark_mc_segscan_task_77160_iter;
    int64_t futhark_mc_segscan_task_77160_total_time;
    int64_t futhark_mc_segscan_task_77160_total_iter;
    int64_t *futhark_mc_segmap_parloop_77169_total_runtime;
    int *futhark_mc_segmap_parloop_77169_runs;
    int64_t *futhark_mc_segmap_parloop_77169_iter;
    int64_t futhark_mc_segmap_parloop_77169_total_total_runtime;
    int futhark_mc_segmap_parloop_77169_total_runs;
    int64_t futhark_mc_segmap_parloop_77169_total_iter;
    int64_t *futhark_mc_segmap_task_77167_total_runtime;
    int *futhark_mc_segmap_task_77167_runs;
    int64_t *futhark_mc_segmap_task_77167_iter;
    int64_t futhark_mc_segmap_task_77167_total_time;
    int64_t futhark_mc_segmap_task_77167_total_iter;
    int64_t *futhark_mc_segmap_parloop_77173_total_runtime;
    int *futhark_mc_segmap_parloop_77173_runs;
    int64_t *futhark_mc_segmap_parloop_77173_iter;
    int64_t futhark_mc_segmap_parloop_77173_total_total_runtime;
    int futhark_mc_segmap_parloop_77173_total_runs;
    int64_t futhark_mc_segmap_parloop_77173_total_iter;
    int64_t *futhark_mc_segmap_task_77171_total_runtime;
    int *futhark_mc_segmap_task_77171_runs;
    int64_t *futhark_mc_segmap_task_77171_iter;
    int64_t futhark_mc_segmap_task_77171_total_time;
    int64_t futhark_mc_segmap_task_77171_total_iter;
    int64_t *futhark_mc_segmap_parloop_77177_total_runtime;
    int *futhark_mc_segmap_parloop_77177_runs;
    int64_t *futhark_mc_segmap_parloop_77177_iter;
    int64_t futhark_mc_segmap_parloop_77177_total_total_runtime;
    int futhark_mc_segmap_parloop_77177_total_runs;
    int64_t futhark_mc_segmap_parloop_77177_total_iter;
    int64_t *futhark_mc_segmap_task_77175_total_runtime;
    int *futhark_mc_segmap_task_77175_runs;
    int64_t *futhark_mc_segmap_task_77175_iter;
    int64_t futhark_mc_segmap_task_77175_total_time;
    int64_t futhark_mc_segmap_task_77175_total_iter;
    int64_t *futhark_mc_segmap_parloop_77181_total_runtime;
    int *futhark_mc_segmap_parloop_77181_runs;
    int64_t *futhark_mc_segmap_parloop_77181_iter;
    int64_t futhark_mc_segmap_parloop_77181_total_total_runtime;
    int futhark_mc_segmap_parloop_77181_total_runs;
    int64_t futhark_mc_segmap_parloop_77181_total_iter;
    int64_t *futhark_mc_segmap_task_77179_total_runtime;
    int *futhark_mc_segmap_task_77179_runs;
    int64_t *futhark_mc_segmap_task_77179_iter;
    int64_t futhark_mc_segmap_task_77179_total_time;
    int64_t futhark_mc_segmap_task_77179_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77193_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77193_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77193_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77193_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77193_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77193_total_iter;
    int64_t *futhark_mc_segred_task_77186_total_runtime;
    int *futhark_mc_segred_task_77186_runs;
    int64_t *futhark_mc_segred_task_77186_iter;
    int64_t futhark_mc_segred_task_77186_total_time;
    int64_t futhark_mc_segred_task_77186_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77199_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77199_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77199_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77199_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77199_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77199_total_iter;
    int64_t *futhark_mc_segred_task_77195_total_runtime;
    int *futhark_mc_segred_task_77195_runs;
    int64_t *futhark_mc_segred_task_77195_iter;
    int64_t futhark_mc_segred_task_77195_total_time;
    int64_t futhark_mc_segred_task_77195_total_iter;
    int64_t *futhark_mc_segmap_parloop_77184_total_runtime;
    int *futhark_mc_segmap_parloop_77184_runs;
    int64_t *futhark_mc_segmap_parloop_77184_iter;
    int64_t futhark_mc_segmap_parloop_77184_total_total_runtime;
    int futhark_mc_segmap_parloop_77184_total_runs;
    int64_t futhark_mc_segmap_parloop_77184_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77182_total_runtime;
    int *futhark_mc_segmap_nested_task_77182_runs;
    int64_t *futhark_mc_segmap_nested_task_77182_iter;
    int64_t *futhark_mc_segmap_parloop_77151_total_runtime;
    int *futhark_mc_segmap_parloop_77151_runs;
    int64_t *futhark_mc_segmap_parloop_77151_iter;
    int64_t futhark_mc_segmap_parloop_77151_total_total_runtime;
    int futhark_mc_segmap_parloop_77151_total_runs;
    int64_t futhark_mc_segmap_parloop_77151_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77149_total_runtime;
    int *futhark_mc_segmap_nested_task_77149_runs;
    int64_t *futhark_mc_segmap_nested_task_77149_iter;
    int64_t *futhark_mc_segmap_parloop_77203_total_runtime;
    int *futhark_mc_segmap_parloop_77203_runs;
    int64_t *futhark_mc_segmap_parloop_77203_iter;
    int64_t futhark_mc_segmap_parloop_77203_total_total_runtime;
    int futhark_mc_segmap_parloop_77203_total_runs;
    int64_t futhark_mc_segmap_parloop_77203_total_iter;
    int64_t *futhark_mc_segmap_task_77201_total_runtime;
    int *futhark_mc_segmap_task_77201_runs;
    int64_t *futhark_mc_segmap_task_77201_iter;
    int64_t futhark_mc_segmap_task_77201_total_time;
    int64_t futhark_mc_segmap_task_77201_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_77224_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_77224_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_77224_iter;
    int64_t futhark_mc_scan_stage_1_parloop_77224_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_77224_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_77224_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_77226_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_77226_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_77226_iter;
    int64_t futhark_mc_scan_stage_3_parloop_77226_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_77226_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_77226_total_iter;
    int64_t *futhark_mc_segscan_task_77221_total_runtime;
    int *futhark_mc_segscan_task_77221_runs;
    int64_t *futhark_mc_segscan_task_77221_iter;
    int64_t futhark_mc_segscan_task_77221_total_time;
    int64_t futhark_mc_segscan_task_77221_total_iter;
    int64_t *futhark_mc_segmap_parloop_77230_total_runtime;
    int *futhark_mc_segmap_parloop_77230_runs;
    int64_t *futhark_mc_segmap_parloop_77230_iter;
    int64_t futhark_mc_segmap_parloop_77230_total_total_runtime;
    int futhark_mc_segmap_parloop_77230_total_runs;
    int64_t futhark_mc_segmap_parloop_77230_total_iter;
    int64_t *futhark_mc_segmap_task_77228_total_runtime;
    int *futhark_mc_segmap_task_77228_runs;
    int64_t *futhark_mc_segmap_task_77228_iter;
    int64_t futhark_mc_segmap_task_77228_total_time;
    int64_t futhark_mc_segmap_task_77228_total_iter;
    int64_t *futhark_mc_segmap_parloop_77234_total_runtime;
    int *futhark_mc_segmap_parloop_77234_runs;
    int64_t *futhark_mc_segmap_parloop_77234_iter;
    int64_t futhark_mc_segmap_parloop_77234_total_total_runtime;
    int futhark_mc_segmap_parloop_77234_total_runs;
    int64_t futhark_mc_segmap_parloop_77234_total_iter;
    int64_t *futhark_mc_segmap_task_77232_total_runtime;
    int *futhark_mc_segmap_task_77232_runs;
    int64_t *futhark_mc_segmap_task_77232_iter;
    int64_t futhark_mc_segmap_task_77232_total_time;
    int64_t futhark_mc_segmap_task_77232_total_iter;
    int64_t *futhark_mc_segmap_parloop_77238_total_runtime;
    int *futhark_mc_segmap_parloop_77238_runs;
    int64_t *futhark_mc_segmap_parloop_77238_iter;
    int64_t futhark_mc_segmap_parloop_77238_total_total_runtime;
    int futhark_mc_segmap_parloop_77238_total_runs;
    int64_t futhark_mc_segmap_parloop_77238_total_iter;
    int64_t *futhark_mc_segmap_task_77236_total_runtime;
    int *futhark_mc_segmap_task_77236_runs;
    int64_t *futhark_mc_segmap_task_77236_iter;
    int64_t futhark_mc_segmap_task_77236_total_time;
    int64_t futhark_mc_segmap_task_77236_total_iter;
    int64_t *futhark_mc_segmap_parloop_77242_total_runtime;
    int *futhark_mc_segmap_parloop_77242_runs;
    int64_t *futhark_mc_segmap_parloop_77242_iter;
    int64_t futhark_mc_segmap_parloop_77242_total_total_runtime;
    int futhark_mc_segmap_parloop_77242_total_runs;
    int64_t futhark_mc_segmap_parloop_77242_total_iter;
    int64_t *futhark_mc_segmap_task_77240_total_runtime;
    int *futhark_mc_segmap_task_77240_runs;
    int64_t *futhark_mc_segmap_task_77240_iter;
    int64_t futhark_mc_segmap_task_77240_total_time;
    int64_t futhark_mc_segmap_task_77240_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77252_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77252_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77252_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77252_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77252_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77252_total_iter;
    int64_t *futhark_mc_segred_task_77249_total_runtime;
    int *futhark_mc_segred_task_77249_runs;
    int64_t *futhark_mc_segred_task_77249_iter;
    int64_t futhark_mc_segred_task_77249_total_time;
    int64_t futhark_mc_segred_task_77249_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77257_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77257_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77257_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77257_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77257_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77257_total_iter;
    int64_t *futhark_mc_segred_task_77254_total_runtime;
    int *futhark_mc_segred_task_77254_runs;
    int64_t *futhark_mc_segred_task_77254_iter;
    int64_t futhark_mc_segred_task_77254_total_time;
    int64_t futhark_mc_segred_task_77254_total_iter;
    int64_t *futhark_mc_segmap_parloop_77246_total_runtime;
    int *futhark_mc_segmap_parloop_77246_runs;
    int64_t *futhark_mc_segmap_parloop_77246_iter;
    int64_t futhark_mc_segmap_parloop_77246_total_total_runtime;
    int futhark_mc_segmap_parloop_77246_total_runs;
    int64_t futhark_mc_segmap_parloop_77246_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77244_total_runtime;
    int *futhark_mc_segmap_nested_task_77244_runs;
    int64_t *futhark_mc_segmap_nested_task_77244_iter;
    int64_t *futhark_mc_segmap_parloop_77213_total_runtime;
    int *futhark_mc_segmap_parloop_77213_runs;
    int64_t *futhark_mc_segmap_parloop_77213_iter;
    int64_t futhark_mc_segmap_parloop_77213_total_total_runtime;
    int futhark_mc_segmap_parloop_77213_total_runs;
    int64_t futhark_mc_segmap_parloop_77213_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77211_total_runtime;
    int *futhark_mc_segmap_nested_task_77211_runs;
    int64_t *futhark_mc_segmap_nested_task_77211_iter;
    int64_t *futhark_mc_segmap_parloop_77261_total_runtime;
    int *futhark_mc_segmap_parloop_77261_runs;
    int64_t *futhark_mc_segmap_parloop_77261_iter;
    int64_t futhark_mc_segmap_parloop_77261_total_total_runtime;
    int futhark_mc_segmap_parloop_77261_total_runs;
    int64_t futhark_mc_segmap_parloop_77261_total_iter;
    int64_t *futhark_mc_segmap_task_77259_total_runtime;
    int *futhark_mc_segmap_task_77259_runs;
    int64_t *futhark_mc_segmap_task_77259_iter;
    int64_t futhark_mc_segmap_task_77259_total_time;
    int64_t futhark_mc_segmap_task_77259_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_77285_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_77285_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_77285_iter;
    int64_t futhark_mc_scan_stage_1_parloop_77285_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_77285_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_77285_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_77287_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_77287_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_77287_iter;
    int64_t futhark_mc_scan_stage_3_parloop_77287_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_77287_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_77287_total_iter;
    int64_t *futhark_mc_segscan_task_77282_total_runtime;
    int *futhark_mc_segscan_task_77282_runs;
    int64_t *futhark_mc_segscan_task_77282_iter;
    int64_t futhark_mc_segscan_task_77282_total_time;
    int64_t futhark_mc_segscan_task_77282_total_iter;
    int64_t *futhark_mc_segmap_parloop_77291_total_runtime;
    int *futhark_mc_segmap_parloop_77291_runs;
    int64_t *futhark_mc_segmap_parloop_77291_iter;
    int64_t futhark_mc_segmap_parloop_77291_total_total_runtime;
    int futhark_mc_segmap_parloop_77291_total_runs;
    int64_t futhark_mc_segmap_parloop_77291_total_iter;
    int64_t *futhark_mc_segmap_task_77289_total_runtime;
    int *futhark_mc_segmap_task_77289_runs;
    int64_t *futhark_mc_segmap_task_77289_iter;
    int64_t futhark_mc_segmap_task_77289_total_time;
    int64_t futhark_mc_segmap_task_77289_total_iter;
    int64_t *futhark_mc_segmap_parloop_77295_total_runtime;
    int *futhark_mc_segmap_parloop_77295_runs;
    int64_t *futhark_mc_segmap_parloop_77295_iter;
    int64_t futhark_mc_segmap_parloop_77295_total_total_runtime;
    int futhark_mc_segmap_parloop_77295_total_runs;
    int64_t futhark_mc_segmap_parloop_77295_total_iter;
    int64_t *futhark_mc_segmap_task_77293_total_runtime;
    int *futhark_mc_segmap_task_77293_runs;
    int64_t *futhark_mc_segmap_task_77293_iter;
    int64_t futhark_mc_segmap_task_77293_total_time;
    int64_t futhark_mc_segmap_task_77293_total_iter;
    int64_t *futhark_mc_segmap_parloop_77299_total_runtime;
    int *futhark_mc_segmap_parloop_77299_runs;
    int64_t *futhark_mc_segmap_parloop_77299_iter;
    int64_t futhark_mc_segmap_parloop_77299_total_total_runtime;
    int futhark_mc_segmap_parloop_77299_total_runs;
    int64_t futhark_mc_segmap_parloop_77299_total_iter;
    int64_t *futhark_mc_segmap_task_77297_total_runtime;
    int *futhark_mc_segmap_task_77297_runs;
    int64_t *futhark_mc_segmap_task_77297_iter;
    int64_t futhark_mc_segmap_task_77297_total_time;
    int64_t futhark_mc_segmap_task_77297_total_iter;
    int64_t *futhark_mc_segmap_parloop_77303_total_runtime;
    int *futhark_mc_segmap_parloop_77303_runs;
    int64_t *futhark_mc_segmap_parloop_77303_iter;
    int64_t futhark_mc_segmap_parloop_77303_total_total_runtime;
    int futhark_mc_segmap_parloop_77303_total_runs;
    int64_t futhark_mc_segmap_parloop_77303_total_iter;
    int64_t *futhark_mc_segmap_task_77301_total_runtime;
    int *futhark_mc_segmap_task_77301_runs;
    int64_t *futhark_mc_segmap_task_77301_iter;
    int64_t futhark_mc_segmap_task_77301_total_time;
    int64_t futhark_mc_segmap_task_77301_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77317_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77317_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77317_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77317_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77317_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77317_total_iter;
    int64_t *futhark_mc_segred_task_77312_total_runtime;
    int *futhark_mc_segred_task_77312_runs;
    int64_t *futhark_mc_segred_task_77312_iter;
    int64_t futhark_mc_segred_task_77312_total_time;
    int64_t futhark_mc_segred_task_77312_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77323_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77323_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77323_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77323_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77323_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77323_total_iter;
    int64_t *futhark_mc_segred_task_77319_total_runtime;
    int *futhark_mc_segred_task_77319_runs;
    int64_t *futhark_mc_segred_task_77319_iter;
    int64_t futhark_mc_segred_task_77319_total_time;
    int64_t futhark_mc_segred_task_77319_total_iter;
    int64_t *futhark_mc_segmap_parloop_77308_total_runtime;
    int *futhark_mc_segmap_parloop_77308_runs;
    int64_t *futhark_mc_segmap_parloop_77308_iter;
    int64_t futhark_mc_segmap_parloop_77308_total_total_runtime;
    int futhark_mc_segmap_parloop_77308_total_runs;
    int64_t futhark_mc_segmap_parloop_77308_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77306_total_runtime;
    int *futhark_mc_segmap_nested_task_77306_runs;
    int64_t *futhark_mc_segmap_nested_task_77306_iter;
    int64_t *futhark_mc_segmap_parloop_77273_total_runtime;
    int *futhark_mc_segmap_parloop_77273_runs;
    int64_t *futhark_mc_segmap_parloop_77273_iter;
    int64_t futhark_mc_segmap_parloop_77273_total_total_runtime;
    int futhark_mc_segmap_parloop_77273_total_runs;
    int64_t futhark_mc_segmap_parloop_77273_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77271_total_runtime;
    int *futhark_mc_segmap_nested_task_77271_runs;
    int64_t *futhark_mc_segmap_nested_task_77271_iter;
    int64_t *futhark_mc_segmap_parloop_77327_total_runtime;
    int *futhark_mc_segmap_parloop_77327_runs;
    int64_t *futhark_mc_segmap_parloop_77327_iter;
    int64_t futhark_mc_segmap_parloop_77327_total_total_runtime;
    int futhark_mc_segmap_parloop_77327_total_runs;
    int64_t futhark_mc_segmap_parloop_77327_total_iter;
    int64_t *futhark_mc_segmap_task_77325_total_runtime;
    int *futhark_mc_segmap_task_77325_runs;
    int64_t *futhark_mc_segmap_task_77325_iter;
    int64_t futhark_mc_segmap_task_77325_total_time;
    int64_t futhark_mc_segmap_task_77325_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_77353_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_77353_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_77353_iter;
    int64_t futhark_mc_scan_stage_1_parloop_77353_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_77353_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_77353_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_77355_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_77355_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_77355_iter;
    int64_t futhark_mc_scan_stage_3_parloop_77355_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_77355_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_77355_total_iter;
    int64_t *futhark_mc_segscan_task_77350_total_runtime;
    int *futhark_mc_segscan_task_77350_runs;
    int64_t *futhark_mc_segscan_task_77350_iter;
    int64_t futhark_mc_segscan_task_77350_total_time;
    int64_t futhark_mc_segscan_task_77350_total_iter;
    int64_t *futhark_mc_segmap_parloop_77359_total_runtime;
    int *futhark_mc_segmap_parloop_77359_runs;
    int64_t *futhark_mc_segmap_parloop_77359_iter;
    int64_t futhark_mc_segmap_parloop_77359_total_total_runtime;
    int futhark_mc_segmap_parloop_77359_total_runs;
    int64_t futhark_mc_segmap_parloop_77359_total_iter;
    int64_t *futhark_mc_segmap_task_77357_total_runtime;
    int *futhark_mc_segmap_task_77357_runs;
    int64_t *futhark_mc_segmap_task_77357_iter;
    int64_t futhark_mc_segmap_task_77357_total_time;
    int64_t futhark_mc_segmap_task_77357_total_iter;
    int64_t *futhark_mc_segmap_parloop_77363_total_runtime;
    int *futhark_mc_segmap_parloop_77363_runs;
    int64_t *futhark_mc_segmap_parloop_77363_iter;
    int64_t futhark_mc_segmap_parloop_77363_total_total_runtime;
    int futhark_mc_segmap_parloop_77363_total_runs;
    int64_t futhark_mc_segmap_parloop_77363_total_iter;
    int64_t *futhark_mc_segmap_task_77361_total_runtime;
    int *futhark_mc_segmap_task_77361_runs;
    int64_t *futhark_mc_segmap_task_77361_iter;
    int64_t futhark_mc_segmap_task_77361_total_time;
    int64_t futhark_mc_segmap_task_77361_total_iter;
    int64_t *futhark_mc_segmap_parloop_77367_total_runtime;
    int *futhark_mc_segmap_parloop_77367_runs;
    int64_t *futhark_mc_segmap_parloop_77367_iter;
    int64_t futhark_mc_segmap_parloop_77367_total_total_runtime;
    int futhark_mc_segmap_parloop_77367_total_runs;
    int64_t futhark_mc_segmap_parloop_77367_total_iter;
    int64_t *futhark_mc_segmap_task_77365_total_runtime;
    int *futhark_mc_segmap_task_77365_runs;
    int64_t *futhark_mc_segmap_task_77365_iter;
    int64_t futhark_mc_segmap_task_77365_total_time;
    int64_t futhark_mc_segmap_task_77365_total_iter;
    int64_t *futhark_mc_segmap_parloop_77371_total_runtime;
    int *futhark_mc_segmap_parloop_77371_runs;
    int64_t *futhark_mc_segmap_parloop_77371_iter;
    int64_t futhark_mc_segmap_parloop_77371_total_total_runtime;
    int futhark_mc_segmap_parloop_77371_total_runs;
    int64_t futhark_mc_segmap_parloop_77371_total_iter;
    int64_t *futhark_mc_segmap_task_77369_total_runtime;
    int *futhark_mc_segmap_task_77369_runs;
    int64_t *futhark_mc_segmap_task_77369_iter;
    int64_t futhark_mc_segmap_task_77369_total_time;
    int64_t futhark_mc_segmap_task_77369_total_iter;
    int64_t *futhark_mc_segmap_parloop_77386_total_runtime;
    int *futhark_mc_segmap_parloop_77386_runs;
    int64_t *futhark_mc_segmap_parloop_77386_iter;
    int64_t futhark_mc_segmap_parloop_77386_total_total_runtime;
    int futhark_mc_segmap_parloop_77386_total_runs;
    int64_t futhark_mc_segmap_parloop_77386_total_iter;
    int64_t *futhark_mc_segmap_task_77384_total_runtime;
    int *futhark_mc_segmap_task_77384_runs;
    int64_t *futhark_mc_segmap_task_77384_iter;
    int64_t futhark_mc_segmap_task_77384_total_time;
    int64_t futhark_mc_segmap_task_77384_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77395_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77395_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77395_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77395_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77395_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77395_total_iter;
    int64_t *futhark_mc_segred_task_77388_total_runtime;
    int *futhark_mc_segred_task_77388_runs;
    int64_t *futhark_mc_segred_task_77388_iter;
    int64_t futhark_mc_segred_task_77388_total_time;
    int64_t futhark_mc_segred_task_77388_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_77401_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_77401_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_77401_iter;
    int64_t futhark_mc_segred_stage_1_parloop_77401_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_77401_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_77401_total_iter;
    int64_t *futhark_mc_segred_task_77397_total_runtime;
    int *futhark_mc_segred_task_77397_runs;
    int64_t *futhark_mc_segred_task_77397_iter;
    int64_t futhark_mc_segred_task_77397_total_time;
    int64_t futhark_mc_segred_task_77397_total_iter;
    int64_t *futhark_mc_segmap_parloop_77378_total_runtime;
    int *futhark_mc_segmap_parloop_77378_runs;
    int64_t *futhark_mc_segmap_parloop_77378_iter;
    int64_t futhark_mc_segmap_parloop_77378_total_total_runtime;
    int futhark_mc_segmap_parloop_77378_total_runs;
    int64_t futhark_mc_segmap_parloop_77378_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77376_total_runtime;
    int *futhark_mc_segmap_nested_task_77376_runs;
    int64_t *futhark_mc_segmap_nested_task_77376_iter;
    int64_t *futhark_mc_segmap_parloop_77341_total_runtime;
    int *futhark_mc_segmap_parloop_77341_runs;
    int64_t *futhark_mc_segmap_parloop_77341_iter;
    int64_t futhark_mc_segmap_parloop_77341_total_total_runtime;
    int futhark_mc_segmap_parloop_77341_total_runs;
    int64_t futhark_mc_segmap_parloop_77341_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77339_total_runtime;
    int *futhark_mc_segmap_nested_task_77339_runs;
    int64_t *futhark_mc_segmap_nested_task_77339_iter;
    int64_t *futhark_mc_segmap_parloop_77405_total_runtime;
    int *futhark_mc_segmap_parloop_77405_runs;
    int64_t *futhark_mc_segmap_parloop_77405_iter;
    int64_t futhark_mc_segmap_parloop_77405_total_total_runtime;
    int futhark_mc_segmap_parloop_77405_total_runs;
    int64_t futhark_mc_segmap_parloop_77405_total_iter;
    int64_t *futhark_mc_segmap_task_77403_total_runtime;
    int *futhark_mc_segmap_task_77403_runs;
    int64_t *futhark_mc_segmap_task_77403_iter;
    int64_t futhark_mc_segmap_task_77403_total_time;
    int64_t futhark_mc_segmap_task_77403_total_iter;
    int64_t *futhark_mc_segmap_parloop_77414_total_runtime;
    int *futhark_mc_segmap_parloop_77414_runs;
    int64_t *futhark_mc_segmap_parloop_77414_iter;
    int64_t futhark_mc_segmap_parloop_77414_total_total_runtime;
    int futhark_mc_segmap_parloop_77414_total_runs;
    int64_t futhark_mc_segmap_parloop_77414_total_iter;
    int64_t *futhark_mc_segmap_task_77412_total_runtime;
    int *futhark_mc_segmap_task_77412_runs;
    int64_t *futhark_mc_segmap_task_77412_iter;
    int64_t futhark_mc_segmap_task_77412_total_time;
    int64_t futhark_mc_segmap_task_77412_total_iter;
    int64_t *futhark_mc_segmap_parloop_77409_total_runtime;
    int *futhark_mc_segmap_parloop_77409_runs;
    int64_t *futhark_mc_segmap_parloop_77409_iter;
    int64_t futhark_mc_segmap_parloop_77409_total_total_runtime;
    int futhark_mc_segmap_parloop_77409_total_runs;
    int64_t futhark_mc_segmap_parloop_77409_total_iter;
    int64_t *futhark_mc_segmap_nested_task_77407_total_runtime;
    int *futhark_mc_segmap_nested_task_77407_runs;
    int64_t *futhark_mc_segmap_nested_task_77407_iter;
    int64_t tuning_timing;
    int64_t tuning_iter;
};
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;
    // Initialize rand()
    fast_srand(time(0));
    ctx->detail_memory = cfg->debugging;
    ctx->debugging = cfg->debugging;
    ctx->profiling = cfg->profiling;
    ctx->profiling_paused = 0;
    ctx->logging = 0;
    ctx->error = NULL;
    ctx->log = stderr;
    create_lock(&ctx->lock);
    
    int tune_kappa = 0;
    double kappa = 5.1f * 1000;
    
    if (tune_kappa) {
        if (determine_kappa(&kappa) != 0)
            return NULL;
    }
    if (scheduler_init(&ctx->scheduler, cfg->num_threads >
                       0 ? cfg->num_threads : num_processors(), kappa) != 0)
        return NULL;
    ctx->peak_mem_usage_default = 0;
    ctx->cur_mem_usage_default = 0;
    ctx->futhark_mc_segmap_parloop_77026_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77026_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77026_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77026_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77026_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77026_total_iter = 0;
    ctx->futhark_mc_segmap_task_77024_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77024_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77024_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77024_total_time = 0;
    ctx->futhark_mc_segmap_task_77024_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77046_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77046_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77046_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77046_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77046_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77048_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77048_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77048_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77048_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77048_total_iter = 0;
    ctx->futhark_mc_segscan_task_77043_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77043_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77043_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77043_total_time = 0;
    ctx->futhark_mc_segscan_task_77043_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77052_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77052_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77052_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77052_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77052_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77052_total_iter = 0;
    ctx->futhark_mc_segmap_task_77050_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77050_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77050_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77050_total_time = 0;
    ctx->futhark_mc_segmap_task_77050_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77056_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77056_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77056_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77056_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77056_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77056_total_iter = 0;
    ctx->futhark_mc_segmap_task_77054_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77054_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77054_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77054_total_time = 0;
    ctx->futhark_mc_segmap_task_77054_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77060_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77060_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77060_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77060_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77060_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77060_total_iter = 0;
    ctx->futhark_mc_segmap_task_77058_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77058_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77058_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77058_total_time = 0;
    ctx->futhark_mc_segmap_task_77058_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77064_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77064_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77064_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77064_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77064_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77064_total_iter = 0;
    ctx->futhark_mc_segmap_task_77062_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77062_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77062_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77062_total_time = 0;
    ctx->futhark_mc_segmap_task_77062_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77072_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77072_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77072_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77072_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77072_total_iter = 0;
    ctx->futhark_mc_segred_task_77069_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77069_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77069_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77069_total_time = 0;
    ctx->futhark_mc_segred_task_77069_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77077_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77077_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77077_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77077_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77077_total_iter = 0;
    ctx->futhark_mc_segred_task_77074_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77074_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77074_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77074_total_time = 0;
    ctx->futhark_mc_segred_task_77074_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77067_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77067_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77067_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77067_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77067_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77067_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77065_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77065_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77065_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77035_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77035_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77035_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77035_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77035_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77035_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77033_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77033_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77033_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77081_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77081_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77081_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77081_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77081_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77081_total_iter = 0;
    ctx->futhark_mc_segmap_task_77079_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77079_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77079_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77079_total_time = 0;
    ctx->futhark_mc_segmap_task_77079_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77103_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77103_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77103_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77103_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77103_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77105_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77105_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77105_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77105_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77105_total_iter = 0;
    ctx->futhark_mc_segscan_task_77100_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77100_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77100_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77100_total_time = 0;
    ctx->futhark_mc_segscan_task_77100_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77109_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77109_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77109_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77109_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77109_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77109_total_iter = 0;
    ctx->futhark_mc_segmap_task_77107_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77107_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77107_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77107_total_time = 0;
    ctx->futhark_mc_segmap_task_77107_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77113_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77113_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77113_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77113_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77113_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77113_total_iter = 0;
    ctx->futhark_mc_segmap_task_77111_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77111_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77111_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77111_total_time = 0;
    ctx->futhark_mc_segmap_task_77111_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77117_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77117_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77117_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77117_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77117_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77117_total_iter = 0;
    ctx->futhark_mc_segmap_task_77115_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77115_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77115_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77115_total_time = 0;
    ctx->futhark_mc_segmap_task_77115_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77121_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77121_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77121_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77121_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77121_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77121_total_iter = 0;
    ctx->futhark_mc_segmap_task_77119_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77119_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77119_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77119_total_time = 0;
    ctx->futhark_mc_segmap_task_77119_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77131_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77131_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77131_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77131_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77131_total_iter = 0;
    ctx->futhark_mc_segred_task_77126_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77126_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77126_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77126_total_time = 0;
    ctx->futhark_mc_segred_task_77126_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77137_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77137_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77137_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77137_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77137_total_iter = 0;
    ctx->futhark_mc_segred_task_77133_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77133_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77133_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77133_total_time = 0;
    ctx->futhark_mc_segred_task_77133_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77124_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77124_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77124_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77124_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77124_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77124_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77122_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77122_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77122_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77091_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77091_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77091_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77091_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77091_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77091_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77089_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77089_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77089_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77141_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77141_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77141_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77141_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77141_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77141_total_iter = 0;
    ctx->futhark_mc_segmap_task_77139_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77139_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77139_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77139_total_time = 0;
    ctx->futhark_mc_segmap_task_77139_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77163_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77163_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77163_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77163_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77163_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77165_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77165_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77165_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77165_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77165_total_iter = 0;
    ctx->futhark_mc_segscan_task_77160_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77160_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77160_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77160_total_time = 0;
    ctx->futhark_mc_segscan_task_77160_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77169_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77169_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77169_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77169_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77169_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77169_total_iter = 0;
    ctx->futhark_mc_segmap_task_77167_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77167_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77167_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77167_total_time = 0;
    ctx->futhark_mc_segmap_task_77167_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77173_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77173_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77173_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77173_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77173_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77173_total_iter = 0;
    ctx->futhark_mc_segmap_task_77171_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77171_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77171_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77171_total_time = 0;
    ctx->futhark_mc_segmap_task_77171_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77177_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77177_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77177_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77177_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77177_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77177_total_iter = 0;
    ctx->futhark_mc_segmap_task_77175_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77175_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77175_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77175_total_time = 0;
    ctx->futhark_mc_segmap_task_77175_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77181_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77181_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77181_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77181_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77181_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77181_total_iter = 0;
    ctx->futhark_mc_segmap_task_77179_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77179_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77179_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77179_total_time = 0;
    ctx->futhark_mc_segmap_task_77179_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77193_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77193_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77193_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77193_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77193_total_iter = 0;
    ctx->futhark_mc_segred_task_77186_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77186_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77186_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77186_total_time = 0;
    ctx->futhark_mc_segred_task_77186_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77199_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77199_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77199_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77199_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77199_total_iter = 0;
    ctx->futhark_mc_segred_task_77195_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77195_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77195_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77195_total_time = 0;
    ctx->futhark_mc_segred_task_77195_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77184_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77184_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77184_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77184_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77184_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77184_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77182_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77182_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77182_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77151_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77151_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77151_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77151_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77151_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77151_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77149_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77149_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77149_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77203_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77203_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77203_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77203_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77203_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77203_total_iter = 0;
    ctx->futhark_mc_segmap_task_77201_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77201_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77201_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77201_total_time = 0;
    ctx->futhark_mc_segmap_task_77201_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77224_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77224_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77224_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77224_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77224_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77226_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77226_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77226_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77226_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77226_total_iter = 0;
    ctx->futhark_mc_segscan_task_77221_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77221_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77221_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77221_total_time = 0;
    ctx->futhark_mc_segscan_task_77221_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77230_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77230_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77230_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77230_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77230_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77230_total_iter = 0;
    ctx->futhark_mc_segmap_task_77228_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77228_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77228_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77228_total_time = 0;
    ctx->futhark_mc_segmap_task_77228_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77234_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77234_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77234_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77234_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77234_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77234_total_iter = 0;
    ctx->futhark_mc_segmap_task_77232_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77232_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77232_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77232_total_time = 0;
    ctx->futhark_mc_segmap_task_77232_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77238_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77238_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77238_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77238_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77238_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77238_total_iter = 0;
    ctx->futhark_mc_segmap_task_77236_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77236_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77236_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77236_total_time = 0;
    ctx->futhark_mc_segmap_task_77236_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77242_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77242_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77242_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77242_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77242_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77242_total_iter = 0;
    ctx->futhark_mc_segmap_task_77240_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77240_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77240_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77240_total_time = 0;
    ctx->futhark_mc_segmap_task_77240_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77252_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77252_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77252_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77252_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77252_total_iter = 0;
    ctx->futhark_mc_segred_task_77249_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77249_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77249_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77249_total_time = 0;
    ctx->futhark_mc_segred_task_77249_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77257_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77257_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77257_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77257_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77257_total_iter = 0;
    ctx->futhark_mc_segred_task_77254_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77254_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77254_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77254_total_time = 0;
    ctx->futhark_mc_segred_task_77254_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77246_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77246_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77246_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77246_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77246_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77246_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77244_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77244_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77244_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77213_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77213_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77213_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77213_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77213_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77213_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77211_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77211_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77211_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77261_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77261_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77261_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77261_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77261_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77261_total_iter = 0;
    ctx->futhark_mc_segmap_task_77259_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77259_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77259_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77259_total_time = 0;
    ctx->futhark_mc_segmap_task_77259_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77285_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77285_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77285_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77285_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77285_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77287_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77287_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77287_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77287_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77287_total_iter = 0;
    ctx->futhark_mc_segscan_task_77282_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77282_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77282_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77282_total_time = 0;
    ctx->futhark_mc_segscan_task_77282_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77291_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77291_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77291_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77291_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77291_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77291_total_iter = 0;
    ctx->futhark_mc_segmap_task_77289_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77289_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77289_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77289_total_time = 0;
    ctx->futhark_mc_segmap_task_77289_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77295_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77295_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77295_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77295_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77295_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77295_total_iter = 0;
    ctx->futhark_mc_segmap_task_77293_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77293_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77293_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77293_total_time = 0;
    ctx->futhark_mc_segmap_task_77293_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77299_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77299_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77299_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77299_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77299_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77299_total_iter = 0;
    ctx->futhark_mc_segmap_task_77297_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77297_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77297_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77297_total_time = 0;
    ctx->futhark_mc_segmap_task_77297_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77303_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77303_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77303_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77303_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77303_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77303_total_iter = 0;
    ctx->futhark_mc_segmap_task_77301_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77301_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77301_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77301_total_time = 0;
    ctx->futhark_mc_segmap_task_77301_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77317_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77317_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77317_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77317_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77317_total_iter = 0;
    ctx->futhark_mc_segred_task_77312_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77312_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77312_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77312_total_time = 0;
    ctx->futhark_mc_segred_task_77312_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77323_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77323_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77323_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77323_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77323_total_iter = 0;
    ctx->futhark_mc_segred_task_77319_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77319_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77319_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77319_total_time = 0;
    ctx->futhark_mc_segred_task_77319_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77308_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77308_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77308_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77308_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77308_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77308_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77306_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77306_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77306_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77273_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77273_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77273_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77273_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77273_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77273_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77271_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77271_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77271_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77327_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77327_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77327_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77327_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77327_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77327_total_iter = 0;
    ctx->futhark_mc_segmap_task_77325_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77325_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77325_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77325_total_time = 0;
    ctx->futhark_mc_segmap_task_77325_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77353_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77353_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77353_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_77353_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_77353_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77355_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77355_runs = calloc(sizeof(int),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77355_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_77355_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_77355_total_iter = 0;
    ctx->futhark_mc_segscan_task_77350_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77350_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77350_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_77350_total_time = 0;
    ctx->futhark_mc_segscan_task_77350_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77359_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77359_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77359_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77359_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77359_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77359_total_iter = 0;
    ctx->futhark_mc_segmap_task_77357_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77357_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77357_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77357_total_time = 0;
    ctx->futhark_mc_segmap_task_77357_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77363_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77363_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77363_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77363_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77363_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77363_total_iter = 0;
    ctx->futhark_mc_segmap_task_77361_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77361_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77361_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77361_total_time = 0;
    ctx->futhark_mc_segmap_task_77361_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77367_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77367_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77367_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77367_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77367_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77367_total_iter = 0;
    ctx->futhark_mc_segmap_task_77365_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77365_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77365_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77365_total_time = 0;
    ctx->futhark_mc_segmap_task_77365_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77371_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77371_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77371_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77371_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77371_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77371_total_iter = 0;
    ctx->futhark_mc_segmap_task_77369_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77369_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77369_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77369_total_time = 0;
    ctx->futhark_mc_segmap_task_77369_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77386_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77386_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77386_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77386_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77386_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77386_total_iter = 0;
    ctx->futhark_mc_segmap_task_77384_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77384_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77384_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77384_total_time = 0;
    ctx->futhark_mc_segmap_task_77384_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77395_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77395_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77395_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77395_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77395_total_iter = 0;
    ctx->futhark_mc_segred_task_77388_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77388_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77388_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77388_total_time = 0;
    ctx->futhark_mc_segred_task_77388_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77401_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77401_runs = calloc(sizeof(int),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77401_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_77401_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_77401_total_iter = 0;
    ctx->futhark_mc_segred_task_77397_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77397_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77397_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_77397_total_time = 0;
    ctx->futhark_mc_segred_task_77397_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77378_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77378_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77378_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77378_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77378_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77378_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77376_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77376_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77376_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77341_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77341_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77341_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77341_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77341_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77341_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77339_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77339_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77339_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77405_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77405_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77405_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77405_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77405_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77405_total_iter = 0;
    ctx->futhark_mc_segmap_task_77403_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77403_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77403_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77403_total_time = 0;
    ctx->futhark_mc_segmap_task_77403_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77414_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77414_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77414_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77414_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77414_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77414_total_iter = 0;
    ctx->futhark_mc_segmap_task_77412_total_runtime = calloc(sizeof(int64_t),
                                                             ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77412_runs = calloc(sizeof(int),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77412_iter = calloc(sizeof(sizeof(int64_t)),
                                                    ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_77412_total_time = 0;
    ctx->futhark_mc_segmap_task_77412_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_77409_total_runtime = calloc(sizeof(int64_t),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77409_runs = calloc(sizeof(int),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77409_iter = calloc(sizeof(sizeof(int64_t)),
                                                       ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_77409_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_77409_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_77409_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_77407_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77407_runs = calloc(sizeof(int),
                                                           ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_77407_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    init_constants(ctx);
    return ctx;
}
void futhark_context_free(struct futhark_context *ctx)
{
    free(ctx->futhark_mc_segmap_parloop_77026_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77026_runs);
    free(ctx->futhark_mc_segmap_parloop_77026_iter);
    free(ctx->futhark_mc_segmap_task_77024_total_runtime);
    free(ctx->futhark_mc_segmap_task_77024_runs);
    free(ctx->futhark_mc_segmap_task_77024_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_77046_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_77046_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_77046_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_77048_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_77048_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_77048_iter);
    free(ctx->futhark_mc_segscan_task_77043_total_runtime);
    free(ctx->futhark_mc_segscan_task_77043_runs);
    free(ctx->futhark_mc_segscan_task_77043_iter);
    free(ctx->futhark_mc_segmap_parloop_77052_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77052_runs);
    free(ctx->futhark_mc_segmap_parloop_77052_iter);
    free(ctx->futhark_mc_segmap_task_77050_total_runtime);
    free(ctx->futhark_mc_segmap_task_77050_runs);
    free(ctx->futhark_mc_segmap_task_77050_iter);
    free(ctx->futhark_mc_segmap_parloop_77056_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77056_runs);
    free(ctx->futhark_mc_segmap_parloop_77056_iter);
    free(ctx->futhark_mc_segmap_task_77054_total_runtime);
    free(ctx->futhark_mc_segmap_task_77054_runs);
    free(ctx->futhark_mc_segmap_task_77054_iter);
    free(ctx->futhark_mc_segmap_parloop_77060_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77060_runs);
    free(ctx->futhark_mc_segmap_parloop_77060_iter);
    free(ctx->futhark_mc_segmap_task_77058_total_runtime);
    free(ctx->futhark_mc_segmap_task_77058_runs);
    free(ctx->futhark_mc_segmap_task_77058_iter);
    free(ctx->futhark_mc_segmap_parloop_77064_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77064_runs);
    free(ctx->futhark_mc_segmap_parloop_77064_iter);
    free(ctx->futhark_mc_segmap_task_77062_total_runtime);
    free(ctx->futhark_mc_segmap_task_77062_runs);
    free(ctx->futhark_mc_segmap_task_77062_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77072_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77072_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77072_iter);
    free(ctx->futhark_mc_segred_task_77069_total_runtime);
    free(ctx->futhark_mc_segred_task_77069_runs);
    free(ctx->futhark_mc_segred_task_77069_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77077_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77077_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77077_iter);
    free(ctx->futhark_mc_segred_task_77074_total_runtime);
    free(ctx->futhark_mc_segred_task_77074_runs);
    free(ctx->futhark_mc_segred_task_77074_iter);
    free(ctx->futhark_mc_segmap_parloop_77067_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77067_runs);
    free(ctx->futhark_mc_segmap_parloop_77067_iter);
    free(ctx->futhark_mc_segmap_nested_task_77065_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77065_runs);
    free(ctx->futhark_mc_segmap_nested_task_77065_iter);
    free(ctx->futhark_mc_segmap_parloop_77035_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77035_runs);
    free(ctx->futhark_mc_segmap_parloop_77035_iter);
    free(ctx->futhark_mc_segmap_nested_task_77033_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77033_runs);
    free(ctx->futhark_mc_segmap_nested_task_77033_iter);
    free(ctx->futhark_mc_segmap_parloop_77081_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77081_runs);
    free(ctx->futhark_mc_segmap_parloop_77081_iter);
    free(ctx->futhark_mc_segmap_task_77079_total_runtime);
    free(ctx->futhark_mc_segmap_task_77079_runs);
    free(ctx->futhark_mc_segmap_task_77079_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_77103_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_77103_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_77103_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_77105_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_77105_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_77105_iter);
    free(ctx->futhark_mc_segscan_task_77100_total_runtime);
    free(ctx->futhark_mc_segscan_task_77100_runs);
    free(ctx->futhark_mc_segscan_task_77100_iter);
    free(ctx->futhark_mc_segmap_parloop_77109_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77109_runs);
    free(ctx->futhark_mc_segmap_parloop_77109_iter);
    free(ctx->futhark_mc_segmap_task_77107_total_runtime);
    free(ctx->futhark_mc_segmap_task_77107_runs);
    free(ctx->futhark_mc_segmap_task_77107_iter);
    free(ctx->futhark_mc_segmap_parloop_77113_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77113_runs);
    free(ctx->futhark_mc_segmap_parloop_77113_iter);
    free(ctx->futhark_mc_segmap_task_77111_total_runtime);
    free(ctx->futhark_mc_segmap_task_77111_runs);
    free(ctx->futhark_mc_segmap_task_77111_iter);
    free(ctx->futhark_mc_segmap_parloop_77117_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77117_runs);
    free(ctx->futhark_mc_segmap_parloop_77117_iter);
    free(ctx->futhark_mc_segmap_task_77115_total_runtime);
    free(ctx->futhark_mc_segmap_task_77115_runs);
    free(ctx->futhark_mc_segmap_task_77115_iter);
    free(ctx->futhark_mc_segmap_parloop_77121_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77121_runs);
    free(ctx->futhark_mc_segmap_parloop_77121_iter);
    free(ctx->futhark_mc_segmap_task_77119_total_runtime);
    free(ctx->futhark_mc_segmap_task_77119_runs);
    free(ctx->futhark_mc_segmap_task_77119_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77131_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77131_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77131_iter);
    free(ctx->futhark_mc_segred_task_77126_total_runtime);
    free(ctx->futhark_mc_segred_task_77126_runs);
    free(ctx->futhark_mc_segred_task_77126_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77137_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77137_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77137_iter);
    free(ctx->futhark_mc_segred_task_77133_total_runtime);
    free(ctx->futhark_mc_segred_task_77133_runs);
    free(ctx->futhark_mc_segred_task_77133_iter);
    free(ctx->futhark_mc_segmap_parloop_77124_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77124_runs);
    free(ctx->futhark_mc_segmap_parloop_77124_iter);
    free(ctx->futhark_mc_segmap_nested_task_77122_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77122_runs);
    free(ctx->futhark_mc_segmap_nested_task_77122_iter);
    free(ctx->futhark_mc_segmap_parloop_77091_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77091_runs);
    free(ctx->futhark_mc_segmap_parloop_77091_iter);
    free(ctx->futhark_mc_segmap_nested_task_77089_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77089_runs);
    free(ctx->futhark_mc_segmap_nested_task_77089_iter);
    free(ctx->futhark_mc_segmap_parloop_77141_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77141_runs);
    free(ctx->futhark_mc_segmap_parloop_77141_iter);
    free(ctx->futhark_mc_segmap_task_77139_total_runtime);
    free(ctx->futhark_mc_segmap_task_77139_runs);
    free(ctx->futhark_mc_segmap_task_77139_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_77163_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_77163_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_77163_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_77165_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_77165_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_77165_iter);
    free(ctx->futhark_mc_segscan_task_77160_total_runtime);
    free(ctx->futhark_mc_segscan_task_77160_runs);
    free(ctx->futhark_mc_segscan_task_77160_iter);
    free(ctx->futhark_mc_segmap_parloop_77169_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77169_runs);
    free(ctx->futhark_mc_segmap_parloop_77169_iter);
    free(ctx->futhark_mc_segmap_task_77167_total_runtime);
    free(ctx->futhark_mc_segmap_task_77167_runs);
    free(ctx->futhark_mc_segmap_task_77167_iter);
    free(ctx->futhark_mc_segmap_parloop_77173_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77173_runs);
    free(ctx->futhark_mc_segmap_parloop_77173_iter);
    free(ctx->futhark_mc_segmap_task_77171_total_runtime);
    free(ctx->futhark_mc_segmap_task_77171_runs);
    free(ctx->futhark_mc_segmap_task_77171_iter);
    free(ctx->futhark_mc_segmap_parloop_77177_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77177_runs);
    free(ctx->futhark_mc_segmap_parloop_77177_iter);
    free(ctx->futhark_mc_segmap_task_77175_total_runtime);
    free(ctx->futhark_mc_segmap_task_77175_runs);
    free(ctx->futhark_mc_segmap_task_77175_iter);
    free(ctx->futhark_mc_segmap_parloop_77181_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77181_runs);
    free(ctx->futhark_mc_segmap_parloop_77181_iter);
    free(ctx->futhark_mc_segmap_task_77179_total_runtime);
    free(ctx->futhark_mc_segmap_task_77179_runs);
    free(ctx->futhark_mc_segmap_task_77179_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77193_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77193_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77193_iter);
    free(ctx->futhark_mc_segred_task_77186_total_runtime);
    free(ctx->futhark_mc_segred_task_77186_runs);
    free(ctx->futhark_mc_segred_task_77186_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77199_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77199_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77199_iter);
    free(ctx->futhark_mc_segred_task_77195_total_runtime);
    free(ctx->futhark_mc_segred_task_77195_runs);
    free(ctx->futhark_mc_segred_task_77195_iter);
    free(ctx->futhark_mc_segmap_parloop_77184_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77184_runs);
    free(ctx->futhark_mc_segmap_parloop_77184_iter);
    free(ctx->futhark_mc_segmap_nested_task_77182_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77182_runs);
    free(ctx->futhark_mc_segmap_nested_task_77182_iter);
    free(ctx->futhark_mc_segmap_parloop_77151_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77151_runs);
    free(ctx->futhark_mc_segmap_parloop_77151_iter);
    free(ctx->futhark_mc_segmap_nested_task_77149_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77149_runs);
    free(ctx->futhark_mc_segmap_nested_task_77149_iter);
    free(ctx->futhark_mc_segmap_parloop_77203_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77203_runs);
    free(ctx->futhark_mc_segmap_parloop_77203_iter);
    free(ctx->futhark_mc_segmap_task_77201_total_runtime);
    free(ctx->futhark_mc_segmap_task_77201_runs);
    free(ctx->futhark_mc_segmap_task_77201_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_77224_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_77224_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_77224_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_77226_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_77226_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_77226_iter);
    free(ctx->futhark_mc_segscan_task_77221_total_runtime);
    free(ctx->futhark_mc_segscan_task_77221_runs);
    free(ctx->futhark_mc_segscan_task_77221_iter);
    free(ctx->futhark_mc_segmap_parloop_77230_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77230_runs);
    free(ctx->futhark_mc_segmap_parloop_77230_iter);
    free(ctx->futhark_mc_segmap_task_77228_total_runtime);
    free(ctx->futhark_mc_segmap_task_77228_runs);
    free(ctx->futhark_mc_segmap_task_77228_iter);
    free(ctx->futhark_mc_segmap_parloop_77234_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77234_runs);
    free(ctx->futhark_mc_segmap_parloop_77234_iter);
    free(ctx->futhark_mc_segmap_task_77232_total_runtime);
    free(ctx->futhark_mc_segmap_task_77232_runs);
    free(ctx->futhark_mc_segmap_task_77232_iter);
    free(ctx->futhark_mc_segmap_parloop_77238_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77238_runs);
    free(ctx->futhark_mc_segmap_parloop_77238_iter);
    free(ctx->futhark_mc_segmap_task_77236_total_runtime);
    free(ctx->futhark_mc_segmap_task_77236_runs);
    free(ctx->futhark_mc_segmap_task_77236_iter);
    free(ctx->futhark_mc_segmap_parloop_77242_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77242_runs);
    free(ctx->futhark_mc_segmap_parloop_77242_iter);
    free(ctx->futhark_mc_segmap_task_77240_total_runtime);
    free(ctx->futhark_mc_segmap_task_77240_runs);
    free(ctx->futhark_mc_segmap_task_77240_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77252_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77252_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77252_iter);
    free(ctx->futhark_mc_segred_task_77249_total_runtime);
    free(ctx->futhark_mc_segred_task_77249_runs);
    free(ctx->futhark_mc_segred_task_77249_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77257_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77257_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77257_iter);
    free(ctx->futhark_mc_segred_task_77254_total_runtime);
    free(ctx->futhark_mc_segred_task_77254_runs);
    free(ctx->futhark_mc_segred_task_77254_iter);
    free(ctx->futhark_mc_segmap_parloop_77246_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77246_runs);
    free(ctx->futhark_mc_segmap_parloop_77246_iter);
    free(ctx->futhark_mc_segmap_nested_task_77244_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77244_runs);
    free(ctx->futhark_mc_segmap_nested_task_77244_iter);
    free(ctx->futhark_mc_segmap_parloop_77213_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77213_runs);
    free(ctx->futhark_mc_segmap_parloop_77213_iter);
    free(ctx->futhark_mc_segmap_nested_task_77211_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77211_runs);
    free(ctx->futhark_mc_segmap_nested_task_77211_iter);
    free(ctx->futhark_mc_segmap_parloop_77261_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77261_runs);
    free(ctx->futhark_mc_segmap_parloop_77261_iter);
    free(ctx->futhark_mc_segmap_task_77259_total_runtime);
    free(ctx->futhark_mc_segmap_task_77259_runs);
    free(ctx->futhark_mc_segmap_task_77259_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_77285_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_77285_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_77285_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_77287_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_77287_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_77287_iter);
    free(ctx->futhark_mc_segscan_task_77282_total_runtime);
    free(ctx->futhark_mc_segscan_task_77282_runs);
    free(ctx->futhark_mc_segscan_task_77282_iter);
    free(ctx->futhark_mc_segmap_parloop_77291_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77291_runs);
    free(ctx->futhark_mc_segmap_parloop_77291_iter);
    free(ctx->futhark_mc_segmap_task_77289_total_runtime);
    free(ctx->futhark_mc_segmap_task_77289_runs);
    free(ctx->futhark_mc_segmap_task_77289_iter);
    free(ctx->futhark_mc_segmap_parloop_77295_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77295_runs);
    free(ctx->futhark_mc_segmap_parloop_77295_iter);
    free(ctx->futhark_mc_segmap_task_77293_total_runtime);
    free(ctx->futhark_mc_segmap_task_77293_runs);
    free(ctx->futhark_mc_segmap_task_77293_iter);
    free(ctx->futhark_mc_segmap_parloop_77299_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77299_runs);
    free(ctx->futhark_mc_segmap_parloop_77299_iter);
    free(ctx->futhark_mc_segmap_task_77297_total_runtime);
    free(ctx->futhark_mc_segmap_task_77297_runs);
    free(ctx->futhark_mc_segmap_task_77297_iter);
    free(ctx->futhark_mc_segmap_parloop_77303_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77303_runs);
    free(ctx->futhark_mc_segmap_parloop_77303_iter);
    free(ctx->futhark_mc_segmap_task_77301_total_runtime);
    free(ctx->futhark_mc_segmap_task_77301_runs);
    free(ctx->futhark_mc_segmap_task_77301_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77317_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77317_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77317_iter);
    free(ctx->futhark_mc_segred_task_77312_total_runtime);
    free(ctx->futhark_mc_segred_task_77312_runs);
    free(ctx->futhark_mc_segred_task_77312_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77323_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77323_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77323_iter);
    free(ctx->futhark_mc_segred_task_77319_total_runtime);
    free(ctx->futhark_mc_segred_task_77319_runs);
    free(ctx->futhark_mc_segred_task_77319_iter);
    free(ctx->futhark_mc_segmap_parloop_77308_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77308_runs);
    free(ctx->futhark_mc_segmap_parloop_77308_iter);
    free(ctx->futhark_mc_segmap_nested_task_77306_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77306_runs);
    free(ctx->futhark_mc_segmap_nested_task_77306_iter);
    free(ctx->futhark_mc_segmap_parloop_77273_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77273_runs);
    free(ctx->futhark_mc_segmap_parloop_77273_iter);
    free(ctx->futhark_mc_segmap_nested_task_77271_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77271_runs);
    free(ctx->futhark_mc_segmap_nested_task_77271_iter);
    free(ctx->futhark_mc_segmap_parloop_77327_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77327_runs);
    free(ctx->futhark_mc_segmap_parloop_77327_iter);
    free(ctx->futhark_mc_segmap_task_77325_total_runtime);
    free(ctx->futhark_mc_segmap_task_77325_runs);
    free(ctx->futhark_mc_segmap_task_77325_iter);
    free(ctx->futhark_mc_scan_stage_1_parloop_77353_total_runtime);
    free(ctx->futhark_mc_scan_stage_1_parloop_77353_runs);
    free(ctx->futhark_mc_scan_stage_1_parloop_77353_iter);
    free(ctx->futhark_mc_scan_stage_3_parloop_77355_total_runtime);
    free(ctx->futhark_mc_scan_stage_3_parloop_77355_runs);
    free(ctx->futhark_mc_scan_stage_3_parloop_77355_iter);
    free(ctx->futhark_mc_segscan_task_77350_total_runtime);
    free(ctx->futhark_mc_segscan_task_77350_runs);
    free(ctx->futhark_mc_segscan_task_77350_iter);
    free(ctx->futhark_mc_segmap_parloop_77359_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77359_runs);
    free(ctx->futhark_mc_segmap_parloop_77359_iter);
    free(ctx->futhark_mc_segmap_task_77357_total_runtime);
    free(ctx->futhark_mc_segmap_task_77357_runs);
    free(ctx->futhark_mc_segmap_task_77357_iter);
    free(ctx->futhark_mc_segmap_parloop_77363_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77363_runs);
    free(ctx->futhark_mc_segmap_parloop_77363_iter);
    free(ctx->futhark_mc_segmap_task_77361_total_runtime);
    free(ctx->futhark_mc_segmap_task_77361_runs);
    free(ctx->futhark_mc_segmap_task_77361_iter);
    free(ctx->futhark_mc_segmap_parloop_77367_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77367_runs);
    free(ctx->futhark_mc_segmap_parloop_77367_iter);
    free(ctx->futhark_mc_segmap_task_77365_total_runtime);
    free(ctx->futhark_mc_segmap_task_77365_runs);
    free(ctx->futhark_mc_segmap_task_77365_iter);
    free(ctx->futhark_mc_segmap_parloop_77371_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77371_runs);
    free(ctx->futhark_mc_segmap_parloop_77371_iter);
    free(ctx->futhark_mc_segmap_task_77369_total_runtime);
    free(ctx->futhark_mc_segmap_task_77369_runs);
    free(ctx->futhark_mc_segmap_task_77369_iter);
    free(ctx->futhark_mc_segmap_parloop_77386_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77386_runs);
    free(ctx->futhark_mc_segmap_parloop_77386_iter);
    free(ctx->futhark_mc_segmap_task_77384_total_runtime);
    free(ctx->futhark_mc_segmap_task_77384_runs);
    free(ctx->futhark_mc_segmap_task_77384_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77395_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77395_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77395_iter);
    free(ctx->futhark_mc_segred_task_77388_total_runtime);
    free(ctx->futhark_mc_segred_task_77388_runs);
    free(ctx->futhark_mc_segred_task_77388_iter);
    free(ctx->futhark_mc_segred_stage_1_parloop_77401_total_runtime);
    free(ctx->futhark_mc_segred_stage_1_parloop_77401_runs);
    free(ctx->futhark_mc_segred_stage_1_parloop_77401_iter);
    free(ctx->futhark_mc_segred_task_77397_total_runtime);
    free(ctx->futhark_mc_segred_task_77397_runs);
    free(ctx->futhark_mc_segred_task_77397_iter);
    free(ctx->futhark_mc_segmap_parloop_77378_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77378_runs);
    free(ctx->futhark_mc_segmap_parloop_77378_iter);
    free(ctx->futhark_mc_segmap_nested_task_77376_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77376_runs);
    free(ctx->futhark_mc_segmap_nested_task_77376_iter);
    free(ctx->futhark_mc_segmap_parloop_77341_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77341_runs);
    free(ctx->futhark_mc_segmap_parloop_77341_iter);
    free(ctx->futhark_mc_segmap_nested_task_77339_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77339_runs);
    free(ctx->futhark_mc_segmap_nested_task_77339_iter);
    free(ctx->futhark_mc_segmap_parloop_77405_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77405_runs);
    free(ctx->futhark_mc_segmap_parloop_77405_iter);
    free(ctx->futhark_mc_segmap_task_77403_total_runtime);
    free(ctx->futhark_mc_segmap_task_77403_runs);
    free(ctx->futhark_mc_segmap_task_77403_iter);
    free(ctx->futhark_mc_segmap_parloop_77414_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77414_runs);
    free(ctx->futhark_mc_segmap_parloop_77414_iter);
    free(ctx->futhark_mc_segmap_task_77412_total_runtime);
    free(ctx->futhark_mc_segmap_task_77412_runs);
    free(ctx->futhark_mc_segmap_task_77412_iter);
    free(ctx->futhark_mc_segmap_parloop_77409_total_runtime);
    free(ctx->futhark_mc_segmap_parloop_77409_runs);
    free(ctx->futhark_mc_segmap_parloop_77409_iter);
    free(ctx->futhark_mc_segmap_nested_task_77407_total_runtime);
    free(ctx->futhark_mc_segmap_nested_task_77407_runs);
    free(ctx->futhark_mc_segmap_nested_task_77407_iter);
    free_constants(ctx);
    (void) scheduler_destroy(&ctx->scheduler);
    free_lock(&ctx->lock);
    ctx->cfg->in_use = 0;
    free(ctx);
}
int futhark_context_sync(struct futhark_context *ctx)
{
    (void) ctx;
    return 0;
}
static const char *tuning_param_names[0];
static const char *tuning_param_vars[0];
static const char *tuning_param_classes[0];
int futhark_context_config_set_tuning_param(struct futhark_context_config *cfg,
                                            const char *param_name,
                                            size_t param_value)
{
    (void) cfg;
    (void) param_name;
    (void) param_value;
    return 1;
}
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) {
        { }
    }
    if (ctx->profiling) {
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77026          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77026_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77026_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77026_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77026_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77026_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77026_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77026_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77026_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77026_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77026_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77026_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77026_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77026_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77026_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77026_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77026_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77026_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77026_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77026_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77026_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77026_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77026_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77026_total_iter /
                (ctx->futhark_mc_segmap_parloop_77026_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77026_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77026_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77026_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_77046    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_1_parloop_77046_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77046_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77046_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77046_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77046_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_77046_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77046_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77046_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77046_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77046_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77046_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77046_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_77046_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77046_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77046_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_77046_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77046_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77046_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77046_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77046_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_77046_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_77048    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_3_parloop_77048_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77048_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77048_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77048_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77048_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_77048_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77048_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77048_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77048_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77048_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77048_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77048_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_77048_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77048_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77048_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_77048_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77048_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77048_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77048_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77048_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_77048_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_77043            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_77043_runs[i],
                    (long) ctx->futhark_mc_segscan_task_77043_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77043_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77043_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_77043_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_77043_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77043_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_77043_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_77043_iter[i],
                    (long) ctx->futhark_mc_segscan_task_77043_iter[i] /
                    (ctx->futhark_mc_segscan_task_77043_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77043_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77052          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77052_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77052_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77052_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77052_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77052_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77052_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77052_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77052_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77052_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77052_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77052_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77052_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77052_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77052_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77052_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77052_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77052_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77052_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77052_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77052_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77052_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77052_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77052_total_iter /
                (ctx->futhark_mc_segmap_parloop_77052_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77052_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77052_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77052_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77050             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77050_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77050_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77050_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77050_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77050_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77050_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77050_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77050_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77050_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77050_iter[i] /
                    (ctx->futhark_mc_segmap_task_77050_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77050_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77056          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77056_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77056_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77056_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77056_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77056_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77056_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77056_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77056_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77056_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77056_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77056_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77056_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77056_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77056_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77056_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77056_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77056_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77056_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77056_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77056_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77056_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77056_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77056_total_iter /
                (ctx->futhark_mc_segmap_parloop_77056_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77056_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77056_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77056_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77054             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77054_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77054_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77054_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77054_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77054_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77054_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77054_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77054_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77054_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77054_iter[i] /
                    (ctx->futhark_mc_segmap_task_77054_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77054_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77060          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77060_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77060_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77060_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77060_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77060_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77060_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77060_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77060_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77060_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77060_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77060_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77060_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77060_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77060_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77060_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77060_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77060_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77060_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77060_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77060_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77060_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77060_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77060_total_iter /
                (ctx->futhark_mc_segmap_parloop_77060_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77060_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77060_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77060_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77058             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77058_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77058_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77058_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77058_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77058_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77058_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77058_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77058_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77058_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77058_iter[i] /
                    (ctx->futhark_mc_segmap_task_77058_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77058_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77064          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77064_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77064_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77064_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77064_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77064_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77064_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77064_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77064_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77064_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77064_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77064_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77064_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77064_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77064_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77064_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77064_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77064_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77064_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77064_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77064_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77064_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77064_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77064_total_iter /
                (ctx->futhark_mc_segmap_parloop_77064_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77064_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77064_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77064_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77072  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77072_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77072_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77072_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77072_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77072_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77072_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77072_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77072_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77072_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77072_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77072_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77072_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77072_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77072_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77072_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77072_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77072_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77072_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77072_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77072_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77072_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77069             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77069_runs[i],
                    (long) ctx->futhark_mc_segred_task_77069_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77069_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77069_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77069_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77069_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77069_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77069_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77069_iter[i],
                    (long) ctx->futhark_mc_segred_task_77069_iter[i] /
                    (ctx->futhark_mc_segred_task_77069_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77069_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77077  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77077_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77077_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77077_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77077_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77077_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77077_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77077_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77077_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77077_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77077_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77077_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77077_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77077_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77077_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77077_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77077_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77077_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77077_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77077_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77077_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77077_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77074             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77074_runs[i],
                    (long) ctx->futhark_mc_segred_task_77074_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77074_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77074_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77074_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77074_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77074_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77074_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77074_iter[i],
                    (long) ctx->futhark_mc_segred_task_77074_iter[i] /
                    (ctx->futhark_mc_segred_task_77074_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77074_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77067          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77067_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77067_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77067_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77067_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77067_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77067_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77067_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77067_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77067_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77067_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77067_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77067_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77067_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77067_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77067_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77067_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77067_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77067_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77067_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77067_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77067_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77067_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77067_total_iter /
                (ctx->futhark_mc_segmap_parloop_77067_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77067_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77067_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77067_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77062             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77062_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77062_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77062_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77062_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77062_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77062_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77062_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77062_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77062_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77062_iter[i] /
                    (ctx->futhark_mc_segmap_task_77062_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77062_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77065      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77065_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77065_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77065_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77065_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77065_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77065_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77065_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77065_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77065_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77065_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77065_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77065_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77035          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77035_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77035_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77035_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77035_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77035_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77035_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77035_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77035_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77035_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77035_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77035_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77035_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77035_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77035_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77035_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77035_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77035_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77035_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77035_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77035_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77035_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77035_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77035_total_iter /
                (ctx->futhark_mc_segmap_parloop_77035_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77035_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77035_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77035_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77024             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77024_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77024_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77024_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77024_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77024_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77024_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77024_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77024_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77024_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77024_iter[i] /
                    (ctx->futhark_mc_segmap_task_77024_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77024_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77033      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77033_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77033_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77033_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77033_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77033_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77033_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77033_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77033_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77033_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77033_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77033_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77033_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77081          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77081_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77081_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77081_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77081_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77081_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77081_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77081_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77081_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77081_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77081_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77081_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77081_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77081_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77081_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77081_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77081_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77081_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77081_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77081_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77081_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77081_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77081_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77081_total_iter /
                (ctx->futhark_mc_segmap_parloop_77081_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77081_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77081_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77081_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_77103    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_1_parloop_77103_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77103_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77103_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77103_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77103_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_77103_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77103_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77103_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77103_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77103_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77103_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77103_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_77103_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77103_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77103_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_77103_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77103_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77103_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77103_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77103_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_77103_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_77105    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_3_parloop_77105_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77105_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77105_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77105_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77105_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_77105_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77105_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77105_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77105_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77105_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77105_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77105_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_77105_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77105_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77105_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_77105_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77105_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77105_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77105_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77105_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_77105_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_77100            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_77100_runs[i],
                    (long) ctx->futhark_mc_segscan_task_77100_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77100_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77100_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_77100_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_77100_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77100_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_77100_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_77100_iter[i],
                    (long) ctx->futhark_mc_segscan_task_77100_iter[i] /
                    (ctx->futhark_mc_segscan_task_77100_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77100_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77109          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77109_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77109_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77109_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77109_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77109_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77109_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77109_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77109_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77109_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77109_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77109_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77109_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77109_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77109_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77109_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77109_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77109_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77109_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77109_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77109_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77109_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77109_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77109_total_iter /
                (ctx->futhark_mc_segmap_parloop_77109_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77109_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77109_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77109_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77107             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77107_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77107_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77107_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77107_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77107_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77107_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77107_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77107_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77107_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77107_iter[i] /
                    (ctx->futhark_mc_segmap_task_77107_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77107_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77113          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77113_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77113_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77113_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77113_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77113_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77113_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77113_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77113_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77113_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77113_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77113_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77113_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77113_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77113_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77113_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77113_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77113_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77113_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77113_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77113_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77113_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77113_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77113_total_iter /
                (ctx->futhark_mc_segmap_parloop_77113_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77113_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77113_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77113_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77111             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77111_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77111_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77111_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77111_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77111_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77111_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77111_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77111_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77111_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77111_iter[i] /
                    (ctx->futhark_mc_segmap_task_77111_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77111_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77117          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77117_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77117_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77117_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77117_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77117_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77117_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77117_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77117_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77117_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77117_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77117_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77117_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77117_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77117_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77117_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77117_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77117_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77117_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77117_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77117_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77117_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77117_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77117_total_iter /
                (ctx->futhark_mc_segmap_parloop_77117_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77117_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77117_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77117_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77115             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77115_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77115_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77115_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77115_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77115_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77115_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77115_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77115_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77115_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77115_iter[i] /
                    (ctx->futhark_mc_segmap_task_77115_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77115_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77121          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77121_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77121_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77121_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77121_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77121_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77121_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77121_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77121_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77121_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77121_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77121_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77121_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77121_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77121_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77121_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77121_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77121_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77121_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77121_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77121_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77121_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77121_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77121_total_iter /
                (ctx->futhark_mc_segmap_parloop_77121_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77121_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77121_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77121_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77131  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77131_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77131_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77131_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77131_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77131_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77131_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77131_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77131_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77131_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77131_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77131_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77131_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77131_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77131_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77131_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77131_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77131_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77131_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77131_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77131_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77131_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77126             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77126_runs[i],
                    (long) ctx->futhark_mc_segred_task_77126_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77126_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77126_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77126_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77126_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77126_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77126_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77126_iter[i],
                    (long) ctx->futhark_mc_segred_task_77126_iter[i] /
                    (ctx->futhark_mc_segred_task_77126_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77126_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77137  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77137_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77137_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77137_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77137_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77137_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77137_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77137_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77137_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77137_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77137_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77137_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77137_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77137_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77137_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77137_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77137_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77137_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77137_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77137_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77137_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77137_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77133             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77133_runs[i],
                    (long) ctx->futhark_mc_segred_task_77133_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77133_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77133_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77133_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77133_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77133_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77133_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77133_iter[i],
                    (long) ctx->futhark_mc_segred_task_77133_iter[i] /
                    (ctx->futhark_mc_segred_task_77133_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77133_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77124          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77124_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77124_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77124_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77124_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77124_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77124_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77124_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77124_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77124_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77124_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77124_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77124_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77124_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77124_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77124_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77124_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77124_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77124_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77124_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77124_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77124_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77124_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77124_total_iter /
                (ctx->futhark_mc_segmap_parloop_77124_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77124_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77124_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77124_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77119             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77119_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77119_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77119_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77119_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77119_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77119_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77119_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77119_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77119_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77119_iter[i] /
                    (ctx->futhark_mc_segmap_task_77119_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77119_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77122      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77122_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77122_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77122_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77122_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77122_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77122_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77122_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77122_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77122_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77122_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77122_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77122_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77091          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77091_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77091_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77091_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77091_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77091_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77091_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77091_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77091_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77091_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77091_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77091_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77091_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77091_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77091_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77091_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77091_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77091_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77091_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77091_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77091_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77091_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77091_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77091_total_iter /
                (ctx->futhark_mc_segmap_parloop_77091_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77091_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77091_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77091_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77079             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77079_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77079_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77079_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77079_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77079_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77079_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77079_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77079_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77079_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77079_iter[i] /
                    (ctx->futhark_mc_segmap_task_77079_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77079_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77089      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77089_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77089_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77089_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77089_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77089_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77089_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77089_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77089_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77089_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77089_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77089_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77089_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77141          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77141_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77141_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77141_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77141_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77141_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77141_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77141_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77141_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77141_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77141_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77141_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77141_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77141_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77141_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77141_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77141_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77141_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77141_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77141_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77141_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77141_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77141_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77141_total_iter /
                (ctx->futhark_mc_segmap_parloop_77141_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77141_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77141_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77141_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_77163    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_1_parloop_77163_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77163_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77163_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77163_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77163_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_77163_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77163_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77163_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77163_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77163_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77163_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77163_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_77163_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77163_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77163_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_77163_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77163_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77163_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77163_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77163_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_77163_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_77165    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_3_parloop_77165_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77165_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77165_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77165_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77165_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_77165_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77165_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77165_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77165_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77165_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77165_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77165_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_77165_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77165_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77165_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_77165_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77165_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77165_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77165_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77165_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_77165_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_77160            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_77160_runs[i],
                    (long) ctx->futhark_mc_segscan_task_77160_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77160_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77160_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_77160_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_77160_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77160_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_77160_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_77160_iter[i],
                    (long) ctx->futhark_mc_segscan_task_77160_iter[i] /
                    (ctx->futhark_mc_segscan_task_77160_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77160_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77169          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77169_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77169_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77169_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77169_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77169_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77169_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77169_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77169_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77169_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77169_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77169_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77169_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77169_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77169_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77169_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77169_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77169_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77169_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77169_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77169_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77169_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77169_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77169_total_iter /
                (ctx->futhark_mc_segmap_parloop_77169_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77169_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77169_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77169_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77167             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77167_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77167_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77167_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77167_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77167_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77167_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77167_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77167_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77167_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77167_iter[i] /
                    (ctx->futhark_mc_segmap_task_77167_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77167_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77173          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77173_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77173_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77173_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77173_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77173_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77173_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77173_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77173_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77173_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77173_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77173_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77173_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77173_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77173_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77173_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77173_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77173_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77173_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77173_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77173_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77173_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77173_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77173_total_iter /
                (ctx->futhark_mc_segmap_parloop_77173_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77173_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77173_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77173_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77171             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77171_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77171_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77171_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77171_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77171_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77171_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77171_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77171_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77171_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77171_iter[i] /
                    (ctx->futhark_mc_segmap_task_77171_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77171_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77177          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77177_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77177_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77177_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77177_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77177_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77177_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77177_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77177_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77177_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77177_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77177_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77177_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77177_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77177_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77177_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77177_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77177_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77177_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77177_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77177_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77177_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77177_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77177_total_iter /
                (ctx->futhark_mc_segmap_parloop_77177_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77177_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77177_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77177_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77175             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77175_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77175_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77175_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77175_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77175_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77175_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77175_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77175_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77175_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77175_iter[i] /
                    (ctx->futhark_mc_segmap_task_77175_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77175_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77181          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77181_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77181_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77181_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77181_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77181_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77181_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77181_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77181_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77181_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77181_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77181_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77181_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77181_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77181_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77181_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77181_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77181_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77181_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77181_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77181_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77181_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77181_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77181_total_iter /
                (ctx->futhark_mc_segmap_parloop_77181_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77181_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77181_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77181_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77193  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77193_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77193_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77193_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77193_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77193_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77193_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77193_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77193_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77193_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77193_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77193_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77193_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77193_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77193_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77193_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77193_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77193_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77193_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77193_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77193_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77193_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77186             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77186_runs[i],
                    (long) ctx->futhark_mc_segred_task_77186_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77186_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77186_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77186_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77186_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77186_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77186_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77186_iter[i],
                    (long) ctx->futhark_mc_segred_task_77186_iter[i] /
                    (ctx->futhark_mc_segred_task_77186_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77186_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77199  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77199_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77199_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77199_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77199_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77199_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77199_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77199_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77199_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77199_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77199_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77199_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77199_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77199_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77199_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77199_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77199_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77199_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77199_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77199_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77199_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77199_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77195             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77195_runs[i],
                    (long) ctx->futhark_mc_segred_task_77195_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77195_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77195_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77195_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77195_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77195_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77195_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77195_iter[i],
                    (long) ctx->futhark_mc_segred_task_77195_iter[i] /
                    (ctx->futhark_mc_segred_task_77195_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77195_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77184          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77184_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77184_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77184_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77184_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77184_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77184_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77184_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77184_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77184_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77184_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77184_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77184_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77184_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77184_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77184_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77184_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77184_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77184_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77184_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77184_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77184_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77184_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77184_total_iter /
                (ctx->futhark_mc_segmap_parloop_77184_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77184_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77184_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77184_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77179             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77179_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77179_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77179_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77179_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77179_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77179_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77179_iter[i] /
                    (ctx->futhark_mc_segmap_task_77179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77179_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77182      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77182_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77182_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77182_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77182_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77182_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77182_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77182_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77182_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77182_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77182_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77182_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77182_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77151          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77151_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77151_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77151_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77151_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77151_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77151_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77151_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77151_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77151_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77151_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77151_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77151_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77151_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77151_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77151_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77151_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77151_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77151_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77151_total_iter /
                (ctx->futhark_mc_segmap_parloop_77151_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77151_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77151_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77151_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77139             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77139_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77139_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77139_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77139_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77139_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77139_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77139_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77139_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77139_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77139_iter[i] /
                    (ctx->futhark_mc_segmap_task_77139_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77139_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77149      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77149_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77149_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77149_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77149_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77149_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77149_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77149_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77149_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77149_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77149_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77149_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77149_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77203          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77203_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77203_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77203_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77203_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77203_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77203_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77203_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77203_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77203_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77203_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77203_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77203_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77203_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77203_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77203_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77203_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77203_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77203_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77203_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77203_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77203_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77203_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77203_total_iter /
                (ctx->futhark_mc_segmap_parloop_77203_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77203_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77203_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77203_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_77224    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_1_parloop_77224_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77224_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77224_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77224_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77224_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_77224_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77224_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77224_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77224_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77224_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77224_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77224_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_77224_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77224_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77224_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_77224_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77224_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77224_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77224_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77224_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_77224_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_77226    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_3_parloop_77226_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77226_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77226_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77226_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77226_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_77226_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77226_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77226_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77226_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77226_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77226_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77226_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_77226_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77226_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77226_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_77226_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77226_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77226_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77226_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77226_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_77226_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_77221            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_77221_runs[i],
                    (long) ctx->futhark_mc_segscan_task_77221_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77221_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77221_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_77221_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_77221_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77221_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_77221_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_77221_iter[i],
                    (long) ctx->futhark_mc_segscan_task_77221_iter[i] /
                    (ctx->futhark_mc_segscan_task_77221_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77221_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77230          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77230_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77230_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77230_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77230_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77230_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77230_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77230_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77230_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77230_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77230_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77230_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77230_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77230_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77230_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77230_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77230_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77230_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77230_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77230_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77230_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77230_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77230_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77230_total_iter /
                (ctx->futhark_mc_segmap_parloop_77230_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77230_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77230_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77230_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77228             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77228_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77228_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77228_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77228_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77228_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77228_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77228_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77228_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77228_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77228_iter[i] /
                    (ctx->futhark_mc_segmap_task_77228_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77228_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77234          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77234_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77234_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77234_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77234_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77234_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77234_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77234_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77234_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77234_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77234_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77234_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77234_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77234_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77234_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77234_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77234_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77234_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77234_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77234_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77234_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77234_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77234_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77234_total_iter /
                (ctx->futhark_mc_segmap_parloop_77234_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77234_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77234_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77234_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77232             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77232_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77232_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77232_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77232_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77232_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77232_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77232_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77232_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77232_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77232_iter[i] /
                    (ctx->futhark_mc_segmap_task_77232_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77232_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77238          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77238_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77238_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77238_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77238_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77238_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77238_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77238_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77238_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77238_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77238_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77238_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77238_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77238_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77238_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77238_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77238_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77238_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77238_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77238_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77238_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77238_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77238_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77238_total_iter /
                (ctx->futhark_mc_segmap_parloop_77238_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77238_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77238_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77238_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77236             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77236_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77236_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77236_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77236_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77236_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77236_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77236_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77236_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77236_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77236_iter[i] /
                    (ctx->futhark_mc_segmap_task_77236_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77236_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77242          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77242_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77242_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77242_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77242_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77242_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77242_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77242_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77242_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77242_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77242_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77242_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77242_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77242_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77242_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77242_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77242_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77242_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77242_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77242_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77242_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77242_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77242_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77242_total_iter /
                (ctx->futhark_mc_segmap_parloop_77242_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77242_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77242_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77242_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77252  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77252_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77252_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77252_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77252_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77252_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77252_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77252_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77252_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77252_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77252_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77252_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77252_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77252_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77252_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77252_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77252_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77252_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77252_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77252_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77252_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77252_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77249             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77249_runs[i],
                    (long) ctx->futhark_mc_segred_task_77249_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77249_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77249_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77249_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77249_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77249_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77249_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77249_iter[i],
                    (long) ctx->futhark_mc_segred_task_77249_iter[i] /
                    (ctx->futhark_mc_segred_task_77249_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77249_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77257  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77257_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77257_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77257_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77257_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77257_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77257_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77257_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77257_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77257_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77257_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77257_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77257_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77257_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77257_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77257_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77257_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77257_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77257_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77257_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77257_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77257_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77254             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77254_runs[i],
                    (long) ctx->futhark_mc_segred_task_77254_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77254_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77254_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77254_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77254_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77254_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77254_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77254_iter[i],
                    (long) ctx->futhark_mc_segred_task_77254_iter[i] /
                    (ctx->futhark_mc_segred_task_77254_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77254_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77246          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77246_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77246_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77246_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77246_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77246_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77246_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77246_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77246_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77246_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77246_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77246_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77246_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77246_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77246_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77246_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77246_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77246_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77246_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77246_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77246_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77246_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77246_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77246_total_iter /
                (ctx->futhark_mc_segmap_parloop_77246_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77246_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77246_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77246_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77240             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77240_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77240_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77240_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77240_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77240_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77240_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77240_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77240_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77240_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77240_iter[i] /
                    (ctx->futhark_mc_segmap_task_77240_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77240_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77244      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77244_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77244_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77244_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77244_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77244_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77244_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77244_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77244_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77244_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77244_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77244_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77244_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77213          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77213_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77213_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77213_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77213_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77213_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77213_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77213_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77213_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77213_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77213_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77213_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77213_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77213_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77213_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77213_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77213_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77213_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77213_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77213_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77213_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77213_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77213_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77213_total_iter /
                (ctx->futhark_mc_segmap_parloop_77213_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77213_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77213_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77213_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77201             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77201_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77201_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77201_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77201_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77201_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77201_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77201_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77201_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77201_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77201_iter[i] /
                    (ctx->futhark_mc_segmap_task_77201_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77201_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77211      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77211_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77211_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77211_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77211_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77211_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77211_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77211_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77211_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77211_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77211_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77211_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77211_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77261          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77261_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77261_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77261_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77261_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77261_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77261_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77261_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77261_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77261_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77261_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77261_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77261_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77261_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77261_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77261_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77261_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77261_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77261_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77261_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77261_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77261_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77261_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77261_total_iter /
                (ctx->futhark_mc_segmap_parloop_77261_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77261_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77261_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77261_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_77285    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_1_parloop_77285_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77285_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77285_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77285_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77285_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_77285_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77285_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77285_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77285_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77285_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77285_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77285_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_77285_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77285_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77285_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_77285_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77285_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77285_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77285_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77285_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_77285_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_77287    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_3_parloop_77287_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77287_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77287_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77287_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77287_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_77287_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77287_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77287_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77287_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77287_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77287_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77287_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_77287_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77287_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77287_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_77287_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77287_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77287_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77287_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77287_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_77287_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_77282            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_77282_runs[i],
                    (long) ctx->futhark_mc_segscan_task_77282_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77282_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77282_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_77282_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_77282_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77282_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_77282_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_77282_iter[i],
                    (long) ctx->futhark_mc_segscan_task_77282_iter[i] /
                    (ctx->futhark_mc_segscan_task_77282_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77282_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77291          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77291_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77291_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77291_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77291_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77291_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77291_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77291_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77291_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77291_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77291_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77291_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77291_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77291_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77291_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77291_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77291_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77291_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77291_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77291_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77291_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77291_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77291_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77291_total_iter /
                (ctx->futhark_mc_segmap_parloop_77291_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77291_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77291_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77291_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77289             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77289_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77289_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77289_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77289_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77289_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77289_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77289_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77289_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77289_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77289_iter[i] /
                    (ctx->futhark_mc_segmap_task_77289_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77289_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77295          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77295_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77295_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77295_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77295_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77295_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77295_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77295_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77295_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77295_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77295_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77295_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77295_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77295_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77295_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77295_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77295_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77295_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77295_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77295_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77295_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77295_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77295_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77295_total_iter /
                (ctx->futhark_mc_segmap_parloop_77295_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77295_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77295_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77295_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77293             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77293_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77293_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77293_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77293_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77293_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77293_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77293_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77293_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77293_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77293_iter[i] /
                    (ctx->futhark_mc_segmap_task_77293_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77293_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77299          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77299_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77299_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77299_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77299_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77299_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77299_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77299_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77299_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77299_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77299_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77299_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77299_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77299_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77299_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77299_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77299_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77299_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77299_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77299_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77299_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77299_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77299_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77299_total_iter /
                (ctx->futhark_mc_segmap_parloop_77299_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77299_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77299_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77299_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77297             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77297_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77297_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77297_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77297_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77297_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77297_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77297_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77297_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77297_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77297_iter[i] /
                    (ctx->futhark_mc_segmap_task_77297_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77297_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77303          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77303_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77303_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77303_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77303_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77303_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77303_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77303_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77303_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77303_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77303_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77303_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77303_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77303_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77303_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77303_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77303_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77303_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77303_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77303_total_iter /
                (ctx->futhark_mc_segmap_parloop_77303_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77303_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77303_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77303_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77317  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77317_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77317_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77317_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77317_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77317_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77317_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77317_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77317_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77317_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77317_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77317_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77317_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77317_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77317_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77317_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77317_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77317_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77317_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77317_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77317_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77317_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77312             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77312_runs[i],
                    (long) ctx->futhark_mc_segred_task_77312_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77312_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77312_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77312_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77312_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77312_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77312_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77312_iter[i],
                    (long) ctx->futhark_mc_segred_task_77312_iter[i] /
                    (ctx->futhark_mc_segred_task_77312_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77312_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77323  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77323_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77323_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77323_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77323_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77323_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77323_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77323_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77323_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77323_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77323_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77323_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77323_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77323_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77323_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77323_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77323_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77323_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77323_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77323_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77323_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77323_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77319             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77319_runs[i],
                    (long) ctx->futhark_mc_segred_task_77319_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77319_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77319_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77319_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77319_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77319_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77319_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77319_iter[i],
                    (long) ctx->futhark_mc_segred_task_77319_iter[i] /
                    (ctx->futhark_mc_segred_task_77319_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77319_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77308          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77308_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77308_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77308_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77308_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77308_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77308_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77308_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77308_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77308_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77308_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77308_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77308_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77308_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77308_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77308_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77308_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77308_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77308_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77308_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77308_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77308_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77308_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77308_total_iter /
                (ctx->futhark_mc_segmap_parloop_77308_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77308_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77308_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77308_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77301             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77301_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77301_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77301_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77301_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77301_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77301_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77301_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77301_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77301_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77301_iter[i] /
                    (ctx->futhark_mc_segmap_task_77301_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77301_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77306      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77306_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77306_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77306_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77306_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77306_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77306_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77306_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77306_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77306_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77306_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77306_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77306_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77273          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77273_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77273_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77273_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77273_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77273_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77273_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77273_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77273_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77273_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77273_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77273_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77273_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77273_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77273_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77273_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77273_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77273_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77273_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77273_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77273_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77273_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77273_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77273_total_iter /
                (ctx->futhark_mc_segmap_parloop_77273_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77273_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77273_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77273_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77259             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77259_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77259_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77259_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77259_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77259_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77259_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77259_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77259_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77259_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77259_iter[i] /
                    (ctx->futhark_mc_segmap_task_77259_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77259_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77271      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77271_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77271_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77271_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77271_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77271_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77271_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77271_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77271_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77271_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77271_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77271_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77271_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77327          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77327_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77327_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77327_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77327_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77327_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77327_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77327_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77327_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77327_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77327_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77327_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77327_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77327_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77327_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77327_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77327_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77327_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77327_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77327_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77327_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77327_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77327_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77327_total_iter /
                (ctx->futhark_mc_segmap_parloop_77327_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77327_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77327_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77327_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_77353    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_1_parloop_77353_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77353_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77353_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77353_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77353_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_77353_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77353_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77353_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77353_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_77353_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_77353_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_77353_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_77353_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77353_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77353_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_77353_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_77353_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_77353_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_77353_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_77353_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_77353_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_77355    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_scan_stage_3_parloop_77355_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77355_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77355_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77355_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77355_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_77355_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77355_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77355_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77355_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_77355_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_77355_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_77355_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_77355_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77355_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77355_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_77355_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_77355_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_77355_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_77355_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_77355_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_77355_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_77350            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_77350_runs[i],
                    (long) ctx->futhark_mc_segscan_task_77350_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77350_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77350_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_77350_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_77350_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_77350_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_77350_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_77350_iter[i],
                    (long) ctx->futhark_mc_segscan_task_77350_iter[i] /
                    (ctx->futhark_mc_segscan_task_77350_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_77350_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77359          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77359_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77359_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77359_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77359_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77359_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77359_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77359_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77359_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77359_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77359_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77359_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77359_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77359_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77359_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77359_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77359_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77359_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77359_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77359_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77359_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77359_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77359_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77359_total_iter /
                (ctx->futhark_mc_segmap_parloop_77359_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77359_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77359_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77359_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77357             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77357_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77357_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77357_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77357_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77357_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77357_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77357_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77357_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77357_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77357_iter[i] /
                    (ctx->futhark_mc_segmap_task_77357_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77357_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77363          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77363_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77363_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77363_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77363_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77363_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77363_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77363_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77363_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77363_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77363_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77363_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77363_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77363_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77363_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77363_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77363_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77363_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77363_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77363_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77363_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77363_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77363_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77363_total_iter /
                (ctx->futhark_mc_segmap_parloop_77363_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77363_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77363_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77363_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77361             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77361_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77361_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77361_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77361_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77361_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77361_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77361_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77361_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77361_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77361_iter[i] /
                    (ctx->futhark_mc_segmap_task_77361_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77361_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77367          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77367_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77367_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77367_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77367_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77367_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77367_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77367_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77367_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77367_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77367_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77367_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77367_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77367_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77367_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77367_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77367_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77367_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77367_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77367_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77367_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77367_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77367_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77367_total_iter /
                (ctx->futhark_mc_segmap_parloop_77367_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77367_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77367_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77367_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77365             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77365_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77365_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77365_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77365_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77365_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77365_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77365_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77365_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77365_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77365_iter[i] /
                    (ctx->futhark_mc_segmap_task_77365_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77365_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77371          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77371_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77371_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77371_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77371_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77371_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77371_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77371_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77371_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77371_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77371_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77371_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77371_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77371_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77371_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77371_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77371_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77371_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77371_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77371_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77371_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77371_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77371_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77371_total_iter /
                (ctx->futhark_mc_segmap_parloop_77371_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77371_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77371_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77371_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77386          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77386_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77386_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77386_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77386_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77386_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77386_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77386_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77386_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77386_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77386_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77386_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77386_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77386_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77386_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77386_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77386_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77386_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77386_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77386_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77386_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77386_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77386_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77386_total_iter /
                (ctx->futhark_mc_segmap_parloop_77386_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77386_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77386_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77386_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77384             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77384_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77384_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77384_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77384_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77384_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77384_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77384_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77384_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77384_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77384_iter[i] /
                    (ctx->futhark_mc_segmap_task_77384_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77384_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77395  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77395_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77395_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77395_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77395_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77395_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77395_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77395_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77395_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77395_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77395_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77395_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77395_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77395_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77395_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77395_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77395_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77395_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77395_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77395_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77395_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77395_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77388             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77388_runs[i],
                    (long) ctx->futhark_mc_segred_task_77388_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77388_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77388_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77388_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77388_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77388_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77388_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77388_iter[i],
                    (long) ctx->futhark_mc_segred_task_77388_iter[i] /
                    (ctx->futhark_mc_segred_task_77388_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77388_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_77401  ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_stage_1_parloop_77401_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77401_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77401_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77401_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77401_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_77401_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77401_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77401_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77401_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_77401_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_77401_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_77401_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_77401_total ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77401_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77401_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_77401_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_77401_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_77401_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_77401_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_77401_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_77401_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_77397             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_77397_runs[i],
                    (long) ctx->futhark_mc_segred_task_77397_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77397_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77397_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_77397_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_77397_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_77397_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_77397_iter[i]),
                    (long) ctx->futhark_mc_segred_task_77397_iter[i],
                    (long) ctx->futhark_mc_segred_task_77397_iter[i] /
                    (ctx->futhark_mc_segred_task_77397_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_77397_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77378          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77378_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77378_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77378_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77378_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77378_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77378_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77378_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77378_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77378_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77378_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77378_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77378_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77378_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77378_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77378_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77378_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77378_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77378_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77378_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77378_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77378_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77378_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77378_total_iter /
                (ctx->futhark_mc_segmap_parloop_77378_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77378_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77378_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77378_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77369             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77369_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77369_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77369_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77369_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77369_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77369_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77369_iter[i] /
                    (ctx->futhark_mc_segmap_task_77369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77369_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77376      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77376_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77376_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77376_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77376_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77376_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77376_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77376_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77376_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77376_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77376_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77376_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77376_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77341          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77341_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77341_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77341_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77341_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77341_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77341_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77341_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77341_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77341_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77341_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77341_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77341_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77341_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77341_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77341_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77341_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77341_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77341_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77341_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77341_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77341_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77341_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77341_total_iter /
                (ctx->futhark_mc_segmap_parloop_77341_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77341_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77341_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77341_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77325             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77325_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77325_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77325_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77325_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77325_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77325_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77325_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77325_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77325_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77325_iter[i] /
                    (ctx->futhark_mc_segmap_task_77325_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77325_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77339      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77339_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77339_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77339_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77339_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77339_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77339_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77339_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77339_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77339_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77339_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77339_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77339_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77405          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77405_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77405_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77405_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77405_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77405_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77405_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77405_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77405_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77405_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77405_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77405_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77405_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77405_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77405_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77405_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77405_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77405_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77405_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77405_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77405_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77405_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77405_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77405_total_iter /
                (ctx->futhark_mc_segmap_parloop_77405_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77405_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77405_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77405_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77414          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77414_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77414_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77414_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77414_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77414_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77414_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77414_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77414_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77414_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77414_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77414_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77414_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77414_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77414_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77414_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77414_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77414_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77414_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77414_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77414_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77414_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77414_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77414_total_iter /
                (ctx->futhark_mc_segmap_parloop_77414_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77414_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77414_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77414_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77412             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77412_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77412_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77412_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77412_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77412_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77412_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77412_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77412_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77412_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77412_iter[i] /
                    (ctx->futhark_mc_segmap_task_77412_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77412_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_77409          ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_77409_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_77409_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77409_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77409_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_77409_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_77409_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_77409_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77409_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_77409_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_77409_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_77409_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_77409_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_77409_total    ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_77409_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_77409_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77409_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77409_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_77409_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_77409_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_77409_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_77409_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_77409_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_77409_total_iter /
                (ctx->futhark_mc_segmap_parloop_77409_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_77409_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_77409_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_77409_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_77403             ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_77403_runs[i],
                    (long) ctx->futhark_mc_segmap_task_77403_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77403_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77403_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_77403_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_77403_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_77403_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_77403_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_77403_iter[i],
                    (long) ctx->futhark_mc_segmap_task_77403_iter[i] /
                    (ctx->futhark_mc_segmap_task_77403_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_77403_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_77407      ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_77407_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77407_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77407_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77407_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_77407_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_77407_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_77407_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_77407_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_77407_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_77407_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_77407_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_77407_runs[i] : 1));
    }
    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);
    worker_local = &ctx->scheduler.workers[0];
    ctx->peak_mem_usage_default = 0;
    lock_unlock(&ctx->lock);
    return ctx->error != NULL;
}

static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock *mem_out_p_77022,
                             struct memblock Y_mem_70569, int64_t m_65343,
                             int64_t n_65344, int64_t q_65346,
                             int64_t degree_65347, int64_t jump_65348,
                             int64_t jump_threshold_65349,
                             int64_t q_threshold_65350);

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_mc_task_77023 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70575;
    int64_t free_bytes_70578;
    int64_t free_bytes_70587;
    int64_t free_bytes_70590;
    unsigned char *free_mem_70685;
};
struct futhark_mc_segmap_parloop_struct_77025 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70575;
    int64_t free_bytes_70578;
    int64_t free_bytes_70587;
    int64_t free_bytes_70590;
    unsigned char *free_mem_70685;
};
static int futhark_mc_segmap_parloop_77026(void *args, int64_t start,
                                           int64_t end, int flat_tid_66692,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77025
    *futhark_mc_segmap_parloop_struct_77025 =
    (struct futhark_mc_segmap_parloop_struct_77025 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77025->ctx;
    uint64_t futhark_mc_segmap_parloop_77026_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77026_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77025->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77025->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77025->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77025->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77025->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77025->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77025->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77025->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77025->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77025->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77025->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70575 =
            futhark_mc_segmap_parloop_struct_77025->free_bytes_70575;
    int64_t bytes_70578 =
            futhark_mc_segmap_parloop_struct_77025->free_bytes_70578;
    int64_t bytes_70587 =
            futhark_mc_segmap_parloop_struct_77025->free_bytes_70587;
    int64_t bytes_70590 =
            futhark_mc_segmap_parloop_struct_77025->free_bytes_70590;
    struct memblock mem_70685 = {.desc ="mem_70685", .mem =
                                 futhark_mc_segmap_parloop_struct_77025->free_mem_70685,
                                 .size =0, .references =NULL};
    size_t mem_70594_cached_sizze_77027 = 0;
    unsigned char *mem_70594 = NULL;
    size_t mem_70609_cached_sizze_77028 = 0;
    unsigned char *mem_70609 = NULL;
    size_t mem_70612_cached_sizze_77029 = 0;
    unsigned char *mem_70612 = NULL;
    size_t mem_70639_cached_sizze_77030 = 0;
    unsigned char *mem_70639 = NULL;
    size_t mem_70654_cached_sizze_77031 = 0;
    unsigned char *mem_70654 = NULL;
    size_t mem_70669_cached_sizze_77032 = 0;
    unsigned char *mem_70669 = NULL;
    int64_t iterations = end - start;
    int64_t iter_71622 = start;
    
    if (mem_70594_cached_sizze_77027 < (size_t) bytes_70575) {
        mem_70594 = realloc(mem_70594, bytes_70575);
        mem_70594_cached_sizze_77027 = bytes_70575;
    }
    if (mem_70609_cached_sizze_77028 < (size_t) bytes_70578) {
        mem_70609 = realloc(mem_70609, bytes_70578);
        mem_70609_cached_sizze_77028 = bytes_70578;
    }
    if (mem_70612_cached_sizze_77029 < (size_t) bytes_70575) {
        mem_70612 = realloc(mem_70612, bytes_70575);
        mem_70612_cached_sizze_77029 = bytes_70575;
    }
    if (mem_70639_cached_sizze_77030 < (size_t) bytes_70575) {
        mem_70639 = realloc(mem_70639, bytes_70575);
        mem_70639_cached_sizze_77030 = bytes_70575;
    }
    if (mem_70654_cached_sizze_77031 < (size_t) bytes_70587) {
        mem_70654 = realloc(mem_70654, bytes_70587);
        mem_70654_cached_sizze_77031 = bytes_70587;
    }
    if (mem_70669_cached_sizze_77032 < (size_t) bytes_70590) {
        mem_70669 = realloc(mem_70669, bytes_70590);
        mem_70669_cached_sizze_77032 = bytes_70590;
    }
    for (; iter_71622 < end; iter_71622++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_71789 = m_65343;
        int64_t gtid_66693 = iter_71622;
        int64_t remnant_71790 = iter_71622 - gtid_66693;
        int64_t discard_70184;
        int64_t scanacc_71624 = (int64_t) 0;
        
        for (int64_t i_71623 = 0; i_71623 < n_65344; i_71623++) {
            float x_71626;
            
            x_71626 = ((float *) Y_mem_70569.mem)[gtid_66693 * n_65344 +
                                                  i_71623];
            
            bool isnan_res_71627;
            
            isnan_res_71627 = futrts_isnan32(x_71626);
            
            bool defunc_0_p_res_71628 = !isnan_res_71627;
            int64_t defunc_0_f_res_71629 = btoi_bool_i64(defunc_0_p_res_71628);
            int64_t defunc_1_op_res_71630 = add64(defunc_0_f_res_71629,
                                                  scanacc_71624);
            
            ((int64_t *) mem_70594)[i_71623] = defunc_1_op_res_71630;
            
            int64_t scanacc_tmp_71791 = defunc_1_op_res_71630;
            
            scanacc_71624 = scanacc_tmp_71791;
        }
        discard_70184 = scanacc_71624;
        
        int64_t last_res_65393;
        
        last_res_65393 = ((int64_t *) mem_70594)[i_65358];
        for (int64_t i_71793 = 0; i_71793 < n_65344; i_71793++) {
            ((float *) mem_70609)[i_71793] = 0.0F;
        }
        for (int64_t i_71794 = 0; i_71794 < n_65344; i_71794++) {
            ((int64_t *) mem_70612)[i_71794] = (int64_t) -1;
        }
        for (int64_t write_iter_71632 = 0; write_iter_71632 < n_65344;
             write_iter_71632++) {
            float write_iv_71635;
            
            write_iv_71635 = ((float *) Y_mem_70569.mem)[gtid_66693 * n_65344 +
                                                         write_iter_71632];
            
            bool isnan_res_71636;
            
            isnan_res_71636 = futrts_isnan32(write_iv_71635);
            
            bool defunc_0_p_res_71637 = !isnan_res_71636;
            int64_t defunc_1_f_res_71638;
            
            if (defunc_0_p_res_71637) {
                int64_t write_iv_71639;
                
                write_iv_71639 = ((int64_t *) mem_70594)[write_iter_71632];
                
                int64_t defunc_1_f_res_t_res_71640 = sub64(write_iv_71639,
                                                           (int64_t) 1);
                
                defunc_1_f_res_71638 = defunc_1_f_res_t_res_71640;
            } else {
                defunc_1_f_res_71638 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_71638) &&
                slt64(defunc_1_f_res_71638, n_65344)) {
                ((int64_t *) mem_70612)[defunc_1_f_res_71638] =
                    write_iter_71632;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_71638) &&
                slt64(defunc_1_f_res_71638, n_65344)) {
                if ((int64_t) 4 > 0)
                    memmove(mem_70609 + defunc_1_f_res_71638 * (int64_t) 4,
                            Y_mem_70569.mem + (gtid_66693 * n_65344 +
                                               write_iter_71632) * (int64_t) 4,
                            (int64_t) 4);
            }
        }
        for (int64_t i_71644 = 0; i_71644 < n_65344; i_71644++) {
            int64_t x_71646;
            
            x_71646 = ((int64_t *) mem_70612)[i_71644];
            
            int64_t defunc_0_f_res_71647 = add64((int64_t) 1, x_71646);
            
            ((int64_t *) mem_70639)[i_71644] = defunc_0_f_res_71647;
        }
        
        int64_t min_arg_65408 = sub64(last_res_65393, (int64_t) 1);
        int64_t min_arg_65409 = sub64(last_res_65393, min_res_65364);
        int64_t min_res_65410 = smin64(q_65346, last_res_65393);
        float i64_res_65411 = sitofp_i64_f32(last_res_65393);
        float x_65412 = i64_res_65370 - i64_res_65411;
        float max_arg_65413 = x_65412 / 2.0F;
        float max_res_65414 = fmax32(0.0F, max_arg_65413);
        
        for (int64_t i_71649 = 0; i_71649 < q_65346; i_71649++) {
            bool cond_71651 = sle64(last_res_65393, i_71649);
            float defunc_0_f_res_71652;
            
            if (cond_71651) {
                defunc_0_f_res_71652 = 0.0F;
            } else {
                defunc_0_f_res_71652 = 1.0F;
            }
            ((float *) mem_70654)[i_71649] = defunc_0_f_res_71652;
        }
        for (int64_t i_71654 = 0; i_71654 < n_m_65352; i_71654++) {
            int64_t min_arg_71656 = mul64(jump_65348, i_71654);
            int64_t min_res_71657 = smin64(i_65358, min_arg_71656);
            int64_t defunc_0_g_res_71658 = add64((int64_t) 1, min_res_71657);
            bool init_idx_71659;
            int64_t init_idx_71660;
            int64_t init_idx_71661;
            bool loop_while_71662;
            int64_t low_71663;
            int64_t high_71664;
            
            loop_while_71662 = x_65359;
            low_71663 = (int64_t) 0;
            high_71664 = i_65358;
            while (loop_while_71662) {
                int64_t x_71665 = add64(low_71663, high_71664);
                int64_t mid_71666 = sdiv64(x_71665, (int64_t) 2);
                bool x_71667 = sle64((int64_t) 0, mid_71666);
                bool y_71668 = slt64(mid_71666, n_65344);
                bool bounds_check_71669 = x_71667 && y_71668;
                bool index_certs_71670;
                
                if (!bounds_check_71669) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_71666,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_71671;
                
                mid_id_71671 = ((int64_t *) mem_70639)[mid_71666];
                
                bool cond_71672 = slt64(mid_id_71671, (int64_t) 0);
                int64_t mid_idx_71673;
                
                if (cond_71672) {
                    mid_idx_71673 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_71673 = mid_id_71671;
                }
                
                bool cond_71674 = sle64(defunc_0_g_res_71658, mid_idx_71673);
                int64_t loopres_71675;
                int64_t loopres_71676;
                
                if (cond_71674) {
                    int64_t loopres_t_res_71677 = sub64(mid_71666, (int64_t) 1);
                    
                    loopres_71675 = low_71663;
                    loopres_71676 = loopres_t_res_71677;
                } else {
                    int64_t loopres_f_res_71678 = add64((int64_t) 1, mid_71666);
                    
                    loopres_71675 = loopres_f_res_71678;
                    loopres_71676 = high_71664;
                }
                
                bool loop_cond_71679 = sle64(loopres_71675, loopres_71676);
                bool loop_while_tmp_71800 = loop_cond_71679;
                int64_t low_tmp_71801 = loopres_71675;
                int64_t high_tmp_71802 = loopres_71676;
                
                loop_while_71662 = loop_while_tmp_71800;
                low_71663 = low_tmp_71801;
                high_71664 = high_tmp_71802;
            }
            init_idx_71659 = loop_while_71662;
            init_idx_71660 = low_71663;
            init_idx_71661 = high_71664;
            
            bool idx_71680;
            int64_t idx_71681;
            int64_t idx_71682;
            int64_t idx_71683;
            bool loop_while_71684;
            int64_t l_idx_71685;
            int64_t r_idx_71686;
            int64_t span_71687;
            
            loop_while_71684 = loop_cond_65369;
            l_idx_71685 = init_idx_71660;
            r_idx_71686 = init_idx_71660;
            span_71687 = (int64_t) 1;
            while (loop_while_71684) {
                int64_t max_arg_71688 = sub64(l_idx_71685, (int64_t) 1);
                int64_t max_res_71689 = smax64((int64_t) 0, max_arg_71688);
                int64_t min_arg_71690 = add64((int64_t) 1, r_idx_71686);
                int64_t min_res_71691 = smin64(min_arg_65408, min_arg_71690);
                bool x_71692 = sle64((int64_t) 0, max_res_71689);
                bool y_71693 = slt64(max_res_71689, n_65344);
                bool bounds_check_71694 = x_71692 && y_71693;
                bool index_certs_71695;
                
                if (!bounds_check_71694) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_71689,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_71696;
                
                x_71696 = ((int64_t *) mem_70639)[max_res_71689];
                
                int64_t abs_arg_71697 = sub64(x_71696, defunc_0_g_res_71658);
                int64_t abs_res_71698 = abs64(abs_arg_71697);
                bool x_71699 = sle64((int64_t) 0, min_res_71691);
                bool y_71700 = slt64(min_res_71691, n_65344);
                bool bounds_check_71701 = x_71699 && y_71700;
                bool index_certs_71702;
                
                if (!bounds_check_71701) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_71691,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_71703;
                
                x_71703 = ((int64_t *) mem_70639)[min_res_71691];
                
                int64_t abs_arg_71704 = sub64(x_71703, defunc_0_g_res_71658);
                int64_t abs_res_71705 = abs64(abs_arg_71704);
                bool cond_71706 = max_res_71689 == l_idx_71685;
                int64_t loopres_71707;
                int64_t loopres_71708;
                int64_t loopres_71709;
                
                if (cond_71706) {
                    loopres_71707 = l_idx_71685;
                    loopres_71708 = r_idx_71686;
                    loopres_71709 = min_res_65364;
                } else {
                    bool cond_71710 = slt64(abs_res_71698, abs_res_71705);
                    bool cond_f_res_71711 = min_res_71691 == r_idx_71686;
                    bool x_71712 = !cond_71710;
                    bool y_71713 = cond_f_res_71711 && x_71712;
                    bool cond_71714 = cond_71710 || y_71713;
                    int64_t loopres_f_res_71715;
                    
                    if (cond_71714) {
                        loopres_f_res_71715 = max_res_71689;
                    } else {
                        loopres_f_res_71715 = l_idx_71685;
                    }
                    
                    int64_t loopres_f_res_71716;
                    
                    if (cond_71714) {
                        loopres_f_res_71716 = r_idx_71686;
                    } else {
                        loopres_f_res_71716 = min_res_71691;
                    }
                    
                    int64_t loopres_f_res_71717;
                    
                    if (cond_71714) {
                        int64_t loopres_f_res_t_res_71718 = add64((int64_t) 1,
                                                                  span_71687);
                        
                        loopres_f_res_71717 = loopres_f_res_t_res_71718;
                    } else {
                        int64_t loopres_f_res_f_res_71719 = add64((int64_t) 1,
                                                                  span_71687);
                        
                        loopres_f_res_71717 = loopres_f_res_f_res_71719;
                    }
                    loopres_71707 = loopres_f_res_71715;
                    loopres_71708 = loopres_f_res_71716;
                    loopres_71709 = loopres_f_res_71717;
                }
                
                bool loop_cond_71720 = slt64(loopres_71709, min_res_65364);
                bool loop_while_tmp_71803 = loop_cond_71720;
                int64_t l_idx_tmp_71804 = loopres_71707;
                int64_t r_idx_tmp_71805 = loopres_71708;
                int64_t span_tmp_71806 = loopres_71709;
                
                loop_while_71684 = loop_while_tmp_71803;
                l_idx_71685 = l_idx_tmp_71804;
                r_idx_71686 = r_idx_tmp_71805;
                span_71687 = span_tmp_71806;
            }
            idx_71680 = loop_while_71684;
            idx_71681 = l_idx_71685;
            idx_71682 = r_idx_71686;
            idx_71683 = span_71687;
            
            int64_t min_res_71721 = smin64(min_arg_65409, idx_71681);
            int64_t max_res_71722 = smax64((int64_t) 0, min_res_71721);
            int64_t x_71723 = add64(min_res_65410, max_res_71722);
            int64_t r_71724 = sub64(x_71723, (int64_t) 1);
            bool x_71725 = sle64((int64_t) 0, r_71724);
            bool y_71726 = slt64(r_71724, n_65344);
            bool bounds_check_71727 = x_71725 && y_71726;
            bool index_certs_71728;
            
            if (!bounds_check_71727) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_71724,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_71729;
            
            x_71729 = ((int64_t *) mem_70612)[r_71724];
            
            int64_t abs_arg_71730 = sub64(x_71729, min_res_71657);
            int64_t abs_res_71731 = abs64(abs_arg_71730);
            bool x_71732 = sle64((int64_t) 0, max_res_71722);
            bool y_71733 = slt64(max_res_71722, n_65344);
            bool bounds_check_71734 = x_71732 && y_71733;
            bool index_certs_71735;
            
            if (!bounds_check_71734) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_71722,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_71736;
            
            x_71736 = ((int64_t *) mem_70612)[max_res_71722];
            
            int64_t abs_arg_71737 = sub64(x_71736, min_res_71657);
            int64_t abs_res_71738 = abs64(abs_arg_71737);
            int64_t max_res_71739 = smax64(abs_res_71731, abs_res_71738);
            float defunc_0_f_res_71740 = sitofp_i64_f32(max_res_71739);
            float defunc_1_f_res_71741 = max_res_65414 + defunc_0_f_res_71740;
            float defunc_2_reduce_res_71742;
            float redout_71744 = 0.0F;
            
            for (int64_t i_71743 = 0; i_71743 < q_65346; i_71743++) {
                float x_71745;
                
                x_71745 = ((float *) mem_70654)[i_71743];
                
                bool cond_71746 = sle64(last_res_65393, i_71743);
                int64_t defunc_0_f_res_71747;
                
                if (cond_71746) {
                    defunc_0_f_res_71747 = (int64_t) 0;
                } else {
                    int64_t i_71748 = add64(max_res_71722, i_71743);
                    int64_t defunc_0_add_arg_71749;
                    
                    defunc_0_add_arg_71749 = ((int64_t *) mem_70612)[i_71748];
                    
                    int64_t defunc_1_add_res_71750 = add64((int64_t) 1,
                                                           defunc_0_add_arg_71749);
                    
                    defunc_0_f_res_71747 = defunc_1_add_res_71750;
                }
                
                int64_t binop_p_71751 = sub64(defunc_0_f_res_71747,
                                              min_res_71657);
                float defunc_0_f_res_71752 = sitofp_i64_f32(binop_p_71751);
                float abs_res_71753 = (float) fabs(defunc_0_f_res_71752);
                float tmp1_71754 = abs_res_71753 / defunc_1_f_res_71741;
                float x_71755 = tmp1_71754 * tmp1_71754;
                float y_71756 = tmp1_71754 * x_71755;
                float tmp2_71757 = 1.0F - y_71756;
                float x_71758 = tmp2_71757 * tmp2_71757;
                float tmp3_71759 = tmp2_71757 * x_71758;
                float w_j_71760 = x_71745 * tmp3_71759;
                float defunc_1_op_res_71761 = w_j_71760 + redout_71744;
                float redout_tmp_71807 = defunc_1_op_res_71761;
                
                redout_71744 = redout_tmp_71807;
            }
            defunc_2_reduce_res_71742 = redout_71744;
            
            float a0_71762 = 1.0F / defunc_2_reduce_res_71742;
            float defunc_2_reduce_res_71763;
            float redout_71765 = 0.0F;
            
            for (int64_t i_71764 = 0; i_71764 < q_65346; i_71764++) {
                float x_71766;
                
                x_71766 = ((float *) mem_70654)[i_71764];
                
                bool cond_71767 = sle64(last_res_65393, i_71764);
                int64_t defunc_0_f_res_71768;
                
                if (cond_71767) {
                    defunc_0_f_res_71768 = (int64_t) 0;
                } else {
                    int64_t i_71769 = add64(max_res_71722, i_71764);
                    int64_t defunc_0_add_arg_71770;
                    
                    defunc_0_add_arg_71770 = ((int64_t *) mem_70612)[i_71769];
                    
                    int64_t defunc_1_add_res_71771 = add64((int64_t) 1,
                                                           defunc_0_add_arg_71770);
                    
                    defunc_0_f_res_71768 = defunc_1_add_res_71771;
                }
                
                int64_t binop_p_71772 = sub64(defunc_0_f_res_71768,
                                              min_res_71657);
                float defunc_0_f_res_71773 = sitofp_i64_f32(binop_p_71772);
                float abs_res_71774 = (float) fabs(defunc_0_f_res_71773);
                float tmp1_71775 = abs_res_71774 / defunc_1_f_res_71741;
                float x_71776 = tmp1_71775 * tmp1_71775;
                float y_71777 = tmp1_71775 * x_71776;
                float tmp2_71778 = 1.0F - y_71777;
                float x_71779 = tmp2_71778 * tmp2_71778;
                float tmp3_71780 = tmp2_71778 * x_71779;
                float tmp4_71781 = x_71766 * tmp3_71780;
                float defunc_0_f_res_71782;
                
                if (cond_71767) {
                    defunc_0_f_res_71782 = 0.0F;
                } else {
                    int64_t i_71783 = add64(max_res_71722, i_71764);
                    float defunc_0_add_arg_71784;
                    
                    defunc_0_add_arg_71784 = ((float *) mem_70609)[i_71783];
                    defunc_0_f_res_71782 = defunc_0_add_arg_71784;
                }
                
                float x_71785 = a0_71762 * tmp4_71781;
                float defunc_9_fit_fun_res_71786 = defunc_0_f_res_71782 *
                      x_71785;
                float defunc_1_op_res_71787 = defunc_9_fit_fun_res_71786 +
                      redout_71765;
                float redout_tmp_71808 = defunc_1_op_res_71787;
                
                redout_71765 = redout_tmp_71808;
            }
            defunc_2_reduce_res_71763 = redout_71765;
            ((float *) mem_70669)[i_71654] = defunc_2_reduce_res_71763;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70685.mem + gtid_66693 * n_m_65352 * (int64_t) 4,
                    mem_70669 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_70594);
    free(mem_70609);
    free(mem_70612);
    free(mem_70639);
    free(mem_70654);
    free(mem_70669);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77026_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77026_end -
                 futhark_mc_segmap_parloop_77026_start;
        
        ctx->futhark_mc_segmap_parloop_77026_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77026_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77026_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77024(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_66692 = tid;
    int num_tasks_71621 = info.nsubtasks;
    struct futhark_mc_task_77023 *futhark_mc_task_77023 =
                                 (struct futhark_mc_task_77023 *) args;
    struct futhark_context *ctx = futhark_mc_task_77023->ctx;
    uint64_t futhark_mc_segmap_task_77024_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77024_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77023->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77023->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77023->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77023->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77023->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77023->free_i_65358;
    bool x_65359 = futhark_mc_task_77023->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77023->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77023->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77023->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77023->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70575 = futhark_mc_task_77023->free_bytes_70575;
    int64_t bytes_70578 = futhark_mc_task_77023->free_bytes_70578;
    int64_t bytes_70587 = futhark_mc_task_77023->free_bytes_70587;
    int64_t bytes_70590 = futhark_mc_task_77023->free_bytes_70590;
    struct memblock mem_70685 = {.desc ="mem_70685", .mem =
                                 futhark_mc_task_77023->free_mem_70685, .size =
                                 0, .references =NULL};
    int64_t iter_71622;
    struct futhark_mc_segmap_parloop_struct_77025
    futhark_mc_segmap_parloop_struct_77025;
    
    futhark_mc_segmap_parloop_struct_77025.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77025.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77025.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77025.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77025.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77025.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77025.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77025.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77025.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77025.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77025.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77025.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77025.free_bytes_70575 = bytes_70575;
    futhark_mc_segmap_parloop_struct_77025.free_bytes_70578 = bytes_70578;
    futhark_mc_segmap_parloop_struct_77025.free_bytes_70587 = bytes_70587;
    futhark_mc_segmap_parloop_struct_77025.free_bytes_70590 = bytes_70590;
    futhark_mc_segmap_parloop_struct_77025.free_mem_70685 = mem_70685.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77026_task;
    
    futhark_mc_segmap_parloop_77026_task.name =
        "futhark_mc_segmap_parloop_77026";
    futhark_mc_segmap_parloop_77026_task.fn = futhark_mc_segmap_parloop_77026;
    futhark_mc_segmap_parloop_77026_task.args =
        &futhark_mc_segmap_parloop_struct_77025;
    futhark_mc_segmap_parloop_77026_task.iterations = iterations;
    futhark_mc_segmap_parloop_77026_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77026_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77026_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77026_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77026_task);
    
    if (futhark_mc_segmap_parloop_77026_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77026_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77026_total_end -
                 futhark_mc_segmap_parloop_77026_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77026_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77026_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77026_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77024_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77024_end -
                 futhark_mc_segmap_task_77024_start;
        
        ctx->futhark_mc_segmap_task_77024_runs[tid]++;
        ctx->futhark_mc_segmap_task_77024_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77024_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77034 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70575;
    int64_t free_bytes_70578;
    int64_t free_bytes_70587;
    int64_t free_bytes_70590;
    unsigned char *free_mem_70685;
};
struct futhark_mc_task_77042 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_66854;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70576;
};
struct futhark_mc_scan_stage_1_parloop_struct_77045 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_66854;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70576;
};
static int futhark_mc_scan_stage_1_parloop_77046(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_71810, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_77045
    *futhark_mc_scan_stage_1_parloop_struct_77045 =
    (struct futhark_mc_scan_stage_1_parloop_struct_77045 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_77045->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_77046_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77046_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_1_parloop_struct_77045->free_n_65344;
    int64_t gtid_66854 =
            futhark_mc_scan_stage_1_parloop_struct_77045->free_gtid_66854;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_1_parloop_struct_77045->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70576 = {.desc ="mem_70576", .mem =
                                 futhark_mc_scan_stage_1_parloop_struct_77045->free_mem_70576,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72110 = start;
    int64_t x_71812;
    int64_t x_71813;
    
    x_71812 = (int64_t) 0;
    for (; iter_72110 < end; iter_72110++) {
        int64_t gtid_71811 = iter_72110;
        
        // stage 1 scan body
        {
            float x_71815;
            
            x_71815 = ((float *) Y_mem_70569.mem)[gtid_66854 * n_65344 +
                                                  gtid_71811];
            
            bool isnan_res_71816;
            
            isnan_res_71816 = futrts_isnan32(x_71815);
            
            bool defunc_0_p_res_71817 = !isnan_res_71816;
            int64_t defunc_0_f_res_71818 = btoi_bool_i64(defunc_0_p_res_71817);
            
            // write mapped values results to memory
            { }
            x_71812 = x_71812;
            // Read next values
            {
                x_71813 = defunc_0_f_res_71818;
            }
            
            int64_t defunc_1_op_res_71814 = add64(x_71812, x_71813);
            
            ((int64_t *) mem_70576.mem)[gtid_71811] = defunc_1_op_res_71814;
            x_71812 = defunc_1_op_res_71814;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77046_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77046_end -
                 futhark_mc_scan_stage_1_parloop_77046_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_77046_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_77046_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_77046_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_77047 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_66854;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70576;
};
static int futhark_mc_scan_stage_3_parloop_77048(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_71810, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_77047
    *futhark_mc_scan_stage_3_parloop_struct_77047 =
    (struct futhark_mc_scan_stage_3_parloop_struct_77047 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_77047->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_77048_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_77048_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_3_parloop_struct_77047->free_n_65344;
    int64_t gtid_66854 =
            futhark_mc_scan_stage_3_parloop_struct_77047->free_gtid_66854;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_3_parloop_struct_77047->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70576 = {.desc ="mem_70576", .mem =
                                 futhark_mc_scan_stage_3_parloop_struct_77047->free_mem_70576,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72122 = start;
    int64_t x_72119;
    int64_t x_72120;
    
    if (iter_72122 == (int64_t) 0) {
        x_72119 = (int64_t) 0;
    } else {
        x_72119 = ((int64_t *) mem_70576.mem)[iter_72122 - (int64_t) 1];
    }
    for (; iter_72122 < end; iter_72122++) {
        int64_t gtid_71811 = iter_72122;
        
        // stage 3 scan body
        {
            float x_71815;
            
            x_71815 = ((float *) Y_mem_70569.mem)[gtid_66854 * n_65344 +
                                                  gtid_71811];
            
            bool isnan_res_71816;
            
            isnan_res_71816 = futrts_isnan32(x_71815);
            
            bool defunc_0_p_res_71817 = !isnan_res_71816;
            int64_t defunc_0_f_res_71818 = btoi_bool_i64(defunc_0_p_res_71817);
            
            x_72119 = x_72119;
            x_72120 = defunc_0_f_res_71818;
            
            int64_t defunc_1_op_res_72121 = add64(x_72119, x_72120);
            
            ((int64_t *) mem_70576.mem)[gtid_71811] = defunc_1_op_res_72121;
            x_72119 = defunc_1_op_res_72121;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_77048_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77048_end -
                 futhark_mc_scan_stage_3_parloop_77048_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_77048_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_77048_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_77048_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_77043(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_71810 = tid;
    int num_tasks_72109 = info.nsubtasks;
    struct futhark_mc_task_77042 *futhark_mc_task_77042 =
                                 (struct futhark_mc_task_77042 *) args;
    struct futhark_context *ctx = futhark_mc_task_77042->ctx;
    uint64_t futhark_mc_segscan_task_77043_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_77043_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77042->free_n_65344;
    int64_t gtid_66854 = futhark_mc_task_77042->free_gtid_66854;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77042->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70576 = {.desc ="mem_70576", .mem =
                                 futhark_mc_task_77042->free_mem_70576, .size =
                                 0, .references =NULL};
    size_t scan_stage_2_accum_mem_72116_cached_sizze_77044 = 0;
    unsigned char *scan_stage_2_accum_mem_72116 = NULL;
    int64_t iter_72110;
    struct futhark_mc_scan_stage_1_parloop_struct_77045
    futhark_mc_scan_stage_1_parloop_struct_77045;
    
    futhark_mc_scan_stage_1_parloop_struct_77045.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_77045.free_n_65344 = n_65344;
    futhark_mc_scan_stage_1_parloop_struct_77045.free_gtid_66854 = gtid_66854;
    futhark_mc_scan_stage_1_parloop_struct_77045.free_Y_mem_70569 =
        Y_mem_70569.mem;
    futhark_mc_scan_stage_1_parloop_struct_77045.free_mem_70576 = mem_70576.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_77046_task;
    
    futhark_mc_scan_stage_1_parloop_77046_task.name =
        "futhark_mc_scan_stage_1_parloop_77046";
    futhark_mc_scan_stage_1_parloop_77046_task.fn =
        futhark_mc_scan_stage_1_parloop_77046;
    futhark_mc_scan_stage_1_parloop_77046_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_77045;
    futhark_mc_scan_stage_1_parloop_77046_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_77046_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_77046_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77046_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_77046_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_77046_task);
    
    if (futhark_mc_scan_stage_1_parloop_77046_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77046_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77046_total_end -
                 futhark_mc_scan_stage_1_parloop_77046_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77046_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77046_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77046_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_72109)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_72111;
        int64_t x_72112;
        int64_t offset_72114 = (int64_t) 0;
        int64_t offset_index_72115 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_72116_cached_sizze_77044 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_72116 = realloc(scan_stage_2_accum_mem_72116,
                                                   (int64_t) 8);
            scan_stage_2_accum_mem_72116_cached_sizze_77044 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_72116)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_72118 = 0; i_72118 < num_tasks_72109 - 1; i_72118++) {
            offset_72114 = squot64(n_65344, sext_i32_i64(num_tasks_72109));
            if (slt64(sext_i32_i64(i_72118), srem64(n_65344,
                                                    sext_i32_i64(num_tasks_72109)))) {
                offset_72114 += (int64_t) 1;
            }
            offset_index_72115 += offset_72114;
            
            int64_t gtid_71811 = offset_index_72115;
            float x_71815;
            
            x_71815 = ((float *) Y_mem_70569.mem)[gtid_66854 * n_65344 +
                                                  gtid_71811];
            
            bool isnan_res_71816;
            
            isnan_res_71816 = futrts_isnan32(x_71815);
            
            bool defunc_0_p_res_71817 = !isnan_res_71816;
            int64_t defunc_0_f_res_71818 = btoi_bool_i64(defunc_0_p_res_71817);
            
            // Read carry in
            {
                x_72111 =
                    ((int64_t *) scan_stage_2_accum_mem_72116)[(int64_t) 0];
            }
            // Read next values
            {
                x_72112 = ((int64_t *) mem_70576.mem)[offset_index_72115 -
                                                      (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_72113 = add64(x_72111, x_72112);
            
            ((int64_t *) mem_70576.mem)[offset_index_72115 - (int64_t) 1] =
                defunc_1_op_res_72113;
            ((int64_t *) scan_stage_2_accum_mem_72116)[(int64_t) 0] =
                defunc_1_op_res_72113;
        }
        
        int64_t iter_72122 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_77047
        futhark_mc_scan_stage_3_parloop_struct_77047;
        
        futhark_mc_scan_stage_3_parloop_struct_77047.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_77047.free_n_65344 = n_65344;
        futhark_mc_scan_stage_3_parloop_struct_77047.free_gtid_66854 =
            gtid_66854;
        futhark_mc_scan_stage_3_parloop_struct_77047.free_Y_mem_70569 =
            Y_mem_70569.mem;
        futhark_mc_scan_stage_3_parloop_struct_77047.free_mem_70576 =
            mem_70576.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_77048_task;
        
        futhark_mc_scan_stage_3_parloop_77048_task.name =
            "futhark_mc_scan_stage_3_parloop_77048";
        futhark_mc_scan_stage_3_parloop_77048_task.fn =
            futhark_mc_scan_stage_3_parloop_77048;
        futhark_mc_scan_stage_3_parloop_77048_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_77047;
        futhark_mc_scan_stage_3_parloop_77048_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_77048_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_77048_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_77048_total_start = get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_77048_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_77048_task);
        
        if (futhark_mc_scan_stage_3_parloop_77048_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_77048_total_end =
                     get_wall_time();
            uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77048_total_end -
                     futhark_mc_scan_stage_3_parloop_77048_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77048_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77048_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77048_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_72116);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_77043_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_77043_end -
                 futhark_mc_segscan_task_77043_start;
        
        ctx->futhark_mc_segscan_task_77043_runs[tid]++;
        ctx->futhark_mc_segscan_task_77043_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_77043_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77049 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_66854;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70576;
    unsigned char *free_mem_70579;
    unsigned char *free_mem_70582;
};
struct futhark_mc_segmap_parloop_struct_77051 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_66854;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70576;
    unsigned char *free_mem_70579;
    unsigned char *free_mem_70582;
};
static int futhark_mc_segmap_parloop_77052(void *args, int64_t start,
                                           int64_t end, int flat_tid_71819,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77051
    *futhark_mc_segmap_parloop_struct_77051 =
    (struct futhark_mc_segmap_parloop_struct_77051 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77051->ctx;
    uint64_t futhark_mc_segmap_parloop_77052_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77052_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77051->free_n_65344;
    int64_t gtid_66854 =
            futhark_mc_segmap_parloop_struct_77051->free_gtid_66854;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77051->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70576 = {.desc ="mem_70576", .mem =
                                 futhark_mc_segmap_parloop_struct_77051->free_mem_70576,
                                 .size =0, .references =NULL};
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_segmap_parloop_struct_77051->free_mem_70579,
                                 .size =0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_segmap_parloop_struct_77051->free_mem_70582,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72126 = start;
    
    for (; iter_72126 < end; iter_72126++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72129 = n_65344;
        int64_t gtid_71820 = iter_72126;
        int64_t remnant_72130 = iter_72126 - gtid_71820;
        float x_71821;
        
        x_71821 = ((float *) Y_mem_70569.mem)[gtid_66854 * n_65344 +
                                              gtid_71820];
        
        bool isnan_res_71822;
        
        isnan_res_71822 = futrts_isnan32(x_71821);
        
        bool defunc_0_p_res_71823 = !isnan_res_71822;
        int64_t defunc_1_f_res_71824;
        
        if (defunc_0_p_res_71823) {
            int64_t x_72127;
            
            x_72127 = ((int64_t *) mem_70576.mem)[gtid_71820];
            
            int64_t defunc_1_f_res_t_res_72128 = sub64(x_72127, (int64_t) 1);
            
            defunc_1_f_res_71824 = defunc_1_f_res_t_res_72128;
        } else {
            defunc_1_f_res_71824 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_71824) &&
            slt64(defunc_1_f_res_71824, n_65344)) {
            ((int64_t *) mem_70582.mem)[defunc_1_f_res_71824] = gtid_71820;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_71824) &&
            slt64(defunc_1_f_res_71824, n_65344)) {
            ((float *) mem_70579.mem)[defunc_1_f_res_71824] = x_71821;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77052_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77052_end -
                 futhark_mc_segmap_parloop_77052_start;
        
        ctx->futhark_mc_segmap_parloop_77052_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77052_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77052_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77050(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_71819 = tid;
    int num_tasks_72125 = info.nsubtasks;
    struct futhark_mc_task_77049 *futhark_mc_task_77049 =
                                 (struct futhark_mc_task_77049 *) args;
    struct futhark_context *ctx = futhark_mc_task_77049->ctx;
    uint64_t futhark_mc_segmap_task_77050_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77050_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77049->free_n_65344;
    int64_t gtid_66854 = futhark_mc_task_77049->free_gtid_66854;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77049->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70576 = {.desc ="mem_70576", .mem =
                                 futhark_mc_task_77049->free_mem_70576, .size =
                                 0, .references =NULL};
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_task_77049->free_mem_70579, .size =
                                 0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_task_77049->free_mem_70582, .size =
                                 0, .references =NULL};
    int64_t iter_72126;
    struct futhark_mc_segmap_parloop_struct_77051
    futhark_mc_segmap_parloop_struct_77051;
    
    futhark_mc_segmap_parloop_struct_77051.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77051.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77051.free_gtid_66854 = gtid_66854;
    futhark_mc_segmap_parloop_struct_77051.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77051.free_mem_70576 = mem_70576.mem;
    futhark_mc_segmap_parloop_struct_77051.free_mem_70579 = mem_70579.mem;
    futhark_mc_segmap_parloop_struct_77051.free_mem_70582 = mem_70582.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77052_task;
    
    futhark_mc_segmap_parloop_77052_task.name =
        "futhark_mc_segmap_parloop_77052";
    futhark_mc_segmap_parloop_77052_task.fn = futhark_mc_segmap_parloop_77052;
    futhark_mc_segmap_parloop_77052_task.args =
        &futhark_mc_segmap_parloop_struct_77051;
    futhark_mc_segmap_parloop_77052_task.iterations = iterations;
    futhark_mc_segmap_parloop_77052_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77052_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77052_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77052_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77052_task);
    
    if (futhark_mc_segmap_parloop_77052_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77052_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77052_total_end -
                 futhark_mc_segmap_parloop_77052_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77052_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77052_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77052_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77050_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77050_end -
                 futhark_mc_segmap_task_77050_start;
        
        ctx->futhark_mc_segmap_task_77050_runs[tid]++;
        ctx->futhark_mc_segmap_task_77050_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77050_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77053 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70585;
};
struct futhark_mc_segmap_parloop_struct_77055 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70585;
};
static int futhark_mc_segmap_parloop_77056(void *args, int64_t start,
                                           int64_t end, int flat_tid_71827,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77055
    *futhark_mc_segmap_parloop_struct_77055 =
    (struct futhark_mc_segmap_parloop_struct_77055 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77055->ctx;
    uint64_t futhark_mc_segmap_parloop_77056_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77056_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77055->free_n_65344;
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_segmap_parloop_struct_77055->free_mem_70582,
                                 .size =0, .references =NULL};
    struct memblock mem_70585 = {.desc ="mem_70585", .mem =
                                 futhark_mc_segmap_parloop_struct_77055->free_mem_70585,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72132 = start;
    
    for (; iter_72132 < end; iter_72132++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72133 = n_65344;
        int64_t gtid_71828 = iter_72132;
        int64_t remnant_72134 = iter_72132 - gtid_71828;
        int64_t x_71829;
        
        x_71829 = ((int64_t *) mem_70582.mem)[gtid_71828];
        
        int64_t defunc_0_f_res_71830 = add64((int64_t) 1, x_71829);
        
        ((int64_t *) mem_70585.mem)[gtid_71828] = defunc_0_f_res_71830;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77056_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77056_end -
                 futhark_mc_segmap_parloop_77056_start;
        
        ctx->futhark_mc_segmap_parloop_77056_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77056_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77056_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77054(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_71827 = tid;
    int num_tasks_72131 = info.nsubtasks;
    struct futhark_mc_task_77053 *futhark_mc_task_77053 =
                                 (struct futhark_mc_task_77053 *) args;
    struct futhark_context *ctx = futhark_mc_task_77053->ctx;
    uint64_t futhark_mc_segmap_task_77054_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77054_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77053->free_n_65344;
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_task_77053->free_mem_70582, .size =
                                 0, .references =NULL};
    struct memblock mem_70585 = {.desc ="mem_70585", .mem =
                                 futhark_mc_task_77053->free_mem_70585, .size =
                                 0, .references =NULL};
    int64_t iter_72132;
    struct futhark_mc_segmap_parloop_struct_77055
    futhark_mc_segmap_parloop_struct_77055;
    
    futhark_mc_segmap_parloop_struct_77055.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77055.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77055.free_mem_70582 = mem_70582.mem;
    futhark_mc_segmap_parloop_struct_77055.free_mem_70585 = mem_70585.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77056_task;
    
    futhark_mc_segmap_parloop_77056_task.name =
        "futhark_mc_segmap_parloop_77056";
    futhark_mc_segmap_parloop_77056_task.fn = futhark_mc_segmap_parloop_77056;
    futhark_mc_segmap_parloop_77056_task.args =
        &futhark_mc_segmap_parloop_struct_77055;
    futhark_mc_segmap_parloop_77056_task.iterations = iterations;
    futhark_mc_segmap_parloop_77056_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77056_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77056_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77056_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77056_task);
    
    if (futhark_mc_segmap_parloop_77056_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77056_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77056_total_end -
                 futhark_mc_segmap_parloop_77056_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77056_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77056_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77056_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77054_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77054_end -
                 futhark_mc_segmap_task_77054_start;
        
        ctx->futhark_mc_segmap_task_77054_runs[tid]++;
        ctx->futhark_mc_segmap_task_77054_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77054_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77057 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_66866;
    unsigned char *free_mem_70588;
};
struct futhark_mc_segmap_parloop_struct_77059 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_66866;
    unsigned char *free_mem_70588;
};
static int futhark_mc_segmap_parloop_77060(void *args, int64_t start,
                                           int64_t end, int flat_tid_71831,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77059
    *futhark_mc_segmap_parloop_struct_77059 =
    (struct futhark_mc_segmap_parloop_struct_77059 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77059->ctx;
    uint64_t futhark_mc_segmap_parloop_77060_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77060_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77059->free_q_65346;
    int64_t last_res_66866 =
            futhark_mc_segmap_parloop_struct_77059->free_last_res_66866;
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_segmap_parloop_struct_77059->free_mem_70588,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72136 = start;
    
    for (; iter_72136 < end; iter_72136++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72137 = q_65346;
        int64_t gtid_71832 = iter_72136;
        int64_t remnant_72138 = iter_72136 - gtid_71832;
        bool cond_71833 = sle64(last_res_66866, gtid_71832);
        float defunc_0_f_res_71834;
        
        if (cond_71833) {
            defunc_0_f_res_71834 = 0.0F;
        } else {
            defunc_0_f_res_71834 = 1.0F;
        }
        ((float *) mem_70588.mem)[gtid_71832] = defunc_0_f_res_71834;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77060_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77060_end -
                 futhark_mc_segmap_parloop_77060_start;
        
        ctx->futhark_mc_segmap_parloop_77060_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77060_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77060_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77058(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_71831 = tid;
    int num_tasks_72135 = info.nsubtasks;
    struct futhark_mc_task_77057 *futhark_mc_task_77057 =
                                 (struct futhark_mc_task_77057 *) args;
    struct futhark_context *ctx = futhark_mc_task_77057->ctx;
    uint64_t futhark_mc_segmap_task_77058_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77058_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_task_77057->free_q_65346;
    int64_t last_res_66866 = futhark_mc_task_77057->free_last_res_66866;
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_task_77057->free_mem_70588, .size =
                                 0, .references =NULL};
    int64_t iter_72136;
    struct futhark_mc_segmap_parloop_struct_77059
    futhark_mc_segmap_parloop_struct_77059;
    
    futhark_mc_segmap_parloop_struct_77059.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77059.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77059.free_last_res_66866 = last_res_66866;
    futhark_mc_segmap_parloop_struct_77059.free_mem_70588 = mem_70588.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77060_task;
    
    futhark_mc_segmap_parloop_77060_task.name =
        "futhark_mc_segmap_parloop_77060";
    futhark_mc_segmap_parloop_77060_task.fn = futhark_mc_segmap_parloop_77060;
    futhark_mc_segmap_parloop_77060_task.args =
        &futhark_mc_segmap_parloop_struct_77059;
    futhark_mc_segmap_parloop_77060_task.iterations = iterations;
    futhark_mc_segmap_parloop_77060_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77060_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77060_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77060_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77060_task);
    
    if (futhark_mc_segmap_parloop_77060_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77060_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77060_total_end -
                 futhark_mc_segmap_parloop_77060_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77060_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77060_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77060_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77058_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77058_end -
                 futhark_mc_segmap_task_77058_start;
        
        ctx->futhark_mc_segmap_task_77058_runs[tid]++;
        ctx->futhark_mc_segmap_task_77058_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77058_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77061 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_66866;
    int64_t free_min_arg_66885;
    int64_t free_min_arg_66886;
    int64_t free_min_res_66887;
    float free_max_res_66891;
    unsigned char *free_mem_70579;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70585;
    unsigned char *free_mem_70588;
    unsigned char *free_mem_70591;
};
struct futhark_mc_segmap_parloop_struct_77063 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_66866;
    int64_t free_min_arg_66885;
    int64_t free_min_arg_66886;
    int64_t free_min_res_66887;
    float free_max_res_66891;
    unsigned char *free_mem_70579;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70585;
    unsigned char *free_mem_70588;
    unsigned char *free_mem_70591;
};
static int futhark_mc_segmap_parloop_77064(void *args, int64_t start,
                                           int64_t end, int flat_tid_71973,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77063
    *futhark_mc_segmap_parloop_struct_77063 =
    (struct futhark_mc_segmap_parloop_struct_77063 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77063->ctx;
    uint64_t futhark_mc_segmap_parloop_77064_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77064_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77063->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77063->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77063->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77063->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77063->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77063->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77063->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77063->free_loop_cond_65369;
    int64_t last_res_66866 =
            futhark_mc_segmap_parloop_struct_77063->free_last_res_66866;
    int64_t min_arg_66885 =
            futhark_mc_segmap_parloop_struct_77063->free_min_arg_66885;
    int64_t min_arg_66886 =
            futhark_mc_segmap_parloop_struct_77063->free_min_arg_66886;
    int64_t min_res_66887 =
            futhark_mc_segmap_parloop_struct_77063->free_min_res_66887;
    float max_res_66891 =
          futhark_mc_segmap_parloop_struct_77063->free_max_res_66891;
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_segmap_parloop_struct_77063->free_mem_70579,
                                 .size =0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_segmap_parloop_struct_77063->free_mem_70582,
                                 .size =0, .references =NULL};
    struct memblock mem_70585 = {.desc ="mem_70585", .mem =
                                 futhark_mc_segmap_parloop_struct_77063->free_mem_70585,
                                 .size =0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_segmap_parloop_struct_77063->free_mem_70588,
                                 .size =0, .references =NULL};
    struct memblock mem_70591 = {.desc ="mem_70591", .mem =
                                 futhark_mc_segmap_parloop_struct_77063->free_mem_70591,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72140 = start;
    
    for (; iter_72140 < end; iter_72140++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72239 = n_m_65352;
        int64_t gtid_71974 = iter_72140;
        int64_t remnant_72240 = iter_72140 - gtid_71974;
        int64_t min_arg_71975 = mul64(jump_65348, gtid_71974);
        int64_t min_res_71976 = smin64(i_65358, min_arg_71975);
        int64_t defunc_0_g_res_71977 = add64((int64_t) 1, min_res_71976);
        bool init_idx_71978;
        int64_t init_idx_71979;
        int64_t init_idx_71980;
        bool loop_while_72141;
        int64_t low_72142;
        int64_t high_72143;
        
        loop_while_72141 = x_65359;
        low_72142 = (int64_t) 0;
        high_72143 = i_65358;
        while (loop_while_72141) {
            int64_t x_72144 = add64(low_72142, high_72143);
            int64_t mid_72145 = sdiv64(x_72144, (int64_t) 2);
            bool x_72146 = sle64((int64_t) 0, mid_72145);
            bool y_72147 = slt64(mid_72145, n_65344);
            bool bounds_check_72148 = x_72146 && y_72147;
            bool index_certs_72149;
            
            if (!bounds_check_72148) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_72145,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_72150;
            
            mid_id_72150 = ((int64_t *) mem_70585.mem)[mid_72145];
            
            bool cond_72151 = slt64(mid_id_72150, (int64_t) 0);
            int64_t mid_idx_72152;
            
            if (cond_72151) {
                mid_idx_72152 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_72152 = mid_id_72150;
            }
            
            bool cond_72153 = sle64(defunc_0_g_res_71977, mid_idx_72152);
            int64_t loopres_72154;
            int64_t loopres_72155;
            
            if (cond_72153) {
                int64_t loopres_t_res_72156 = sub64(mid_72145, (int64_t) 1);
                
                loopres_72154 = low_72142;
                loopres_72155 = loopres_t_res_72156;
            } else {
                int64_t loopres_f_res_72157 = add64((int64_t) 1, mid_72145);
                
                loopres_72154 = loopres_f_res_72157;
                loopres_72155 = high_72143;
            }
            
            bool loop_cond_72158 = sle64(loopres_72154, loopres_72155);
            bool loop_while_tmp_72241 = loop_cond_72158;
            int64_t low_tmp_72242 = loopres_72154;
            int64_t high_tmp_72243 = loopres_72155;
            
            loop_while_72141 = loop_while_tmp_72241;
            low_72142 = low_tmp_72242;
            high_72143 = high_tmp_72243;
        }
        init_idx_71978 = loop_while_72141;
        init_idx_71979 = low_72142;
        init_idx_71980 = high_72143;
        
        bool idx_71999;
        int64_t idx_72000;
        int64_t idx_72001;
        int64_t idx_72002;
        bool loop_while_72159;
        int64_t l_idx_72160;
        int64_t r_idx_72161;
        int64_t span_72162;
        
        loop_while_72159 = loop_cond_65369;
        l_idx_72160 = init_idx_71979;
        r_idx_72161 = init_idx_71979;
        span_72162 = (int64_t) 1;
        while (loop_while_72159) {
            int64_t max_arg_72163 = sub64(l_idx_72160, (int64_t) 1);
            int64_t max_res_72164 = smax64((int64_t) 0, max_arg_72163);
            int64_t min_arg_72165 = add64((int64_t) 1, r_idx_72161);
            int64_t min_res_72166 = smin64(min_arg_66885, min_arg_72165);
            bool x_72167 = sle64((int64_t) 0, max_res_72164);
            bool y_72168 = slt64(max_res_72164, n_65344);
            bool bounds_check_72169 = x_72167 && y_72168;
            bool index_certs_72170;
            
            if (!bounds_check_72169) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_72164,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_72171;
            
            x_72171 = ((int64_t *) mem_70585.mem)[max_res_72164];
            
            int64_t abs_arg_72172 = sub64(x_72171, defunc_0_g_res_71977);
            int64_t abs_res_72173 = abs64(abs_arg_72172);
            bool x_72174 = sle64((int64_t) 0, min_res_72166);
            bool y_72175 = slt64(min_res_72166, n_65344);
            bool bounds_check_72176 = x_72174 && y_72175;
            bool index_certs_72177;
            
            if (!bounds_check_72176) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_72166,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_72178;
            
            x_72178 = ((int64_t *) mem_70585.mem)[min_res_72166];
            
            int64_t abs_arg_72179 = sub64(x_72178, defunc_0_g_res_71977);
            int64_t abs_res_72180 = abs64(abs_arg_72179);
            bool cond_72181 = max_res_72164 == l_idx_72160;
            int64_t loopres_72182;
            int64_t loopres_72183;
            int64_t loopres_72184;
            
            if (cond_72181) {
                loopres_72182 = l_idx_72160;
                loopres_72183 = r_idx_72161;
                loopres_72184 = min_res_65364;
            } else {
                bool cond_72185 = slt64(abs_res_72173, abs_res_72180);
                bool cond_f_res_72186 = min_res_72166 == r_idx_72161;
                bool x_72187 = !cond_72185;
                bool y_72188 = cond_f_res_72186 && x_72187;
                bool cond_72189 = cond_72185 || y_72188;
                int64_t loopres_f_res_72190;
                
                if (cond_72189) {
                    loopres_f_res_72190 = max_res_72164;
                } else {
                    loopres_f_res_72190 = l_idx_72160;
                }
                
                int64_t loopres_f_res_72191;
                
                if (cond_72189) {
                    loopres_f_res_72191 = r_idx_72161;
                } else {
                    loopres_f_res_72191 = min_res_72166;
                }
                
                int64_t loopres_f_res_72192;
                
                if (cond_72189) {
                    int64_t loopres_f_res_t_res_72193 = add64((int64_t) 1,
                                                              span_72162);
                    
                    loopres_f_res_72192 = loopres_f_res_t_res_72193;
                } else {
                    int64_t loopres_f_res_f_res_72194 = add64((int64_t) 1,
                                                              span_72162);
                    
                    loopres_f_res_72192 = loopres_f_res_f_res_72194;
                }
                loopres_72182 = loopres_f_res_72190;
                loopres_72183 = loopres_f_res_72191;
                loopres_72184 = loopres_f_res_72192;
            }
            
            bool loop_cond_72195 = slt64(loopres_72184, min_res_65364);
            bool loop_while_tmp_72244 = loop_cond_72195;
            int64_t l_idx_tmp_72245 = loopres_72182;
            int64_t r_idx_tmp_72246 = loopres_72183;
            int64_t span_tmp_72247 = loopres_72184;
            
            loop_while_72159 = loop_while_tmp_72244;
            l_idx_72160 = l_idx_tmp_72245;
            r_idx_72161 = r_idx_tmp_72246;
            span_72162 = span_tmp_72247;
        }
        idx_71999 = loop_while_72159;
        idx_72000 = l_idx_72160;
        idx_72001 = r_idx_72161;
        idx_72002 = span_72162;
        
        int64_t min_res_72040 = smin64(min_arg_66886, idx_72000);
        int64_t max_res_72041 = smax64((int64_t) 0, min_res_72040);
        int64_t x_72042 = add64(min_res_66887, max_res_72041);
        int64_t r_72043 = sub64(x_72042, (int64_t) 1);
        bool x_72044 = sle64((int64_t) 0, r_72043);
        bool y_72045 = slt64(r_72043, n_65344);
        bool bounds_check_72046 = x_72044 && y_72045;
        bool index_certs_72047;
        
        if (!bounds_check_72046) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_72043,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_72048;
        
        x_72048 = ((int64_t *) mem_70582.mem)[r_72043];
        
        int64_t abs_arg_72049 = sub64(x_72048, min_res_71976);
        int64_t abs_res_72050 = abs64(abs_arg_72049);
        bool x_72051 = sle64((int64_t) 0, max_res_72041);
        bool y_72052 = slt64(max_res_72041, n_65344);
        bool bounds_check_72053 = x_72051 && y_72052;
        bool index_certs_72054;
        
        if (!bounds_check_72053) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_72041,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_72055;
        
        x_72055 = ((int64_t *) mem_70582.mem)[max_res_72041];
        
        int64_t abs_arg_72056 = sub64(x_72055, min_res_71976);
        int64_t abs_res_72057 = abs64(abs_arg_72056);
        int64_t max_res_72058 = smax64(abs_res_72050, abs_res_72057);
        float defunc_0_f_res_72059 = sitofp_i64_f32(max_res_72058);
        float defunc_1_f_res_72060 = max_res_66891 + defunc_0_f_res_72059;
        float defunc_2_reduce_res_72061;
        float redout_72197 = 0.0F;
        
        for (int64_t i_72196 = 0; i_72196 < q_65346; i_72196++) {
            float x_72198;
            
            x_72198 = ((float *) mem_70588.mem)[i_72196];
            
            bool cond_72199 = sle64(last_res_66866, i_72196);
            int64_t defunc_0_f_res_72200;
            
            if (cond_72199) {
                defunc_0_f_res_72200 = (int64_t) 0;
            } else {
                int64_t i_72201 = add64(max_res_72041, i_72196);
                int64_t defunc_0_add_arg_72202;
                
                defunc_0_add_arg_72202 = ((int64_t *) mem_70582.mem)[i_72201];
                
                int64_t defunc_1_add_res_72203 = add64((int64_t) 1,
                                                       defunc_0_add_arg_72202);
                
                defunc_0_f_res_72200 = defunc_1_add_res_72203;
            }
            
            int64_t binop_p_72204 = sub64(defunc_0_f_res_72200, min_res_71976);
            float defunc_0_f_res_72205 = sitofp_i64_f32(binop_p_72204);
            float abs_res_72206 = (float) fabs(defunc_0_f_res_72205);
            float tmp1_72207 = abs_res_72206 / defunc_1_f_res_72060;
            float x_72208 = tmp1_72207 * tmp1_72207;
            float y_72209 = tmp1_72207 * x_72208;
            float tmp2_72210 = 1.0F - y_72209;
            float x_72211 = tmp2_72210 * tmp2_72210;
            float tmp3_72212 = tmp2_72210 * x_72211;
            float w_j_72213 = x_72198 * tmp3_72212;
            float defunc_1_op_res_72214 = w_j_72213 + redout_72197;
            float redout_tmp_72248 = defunc_1_op_res_72214;
            
            redout_72197 = redout_tmp_72248;
        }
        defunc_2_reduce_res_72061 = redout_72197;
        
        float a0_72081 = 1.0F / defunc_2_reduce_res_72061;
        float defunc_2_reduce_res_72082;
        float redout_72216 = 0.0F;
        
        for (int64_t i_72215 = 0; i_72215 < q_65346; i_72215++) {
            float x_72217;
            
            x_72217 = ((float *) mem_70588.mem)[i_72215];
            
            bool cond_72218 = sle64(last_res_66866, i_72215);
            int64_t defunc_0_f_res_72219;
            
            if (cond_72218) {
                defunc_0_f_res_72219 = (int64_t) 0;
            } else {
                int64_t i_72220 = add64(max_res_72041, i_72215);
                int64_t defunc_0_add_arg_72221;
                
                defunc_0_add_arg_72221 = ((int64_t *) mem_70582.mem)[i_72220];
                
                int64_t defunc_1_add_res_72222 = add64((int64_t) 1,
                                                       defunc_0_add_arg_72221);
                
                defunc_0_f_res_72219 = defunc_1_add_res_72222;
            }
            
            int64_t binop_p_72223 = sub64(defunc_0_f_res_72219, min_res_71976);
            float defunc_0_f_res_72224 = sitofp_i64_f32(binop_p_72223);
            float abs_res_72225 = (float) fabs(defunc_0_f_res_72224);
            float tmp1_72226 = abs_res_72225 / defunc_1_f_res_72060;
            float x_72227 = tmp1_72226 * tmp1_72226;
            float y_72228 = tmp1_72226 * x_72227;
            float tmp2_72229 = 1.0F - y_72228;
            float x_72230 = tmp2_72229 * tmp2_72229;
            float tmp3_72231 = tmp2_72229 * x_72230;
            float tmp4_72232 = x_72217 * tmp3_72231;
            float defunc_0_f_res_72233;
            
            if (cond_72218) {
                defunc_0_f_res_72233 = 0.0F;
            } else {
                int64_t i_72234 = add64(max_res_72041, i_72215);
                float defunc_0_add_arg_72235;
                
                defunc_0_add_arg_72235 = ((float *) mem_70579.mem)[i_72234];
                defunc_0_f_res_72233 = defunc_0_add_arg_72235;
            }
            
            float x_72236 = a0_72081 * tmp4_72232;
            float defunc_9_fit_fun_res_72237 = defunc_0_f_res_72233 * x_72236;
            float defunc_1_op_res_72238 = defunc_9_fit_fun_res_72237 +
                  redout_72216;
            float redout_tmp_72249 = defunc_1_op_res_72238;
            
            redout_72216 = redout_tmp_72249;
        }
        defunc_2_reduce_res_72082 = redout_72216;
        ((float *) mem_70591.mem)[gtid_71974] = defunc_2_reduce_res_72082;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77064_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77064_end -
                 futhark_mc_segmap_parloop_77064_start;
        
        ctx->futhark_mc_segmap_parloop_77064_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77064_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77064_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77062(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_71973 = tid;
    int num_tasks_72139 = info.nsubtasks;
    struct futhark_mc_task_77061 *futhark_mc_task_77061 =
                                 (struct futhark_mc_task_77061 *) args;
    struct futhark_context *ctx = futhark_mc_task_77061->ctx;
    uint64_t futhark_mc_segmap_task_77062_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77062_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77061->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77061->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77061->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77061->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77061->free_i_65358;
    bool x_65359 = futhark_mc_task_77061->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77061->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77061->free_loop_cond_65369;
    int64_t last_res_66866 = futhark_mc_task_77061->free_last_res_66866;
    int64_t min_arg_66885 = futhark_mc_task_77061->free_min_arg_66885;
    int64_t min_arg_66886 = futhark_mc_task_77061->free_min_arg_66886;
    int64_t min_res_66887 = futhark_mc_task_77061->free_min_res_66887;
    float max_res_66891 = futhark_mc_task_77061->free_max_res_66891;
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_task_77061->free_mem_70579, .size =
                                 0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_task_77061->free_mem_70582, .size =
                                 0, .references =NULL};
    struct memblock mem_70585 = {.desc ="mem_70585", .mem =
                                 futhark_mc_task_77061->free_mem_70585, .size =
                                 0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_task_77061->free_mem_70588, .size =
                                 0, .references =NULL};
    struct memblock mem_70591 = {.desc ="mem_70591", .mem =
                                 futhark_mc_task_77061->free_mem_70591, .size =
                                 0, .references =NULL};
    int64_t iter_72140;
    struct futhark_mc_segmap_parloop_struct_77063
    futhark_mc_segmap_parloop_struct_77063;
    
    futhark_mc_segmap_parloop_struct_77063.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77063.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77063.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77063.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77063.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77063.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77063.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77063.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77063.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77063.free_last_res_66866 = last_res_66866;
    futhark_mc_segmap_parloop_struct_77063.free_min_arg_66885 = min_arg_66885;
    futhark_mc_segmap_parloop_struct_77063.free_min_arg_66886 = min_arg_66886;
    futhark_mc_segmap_parloop_struct_77063.free_min_res_66887 = min_res_66887;
    futhark_mc_segmap_parloop_struct_77063.free_max_res_66891 = max_res_66891;
    futhark_mc_segmap_parloop_struct_77063.free_mem_70579 = mem_70579.mem;
    futhark_mc_segmap_parloop_struct_77063.free_mem_70582 = mem_70582.mem;
    futhark_mc_segmap_parloop_struct_77063.free_mem_70585 = mem_70585.mem;
    futhark_mc_segmap_parloop_struct_77063.free_mem_70588 = mem_70588.mem;
    futhark_mc_segmap_parloop_struct_77063.free_mem_70591 = mem_70591.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77064_task;
    
    futhark_mc_segmap_parloop_77064_task.name =
        "futhark_mc_segmap_parloop_77064";
    futhark_mc_segmap_parloop_77064_task.fn = futhark_mc_segmap_parloop_77064;
    futhark_mc_segmap_parloop_77064_task.args =
        &futhark_mc_segmap_parloop_struct_77063;
    futhark_mc_segmap_parloop_77064_task.iterations = iterations;
    futhark_mc_segmap_parloop_77064_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77064_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77064_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77064_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77064_task);
    
    if (futhark_mc_segmap_parloop_77064_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77064_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77064_total_end -
                 futhark_mc_segmap_parloop_77064_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77064_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77064_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77064_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77062_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77062_end -
                 futhark_mc_segmap_task_77062_start;
        
        ctx->futhark_mc_segmap_task_77062_runs[tid]++;
        ctx->futhark_mc_segmap_task_77062_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77062_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77066 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_66866;
    int64_t free_min_arg_66885;
    int64_t free_min_arg_66886;
    int64_t free_min_res_66887;
    float free_max_res_66891;
    unsigned char *free_mem_70579;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70585;
    unsigned char *free_mem_70588;
    unsigned char *free_mem_70591;
};
struct futhark_mc_task_77068 {
    struct futhark_context *ctx;
    int64_t free_last_res_66866;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70588;
    int64_t free_min_res_71838;
    int64_t free_max_res_71903;
    float free_defunc_1_f_res_71922;
    float *retval_defunc_2_reduce_res_71923;
};
struct futhark_mc_segred_stage_1_parloop_struct_77071 {
    struct futhark_context *ctx;
    int64_t free_last_res_66866;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70588;
    int64_t free_min_res_71838;
    int64_t free_max_res_71903;
    float free_defunc_1_f_res_71922;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_72363;
};
static int futhark_mc_segred_stage_1_parloop_77072(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_72306, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77071
    *futhark_mc_segred_stage_1_parloop_struct_77071 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77071 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77071->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77072_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77072_start = get_wall_time();
    
    int64_t last_res_66866 =
            futhark_mc_segred_stage_1_parloop_struct_77071->free_last_res_66866;
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77071->free_mem_70582,
                                 .size =0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77071->free_mem_70588,
                                 .size =0, .references =NULL};
    int64_t min_res_71838 =
            futhark_mc_segred_stage_1_parloop_struct_77071->free_min_res_71838;
    int64_t max_res_71903 =
            futhark_mc_segred_stage_1_parloop_struct_77071->free_max_res_71903;
    float defunc_1_f_res_71922 =
          futhark_mc_segred_stage_1_parloop_struct_77071->free_defunc_1_f_res_71922;
    struct memblock reduce_stage_1_tid_res_arr_mem_72363 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_72363",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77071->free_reduce_stage_1_tid_res_arr_mem_72363,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72365 = start;
    float x_72308;
    float x_72309;
    float local_acc_72366 = 0.0F;
    
    for (; iter_72365 < end; iter_72365++) {
        int64_t gtid_72307 = iter_72365;
        float x_72311;
        
        x_72311 = ((float *) mem_70588.mem)[gtid_72307];
        
        bool cond_72312 = sle64(last_res_66866, gtid_72307);
        int64_t defunc_0_f_res_72313;
        
        if (cond_72312) {
            defunc_0_f_res_72313 = (int64_t) 0;
        } else {
            int64_t i_72314 = add64(max_res_71903, gtid_72307);
            int64_t defunc_0_add_arg_72315;
            
            defunc_0_add_arg_72315 = ((int64_t *) mem_70582.mem)[i_72314];
            
            int64_t defunc_1_add_res_72316 = add64((int64_t) 1,
                                                   defunc_0_add_arg_72315);
            
            defunc_0_f_res_72313 = defunc_1_add_res_72316;
        }
        
        int64_t binop_p_72317 = sub64(defunc_0_f_res_72313, min_res_71838);
        float defunc_0_f_res_72318 = sitofp_i64_f32(binop_p_72317);
        float abs_res_72319 = (float) fabs(defunc_0_f_res_72318);
        float tmp1_72320 = abs_res_72319 / defunc_1_f_res_71922;
        float x_72321 = tmp1_72320 * tmp1_72320;
        float y_72322 = tmp1_72320 * x_72321;
        float tmp2_72323 = 1.0F - y_72322;
        float x_72324 = tmp2_72323 * tmp2_72323;
        float tmp3_72325 = tmp2_72323 * x_72324;
        float w_j_72326 = x_72311 * tmp3_72325;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_72308 = local_acc_72366;
        }
        // Load next params
        {
            x_72309 = w_j_72326;
        }
        // Red body
        {
            float defunc_1_op_res_72310 = x_72308 + x_72309;
            
            local_acc_72366 = defunc_1_op_res_72310;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_72363.mem)[flat_tid_72306] =
        local_acc_72366;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77072_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77072_end -
                 futhark_mc_segred_stage_1_parloop_77072_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77072_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77072_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77072_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77069(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72306 = tid;
    int num_tasks_72362 = info.nsubtasks;
    struct futhark_mc_task_77068 *futhark_mc_task_77068 =
                                 (struct futhark_mc_task_77068 *) args;
    struct futhark_context *ctx = futhark_mc_task_77068->ctx;
    uint64_t futhark_mc_segred_task_77069_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77069_start = get_wall_time();
    
    int64_t last_res_66866 = futhark_mc_task_77068->free_last_res_66866;
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_task_77068->free_mem_70582, .size =
                                 0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_task_77068->free_mem_70588, .size =
                                 0, .references =NULL};
    int64_t min_res_71838 = futhark_mc_task_77068->free_min_res_71838;
    int64_t max_res_71903 = futhark_mc_task_77068->free_max_res_71903;
    float defunc_1_f_res_71922 =
          futhark_mc_task_77068->free_defunc_1_f_res_71922;
    float defunc_2_reduce_res_71923 =
          *futhark_mc_task_77068->retval_defunc_2_reduce_res_71923;
    size_t reduce_stage_1_tid_res_arr_mem_72363_cached_sizze_77070 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_72363 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_72363_cached_sizze_77070 <
        (size_t) ((int64_t) 4 * num_tasks_72362)) {
        reduce_stage_1_tid_res_arr_mem_72363 =
            realloc(reduce_stage_1_tid_res_arr_mem_72363, (int64_t) 4 *
                    num_tasks_72362);
        reduce_stage_1_tid_res_arr_mem_72363_cached_sizze_77070 = (int64_t) 4 *
            num_tasks_72362;
    }
    
    int64_t iter_72365;
    struct futhark_mc_segred_stage_1_parloop_struct_77071
    futhark_mc_segred_stage_1_parloop_struct_77071;
    
    futhark_mc_segred_stage_1_parloop_struct_77071.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77071.free_last_res_66866 =
        last_res_66866;
    futhark_mc_segred_stage_1_parloop_struct_77071.free_mem_70582 =
        mem_70582.mem;
    futhark_mc_segred_stage_1_parloop_struct_77071.free_mem_70588 =
        mem_70588.mem;
    futhark_mc_segred_stage_1_parloop_struct_77071.free_min_res_71838 =
        min_res_71838;
    futhark_mc_segred_stage_1_parloop_struct_77071.free_max_res_71903 =
        max_res_71903;
    futhark_mc_segred_stage_1_parloop_struct_77071.free_defunc_1_f_res_71922 =
        defunc_1_f_res_71922;
    futhark_mc_segred_stage_1_parloop_struct_77071.free_reduce_stage_1_tid_res_arr_mem_72363 =
        reduce_stage_1_tid_res_arr_mem_72363;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77072_task;
    
    futhark_mc_segred_stage_1_parloop_77072_task.name =
        "futhark_mc_segred_stage_1_parloop_77072";
    futhark_mc_segred_stage_1_parloop_77072_task.fn =
        futhark_mc_segred_stage_1_parloop_77072;
    futhark_mc_segred_stage_1_parloop_77072_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77071;
    futhark_mc_segred_stage_1_parloop_77072_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77072_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77072_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77072_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77072_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77072_task);
    
    if (futhark_mc_segred_stage_1_parloop_77072_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77072_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77072_total_end -
                 futhark_mc_segred_stage_1_parloop_77072_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77072_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77072_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77072_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_71923 = 0.0F;
    }
    
    float x_72367;
    float x_72368;
    
    for (int32_t i_72370 = 0; i_72370 < num_tasks_72362; i_72370++) {
        flat_tid_72306 = i_72370;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_72367 = defunc_2_reduce_res_71923;
            }
            // load next params
            {
                x_72368 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_72363)[flat_tid_72306];
            }
            // red body
            {
                float defunc_1_op_res_72369 = x_72367 + x_72368;
                
                defunc_2_reduce_res_71923 = defunc_1_op_res_72369;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_72363);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77069_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77069_end -
                 futhark_mc_segred_task_77069_start;
        
        ctx->futhark_mc_segred_task_77069_runs[tid]++;
        ctx->futhark_mc_segred_task_77069_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77069_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77068->retval_defunc_2_reduce_res_71923 =
            defunc_2_reduce_res_71923;
    }
    return err;
}
struct futhark_mc_task_77073 {
    struct futhark_context *ctx;
    int64_t free_last_res_66866;
    unsigned char *free_mem_70579;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70588;
    int64_t free_min_res_71838;
    int64_t free_max_res_71903;
    float free_defunc_1_f_res_71922;
    float free_a0_71945;
    float *retval_defunc_2_reduce_res_71946;
};
struct futhark_mc_segred_stage_1_parloop_struct_77076 {
    struct futhark_context *ctx;
    int64_t free_last_res_66866;
    unsigned char *free_mem_70579;
    unsigned char *free_mem_70582;
    unsigned char *free_mem_70588;
    int64_t free_min_res_71838;
    int64_t free_max_res_71903;
    float free_defunc_1_f_res_71922;
    float free_a0_71945;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_72372;
};
static int futhark_mc_segred_stage_1_parloop_77077(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_72327, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77076
    *futhark_mc_segred_stage_1_parloop_struct_77076 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77076 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77076->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77077_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77077_start = get_wall_time();
    
    int64_t last_res_66866 =
            futhark_mc_segred_stage_1_parloop_struct_77076->free_last_res_66866;
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77076->free_mem_70579,
                                 .size =0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77076->free_mem_70582,
                                 .size =0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77076->free_mem_70588,
                                 .size =0, .references =NULL};
    int64_t min_res_71838 =
            futhark_mc_segred_stage_1_parloop_struct_77076->free_min_res_71838;
    int64_t max_res_71903 =
            futhark_mc_segred_stage_1_parloop_struct_77076->free_max_res_71903;
    float defunc_1_f_res_71922 =
          futhark_mc_segred_stage_1_parloop_struct_77076->free_defunc_1_f_res_71922;
    float a0_71945 =
          futhark_mc_segred_stage_1_parloop_struct_77076->free_a0_71945;
    struct memblock reduce_stage_1_tid_res_arr_mem_72372 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_72372",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77076->free_reduce_stage_1_tid_res_arr_mem_72372,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72374 = start;
    float x_72329;
    float x_72330;
    float local_acc_72375 = 0.0F;
    
    for (; iter_72374 < end; iter_72374++) {
        int64_t gtid_72328 = iter_72374;
        float x_72332;
        
        x_72332 = ((float *) mem_70588.mem)[gtid_72328];
        
        bool cond_72333 = sle64(last_res_66866, gtid_72328);
        int64_t defunc_0_f_res_72334;
        
        if (cond_72333) {
            defunc_0_f_res_72334 = (int64_t) 0;
        } else {
            int64_t i_72335 = add64(max_res_71903, gtid_72328);
            int64_t defunc_0_add_arg_72336;
            
            defunc_0_add_arg_72336 = ((int64_t *) mem_70582.mem)[i_72335];
            
            int64_t defunc_1_add_res_72337 = add64((int64_t) 1,
                                                   defunc_0_add_arg_72336);
            
            defunc_0_f_res_72334 = defunc_1_add_res_72337;
        }
        
        int64_t binop_p_72338 = sub64(defunc_0_f_res_72334, min_res_71838);
        float defunc_0_f_res_72339 = sitofp_i64_f32(binop_p_72338);
        float abs_res_72340 = (float) fabs(defunc_0_f_res_72339);
        float tmp1_72341 = abs_res_72340 / defunc_1_f_res_71922;
        float x_72342 = tmp1_72341 * tmp1_72341;
        float y_72343 = tmp1_72341 * x_72342;
        float tmp2_72344 = 1.0F - y_72343;
        float x_72345 = tmp2_72344 * tmp2_72344;
        float tmp3_72346 = tmp2_72344 * x_72345;
        float tmp4_72347 = x_72332 * tmp3_72346;
        float defunc_0_f_res_72348;
        
        if (cond_72333) {
            defunc_0_f_res_72348 = 0.0F;
        } else {
            int64_t i_72349 = add64(max_res_71903, gtid_72328);
            float defunc_0_add_arg_72350;
            
            defunc_0_add_arg_72350 = ((float *) mem_70579.mem)[i_72349];
            defunc_0_f_res_72348 = defunc_0_add_arg_72350;
        }
        
        float x_72351 = a0_71945 * tmp4_72347;
        float defunc_9_fit_fun_res_72352 = defunc_0_f_res_72348 * x_72351;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_72329 = local_acc_72375;
        }
        // Load next params
        {
            x_72330 = defunc_9_fit_fun_res_72352;
        }
        // Red body
        {
            float defunc_1_op_res_72331 = x_72329 + x_72330;
            
            local_acc_72375 = defunc_1_op_res_72331;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_72372.mem)[flat_tid_72327] =
        local_acc_72375;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77077_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77077_end -
                 futhark_mc_segred_stage_1_parloop_77077_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77077_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77077_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77077_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77074(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72327 = tid;
    int num_tasks_72371 = info.nsubtasks;
    struct futhark_mc_task_77073 *futhark_mc_task_77073 =
                                 (struct futhark_mc_task_77073 *) args;
    struct futhark_context *ctx = futhark_mc_task_77073->ctx;
    uint64_t futhark_mc_segred_task_77074_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77074_start = get_wall_time();
    
    int64_t last_res_66866 = futhark_mc_task_77073->free_last_res_66866;
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_task_77073->free_mem_70579, .size =
                                 0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_task_77073->free_mem_70582, .size =
                                 0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_task_77073->free_mem_70588, .size =
                                 0, .references =NULL};
    int64_t min_res_71838 = futhark_mc_task_77073->free_min_res_71838;
    int64_t max_res_71903 = futhark_mc_task_77073->free_max_res_71903;
    float defunc_1_f_res_71922 =
          futhark_mc_task_77073->free_defunc_1_f_res_71922;
    float a0_71945 = futhark_mc_task_77073->free_a0_71945;
    float defunc_2_reduce_res_71946 =
          *futhark_mc_task_77073->retval_defunc_2_reduce_res_71946;
    size_t reduce_stage_1_tid_res_arr_mem_72372_cached_sizze_77075 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_72372 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_72372_cached_sizze_77075 <
        (size_t) ((int64_t) 4 * num_tasks_72371)) {
        reduce_stage_1_tid_res_arr_mem_72372 =
            realloc(reduce_stage_1_tid_res_arr_mem_72372, (int64_t) 4 *
                    num_tasks_72371);
        reduce_stage_1_tid_res_arr_mem_72372_cached_sizze_77075 = (int64_t) 4 *
            num_tasks_72371;
    }
    
    int64_t iter_72374;
    struct futhark_mc_segred_stage_1_parloop_struct_77076
    futhark_mc_segred_stage_1_parloop_struct_77076;
    
    futhark_mc_segred_stage_1_parloop_struct_77076.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_last_res_66866 =
        last_res_66866;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_mem_70579 =
        mem_70579.mem;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_mem_70582 =
        mem_70582.mem;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_mem_70588 =
        mem_70588.mem;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_min_res_71838 =
        min_res_71838;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_max_res_71903 =
        max_res_71903;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_defunc_1_f_res_71922 =
        defunc_1_f_res_71922;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_a0_71945 = a0_71945;
    futhark_mc_segred_stage_1_parloop_struct_77076.free_reduce_stage_1_tid_res_arr_mem_72372 =
        reduce_stage_1_tid_res_arr_mem_72372;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77077_task;
    
    futhark_mc_segred_stage_1_parloop_77077_task.name =
        "futhark_mc_segred_stage_1_parloop_77077";
    futhark_mc_segred_stage_1_parloop_77077_task.fn =
        futhark_mc_segred_stage_1_parloop_77077;
    futhark_mc_segred_stage_1_parloop_77077_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77076;
    futhark_mc_segred_stage_1_parloop_77077_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77077_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77077_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77077_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77077_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77077_task);
    
    if (futhark_mc_segred_stage_1_parloop_77077_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77077_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77077_total_end -
                 futhark_mc_segred_stage_1_parloop_77077_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77077_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77077_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77077_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_71946 = 0.0F;
    }
    
    float x_72376;
    float x_72377;
    
    for (int32_t i_72379 = 0; i_72379 < num_tasks_72371; i_72379++) {
        flat_tid_72327 = i_72379;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_72376 = defunc_2_reduce_res_71946;
            }
            // load next params
            {
                x_72377 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_72372)[flat_tid_72327];
            }
            // red body
            {
                float defunc_1_op_res_72378 = x_72376 + x_72377;
                
                defunc_2_reduce_res_71946 = defunc_1_op_res_72378;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_72372);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77074_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77074_end -
                 futhark_mc_segred_task_77074_start;
        
        ctx->futhark_mc_segred_task_77074_runs[tid]++;
        ctx->futhark_mc_segred_task_77074_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77074_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77073->retval_defunc_2_reduce_res_71946 =
            defunc_2_reduce_res_71946;
    }
    return err;
}
static int futhark_mc_segmap_parloop_77067(void *args, int64_t start,
                                           int64_t end, int flat_tid_71835,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77066
    *futhark_mc_segmap_parloop_struct_77066 =
    (struct futhark_mc_segmap_parloop_struct_77066 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77066->ctx;
    uint64_t futhark_mc_segmap_parloop_77067_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77067_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77066->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77066->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77066->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77066->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77066->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77066->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77066->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77066->free_loop_cond_65369;
    int64_t last_res_66866 =
            futhark_mc_segmap_parloop_struct_77066->free_last_res_66866;
    int64_t min_arg_66885 =
            futhark_mc_segmap_parloop_struct_77066->free_min_arg_66885;
    int64_t min_arg_66886 =
            futhark_mc_segmap_parloop_struct_77066->free_min_arg_66886;
    int64_t min_res_66887 =
            futhark_mc_segmap_parloop_struct_77066->free_min_res_66887;
    float max_res_66891 =
          futhark_mc_segmap_parloop_struct_77066->free_max_res_66891;
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_segmap_parloop_struct_77066->free_mem_70579,
                                 .size =0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_segmap_parloop_struct_77066->free_mem_70582,
                                 .size =0, .references =NULL};
    struct memblock mem_70585 = {.desc ="mem_70585", .mem =
                                 futhark_mc_segmap_parloop_struct_77066->free_mem_70585,
                                 .size =0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_segmap_parloop_struct_77066->free_mem_70588,
                                 .size =0, .references =NULL};
    struct memblock mem_70591 = {.desc ="mem_70591", .mem =
                                 futhark_mc_segmap_parloop_struct_77066->free_mem_70591,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72250 = start;
    
    for (; iter_72250 < end; iter_72250++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72353 = n_m_65352;
        int64_t gtid_71836 = iter_72250;
        int64_t remnant_72354 = iter_72250 - gtid_71836;
        int64_t min_arg_71837 = mul64(jump_65348, gtid_71836);
        int64_t min_res_71838 = smin64(i_65358, min_arg_71837);
        int64_t defunc_0_g_res_71839 = add64((int64_t) 1, min_res_71838);
        bool init_idx_71840;
        int64_t init_idx_71841;
        int64_t init_idx_71842;
        bool loop_while_72251;
        int64_t low_72252;
        int64_t high_72253;
        
        loop_while_72251 = x_65359;
        low_72252 = (int64_t) 0;
        high_72253 = i_65358;
        while (loop_while_72251) {
            int64_t x_72254 = add64(low_72252, high_72253);
            int64_t mid_72255 = sdiv64(x_72254, (int64_t) 2);
            bool x_72256 = sle64((int64_t) 0, mid_72255);
            bool y_72257 = slt64(mid_72255, n_65344);
            bool bounds_check_72258 = x_72256 && y_72257;
            bool index_certs_72259;
            
            if (!bounds_check_72258) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_72255,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_72260;
            
            mid_id_72260 = ((int64_t *) mem_70585.mem)[mid_72255];
            
            bool cond_72261 = slt64(mid_id_72260, (int64_t) 0);
            int64_t mid_idx_72262;
            
            if (cond_72261) {
                mid_idx_72262 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_72262 = mid_id_72260;
            }
            
            bool cond_72263 = sle64(defunc_0_g_res_71839, mid_idx_72262);
            int64_t loopres_72264;
            int64_t loopres_72265;
            
            if (cond_72263) {
                int64_t loopres_t_res_72266 = sub64(mid_72255, (int64_t) 1);
                
                loopres_72264 = low_72252;
                loopres_72265 = loopres_t_res_72266;
            } else {
                int64_t loopres_f_res_72267 = add64((int64_t) 1, mid_72255);
                
                loopres_72264 = loopres_f_res_72267;
                loopres_72265 = high_72253;
            }
            
            bool loop_cond_72268 = sle64(loopres_72264, loopres_72265);
            bool loop_while_tmp_72355 = loop_cond_72268;
            int64_t low_tmp_72356 = loopres_72264;
            int64_t high_tmp_72357 = loopres_72265;
            
            loop_while_72251 = loop_while_tmp_72355;
            low_72252 = low_tmp_72356;
            high_72253 = high_tmp_72357;
        }
        init_idx_71840 = loop_while_72251;
        init_idx_71841 = low_72252;
        init_idx_71842 = high_72253;
        
        bool idx_71861;
        int64_t idx_71862;
        int64_t idx_71863;
        int64_t idx_71864;
        bool loop_while_72269;
        int64_t l_idx_72270;
        int64_t r_idx_72271;
        int64_t span_72272;
        
        loop_while_72269 = loop_cond_65369;
        l_idx_72270 = init_idx_71841;
        r_idx_72271 = init_idx_71841;
        span_72272 = (int64_t) 1;
        while (loop_while_72269) {
            int64_t max_arg_72273 = sub64(l_idx_72270, (int64_t) 1);
            int64_t max_res_72274 = smax64((int64_t) 0, max_arg_72273);
            int64_t min_arg_72275 = add64((int64_t) 1, r_idx_72271);
            int64_t min_res_72276 = smin64(min_arg_66885, min_arg_72275);
            bool x_72277 = sle64((int64_t) 0, max_res_72274);
            bool y_72278 = slt64(max_res_72274, n_65344);
            bool bounds_check_72279 = x_72277 && y_72278;
            bool index_certs_72280;
            
            if (!bounds_check_72279) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_72274,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_72281;
            
            x_72281 = ((int64_t *) mem_70585.mem)[max_res_72274];
            
            int64_t abs_arg_72282 = sub64(x_72281, defunc_0_g_res_71839);
            int64_t abs_res_72283 = abs64(abs_arg_72282);
            bool x_72284 = sle64((int64_t) 0, min_res_72276);
            bool y_72285 = slt64(min_res_72276, n_65344);
            bool bounds_check_72286 = x_72284 && y_72285;
            bool index_certs_72287;
            
            if (!bounds_check_72286) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_72276,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_72288;
            
            x_72288 = ((int64_t *) mem_70585.mem)[min_res_72276];
            
            int64_t abs_arg_72289 = sub64(x_72288, defunc_0_g_res_71839);
            int64_t abs_res_72290 = abs64(abs_arg_72289);
            bool cond_72291 = max_res_72274 == l_idx_72270;
            int64_t loopres_72292;
            int64_t loopres_72293;
            int64_t loopres_72294;
            
            if (cond_72291) {
                loopres_72292 = l_idx_72270;
                loopres_72293 = r_idx_72271;
                loopres_72294 = min_res_65364;
            } else {
                bool cond_72295 = slt64(abs_res_72283, abs_res_72290);
                bool cond_f_res_72296 = min_res_72276 == r_idx_72271;
                bool x_72297 = !cond_72295;
                bool y_72298 = cond_f_res_72296 && x_72297;
                bool cond_72299 = cond_72295 || y_72298;
                int64_t loopres_f_res_72300;
                
                if (cond_72299) {
                    loopres_f_res_72300 = max_res_72274;
                } else {
                    loopres_f_res_72300 = l_idx_72270;
                }
                
                int64_t loopres_f_res_72301;
                
                if (cond_72299) {
                    loopres_f_res_72301 = r_idx_72271;
                } else {
                    loopres_f_res_72301 = min_res_72276;
                }
                
                int64_t loopres_f_res_72302;
                
                if (cond_72299) {
                    int64_t loopres_f_res_t_res_72303 = add64((int64_t) 1,
                                                              span_72272);
                    
                    loopres_f_res_72302 = loopres_f_res_t_res_72303;
                } else {
                    int64_t loopres_f_res_f_res_72304 = add64((int64_t) 1,
                                                              span_72272);
                    
                    loopres_f_res_72302 = loopres_f_res_f_res_72304;
                }
                loopres_72292 = loopres_f_res_72300;
                loopres_72293 = loopres_f_res_72301;
                loopres_72294 = loopres_f_res_72302;
            }
            
            bool loop_cond_72305 = slt64(loopres_72294, min_res_65364);
            bool loop_while_tmp_72358 = loop_cond_72305;
            int64_t l_idx_tmp_72359 = loopres_72292;
            int64_t r_idx_tmp_72360 = loopres_72293;
            int64_t span_tmp_72361 = loopres_72294;
            
            loop_while_72269 = loop_while_tmp_72358;
            l_idx_72270 = l_idx_tmp_72359;
            r_idx_72271 = r_idx_tmp_72360;
            span_72272 = span_tmp_72361;
        }
        idx_71861 = loop_while_72269;
        idx_71862 = l_idx_72270;
        idx_71863 = r_idx_72271;
        idx_71864 = span_72272;
        
        int64_t min_res_71902 = smin64(min_arg_66886, idx_71862);
        int64_t max_res_71903 = smax64((int64_t) 0, min_res_71902);
        int64_t x_71904 = add64(min_res_66887, max_res_71903);
        int64_t r_71905 = sub64(x_71904, (int64_t) 1);
        bool x_71906 = sle64((int64_t) 0, r_71905);
        bool y_71907 = slt64(r_71905, n_65344);
        bool bounds_check_71908 = x_71906 && y_71907;
        bool index_certs_71909;
        
        if (!bounds_check_71908) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_71905,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_71910;
        
        x_71910 = ((int64_t *) mem_70582.mem)[r_71905];
        
        int64_t abs_arg_71911 = sub64(x_71910, min_res_71838);
        int64_t abs_res_71912 = abs64(abs_arg_71911);
        bool x_71913 = sle64((int64_t) 0, max_res_71903);
        bool y_71914 = slt64(max_res_71903, n_65344);
        bool bounds_check_71915 = x_71913 && y_71914;
        bool index_certs_71916;
        
        if (!bounds_check_71915) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_71903,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_71917;
        
        x_71917 = ((int64_t *) mem_70582.mem)[max_res_71903];
        
        int64_t abs_arg_71918 = sub64(x_71917, min_res_71838);
        int64_t abs_res_71919 = abs64(abs_arg_71918);
        int64_t max_res_71920 = smax64(abs_res_71912, abs_res_71919);
        float defunc_0_f_res_71921 = sitofp_i64_f32(max_res_71920);
        float defunc_1_f_res_71922 = max_res_66891 + defunc_0_f_res_71921;
        float defunc_2_reduce_res_71923;
        int64_t flat_tid_72306 = (int64_t) 0;
        int32_t num_tasks_72362;
        
        defunc_2_reduce_res_71923 = 0.0F;
        
        struct futhark_mc_task_77068 futhark_mc_task_77068;
        
        futhark_mc_task_77068.ctx = ctx;
        futhark_mc_task_77068.free_last_res_66866 = last_res_66866;
        futhark_mc_task_77068.free_mem_70582 = mem_70582.mem;
        futhark_mc_task_77068.free_mem_70588 = mem_70588.mem;
        futhark_mc_task_77068.free_min_res_71838 = min_res_71838;
        futhark_mc_task_77068.free_max_res_71903 = max_res_71903;
        futhark_mc_task_77068.free_defunc_1_f_res_71922 = defunc_1_f_res_71922;
        futhark_mc_task_77068.retval_defunc_2_reduce_res_71923 =
            &defunc_2_reduce_res_71923;
        
        struct scheduler_segop futhark_mc_task_77068_task;
        
        futhark_mc_task_77068_task.args = &futhark_mc_task_77068;
        futhark_mc_task_77068_task.top_level_fn = futhark_mc_segred_task_77069;
        futhark_mc_task_77068_task.name = "futhark_mc_segred_task_77069";
        futhark_mc_task_77068_task.iterations = q_65346;
        futhark_mc_task_77068_task.task_time =
            &ctx->futhark_mc_segred_task_77069_total_time;
        futhark_mc_task_77068_task.task_iter =
            &ctx->futhark_mc_segred_task_77069_total_iter;
        futhark_mc_task_77068_task.sched = STATIC;
        futhark_mc_task_77068_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77069_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77068_task);
        
        if (futhark_mc_segred_task_77069_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        float a0_71945 = 1.0F / defunc_2_reduce_res_71923;
        float defunc_2_reduce_res_71946;
        int64_t flat_tid_72327 = (int64_t) 0;
        int32_t num_tasks_72371;
        
        defunc_2_reduce_res_71946 = 0.0F;
        
        struct futhark_mc_task_77073 futhark_mc_task_77073;
        
        futhark_mc_task_77073.ctx = ctx;
        futhark_mc_task_77073.free_last_res_66866 = last_res_66866;
        futhark_mc_task_77073.free_mem_70579 = mem_70579.mem;
        futhark_mc_task_77073.free_mem_70582 = mem_70582.mem;
        futhark_mc_task_77073.free_mem_70588 = mem_70588.mem;
        futhark_mc_task_77073.free_min_res_71838 = min_res_71838;
        futhark_mc_task_77073.free_max_res_71903 = max_res_71903;
        futhark_mc_task_77073.free_defunc_1_f_res_71922 = defunc_1_f_res_71922;
        futhark_mc_task_77073.free_a0_71945 = a0_71945;
        futhark_mc_task_77073.retval_defunc_2_reduce_res_71946 =
            &defunc_2_reduce_res_71946;
        
        struct scheduler_segop futhark_mc_task_77073_task;
        
        futhark_mc_task_77073_task.args = &futhark_mc_task_77073;
        futhark_mc_task_77073_task.top_level_fn = futhark_mc_segred_task_77074;
        futhark_mc_task_77073_task.name = "futhark_mc_segred_task_77074";
        futhark_mc_task_77073_task.iterations = q_65346;
        futhark_mc_task_77073_task.task_time =
            &ctx->futhark_mc_segred_task_77074_total_time;
        futhark_mc_task_77073_task.task_iter =
            &ctx->futhark_mc_segred_task_77074_total_iter;
        futhark_mc_task_77073_task.sched = STATIC;
        futhark_mc_task_77073_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77074_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77073_task);
        
        if (futhark_mc_segred_task_77074_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((float *) mem_70591.mem)[gtid_71836] = defunc_2_reduce_res_71946;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77067_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77067_end -
                 futhark_mc_segmap_parloop_77067_start;
        
        ctx->futhark_mc_segmap_parloop_77067_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77067_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77067_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77065(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_71835 = tid;
    int num_tasks_72139 = info.nsubtasks;
    struct futhark_mc_task_77061 *futhark_mc_task_77061 =
                                 (struct futhark_mc_task_77061 *) args;
    struct futhark_context *ctx = futhark_mc_task_77061->ctx;
    uint64_t futhark_mc_segmap_nested_task_77065_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77065_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77061->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77061->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77061->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77061->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77061->free_i_65358;
    bool x_65359 = futhark_mc_task_77061->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77061->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77061->free_loop_cond_65369;
    int64_t last_res_66866 = futhark_mc_task_77061->free_last_res_66866;
    int64_t min_arg_66885 = futhark_mc_task_77061->free_min_arg_66885;
    int64_t min_arg_66886 = futhark_mc_task_77061->free_min_arg_66886;
    int64_t min_res_66887 = futhark_mc_task_77061->free_min_res_66887;
    float max_res_66891 = futhark_mc_task_77061->free_max_res_66891;
    struct memblock mem_70579 = {.desc ="mem_70579", .mem =
                                 futhark_mc_task_77061->free_mem_70579, .size =
                                 0, .references =NULL};
    struct memblock mem_70582 = {.desc ="mem_70582", .mem =
                                 futhark_mc_task_77061->free_mem_70582, .size =
                                 0, .references =NULL};
    struct memblock mem_70585 = {.desc ="mem_70585", .mem =
                                 futhark_mc_task_77061->free_mem_70585, .size =
                                 0, .references =NULL};
    struct memblock mem_70588 = {.desc ="mem_70588", .mem =
                                 futhark_mc_task_77061->free_mem_70588, .size =
                                 0, .references =NULL};
    struct memblock mem_70591 = {.desc ="mem_70591", .mem =
                                 futhark_mc_task_77061->free_mem_70591, .size =
                                 0, .references =NULL};
    int64_t iter_72250;
    struct futhark_mc_segmap_parloop_struct_77066
    futhark_mc_segmap_parloop_struct_77066;
    
    futhark_mc_segmap_parloop_struct_77066.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77066.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77066.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77066.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77066.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77066.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77066.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77066.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77066.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77066.free_last_res_66866 = last_res_66866;
    futhark_mc_segmap_parloop_struct_77066.free_min_arg_66885 = min_arg_66885;
    futhark_mc_segmap_parloop_struct_77066.free_min_arg_66886 = min_arg_66886;
    futhark_mc_segmap_parloop_struct_77066.free_min_res_66887 = min_res_66887;
    futhark_mc_segmap_parloop_struct_77066.free_max_res_66891 = max_res_66891;
    futhark_mc_segmap_parloop_struct_77066.free_mem_70579 = mem_70579.mem;
    futhark_mc_segmap_parloop_struct_77066.free_mem_70582 = mem_70582.mem;
    futhark_mc_segmap_parloop_struct_77066.free_mem_70585 = mem_70585.mem;
    futhark_mc_segmap_parloop_struct_77066.free_mem_70588 = mem_70588.mem;
    futhark_mc_segmap_parloop_struct_77066.free_mem_70591 = mem_70591.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77067_task;
    
    futhark_mc_segmap_parloop_77067_task.name =
        "futhark_mc_segmap_parloop_77067";
    futhark_mc_segmap_parloop_77067_task.fn = futhark_mc_segmap_parloop_77067;
    futhark_mc_segmap_parloop_77067_task.args =
        &futhark_mc_segmap_parloop_struct_77066;
    futhark_mc_segmap_parloop_77067_task.iterations = iterations;
    futhark_mc_segmap_parloop_77067_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77067_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77067_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77067_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77067_task);
    
    if (futhark_mc_segmap_parloop_77067_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77067_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77067_total_end -
                 futhark_mc_segmap_parloop_77067_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77067_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77067_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77067_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77065_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77065_end -
                 futhark_mc_segmap_nested_task_77065_start;
        
        ctx->futhark_mc_segmap_nested_task_77065_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77065_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77065_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_77035(void *args, int64_t start,
                                           int64_t end, int flat_tid_66853,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77034
    *futhark_mc_segmap_parloop_struct_77034 =
    (struct futhark_mc_segmap_parloop_struct_77034 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77034->ctx;
    uint64_t futhark_mc_segmap_parloop_77035_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77035_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77034->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77034->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77034->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77034->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77034->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77034->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77034->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77034->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77034->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77034->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77034->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70575 =
            futhark_mc_segmap_parloop_struct_77034->free_bytes_70575;
    int64_t bytes_70578 =
            futhark_mc_segmap_parloop_struct_77034->free_bytes_70578;
    int64_t bytes_70587 =
            futhark_mc_segmap_parloop_struct_77034->free_bytes_70587;
    int64_t bytes_70590 =
            futhark_mc_segmap_parloop_struct_77034->free_bytes_70590;
    struct memblock mem_70685 = {.desc ="mem_70685", .mem =
                                 futhark_mc_segmap_parloop_struct_77034->free_mem_70685,
                                 .size =0, .references =NULL};
    size_t mem_70576_cached_sizze_77036 = 0;
    unsigned char *mem_70576 = NULL;
    size_t mem_70579_cached_sizze_77037 = 0;
    unsigned char *mem_70579 = NULL;
    size_t mem_70582_cached_sizze_77038 = 0;
    unsigned char *mem_70582 = NULL;
    size_t mem_70585_cached_sizze_77039 = 0;
    unsigned char *mem_70585 = NULL;
    size_t mem_70588_cached_sizze_77040 = 0;
    unsigned char *mem_70588 = NULL;
    size_t mem_70591_cached_sizze_77041 = 0;
    unsigned char *mem_70591 = NULL;
    int64_t iterations = end - start;
    int64_t iter_71809 = start;
    
    if (mem_70576_cached_sizze_77036 < (size_t) bytes_70575) {
        mem_70576 = realloc(mem_70576, bytes_70575);
        mem_70576_cached_sizze_77036 = bytes_70575;
    }
    if (mem_70579_cached_sizze_77037 < (size_t) bytes_70578) {
        mem_70579 = realloc(mem_70579, bytes_70578);
        mem_70579_cached_sizze_77037 = bytes_70578;
    }
    if (mem_70582_cached_sizze_77038 < (size_t) bytes_70575) {
        mem_70582 = realloc(mem_70582, bytes_70575);
        mem_70582_cached_sizze_77038 = bytes_70575;
    }
    if (mem_70585_cached_sizze_77039 < (size_t) bytes_70575) {
        mem_70585 = realloc(mem_70585, bytes_70575);
        mem_70585_cached_sizze_77039 = bytes_70575;
    }
    if (mem_70588_cached_sizze_77040 < (size_t) bytes_70587) {
        mem_70588 = realloc(mem_70588, bytes_70587);
        mem_70588_cached_sizze_77040 = bytes_70587;
    }
    if (mem_70591_cached_sizze_77041 < (size_t) bytes_70590) {
        mem_70591 = realloc(mem_70591, bytes_70590);
        mem_70591_cached_sizze_77041 = bytes_70590;
    }
    for (; iter_71809 < end; iter_71809++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72107 = m_65343;
        int64_t gtid_66854 = iter_71809;
        int64_t remnant_72108 = iter_71809 - gtid_66854;
        int64_t flat_tid_71810 = (int64_t) 0;
        int32_t num_tasks_72109;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_77042 futhark_mc_task_77042;
        
        futhark_mc_task_77042.ctx = ctx;
        futhark_mc_task_77042.free_n_65344 = n_65344;
        futhark_mc_task_77042.free_gtid_66854 = gtid_66854;
        futhark_mc_task_77042.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77042.free_mem_70576 = mem_70576;
        
        struct scheduler_segop futhark_mc_task_77042_task;
        
        futhark_mc_task_77042_task.args = &futhark_mc_task_77042;
        futhark_mc_task_77042_task.top_level_fn = futhark_mc_segscan_task_77043;
        futhark_mc_task_77042_task.name = "futhark_mc_segscan_task_77043";
        futhark_mc_task_77042_task.iterations = n_65344;
        futhark_mc_task_77042_task.task_time =
            &ctx->futhark_mc_segscan_task_77043_total_time;
        futhark_mc_task_77042_task.task_iter =
            &ctx->futhark_mc_segscan_task_77043_total_iter;
        futhark_mc_task_77042_task.sched = STATIC;
        futhark_mc_task_77042_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_77043_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77042_task);
        
        if (futhark_mc_segscan_task_77043_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_66866;
        
        last_res_66866 = ((int64_t *) mem_70576)[i_65358];
        for (int64_t i_72123 = 0; i_72123 < n_65344; i_72123++) {
            ((float *) mem_70579)[i_72123] = 0.0F;
        }
        for (int64_t i_72124 = 0; i_72124 < n_65344; i_72124++) {
            ((int64_t *) mem_70582)[i_72124] = (int64_t) -1;
        }
        
        int64_t flat_tid_71819 = (int64_t) 0;
        int32_t num_tasks_72125;
        struct futhark_mc_task_77049 futhark_mc_task_77049;
        
        futhark_mc_task_77049.ctx = ctx;
        futhark_mc_task_77049.free_n_65344 = n_65344;
        futhark_mc_task_77049.free_gtid_66854 = gtid_66854;
        futhark_mc_task_77049.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77049.free_mem_70576 = mem_70576;
        futhark_mc_task_77049.free_mem_70579 = mem_70579;
        futhark_mc_task_77049.free_mem_70582 = mem_70582;
        
        struct scheduler_segop futhark_mc_task_77049_task;
        
        futhark_mc_task_77049_task.args = &futhark_mc_task_77049;
        futhark_mc_task_77049_task.top_level_fn = futhark_mc_segmap_task_77050;
        futhark_mc_task_77049_task.name = "futhark_mc_segmap_task_77050";
        futhark_mc_task_77049_task.iterations = n_65344;
        futhark_mc_task_77049_task.task_time =
            &ctx->futhark_mc_segmap_task_77050_total_time;
        futhark_mc_task_77049_task.task_iter =
            &ctx->futhark_mc_segmap_task_77050_total_iter;
        futhark_mc_task_77049_task.sched = STATIC;
        futhark_mc_task_77049_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77050_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77049_task);
        
        if (futhark_mc_segmap_task_77050_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_71827 = (int64_t) 0;
        int32_t num_tasks_72131;
        struct futhark_mc_task_77053 futhark_mc_task_77053;
        
        futhark_mc_task_77053.ctx = ctx;
        futhark_mc_task_77053.free_n_65344 = n_65344;
        futhark_mc_task_77053.free_mem_70582 = mem_70582;
        futhark_mc_task_77053.free_mem_70585 = mem_70585;
        
        struct scheduler_segop futhark_mc_task_77053_task;
        
        futhark_mc_task_77053_task.args = &futhark_mc_task_77053;
        futhark_mc_task_77053_task.top_level_fn = futhark_mc_segmap_task_77054;
        futhark_mc_task_77053_task.name = "futhark_mc_segmap_task_77054";
        futhark_mc_task_77053_task.iterations = n_65344;
        futhark_mc_task_77053_task.task_time =
            &ctx->futhark_mc_segmap_task_77054_total_time;
        futhark_mc_task_77053_task.task_iter =
            &ctx->futhark_mc_segmap_task_77054_total_iter;
        futhark_mc_task_77053_task.sched = STATIC;
        futhark_mc_task_77053_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77054_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77053_task);
        
        if (futhark_mc_segmap_task_77054_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_66885 = sub64(last_res_66866, (int64_t) 1);
        int64_t min_arg_66886 = sub64(last_res_66866, min_res_65364);
        int64_t min_res_66887 = smin64(q_65346, last_res_66866);
        float i64_res_66888 = sitofp_i64_f32(last_res_66866);
        float x_66889 = i64_res_65370 - i64_res_66888;
        float max_arg_66890 = x_66889 / 2.0F;
        float max_res_66891 = fmax32(0.0F, max_arg_66890);
        int64_t flat_tid_71831 = (int64_t) 0;
        int32_t num_tasks_72135;
        struct futhark_mc_task_77057 futhark_mc_task_77057;
        
        futhark_mc_task_77057.ctx = ctx;
        futhark_mc_task_77057.free_q_65346 = q_65346;
        futhark_mc_task_77057.free_last_res_66866 = last_res_66866;
        futhark_mc_task_77057.free_mem_70588 = mem_70588;
        
        struct scheduler_segop futhark_mc_task_77057_task;
        
        futhark_mc_task_77057_task.args = &futhark_mc_task_77057;
        futhark_mc_task_77057_task.top_level_fn = futhark_mc_segmap_task_77058;
        futhark_mc_task_77057_task.name = "futhark_mc_segmap_task_77058";
        futhark_mc_task_77057_task.iterations = q_65346;
        futhark_mc_task_77057_task.task_time =
            &ctx->futhark_mc_segmap_task_77058_total_time;
        futhark_mc_task_77057_task.task_iter =
            &ctx->futhark_mc_segmap_task_77058_total_iter;
        futhark_mc_task_77057_task.sched = STATIC;
        futhark_mc_task_77057_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77058_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77057_task);
        
        if (futhark_mc_segmap_task_77058_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_71973 = (int64_t) 0;
        int32_t num_tasks_72139;
        int64_t flat_tid_71835 = (int64_t) 0;
        struct futhark_mc_task_77061 futhark_mc_task_77061;
        
        futhark_mc_task_77061.ctx = ctx;
        futhark_mc_task_77061.free_n_65344 = n_65344;
        futhark_mc_task_77061.free_q_65346 = q_65346;
        futhark_mc_task_77061.free_jump_65348 = jump_65348;
        futhark_mc_task_77061.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77061.free_i_65358 = i_65358;
        futhark_mc_task_77061.free_x_65359 = x_65359;
        futhark_mc_task_77061.free_min_res_65364 = min_res_65364;
        futhark_mc_task_77061.free_loop_cond_65369 = loop_cond_65369;
        futhark_mc_task_77061.free_last_res_66866 = last_res_66866;
        futhark_mc_task_77061.free_min_arg_66885 = min_arg_66885;
        futhark_mc_task_77061.free_min_arg_66886 = min_arg_66886;
        futhark_mc_task_77061.free_min_res_66887 = min_res_66887;
        futhark_mc_task_77061.free_max_res_66891 = max_res_66891;
        futhark_mc_task_77061.free_mem_70579 = mem_70579;
        futhark_mc_task_77061.free_mem_70582 = mem_70582;
        futhark_mc_task_77061.free_mem_70585 = mem_70585;
        futhark_mc_task_77061.free_mem_70588 = mem_70588;
        futhark_mc_task_77061.free_mem_70591 = mem_70591;
        
        struct scheduler_segop futhark_mc_task_77061_task;
        
        futhark_mc_task_77061_task.args = &futhark_mc_task_77061;
        futhark_mc_task_77061_task.top_level_fn = futhark_mc_segmap_task_77062;
        futhark_mc_task_77061_task.name = "futhark_mc_segmap_task_77062";
        futhark_mc_task_77061_task.iterations = n_m_65352;
        futhark_mc_task_77061_task.task_time =
            &ctx->futhark_mc_segmap_task_77062_total_time;
        futhark_mc_task_77061_task.task_iter =
            &ctx->futhark_mc_segmap_task_77062_total_iter;
        futhark_mc_task_77061_task.sched = DYNAMIC;
        futhark_mc_task_77061_task.nested_fn =
            futhark_mc_segmap_nested_task_77065;
        
        int futhark_mc_segmap_task_77062_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77061_task);
        
        if (futhark_mc_segmap_task_77062_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70685.mem + gtid_66854 * n_m_65352 * (int64_t) 4,
                    mem_70591 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_70576);
    free(mem_70579);
    free(mem_70582);
    free(mem_70585);
    free(mem_70588);
    free(mem_70591);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77035_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77035_end -
                 futhark_mc_segmap_parloop_77035_start;
        
        ctx->futhark_mc_segmap_parloop_77035_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77035_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77035_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77033(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_66853 = tid;
    int num_tasks_71621 = info.nsubtasks;
    struct futhark_mc_task_77023 *futhark_mc_task_77023 =
                                 (struct futhark_mc_task_77023 *) args;
    struct futhark_context *ctx = futhark_mc_task_77023->ctx;
    uint64_t futhark_mc_segmap_nested_task_77033_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77033_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77023->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77023->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77023->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77023->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77023->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77023->free_i_65358;
    bool x_65359 = futhark_mc_task_77023->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77023->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77023->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77023->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77023->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70575 = futhark_mc_task_77023->free_bytes_70575;
    int64_t bytes_70578 = futhark_mc_task_77023->free_bytes_70578;
    int64_t bytes_70587 = futhark_mc_task_77023->free_bytes_70587;
    int64_t bytes_70590 = futhark_mc_task_77023->free_bytes_70590;
    struct memblock mem_70685 = {.desc ="mem_70685", .mem =
                                 futhark_mc_task_77023->free_mem_70685, .size =
                                 0, .references =NULL};
    int64_t iter_71809;
    struct futhark_mc_segmap_parloop_struct_77034
    futhark_mc_segmap_parloop_struct_77034;
    
    futhark_mc_segmap_parloop_struct_77034.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77034.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77034.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77034.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77034.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77034.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77034.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77034.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77034.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77034.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77034.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77034.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77034.free_bytes_70575 = bytes_70575;
    futhark_mc_segmap_parloop_struct_77034.free_bytes_70578 = bytes_70578;
    futhark_mc_segmap_parloop_struct_77034.free_bytes_70587 = bytes_70587;
    futhark_mc_segmap_parloop_struct_77034.free_bytes_70590 = bytes_70590;
    futhark_mc_segmap_parloop_struct_77034.free_mem_70685 = mem_70685.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77035_task;
    
    futhark_mc_segmap_parloop_77035_task.name =
        "futhark_mc_segmap_parloop_77035";
    futhark_mc_segmap_parloop_77035_task.fn = futhark_mc_segmap_parloop_77035;
    futhark_mc_segmap_parloop_77035_task.args =
        &futhark_mc_segmap_parloop_struct_77034;
    futhark_mc_segmap_parloop_77035_task.iterations = iterations;
    futhark_mc_segmap_parloop_77035_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77035_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77035_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77035_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77035_task);
    
    if (futhark_mc_segmap_parloop_77035_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77035_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77035_total_end -
                 futhark_mc_segmap_parloop_77035_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77035_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77035_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77035_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77033_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77033_end -
                 futhark_mc_segmap_nested_task_77033_start;
        
        ctx->futhark_mc_segmap_nested_task_77033_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77033_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77033_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77078 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70687;
    int64_t free_bytes_70690;
    int64_t free_bytes_70699;
    int64_t free_bytes_70702;
    unsigned char *free_mem_70815;
    unsigned char *free_mem_70819;
};
struct futhark_mc_segmap_parloop_struct_77080 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70687;
    int64_t free_bytes_70690;
    int64_t free_bytes_70699;
    int64_t free_bytes_70702;
    unsigned char *free_mem_70815;
    unsigned char *free_mem_70819;
};
static int futhark_mc_segmap_parloop_77081(void *args, int64_t start,
                                           int64_t end, int flat_tid_67177,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77080
    *futhark_mc_segmap_parloop_struct_77080 =
    (struct futhark_mc_segmap_parloop_struct_77080 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77080->ctx;
    uint64_t futhark_mc_segmap_parloop_77081_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77081_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77080->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77080->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77080->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77080->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77080->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77080->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77080->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77080->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77080->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77080->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77080->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70687 =
            futhark_mc_segmap_parloop_struct_77080->free_bytes_70687;
    int64_t bytes_70690 =
            futhark_mc_segmap_parloop_struct_77080->free_bytes_70690;
    int64_t bytes_70699 =
            futhark_mc_segmap_parloop_struct_77080->free_bytes_70699;
    int64_t bytes_70702 =
            futhark_mc_segmap_parloop_struct_77080->free_bytes_70702;
    struct memblock mem_70815 = {.desc ="mem_70815", .mem =
                                 futhark_mc_segmap_parloop_struct_77080->free_mem_70815,
                                 .size =0, .references =NULL};
    struct memblock mem_70819 = {.desc ="mem_70819", .mem =
                                 futhark_mc_segmap_parloop_struct_77080->free_mem_70819,
                                 .size =0, .references =NULL};
    size_t mem_70709_cached_sizze_77082 = 0;
    unsigned char *mem_70709 = NULL;
    size_t mem_70724_cached_sizze_77083 = 0;
    unsigned char *mem_70724 = NULL;
    size_t mem_70727_cached_sizze_77084 = 0;
    unsigned char *mem_70727 = NULL;
    size_t mem_70754_cached_sizze_77085 = 0;
    unsigned char *mem_70754 = NULL;
    size_t mem_70769_cached_sizze_77086 = 0;
    unsigned char *mem_70769 = NULL;
    size_t mem_70784_cached_sizze_77087 = 0;
    unsigned char *mem_70784 = NULL;
    size_t mem_70787_cached_sizze_77088 = 0;
    unsigned char *mem_70787 = NULL;
    int64_t iterations = end - start;
    int64_t iter_72381 = start;
    
    if (mem_70709_cached_sizze_77082 < (size_t) bytes_70687) {
        mem_70709 = realloc(mem_70709, bytes_70687);
        mem_70709_cached_sizze_77082 = bytes_70687;
    }
    if (mem_70724_cached_sizze_77083 < (size_t) bytes_70690) {
        mem_70724 = realloc(mem_70724, bytes_70690);
        mem_70724_cached_sizze_77083 = bytes_70690;
    }
    if (mem_70727_cached_sizze_77084 < (size_t) bytes_70687) {
        mem_70727 = realloc(mem_70727, bytes_70687);
        mem_70727_cached_sizze_77084 = bytes_70687;
    }
    if (mem_70754_cached_sizze_77085 < (size_t) bytes_70687) {
        mem_70754 = realloc(mem_70754, bytes_70687);
        mem_70754_cached_sizze_77085 = bytes_70687;
    }
    if (mem_70769_cached_sizze_77086 < (size_t) bytes_70699) {
        mem_70769 = realloc(mem_70769, bytes_70699);
        mem_70769_cached_sizze_77086 = bytes_70699;
    }
    if (mem_70784_cached_sizze_77087 < (size_t) bytes_70702) {
        mem_70784 = realloc(mem_70784, bytes_70702);
        mem_70784_cached_sizze_77087 = bytes_70702;
    }
    if (mem_70787_cached_sizze_77088 < (size_t) bytes_70702) {
        mem_70787 = realloc(mem_70787, bytes_70702);
        mem_70787_cached_sizze_77088 = bytes_70702;
    }
    for (; iter_72381 < end; iter_72381++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72575 = m_65343;
        int64_t gtid_67178 = iter_72381;
        int64_t remnant_72576 = iter_72381 - gtid_67178;
        int64_t discard_70221;
        int64_t scanacc_72383 = (int64_t) 0;
        
        for (int64_t i_72382 = 0; i_72382 < n_65344; i_72382++) {
            float x_72385;
            
            x_72385 = ((float *) Y_mem_70569.mem)[gtid_67178 * n_65344 +
                                                  i_72382];
            
            bool isnan_res_72386;
            
            isnan_res_72386 = futrts_isnan32(x_72385);
            
            bool defunc_0_p_res_72387 = !isnan_res_72386;
            int64_t defunc_0_f_res_72388 = btoi_bool_i64(defunc_0_p_res_72387);
            int64_t defunc_1_op_res_72389 = add64(defunc_0_f_res_72388,
                                                  scanacc_72383);
            
            ((int64_t *) mem_70709)[i_72382] = defunc_1_op_res_72389;
            
            int64_t scanacc_tmp_72577 = defunc_1_op_res_72389;
            
            scanacc_72383 = scanacc_tmp_72577;
        }
        discard_70221 = scanacc_72383;
        
        int64_t last_res_65572;
        
        last_res_65572 = ((int64_t *) mem_70709)[i_65358];
        for (int64_t i_72579 = 0; i_72579 < n_65344; i_72579++) {
            ((float *) mem_70724)[i_72579] = 0.0F;
        }
        for (int64_t i_72580 = 0; i_72580 < n_65344; i_72580++) {
            ((int64_t *) mem_70727)[i_72580] = (int64_t) -1;
        }
        for (int64_t write_iter_72391 = 0; write_iter_72391 < n_65344;
             write_iter_72391++) {
            float write_iv_72394;
            
            write_iv_72394 = ((float *) Y_mem_70569.mem)[gtid_67178 * n_65344 +
                                                         write_iter_72391];
            
            bool isnan_res_72395;
            
            isnan_res_72395 = futrts_isnan32(write_iv_72394);
            
            bool defunc_0_p_res_72396 = !isnan_res_72395;
            int64_t defunc_1_f_res_72397;
            
            if (defunc_0_p_res_72396) {
                int64_t write_iv_72398;
                
                write_iv_72398 = ((int64_t *) mem_70709)[write_iter_72391];
                
                int64_t defunc_1_f_res_t_res_72399 = sub64(write_iv_72398,
                                                           (int64_t) 1);
                
                defunc_1_f_res_72397 = defunc_1_f_res_t_res_72399;
            } else {
                defunc_1_f_res_72397 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_72397) &&
                slt64(defunc_1_f_res_72397, n_65344)) {
                ((int64_t *) mem_70727)[defunc_1_f_res_72397] =
                    write_iter_72391;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_72397) &&
                slt64(defunc_1_f_res_72397, n_65344)) {
                if ((int64_t) 4 > 0)
                    memmove(mem_70724 + defunc_1_f_res_72397 * (int64_t) 4,
                            Y_mem_70569.mem + (gtid_67178 * n_65344 +
                                               write_iter_72391) * (int64_t) 4,
                            (int64_t) 4);
            }
        }
        for (int64_t i_72403 = 0; i_72403 < n_65344; i_72403++) {
            int64_t x_72405;
            
            x_72405 = ((int64_t *) mem_70727)[i_72403];
            
            int64_t defunc_0_f_res_72406 = add64((int64_t) 1, x_72405);
            
            ((int64_t *) mem_70754)[i_72403] = defunc_0_f_res_72406;
        }
        
        int64_t min_arg_65587 = sub64(last_res_65572, (int64_t) 1);
        int64_t min_arg_65588 = sub64(last_res_65572, min_res_65364);
        int64_t min_res_65589 = smin64(q_65346, last_res_65572);
        float i64_res_65590 = sitofp_i64_f32(last_res_65572);
        float x_65591 = i64_res_65370 - i64_res_65590;
        float max_arg_65592 = x_65591 / 2.0F;
        float max_res_65593 = fmax32(0.0F, max_arg_65592);
        
        for (int64_t i_72408 = 0; i_72408 < q_65346; i_72408++) {
            bool cond_72410 = sle64(last_res_65572, i_72408);
            float defunc_0_f_res_72411;
            
            if (cond_72410) {
                defunc_0_f_res_72411 = 0.0F;
            } else {
                defunc_0_f_res_72411 = 1.0F;
            }
            ((float *) mem_70769)[i_72408] = defunc_0_f_res_72411;
        }
        for (int64_t i_72413 = 0; i_72413 < n_m_65352; i_72413++) {
            int64_t min_arg_72416 = mul64(jump_65348, i_72413);
            int64_t min_res_72417 = smin64(i_65358, min_arg_72416);
            int64_t defunc_0_g_res_72418 = add64((int64_t) 1, min_res_72417);
            bool init_idx_72419;
            int64_t init_idx_72420;
            int64_t init_idx_72421;
            bool loop_while_72422;
            int64_t low_72423;
            int64_t high_72424;
            
            loop_while_72422 = x_65359;
            low_72423 = (int64_t) 0;
            high_72424 = i_65358;
            while (loop_while_72422) {
                int64_t x_72425 = add64(low_72423, high_72424);
                int64_t mid_72426 = sdiv64(x_72425, (int64_t) 2);
                bool x_72427 = sle64((int64_t) 0, mid_72426);
                bool y_72428 = slt64(mid_72426, n_65344);
                bool bounds_check_72429 = x_72427 && y_72428;
                bool index_certs_72430;
                
                if (!bounds_check_72429) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_72426,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_72431;
                
                mid_id_72431 = ((int64_t *) mem_70754)[mid_72426];
                
                bool cond_72432 = slt64(mid_id_72431, (int64_t) 0);
                int64_t mid_idx_72433;
                
                if (cond_72432) {
                    mid_idx_72433 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_72433 = mid_id_72431;
                }
                
                bool cond_72434 = sle64(defunc_0_g_res_72418, mid_idx_72433);
                int64_t loopres_72435;
                int64_t loopres_72436;
                
                if (cond_72434) {
                    int64_t loopres_t_res_72437 = sub64(mid_72426, (int64_t) 1);
                    
                    loopres_72435 = low_72423;
                    loopres_72436 = loopres_t_res_72437;
                } else {
                    int64_t loopres_f_res_72438 = add64((int64_t) 1, mid_72426);
                    
                    loopres_72435 = loopres_f_res_72438;
                    loopres_72436 = high_72424;
                }
                
                bool loop_cond_72439 = sle64(loopres_72435, loopres_72436);
                bool loop_while_tmp_72587 = loop_cond_72439;
                int64_t low_tmp_72588 = loopres_72435;
                int64_t high_tmp_72589 = loopres_72436;
                
                loop_while_72422 = loop_while_tmp_72587;
                low_72423 = low_tmp_72588;
                high_72424 = high_tmp_72589;
            }
            init_idx_72419 = loop_while_72422;
            init_idx_72420 = low_72423;
            init_idx_72421 = high_72424;
            
            bool idx_72440;
            int64_t idx_72441;
            int64_t idx_72442;
            int64_t idx_72443;
            bool loop_while_72444;
            int64_t l_idx_72445;
            int64_t r_idx_72446;
            int64_t span_72447;
            
            loop_while_72444 = loop_cond_65369;
            l_idx_72445 = init_idx_72420;
            r_idx_72446 = init_idx_72420;
            span_72447 = (int64_t) 1;
            while (loop_while_72444) {
                int64_t max_arg_72448 = sub64(l_idx_72445, (int64_t) 1);
                int64_t max_res_72449 = smax64((int64_t) 0, max_arg_72448);
                int64_t min_arg_72450 = add64((int64_t) 1, r_idx_72446);
                int64_t min_res_72451 = smin64(min_arg_65587, min_arg_72450);
                bool x_72452 = sle64((int64_t) 0, max_res_72449);
                bool y_72453 = slt64(max_res_72449, n_65344);
                bool bounds_check_72454 = x_72452 && y_72453;
                bool index_certs_72455;
                
                if (!bounds_check_72454) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_72449,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_72456;
                
                x_72456 = ((int64_t *) mem_70754)[max_res_72449];
                
                int64_t abs_arg_72457 = sub64(x_72456, defunc_0_g_res_72418);
                int64_t abs_res_72458 = abs64(abs_arg_72457);
                bool x_72459 = sle64((int64_t) 0, min_res_72451);
                bool y_72460 = slt64(min_res_72451, n_65344);
                bool bounds_check_72461 = x_72459 && y_72460;
                bool index_certs_72462;
                
                if (!bounds_check_72461) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_72451,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_72463;
                
                x_72463 = ((int64_t *) mem_70754)[min_res_72451];
                
                int64_t abs_arg_72464 = sub64(x_72463, defunc_0_g_res_72418);
                int64_t abs_res_72465 = abs64(abs_arg_72464);
                bool cond_72466 = max_res_72449 == l_idx_72445;
                int64_t loopres_72467;
                int64_t loopres_72468;
                int64_t loopres_72469;
                
                if (cond_72466) {
                    loopres_72467 = l_idx_72445;
                    loopres_72468 = r_idx_72446;
                    loopres_72469 = min_res_65364;
                } else {
                    bool cond_72470 = slt64(abs_res_72458, abs_res_72465);
                    bool cond_f_res_72471 = min_res_72451 == r_idx_72446;
                    bool x_72472 = !cond_72470;
                    bool y_72473 = cond_f_res_72471 && x_72472;
                    bool cond_72474 = cond_72470 || y_72473;
                    int64_t loopres_f_res_72475;
                    
                    if (cond_72474) {
                        loopres_f_res_72475 = max_res_72449;
                    } else {
                        loopres_f_res_72475 = l_idx_72445;
                    }
                    
                    int64_t loopres_f_res_72476;
                    
                    if (cond_72474) {
                        loopres_f_res_72476 = r_idx_72446;
                    } else {
                        loopres_f_res_72476 = min_res_72451;
                    }
                    
                    int64_t loopres_f_res_72477;
                    
                    if (cond_72474) {
                        int64_t loopres_f_res_t_res_72478 = add64((int64_t) 1,
                                                                  span_72447);
                        
                        loopres_f_res_72477 = loopres_f_res_t_res_72478;
                    } else {
                        int64_t loopres_f_res_f_res_72479 = add64((int64_t) 1,
                                                                  span_72447);
                        
                        loopres_f_res_72477 = loopres_f_res_f_res_72479;
                    }
                    loopres_72467 = loopres_f_res_72475;
                    loopres_72468 = loopres_f_res_72476;
                    loopres_72469 = loopres_f_res_72477;
                }
                
                bool loop_cond_72480 = slt64(loopres_72469, min_res_65364);
                bool loop_while_tmp_72590 = loop_cond_72480;
                int64_t l_idx_tmp_72591 = loopres_72467;
                int64_t r_idx_tmp_72592 = loopres_72468;
                int64_t span_tmp_72593 = loopres_72469;
                
                loop_while_72444 = loop_while_tmp_72590;
                l_idx_72445 = l_idx_tmp_72591;
                r_idx_72446 = r_idx_tmp_72592;
                span_72447 = span_tmp_72593;
            }
            idx_72440 = loop_while_72444;
            idx_72441 = l_idx_72445;
            idx_72442 = r_idx_72446;
            idx_72443 = span_72447;
            
            int64_t min_res_72481 = smin64(min_arg_65588, idx_72441);
            int64_t max_res_72482 = smax64((int64_t) 0, min_res_72481);
            int64_t x_72483 = add64(min_res_65589, max_res_72482);
            int64_t r_72484 = sub64(x_72483, (int64_t) 1);
            bool x_72485 = sle64((int64_t) 0, r_72484);
            bool y_72486 = slt64(r_72484, n_65344);
            bool bounds_check_72487 = x_72485 && y_72486;
            bool index_certs_72488;
            
            if (!bounds_check_72487) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_72484,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_72489;
            
            x_72489 = ((int64_t *) mem_70727)[r_72484];
            
            int64_t abs_arg_72490 = sub64(x_72489, min_res_72417);
            int64_t abs_res_72491 = abs64(abs_arg_72490);
            bool x_72492 = sle64((int64_t) 0, max_res_72482);
            bool y_72493 = slt64(max_res_72482, n_65344);
            bool bounds_check_72494 = x_72492 && y_72493;
            bool index_certs_72495;
            
            if (!bounds_check_72494) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_72482,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_72496;
            
            x_72496 = ((int64_t *) mem_70727)[max_res_72482];
            
            int64_t abs_arg_72497 = sub64(x_72496, min_res_72417);
            int64_t abs_res_72498 = abs64(abs_arg_72497);
            int64_t max_res_72499 = smax64(abs_res_72491, abs_res_72498);
            float defunc_0_f_res_72500 = sitofp_i64_f32(max_res_72499);
            float defunc_1_f_res_72501 = max_res_65593 + defunc_0_f_res_72500;
            float defunc_2_reduce_res_72502;
            float defunc_2_reduce_res_72503;
            float defunc_2_reduce_res_72504;
            float redout_72506;
            float redout_72507;
            float redout_72508;
            
            redout_72506 = 0.0F;
            redout_72507 = 0.0F;
            redout_72508 = 0.0F;
            for (int64_t i_72505 = 0; i_72505 < q_65346; i_72505++) {
                float x_72509;
                
                x_72509 = ((float *) mem_70769)[i_72505];
                
                bool cond_72510 = sle64(last_res_65572, i_72505);
                int64_t defunc_0_f_res_72511;
                
                if (cond_72510) {
                    defunc_0_f_res_72511 = (int64_t) 0;
                } else {
                    int64_t i_72512 = add64(max_res_72482, i_72505);
                    int64_t defunc_0_add_arg_72513;
                    
                    defunc_0_add_arg_72513 = ((int64_t *) mem_70727)[i_72512];
                    
                    int64_t defunc_1_add_res_72514 = add64((int64_t) 1,
                                                           defunc_0_add_arg_72513);
                    
                    defunc_0_f_res_72511 = defunc_1_add_res_72514;
                }
                
                int64_t binop_p_72515 = sub64(defunc_0_f_res_72511,
                                              min_res_72417);
                float defunc_0_f_res_72516 = sitofp_i64_f32(binop_p_72515);
                float abs_res_72517 = (float) fabs(defunc_0_f_res_72516);
                float tmp1_72518 = abs_res_72517 / defunc_1_f_res_72501;
                float x_72519 = tmp1_72518 * tmp1_72518;
                float y_72520 = tmp1_72518 * x_72519;
                float tmp2_72521 = 1.0F - y_72520;
                float x_72522 = tmp2_72521 * tmp2_72521;
                float tmp3_72523 = tmp2_72521 * x_72522;
                float w_j_72524 = x_72509 * tmp3_72523;
                float xw_j_72525 = defunc_0_f_res_72516 * w_j_72524;
                float x2w_j_72526 = defunc_0_f_res_72516 * xw_j_72525;
                float defunc_1_op_res_72527 = w_j_72524 + redout_72506;
                float defunc_1_op_res_72528 = xw_j_72525 + redout_72507;
                float defunc_1_op_res_72529 = x2w_j_72526 + redout_72508;
                float redout_tmp_72594 = defunc_1_op_res_72527;
                float redout_tmp_72595 = defunc_1_op_res_72528;
                float redout_tmp_72596 = defunc_1_op_res_72529;
                
                redout_72506 = redout_tmp_72594;
                redout_72507 = redout_tmp_72595;
                redout_72508 = redout_tmp_72596;
            }
            defunc_2_reduce_res_72502 = redout_72506;
            defunc_2_reduce_res_72503 = redout_72507;
            defunc_2_reduce_res_72504 = redout_72508;
            
            float x_72530 = defunc_2_reduce_res_72502 *
                  defunc_2_reduce_res_72504;
            float y_72531 = defunc_2_reduce_res_72503 *
                  defunc_2_reduce_res_72503;
            float y_72532 = x_72530 - y_72531;
            float det1_72533 = 1.0F / y_72532;
            float a11_72534 = defunc_2_reduce_res_72504 * det1_72533;
            float x_72535 = 0.0F - defunc_2_reduce_res_72503;
            float b11_72536 = det1_72533 * x_72535;
            float c11_72537 = defunc_2_reduce_res_72502 * det1_72533;
            float defunc_2_reduce_res_72538;
            float defunc_2_reduce_res_72539;
            float redout_72541;
            float redout_72542;
            
            redout_72541 = 0.0F;
            redout_72542 = 0.0F;
            for (int64_t i_72540 = 0; i_72540 < q_65346; i_72540++) {
                float x_72543;
                
                x_72543 = ((float *) mem_70769)[i_72540];
                
                bool cond_72544 = sle64(last_res_65572, i_72540);
                int64_t defunc_0_f_res_72545;
                
                if (cond_72544) {
                    defunc_0_f_res_72545 = (int64_t) 0;
                } else {
                    int64_t i_72546 = add64(max_res_72482, i_72540);
                    int64_t defunc_0_add_arg_72547;
                    
                    defunc_0_add_arg_72547 = ((int64_t *) mem_70727)[i_72546];
                    
                    int64_t defunc_1_add_res_72548 = add64((int64_t) 1,
                                                           defunc_0_add_arg_72547);
                    
                    defunc_0_f_res_72545 = defunc_1_add_res_72548;
                }
                
                int64_t binop_p_72549 = sub64(defunc_0_f_res_72545,
                                              min_res_72417);
                float defunc_0_f_res_72550 = sitofp_i64_f32(binop_p_72549);
                float abs_res_72551 = (float) fabs(defunc_0_f_res_72550);
                float tmp1_72552 = abs_res_72551 / defunc_1_f_res_72501;
                float x_72553 = tmp1_72552 * tmp1_72552;
                float y_72554 = tmp1_72552 * x_72553;
                float tmp2_72555 = 1.0F - y_72554;
                float x_72556 = tmp2_72555 * tmp2_72555;
                float tmp3_72557 = tmp2_72555 * x_72556;
                float tmp4_72558 = x_72543 * tmp3_72557;
                float defunc_1_f_res_72559 = defunc_0_f_res_72550 * tmp4_72558;
                float defunc_0_f_res_72560;
                
                if (cond_72544) {
                    defunc_0_f_res_72560 = 0.0F;
                } else {
                    int64_t i_72561 = add64(max_res_72482, i_72540);
                    float defunc_0_add_arg_72562;
                    
                    defunc_0_add_arg_72562 = ((float *) mem_70724)[i_72561];
                    defunc_0_f_res_72560 = defunc_0_add_arg_72562;
                }
                
                float x_72563 = a11_72534 * tmp4_72558;
                float y_72564 = b11_72536 * defunc_1_f_res_72559;
                float x_72565 = x_72563 + y_72564;
                float defunc_9_fit_fun_res_72566 = defunc_0_f_res_72560 *
                      x_72565;
                float x_72567 = b11_72536 * tmp4_72558;
                float y_72568 = c11_72537 * defunc_1_f_res_72559;
                float x_72569 = x_72567 + y_72568;
                float defunc_9_slope_fun_res_72570 = defunc_0_f_res_72560 *
                      x_72569;
                float defunc_1_op_res_72571 = defunc_9_fit_fun_res_72566 +
                      redout_72541;
                float defunc_1_op_res_72572 = defunc_9_slope_fun_res_72570 +
                      redout_72542;
                float redout_tmp_72597 = defunc_1_op_res_72571;
                float redout_tmp_72598 = defunc_1_op_res_72572;
                
                redout_72541 = redout_tmp_72597;
                redout_72542 = redout_tmp_72598;
            }
            defunc_2_reduce_res_72538 = redout_72541;
            defunc_2_reduce_res_72539 = redout_72542;
            ((float *) mem_70784)[i_72413] = defunc_2_reduce_res_72538;
            ((float *) mem_70787)[i_72413] = defunc_2_reduce_res_72539;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70815.mem + gtid_67178 * n_m_65352 * (int64_t) 4,
                    mem_70784 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70819.mem + gtid_67178 * n_m_65352 * (int64_t) 4,
                    mem_70787 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_70709);
    free(mem_70724);
    free(mem_70727);
    free(mem_70754);
    free(mem_70769);
    free(mem_70784);
    free(mem_70787);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77081_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77081_end -
                 futhark_mc_segmap_parloop_77081_start;
        
        ctx->futhark_mc_segmap_parloop_77081_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77081_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77081_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77079(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_67177 = tid;
    int num_tasks_72380 = info.nsubtasks;
    struct futhark_mc_task_77078 *futhark_mc_task_77078 =
                                 (struct futhark_mc_task_77078 *) args;
    struct futhark_context *ctx = futhark_mc_task_77078->ctx;
    uint64_t futhark_mc_segmap_task_77079_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77079_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77078->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77078->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77078->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77078->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77078->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77078->free_i_65358;
    bool x_65359 = futhark_mc_task_77078->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77078->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77078->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77078->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77078->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70687 = futhark_mc_task_77078->free_bytes_70687;
    int64_t bytes_70690 = futhark_mc_task_77078->free_bytes_70690;
    int64_t bytes_70699 = futhark_mc_task_77078->free_bytes_70699;
    int64_t bytes_70702 = futhark_mc_task_77078->free_bytes_70702;
    struct memblock mem_70815 = {.desc ="mem_70815", .mem =
                                 futhark_mc_task_77078->free_mem_70815, .size =
                                 0, .references =NULL};
    struct memblock mem_70819 = {.desc ="mem_70819", .mem =
                                 futhark_mc_task_77078->free_mem_70819, .size =
                                 0, .references =NULL};
    int64_t iter_72381;
    struct futhark_mc_segmap_parloop_struct_77080
    futhark_mc_segmap_parloop_struct_77080;
    
    futhark_mc_segmap_parloop_struct_77080.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77080.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77080.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77080.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77080.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77080.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77080.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77080.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77080.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77080.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77080.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77080.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77080.free_bytes_70687 = bytes_70687;
    futhark_mc_segmap_parloop_struct_77080.free_bytes_70690 = bytes_70690;
    futhark_mc_segmap_parloop_struct_77080.free_bytes_70699 = bytes_70699;
    futhark_mc_segmap_parloop_struct_77080.free_bytes_70702 = bytes_70702;
    futhark_mc_segmap_parloop_struct_77080.free_mem_70815 = mem_70815.mem;
    futhark_mc_segmap_parloop_struct_77080.free_mem_70819 = mem_70819.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77081_task;
    
    futhark_mc_segmap_parloop_77081_task.name =
        "futhark_mc_segmap_parloop_77081";
    futhark_mc_segmap_parloop_77081_task.fn = futhark_mc_segmap_parloop_77081;
    futhark_mc_segmap_parloop_77081_task.args =
        &futhark_mc_segmap_parloop_struct_77080;
    futhark_mc_segmap_parloop_77081_task.iterations = iterations;
    futhark_mc_segmap_parloop_77081_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77081_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77081_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77081_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77081_task);
    
    if (futhark_mc_segmap_parloop_77081_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77081_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77081_total_end -
                 futhark_mc_segmap_parloop_77081_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77081_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77081_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77081_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77079_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77079_end -
                 futhark_mc_segmap_task_77079_start;
        
        ctx->futhark_mc_segmap_task_77079_runs[tid]++;
        ctx->futhark_mc_segmap_task_77079_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77079_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77090 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70687;
    int64_t free_bytes_70690;
    int64_t free_bytes_70699;
    int64_t free_bytes_70702;
    unsigned char *free_mem_70815;
    unsigned char *free_mem_70819;
};
struct futhark_mc_task_77099 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67367;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70688;
};
struct futhark_mc_scan_stage_1_parloop_struct_77102 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67367;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70688;
};
static int futhark_mc_scan_stage_1_parloop_77103(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_72600, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_77102
    *futhark_mc_scan_stage_1_parloop_struct_77102 =
    (struct futhark_mc_scan_stage_1_parloop_struct_77102 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_77102->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_77103_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77103_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_1_parloop_struct_77102->free_n_65344;
    int64_t gtid_67367 =
            futhark_mc_scan_stage_1_parloop_struct_77102->free_gtid_67367;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_1_parloop_struct_77102->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70688 = {.desc ="mem_70688", .mem =
                                 futhark_mc_scan_stage_1_parloop_struct_77102->free_mem_70688,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72953 = start;
    int64_t x_72602;
    int64_t x_72603;
    
    x_72602 = (int64_t) 0;
    for (; iter_72953 < end; iter_72953++) {
        int64_t gtid_72601 = iter_72953;
        
        // stage 1 scan body
        {
            float x_72605;
            
            x_72605 = ((float *) Y_mem_70569.mem)[gtid_67367 * n_65344 +
                                                  gtid_72601];
            
            bool isnan_res_72606;
            
            isnan_res_72606 = futrts_isnan32(x_72605);
            
            bool defunc_0_p_res_72607 = !isnan_res_72606;
            int64_t defunc_0_f_res_72608 = btoi_bool_i64(defunc_0_p_res_72607);
            
            // write mapped values results to memory
            { }
            x_72602 = x_72602;
            // Read next values
            {
                x_72603 = defunc_0_f_res_72608;
            }
            
            int64_t defunc_1_op_res_72604 = add64(x_72602, x_72603);
            
            ((int64_t *) mem_70688.mem)[gtid_72601] = defunc_1_op_res_72604;
            x_72602 = defunc_1_op_res_72604;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77103_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77103_end -
                 futhark_mc_scan_stage_1_parloop_77103_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_77103_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_77103_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_77103_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_77104 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67367;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70688;
};
static int futhark_mc_scan_stage_3_parloop_77105(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_72600, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_77104
    *futhark_mc_scan_stage_3_parloop_struct_77104 =
    (struct futhark_mc_scan_stage_3_parloop_struct_77104 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_77104->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_77105_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_77105_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_3_parloop_struct_77104->free_n_65344;
    int64_t gtid_67367 =
            futhark_mc_scan_stage_3_parloop_struct_77104->free_gtid_67367;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_3_parloop_struct_77104->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70688 = {.desc ="mem_70688", .mem =
                                 futhark_mc_scan_stage_3_parloop_struct_77104->free_mem_70688,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72965 = start;
    int64_t x_72962;
    int64_t x_72963;
    
    if (iter_72965 == (int64_t) 0) {
        x_72962 = (int64_t) 0;
    } else {
        x_72962 = ((int64_t *) mem_70688.mem)[iter_72965 - (int64_t) 1];
    }
    for (; iter_72965 < end; iter_72965++) {
        int64_t gtid_72601 = iter_72965;
        
        // stage 3 scan body
        {
            float x_72605;
            
            x_72605 = ((float *) Y_mem_70569.mem)[gtid_67367 * n_65344 +
                                                  gtid_72601];
            
            bool isnan_res_72606;
            
            isnan_res_72606 = futrts_isnan32(x_72605);
            
            bool defunc_0_p_res_72607 = !isnan_res_72606;
            int64_t defunc_0_f_res_72608 = btoi_bool_i64(defunc_0_p_res_72607);
            
            x_72962 = x_72962;
            x_72963 = defunc_0_f_res_72608;
            
            int64_t defunc_1_op_res_72964 = add64(x_72962, x_72963);
            
            ((int64_t *) mem_70688.mem)[gtid_72601] = defunc_1_op_res_72964;
            x_72962 = defunc_1_op_res_72964;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_77105_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77105_end -
                 futhark_mc_scan_stage_3_parloop_77105_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_77105_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_77105_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_77105_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_77100(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72600 = tid;
    int num_tasks_72952 = info.nsubtasks;
    struct futhark_mc_task_77099 *futhark_mc_task_77099 =
                                 (struct futhark_mc_task_77099 *) args;
    struct futhark_context *ctx = futhark_mc_task_77099->ctx;
    uint64_t futhark_mc_segscan_task_77100_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_77100_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77099->free_n_65344;
    int64_t gtid_67367 = futhark_mc_task_77099->free_gtid_67367;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77099->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70688 = {.desc ="mem_70688", .mem =
                                 futhark_mc_task_77099->free_mem_70688, .size =
                                 0, .references =NULL};
    size_t scan_stage_2_accum_mem_72959_cached_sizze_77101 = 0;
    unsigned char *scan_stage_2_accum_mem_72959 = NULL;
    int64_t iter_72953;
    struct futhark_mc_scan_stage_1_parloop_struct_77102
    futhark_mc_scan_stage_1_parloop_struct_77102;
    
    futhark_mc_scan_stage_1_parloop_struct_77102.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_77102.free_n_65344 = n_65344;
    futhark_mc_scan_stage_1_parloop_struct_77102.free_gtid_67367 = gtid_67367;
    futhark_mc_scan_stage_1_parloop_struct_77102.free_Y_mem_70569 =
        Y_mem_70569.mem;
    futhark_mc_scan_stage_1_parloop_struct_77102.free_mem_70688 = mem_70688.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_77103_task;
    
    futhark_mc_scan_stage_1_parloop_77103_task.name =
        "futhark_mc_scan_stage_1_parloop_77103";
    futhark_mc_scan_stage_1_parloop_77103_task.fn =
        futhark_mc_scan_stage_1_parloop_77103;
    futhark_mc_scan_stage_1_parloop_77103_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_77102;
    futhark_mc_scan_stage_1_parloop_77103_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_77103_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_77103_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77103_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_77103_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_77103_task);
    
    if (futhark_mc_scan_stage_1_parloop_77103_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77103_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77103_total_end -
                 futhark_mc_scan_stage_1_parloop_77103_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77103_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77103_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77103_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_72952)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_72954;
        int64_t x_72955;
        int64_t offset_72957 = (int64_t) 0;
        int64_t offset_index_72958 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_72959_cached_sizze_77101 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_72959 = realloc(scan_stage_2_accum_mem_72959,
                                                   (int64_t) 8);
            scan_stage_2_accum_mem_72959_cached_sizze_77101 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_72959)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_72961 = 0; i_72961 < num_tasks_72952 - 1; i_72961++) {
            offset_72957 = squot64(n_65344, sext_i32_i64(num_tasks_72952));
            if (slt64(sext_i32_i64(i_72961), srem64(n_65344,
                                                    sext_i32_i64(num_tasks_72952)))) {
                offset_72957 += (int64_t) 1;
            }
            offset_index_72958 += offset_72957;
            
            int64_t gtid_72601 = offset_index_72958;
            float x_72605;
            
            x_72605 = ((float *) Y_mem_70569.mem)[gtid_67367 * n_65344 +
                                                  gtid_72601];
            
            bool isnan_res_72606;
            
            isnan_res_72606 = futrts_isnan32(x_72605);
            
            bool defunc_0_p_res_72607 = !isnan_res_72606;
            int64_t defunc_0_f_res_72608 = btoi_bool_i64(defunc_0_p_res_72607);
            
            // Read carry in
            {
                x_72954 =
                    ((int64_t *) scan_stage_2_accum_mem_72959)[(int64_t) 0];
            }
            // Read next values
            {
                x_72955 = ((int64_t *) mem_70688.mem)[offset_index_72958 -
                                                      (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_72956 = add64(x_72954, x_72955);
            
            ((int64_t *) mem_70688.mem)[offset_index_72958 - (int64_t) 1] =
                defunc_1_op_res_72956;
            ((int64_t *) scan_stage_2_accum_mem_72959)[(int64_t) 0] =
                defunc_1_op_res_72956;
        }
        
        int64_t iter_72965 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_77104
        futhark_mc_scan_stage_3_parloop_struct_77104;
        
        futhark_mc_scan_stage_3_parloop_struct_77104.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_77104.free_n_65344 = n_65344;
        futhark_mc_scan_stage_3_parloop_struct_77104.free_gtid_67367 =
            gtid_67367;
        futhark_mc_scan_stage_3_parloop_struct_77104.free_Y_mem_70569 =
            Y_mem_70569.mem;
        futhark_mc_scan_stage_3_parloop_struct_77104.free_mem_70688 =
            mem_70688.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_77105_task;
        
        futhark_mc_scan_stage_3_parloop_77105_task.name =
            "futhark_mc_scan_stage_3_parloop_77105";
        futhark_mc_scan_stage_3_parloop_77105_task.fn =
            futhark_mc_scan_stage_3_parloop_77105;
        futhark_mc_scan_stage_3_parloop_77105_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_77104;
        futhark_mc_scan_stage_3_parloop_77105_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_77105_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_77105_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_77105_total_start = get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_77105_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_77105_task);
        
        if (futhark_mc_scan_stage_3_parloop_77105_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_77105_total_end =
                     get_wall_time();
            uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77105_total_end -
                     futhark_mc_scan_stage_3_parloop_77105_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77105_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77105_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77105_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_72959);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_77100_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_77100_end -
                 futhark_mc_segscan_task_77100_start;
        
        ctx->futhark_mc_segscan_task_77100_runs[tid]++;
        ctx->futhark_mc_segscan_task_77100_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_77100_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77106 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67367;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70688;
    unsigned char *free_mem_70691;
    unsigned char *free_mem_70694;
};
struct futhark_mc_segmap_parloop_struct_77108 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67367;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70688;
    unsigned char *free_mem_70691;
    unsigned char *free_mem_70694;
};
static int futhark_mc_segmap_parloop_77109(void *args, int64_t start,
                                           int64_t end, int flat_tid_72609,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77108
    *futhark_mc_segmap_parloop_struct_77108 =
    (struct futhark_mc_segmap_parloop_struct_77108 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77108->ctx;
    uint64_t futhark_mc_segmap_parloop_77109_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77109_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77108->free_n_65344;
    int64_t gtid_67367 =
            futhark_mc_segmap_parloop_struct_77108->free_gtid_67367;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77108->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70688 = {.desc ="mem_70688", .mem =
                                 futhark_mc_segmap_parloop_struct_77108->free_mem_70688,
                                 .size =0, .references =NULL};
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_segmap_parloop_struct_77108->free_mem_70691,
                                 .size =0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_segmap_parloop_struct_77108->free_mem_70694,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72969 = start;
    
    for (; iter_72969 < end; iter_72969++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72972 = n_65344;
        int64_t gtid_72610 = iter_72969;
        int64_t remnant_72973 = iter_72969 - gtid_72610;
        float x_72611;
        
        x_72611 = ((float *) Y_mem_70569.mem)[gtid_67367 * n_65344 +
                                              gtid_72610];
        
        bool isnan_res_72612;
        
        isnan_res_72612 = futrts_isnan32(x_72611);
        
        bool defunc_0_p_res_72613 = !isnan_res_72612;
        int64_t defunc_1_f_res_72614;
        
        if (defunc_0_p_res_72613) {
            int64_t x_72970;
            
            x_72970 = ((int64_t *) mem_70688.mem)[gtid_72610];
            
            int64_t defunc_1_f_res_t_res_72971 = sub64(x_72970, (int64_t) 1);
            
            defunc_1_f_res_72614 = defunc_1_f_res_t_res_72971;
        } else {
            defunc_1_f_res_72614 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_72614) &&
            slt64(defunc_1_f_res_72614, n_65344)) {
            ((int64_t *) mem_70694.mem)[defunc_1_f_res_72614] = gtid_72610;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_72614) &&
            slt64(defunc_1_f_res_72614, n_65344)) {
            ((float *) mem_70691.mem)[defunc_1_f_res_72614] = x_72611;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77109_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77109_end -
                 futhark_mc_segmap_parloop_77109_start;
        
        ctx->futhark_mc_segmap_parloop_77109_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77109_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77109_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77107(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72609 = tid;
    int num_tasks_72968 = info.nsubtasks;
    struct futhark_mc_task_77106 *futhark_mc_task_77106 =
                                 (struct futhark_mc_task_77106 *) args;
    struct futhark_context *ctx = futhark_mc_task_77106->ctx;
    uint64_t futhark_mc_segmap_task_77107_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77107_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77106->free_n_65344;
    int64_t gtid_67367 = futhark_mc_task_77106->free_gtid_67367;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77106->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70688 = {.desc ="mem_70688", .mem =
                                 futhark_mc_task_77106->free_mem_70688, .size =
                                 0, .references =NULL};
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_task_77106->free_mem_70691, .size =
                                 0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_task_77106->free_mem_70694, .size =
                                 0, .references =NULL};
    int64_t iter_72969;
    struct futhark_mc_segmap_parloop_struct_77108
    futhark_mc_segmap_parloop_struct_77108;
    
    futhark_mc_segmap_parloop_struct_77108.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77108.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77108.free_gtid_67367 = gtid_67367;
    futhark_mc_segmap_parloop_struct_77108.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77108.free_mem_70688 = mem_70688.mem;
    futhark_mc_segmap_parloop_struct_77108.free_mem_70691 = mem_70691.mem;
    futhark_mc_segmap_parloop_struct_77108.free_mem_70694 = mem_70694.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77109_task;
    
    futhark_mc_segmap_parloop_77109_task.name =
        "futhark_mc_segmap_parloop_77109";
    futhark_mc_segmap_parloop_77109_task.fn = futhark_mc_segmap_parloop_77109;
    futhark_mc_segmap_parloop_77109_task.args =
        &futhark_mc_segmap_parloop_struct_77108;
    futhark_mc_segmap_parloop_77109_task.iterations = iterations;
    futhark_mc_segmap_parloop_77109_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77109_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77109_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77109_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77109_task);
    
    if (futhark_mc_segmap_parloop_77109_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77109_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77109_total_end -
                 futhark_mc_segmap_parloop_77109_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77109_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77109_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77109_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77107_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77107_end -
                 futhark_mc_segmap_task_77107_start;
        
        ctx->futhark_mc_segmap_task_77107_runs[tid]++;
        ctx->futhark_mc_segmap_task_77107_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77107_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77110 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70697;
};
struct futhark_mc_segmap_parloop_struct_77112 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70697;
};
static int futhark_mc_segmap_parloop_77113(void *args, int64_t start,
                                           int64_t end, int flat_tid_72617,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77112
    *futhark_mc_segmap_parloop_struct_77112 =
    (struct futhark_mc_segmap_parloop_struct_77112 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77112->ctx;
    uint64_t futhark_mc_segmap_parloop_77113_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77113_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77112->free_n_65344;
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_segmap_parloop_struct_77112->free_mem_70694,
                                 .size =0, .references =NULL};
    struct memblock mem_70697 = {.desc ="mem_70697", .mem =
                                 futhark_mc_segmap_parloop_struct_77112->free_mem_70697,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72975 = start;
    
    for (; iter_72975 < end; iter_72975++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72976 = n_65344;
        int64_t gtid_72618 = iter_72975;
        int64_t remnant_72977 = iter_72975 - gtid_72618;
        int64_t x_72619;
        
        x_72619 = ((int64_t *) mem_70694.mem)[gtid_72618];
        
        int64_t defunc_0_f_res_72620 = add64((int64_t) 1, x_72619);
        
        ((int64_t *) mem_70697.mem)[gtid_72618] = defunc_0_f_res_72620;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77113_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77113_end -
                 futhark_mc_segmap_parloop_77113_start;
        
        ctx->futhark_mc_segmap_parloop_77113_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77113_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77113_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77111(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72617 = tid;
    int num_tasks_72974 = info.nsubtasks;
    struct futhark_mc_task_77110 *futhark_mc_task_77110 =
                                 (struct futhark_mc_task_77110 *) args;
    struct futhark_context *ctx = futhark_mc_task_77110->ctx;
    uint64_t futhark_mc_segmap_task_77111_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77111_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77110->free_n_65344;
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_task_77110->free_mem_70694, .size =
                                 0, .references =NULL};
    struct memblock mem_70697 = {.desc ="mem_70697", .mem =
                                 futhark_mc_task_77110->free_mem_70697, .size =
                                 0, .references =NULL};
    int64_t iter_72975;
    struct futhark_mc_segmap_parloop_struct_77112
    futhark_mc_segmap_parloop_struct_77112;
    
    futhark_mc_segmap_parloop_struct_77112.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77112.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77112.free_mem_70694 = mem_70694.mem;
    futhark_mc_segmap_parloop_struct_77112.free_mem_70697 = mem_70697.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77113_task;
    
    futhark_mc_segmap_parloop_77113_task.name =
        "futhark_mc_segmap_parloop_77113";
    futhark_mc_segmap_parloop_77113_task.fn = futhark_mc_segmap_parloop_77113;
    futhark_mc_segmap_parloop_77113_task.args =
        &futhark_mc_segmap_parloop_struct_77112;
    futhark_mc_segmap_parloop_77113_task.iterations = iterations;
    futhark_mc_segmap_parloop_77113_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77113_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77113_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77113_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77113_task);
    
    if (futhark_mc_segmap_parloop_77113_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77113_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77113_total_end -
                 futhark_mc_segmap_parloop_77113_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77113_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77113_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77113_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77111_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77111_end -
                 futhark_mc_segmap_task_77111_start;
        
        ctx->futhark_mc_segmap_task_77111_runs[tid]++;
        ctx->futhark_mc_segmap_task_77111_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77111_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77114 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_67379;
    unsigned char *free_mem_70700;
};
struct futhark_mc_segmap_parloop_struct_77116 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_67379;
    unsigned char *free_mem_70700;
};
static int futhark_mc_segmap_parloop_77117(void *args, int64_t start,
                                           int64_t end, int flat_tid_72621,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77116
    *futhark_mc_segmap_parloop_struct_77116 =
    (struct futhark_mc_segmap_parloop_struct_77116 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77116->ctx;
    uint64_t futhark_mc_segmap_parloop_77117_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77117_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77116->free_q_65346;
    int64_t last_res_67379 =
            futhark_mc_segmap_parloop_struct_77116->free_last_res_67379;
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_segmap_parloop_struct_77116->free_mem_70700,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72979 = start;
    
    for (; iter_72979 < end; iter_72979++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72980 = q_65346;
        int64_t gtid_72622 = iter_72979;
        int64_t remnant_72981 = iter_72979 - gtid_72622;
        bool cond_72623 = sle64(last_res_67379, gtid_72622);
        float defunc_0_f_res_72624;
        
        if (cond_72623) {
            defunc_0_f_res_72624 = 0.0F;
        } else {
            defunc_0_f_res_72624 = 1.0F;
        }
        ((float *) mem_70700.mem)[gtid_72622] = defunc_0_f_res_72624;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77117_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77117_end -
                 futhark_mc_segmap_parloop_77117_start;
        
        ctx->futhark_mc_segmap_parloop_77117_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77117_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77117_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77115(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72621 = tid;
    int num_tasks_72978 = info.nsubtasks;
    struct futhark_mc_task_77114 *futhark_mc_task_77114 =
                                 (struct futhark_mc_task_77114 *) args;
    struct futhark_context *ctx = futhark_mc_task_77114->ctx;
    uint64_t futhark_mc_segmap_task_77115_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77115_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_task_77114->free_q_65346;
    int64_t last_res_67379 = futhark_mc_task_77114->free_last_res_67379;
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_task_77114->free_mem_70700, .size =
                                 0, .references =NULL};
    int64_t iter_72979;
    struct futhark_mc_segmap_parloop_struct_77116
    futhark_mc_segmap_parloop_struct_77116;
    
    futhark_mc_segmap_parloop_struct_77116.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77116.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77116.free_last_res_67379 = last_res_67379;
    futhark_mc_segmap_parloop_struct_77116.free_mem_70700 = mem_70700.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77117_task;
    
    futhark_mc_segmap_parloop_77117_task.name =
        "futhark_mc_segmap_parloop_77117";
    futhark_mc_segmap_parloop_77117_task.fn = futhark_mc_segmap_parloop_77117;
    futhark_mc_segmap_parloop_77117_task.args =
        &futhark_mc_segmap_parloop_struct_77116;
    futhark_mc_segmap_parloop_77117_task.iterations = iterations;
    futhark_mc_segmap_parloop_77117_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77117_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77117_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77117_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77117_task);
    
    if (futhark_mc_segmap_parloop_77117_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77117_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77117_total_end -
                 futhark_mc_segmap_parloop_77117_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77117_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77117_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77117_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77115_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77115_end -
                 futhark_mc_segmap_task_77115_start;
        
        ctx->futhark_mc_segmap_task_77115_runs[tid]++;
        ctx->futhark_mc_segmap_task_77115_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77115_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77118 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_67379;
    int64_t free_min_arg_67398;
    int64_t free_min_arg_67399;
    int64_t free_min_res_67400;
    float free_max_res_67404;
    unsigned char *free_mem_70691;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70697;
    unsigned char *free_mem_70700;
    unsigned char *free_mem_70703;
    unsigned char *free_mem_70706;
};
struct futhark_mc_segmap_parloop_struct_77120 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_67379;
    int64_t free_min_arg_67398;
    int64_t free_min_arg_67399;
    int64_t free_min_res_67400;
    float free_max_res_67404;
    unsigned char *free_mem_70691;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70697;
    unsigned char *free_mem_70700;
    unsigned char *free_mem_70703;
    unsigned char *free_mem_70706;
};
static int futhark_mc_segmap_parloop_77121(void *args, int64_t start,
                                           int64_t end, int flat_tid_72791,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77120
    *futhark_mc_segmap_parloop_struct_77120 =
    (struct futhark_mc_segmap_parloop_struct_77120 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77120->ctx;
    uint64_t futhark_mc_segmap_parloop_77121_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77121_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77120->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77120->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77120->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77120->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77120->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77120->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77120->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77120->free_loop_cond_65369;
    int64_t last_res_67379 =
            futhark_mc_segmap_parloop_struct_77120->free_last_res_67379;
    int64_t min_arg_67398 =
            futhark_mc_segmap_parloop_struct_77120->free_min_arg_67398;
    int64_t min_arg_67399 =
            futhark_mc_segmap_parloop_struct_77120->free_min_arg_67399;
    int64_t min_res_67400 =
            futhark_mc_segmap_parloop_struct_77120->free_min_res_67400;
    float max_res_67404 =
          futhark_mc_segmap_parloop_struct_77120->free_max_res_67404;
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_segmap_parloop_struct_77120->free_mem_70691,
                                 .size =0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_segmap_parloop_struct_77120->free_mem_70694,
                                 .size =0, .references =NULL};
    struct memblock mem_70697 = {.desc ="mem_70697", .mem =
                                 futhark_mc_segmap_parloop_struct_77120->free_mem_70697,
                                 .size =0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_segmap_parloop_struct_77120->free_mem_70700,
                                 .size =0, .references =NULL};
    struct memblock mem_70703 = {.desc ="mem_70703", .mem =
                                 futhark_mc_segmap_parloop_struct_77120->free_mem_70703,
                                 .size =0, .references =NULL};
    struct memblock mem_70706 = {.desc ="mem_70706", .mem =
                                 futhark_mc_segmap_parloop_struct_77120->free_mem_70706,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_72983 = start;
    
    for (; iter_72983 < end; iter_72983++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_73097 = n_m_65352;
        int64_t gtid_72792 = iter_72983;
        int64_t remnant_73098 = iter_72983 - gtid_72792;
        int64_t min_arg_72793 = mul64(jump_65348, gtid_72792);
        int64_t min_res_72794 = smin64(i_65358, min_arg_72793);
        int64_t defunc_0_g_res_72795 = add64((int64_t) 1, min_res_72794);
        bool init_idx_72796;
        int64_t init_idx_72797;
        int64_t init_idx_72798;
        bool loop_while_72984;
        int64_t low_72985;
        int64_t high_72986;
        
        loop_while_72984 = x_65359;
        low_72985 = (int64_t) 0;
        high_72986 = i_65358;
        while (loop_while_72984) {
            int64_t x_72987 = add64(low_72985, high_72986);
            int64_t mid_72988 = sdiv64(x_72987, (int64_t) 2);
            bool x_72989 = sle64((int64_t) 0, mid_72988);
            bool y_72990 = slt64(mid_72988, n_65344);
            bool bounds_check_72991 = x_72989 && y_72990;
            bool index_certs_72992;
            
            if (!bounds_check_72991) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_72988,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_72993;
            
            mid_id_72993 = ((int64_t *) mem_70697.mem)[mid_72988];
            
            bool cond_72994 = slt64(mid_id_72993, (int64_t) 0);
            int64_t mid_idx_72995;
            
            if (cond_72994) {
                mid_idx_72995 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_72995 = mid_id_72993;
            }
            
            bool cond_72996 = sle64(defunc_0_g_res_72795, mid_idx_72995);
            int64_t loopres_72997;
            int64_t loopres_72998;
            
            if (cond_72996) {
                int64_t loopres_t_res_72999 = sub64(mid_72988, (int64_t) 1);
                
                loopres_72997 = low_72985;
                loopres_72998 = loopres_t_res_72999;
            } else {
                int64_t loopres_f_res_73000 = add64((int64_t) 1, mid_72988);
                
                loopres_72997 = loopres_f_res_73000;
                loopres_72998 = high_72986;
            }
            
            bool loop_cond_73001 = sle64(loopres_72997, loopres_72998);
            bool loop_while_tmp_73099 = loop_cond_73001;
            int64_t low_tmp_73100 = loopres_72997;
            int64_t high_tmp_73101 = loopres_72998;
            
            loop_while_72984 = loop_while_tmp_73099;
            low_72985 = low_tmp_73100;
            high_72986 = high_tmp_73101;
        }
        init_idx_72796 = loop_while_72984;
        init_idx_72797 = low_72985;
        init_idx_72798 = high_72986;
        
        bool idx_72817;
        int64_t idx_72818;
        int64_t idx_72819;
        int64_t idx_72820;
        bool loop_while_73002;
        int64_t l_idx_73003;
        int64_t r_idx_73004;
        int64_t span_73005;
        
        loop_while_73002 = loop_cond_65369;
        l_idx_73003 = init_idx_72797;
        r_idx_73004 = init_idx_72797;
        span_73005 = (int64_t) 1;
        while (loop_while_73002) {
            int64_t max_arg_73006 = sub64(l_idx_73003, (int64_t) 1);
            int64_t max_res_73007 = smax64((int64_t) 0, max_arg_73006);
            int64_t min_arg_73008 = add64((int64_t) 1, r_idx_73004);
            int64_t min_res_73009 = smin64(min_arg_67398, min_arg_73008);
            bool x_73010 = sle64((int64_t) 0, max_res_73007);
            bool y_73011 = slt64(max_res_73007, n_65344);
            bool bounds_check_73012 = x_73010 && y_73011;
            bool index_certs_73013;
            
            if (!bounds_check_73012) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_73007,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_73014;
            
            x_73014 = ((int64_t *) mem_70697.mem)[max_res_73007];
            
            int64_t abs_arg_73015 = sub64(x_73014, defunc_0_g_res_72795);
            int64_t abs_res_73016 = abs64(abs_arg_73015);
            bool x_73017 = sle64((int64_t) 0, min_res_73009);
            bool y_73018 = slt64(min_res_73009, n_65344);
            bool bounds_check_73019 = x_73017 && y_73018;
            bool index_certs_73020;
            
            if (!bounds_check_73019) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_73009,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_73021;
            
            x_73021 = ((int64_t *) mem_70697.mem)[min_res_73009];
            
            int64_t abs_arg_73022 = sub64(x_73021, defunc_0_g_res_72795);
            int64_t abs_res_73023 = abs64(abs_arg_73022);
            bool cond_73024 = max_res_73007 == l_idx_73003;
            int64_t loopres_73025;
            int64_t loopres_73026;
            int64_t loopres_73027;
            
            if (cond_73024) {
                loopres_73025 = l_idx_73003;
                loopres_73026 = r_idx_73004;
                loopres_73027 = min_res_65364;
            } else {
                bool cond_73028 = slt64(abs_res_73016, abs_res_73023);
                bool cond_f_res_73029 = min_res_73009 == r_idx_73004;
                bool x_73030 = !cond_73028;
                bool y_73031 = cond_f_res_73029 && x_73030;
                bool cond_73032 = cond_73028 || y_73031;
                int64_t loopres_f_res_73033;
                
                if (cond_73032) {
                    loopres_f_res_73033 = max_res_73007;
                } else {
                    loopres_f_res_73033 = l_idx_73003;
                }
                
                int64_t loopres_f_res_73034;
                
                if (cond_73032) {
                    loopres_f_res_73034 = r_idx_73004;
                } else {
                    loopres_f_res_73034 = min_res_73009;
                }
                
                int64_t loopres_f_res_73035;
                
                if (cond_73032) {
                    int64_t loopres_f_res_t_res_73036 = add64((int64_t) 1,
                                                              span_73005);
                    
                    loopres_f_res_73035 = loopres_f_res_t_res_73036;
                } else {
                    int64_t loopres_f_res_f_res_73037 = add64((int64_t) 1,
                                                              span_73005);
                    
                    loopres_f_res_73035 = loopres_f_res_f_res_73037;
                }
                loopres_73025 = loopres_f_res_73033;
                loopres_73026 = loopres_f_res_73034;
                loopres_73027 = loopres_f_res_73035;
            }
            
            bool loop_cond_73038 = slt64(loopres_73027, min_res_65364);
            bool loop_while_tmp_73102 = loop_cond_73038;
            int64_t l_idx_tmp_73103 = loopres_73025;
            int64_t r_idx_tmp_73104 = loopres_73026;
            int64_t span_tmp_73105 = loopres_73027;
            
            loop_while_73002 = loop_while_tmp_73102;
            l_idx_73003 = l_idx_tmp_73103;
            r_idx_73004 = r_idx_tmp_73104;
            span_73005 = span_tmp_73105;
        }
        idx_72817 = loop_while_73002;
        idx_72818 = l_idx_73003;
        idx_72819 = r_idx_73004;
        idx_72820 = span_73005;
        
        int64_t min_res_72858 = smin64(min_arg_67399, idx_72818);
        int64_t max_res_72859 = smax64((int64_t) 0, min_res_72858);
        int64_t x_72860 = add64(min_res_67400, max_res_72859);
        int64_t r_72861 = sub64(x_72860, (int64_t) 1);
        bool x_72862 = sle64((int64_t) 0, r_72861);
        bool y_72863 = slt64(r_72861, n_65344);
        bool bounds_check_72864 = x_72862 && y_72863;
        bool index_certs_72865;
        
        if (!bounds_check_72864) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_72861,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_72866;
        
        x_72866 = ((int64_t *) mem_70694.mem)[r_72861];
        
        int64_t abs_arg_72867 = sub64(x_72866, min_res_72794);
        int64_t abs_res_72868 = abs64(abs_arg_72867);
        bool x_72869 = sle64((int64_t) 0, max_res_72859);
        bool y_72870 = slt64(max_res_72859, n_65344);
        bool bounds_check_72871 = x_72869 && y_72870;
        bool index_certs_72872;
        
        if (!bounds_check_72871) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_72859,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_72873;
        
        x_72873 = ((int64_t *) mem_70694.mem)[max_res_72859];
        
        int64_t abs_arg_72874 = sub64(x_72873, min_res_72794);
        int64_t abs_res_72875 = abs64(abs_arg_72874);
        int64_t max_res_72876 = smax64(abs_res_72868, abs_res_72875);
        float defunc_0_f_res_72877 = sitofp_i64_f32(max_res_72876);
        float defunc_1_f_res_72878 = max_res_67404 + defunc_0_f_res_72877;
        float defunc_2_reduce_res_72879;
        float defunc_2_reduce_res_72880;
        float defunc_2_reduce_res_72881;
        float redout_73040;
        float redout_73041;
        float redout_73042;
        
        redout_73040 = 0.0F;
        redout_73041 = 0.0F;
        redout_73042 = 0.0F;
        for (int64_t i_73039 = 0; i_73039 < q_65346; i_73039++) {
            float x_73043;
            
            x_73043 = ((float *) mem_70700.mem)[i_73039];
            
            bool cond_73044 = sle64(last_res_67379, i_73039);
            int64_t defunc_0_f_res_73045;
            
            if (cond_73044) {
                defunc_0_f_res_73045 = (int64_t) 0;
            } else {
                int64_t i_73046 = add64(max_res_72859, i_73039);
                int64_t defunc_0_add_arg_73047;
                
                defunc_0_add_arg_73047 = ((int64_t *) mem_70694.mem)[i_73046];
                
                int64_t defunc_1_add_res_73048 = add64((int64_t) 1,
                                                       defunc_0_add_arg_73047);
                
                defunc_0_f_res_73045 = defunc_1_add_res_73048;
            }
            
            int64_t binop_p_73049 = sub64(defunc_0_f_res_73045, min_res_72794);
            float defunc_0_f_res_73050 = sitofp_i64_f32(binop_p_73049);
            float abs_res_73051 = (float) fabs(defunc_0_f_res_73050);
            float tmp1_73052 = abs_res_73051 / defunc_1_f_res_72878;
            float x_73053 = tmp1_73052 * tmp1_73052;
            float y_73054 = tmp1_73052 * x_73053;
            float tmp2_73055 = 1.0F - y_73054;
            float x_73056 = tmp2_73055 * tmp2_73055;
            float tmp3_73057 = tmp2_73055 * x_73056;
            float w_j_73058 = x_73043 * tmp3_73057;
            float xw_j_73059 = defunc_0_f_res_73050 * w_j_73058;
            float x2w_j_73060 = defunc_0_f_res_73050 * xw_j_73059;
            float defunc_1_op_res_73061 = w_j_73058 + redout_73040;
            float defunc_1_op_res_73062 = xw_j_73059 + redout_73041;
            float defunc_1_op_res_73063 = x2w_j_73060 + redout_73042;
            float redout_tmp_73106 = defunc_1_op_res_73061;
            float redout_tmp_73107 = defunc_1_op_res_73062;
            float redout_tmp_73108 = defunc_1_op_res_73063;
            
            redout_73040 = redout_tmp_73106;
            redout_73041 = redout_tmp_73107;
            redout_73042 = redout_tmp_73108;
        }
        defunc_2_reduce_res_72879 = redout_73040;
        defunc_2_reduce_res_72880 = redout_73041;
        defunc_2_reduce_res_72881 = redout_73042;
        
        float x_72907 = defunc_2_reduce_res_72879 * defunc_2_reduce_res_72881;
        float y_72908 = defunc_2_reduce_res_72880 * defunc_2_reduce_res_72880;
        float y_72909 = x_72907 - y_72908;
        float det1_72910 = 1.0F / y_72909;
        float a11_72911 = defunc_2_reduce_res_72881 * det1_72910;
        float x_72912 = 0.0F - defunc_2_reduce_res_72880;
        float b11_72913 = det1_72910 * x_72912;
        float c11_72914 = defunc_2_reduce_res_72879 * det1_72910;
        float defunc_2_reduce_res_72915;
        float defunc_2_reduce_res_72916;
        float redout_73065;
        float redout_73066;
        
        redout_73065 = 0.0F;
        redout_73066 = 0.0F;
        for (int64_t i_73064 = 0; i_73064 < q_65346; i_73064++) {
            float x_73067;
            
            x_73067 = ((float *) mem_70700.mem)[i_73064];
            
            bool cond_73068 = sle64(last_res_67379, i_73064);
            int64_t defunc_0_f_res_73069;
            
            if (cond_73068) {
                defunc_0_f_res_73069 = (int64_t) 0;
            } else {
                int64_t i_73070 = add64(max_res_72859, i_73064);
                int64_t defunc_0_add_arg_73071;
                
                defunc_0_add_arg_73071 = ((int64_t *) mem_70694.mem)[i_73070];
                
                int64_t defunc_1_add_res_73072 = add64((int64_t) 1,
                                                       defunc_0_add_arg_73071);
                
                defunc_0_f_res_73069 = defunc_1_add_res_73072;
            }
            
            int64_t binop_p_73073 = sub64(defunc_0_f_res_73069, min_res_72794);
            float defunc_0_f_res_73074 = sitofp_i64_f32(binop_p_73073);
            float abs_res_73075 = (float) fabs(defunc_0_f_res_73074);
            float tmp1_73076 = abs_res_73075 / defunc_1_f_res_72878;
            float x_73077 = tmp1_73076 * tmp1_73076;
            float y_73078 = tmp1_73076 * x_73077;
            float tmp2_73079 = 1.0F - y_73078;
            float x_73080 = tmp2_73079 * tmp2_73079;
            float tmp3_73081 = tmp2_73079 * x_73080;
            float tmp4_73082 = x_73067 * tmp3_73081;
            float defunc_1_f_res_73083 = defunc_0_f_res_73074 * tmp4_73082;
            float defunc_0_f_res_73084;
            
            if (cond_73068) {
                defunc_0_f_res_73084 = 0.0F;
            } else {
                int64_t i_73085 = add64(max_res_72859, i_73064);
                float defunc_0_add_arg_73086;
                
                defunc_0_add_arg_73086 = ((float *) mem_70691.mem)[i_73085];
                defunc_0_f_res_73084 = defunc_0_add_arg_73086;
            }
            
            float x_73087 = a11_72911 * tmp4_73082;
            float y_73088 = b11_72913 * defunc_1_f_res_73083;
            float x_73089 = x_73087 + y_73088;
            float defunc_9_fit_fun_res_73090 = defunc_0_f_res_73084 * x_73089;
            float x_73091 = b11_72913 * tmp4_73082;
            float y_73092 = c11_72914 * defunc_1_f_res_73083;
            float x_73093 = x_73091 + y_73092;
            float defunc_9_slope_fun_res_73094 = defunc_0_f_res_73084 * x_73093;
            float defunc_1_op_res_73095 = defunc_9_fit_fun_res_73090 +
                  redout_73065;
            float defunc_1_op_res_73096 = defunc_9_slope_fun_res_73094 +
                  redout_73066;
            float redout_tmp_73109 = defunc_1_op_res_73095;
            float redout_tmp_73110 = defunc_1_op_res_73096;
            
            redout_73065 = redout_tmp_73109;
            redout_73066 = redout_tmp_73110;
        }
        defunc_2_reduce_res_72915 = redout_73065;
        defunc_2_reduce_res_72916 = redout_73066;
        ((float *) mem_70703.mem)[gtid_72792] = defunc_2_reduce_res_72915;
        ((float *) mem_70706.mem)[gtid_72792] = defunc_2_reduce_res_72916;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77121_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77121_end -
                 futhark_mc_segmap_parloop_77121_start;
        
        ctx->futhark_mc_segmap_parloop_77121_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77121_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77121_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77119(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72791 = tid;
    int num_tasks_72982 = info.nsubtasks;
    struct futhark_mc_task_77118 *futhark_mc_task_77118 =
                                 (struct futhark_mc_task_77118 *) args;
    struct futhark_context *ctx = futhark_mc_task_77118->ctx;
    uint64_t futhark_mc_segmap_task_77119_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77119_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77118->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77118->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77118->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77118->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77118->free_i_65358;
    bool x_65359 = futhark_mc_task_77118->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77118->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77118->free_loop_cond_65369;
    int64_t last_res_67379 = futhark_mc_task_77118->free_last_res_67379;
    int64_t min_arg_67398 = futhark_mc_task_77118->free_min_arg_67398;
    int64_t min_arg_67399 = futhark_mc_task_77118->free_min_arg_67399;
    int64_t min_res_67400 = futhark_mc_task_77118->free_min_res_67400;
    float max_res_67404 = futhark_mc_task_77118->free_max_res_67404;
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_task_77118->free_mem_70691, .size =
                                 0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_task_77118->free_mem_70694, .size =
                                 0, .references =NULL};
    struct memblock mem_70697 = {.desc ="mem_70697", .mem =
                                 futhark_mc_task_77118->free_mem_70697, .size =
                                 0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_task_77118->free_mem_70700, .size =
                                 0, .references =NULL};
    struct memblock mem_70703 = {.desc ="mem_70703", .mem =
                                 futhark_mc_task_77118->free_mem_70703, .size =
                                 0, .references =NULL};
    struct memblock mem_70706 = {.desc ="mem_70706", .mem =
                                 futhark_mc_task_77118->free_mem_70706, .size =
                                 0, .references =NULL};
    int64_t iter_72983;
    struct futhark_mc_segmap_parloop_struct_77120
    futhark_mc_segmap_parloop_struct_77120;
    
    futhark_mc_segmap_parloop_struct_77120.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77120.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77120.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77120.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77120.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77120.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77120.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77120.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77120.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77120.free_last_res_67379 = last_res_67379;
    futhark_mc_segmap_parloop_struct_77120.free_min_arg_67398 = min_arg_67398;
    futhark_mc_segmap_parloop_struct_77120.free_min_arg_67399 = min_arg_67399;
    futhark_mc_segmap_parloop_struct_77120.free_min_res_67400 = min_res_67400;
    futhark_mc_segmap_parloop_struct_77120.free_max_res_67404 = max_res_67404;
    futhark_mc_segmap_parloop_struct_77120.free_mem_70691 = mem_70691.mem;
    futhark_mc_segmap_parloop_struct_77120.free_mem_70694 = mem_70694.mem;
    futhark_mc_segmap_parloop_struct_77120.free_mem_70697 = mem_70697.mem;
    futhark_mc_segmap_parloop_struct_77120.free_mem_70700 = mem_70700.mem;
    futhark_mc_segmap_parloop_struct_77120.free_mem_70703 = mem_70703.mem;
    futhark_mc_segmap_parloop_struct_77120.free_mem_70706 = mem_70706.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77121_task;
    
    futhark_mc_segmap_parloop_77121_task.name =
        "futhark_mc_segmap_parloop_77121";
    futhark_mc_segmap_parloop_77121_task.fn = futhark_mc_segmap_parloop_77121;
    futhark_mc_segmap_parloop_77121_task.args =
        &futhark_mc_segmap_parloop_struct_77120;
    futhark_mc_segmap_parloop_77121_task.iterations = iterations;
    futhark_mc_segmap_parloop_77121_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77121_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77121_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77121_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77121_task);
    
    if (futhark_mc_segmap_parloop_77121_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77121_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77121_total_end -
                 futhark_mc_segmap_parloop_77121_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77121_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77121_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77121_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77119_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77119_end -
                 futhark_mc_segmap_task_77119_start;
        
        ctx->futhark_mc_segmap_task_77119_runs[tid]++;
        ctx->futhark_mc_segmap_task_77119_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77119_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77123 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_67379;
    int64_t free_min_arg_67398;
    int64_t free_min_arg_67399;
    int64_t free_min_res_67400;
    float free_max_res_67404;
    unsigned char *free_mem_70691;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70697;
    unsigned char *free_mem_70700;
    unsigned char *free_mem_70703;
    unsigned char *free_mem_70706;
};
struct futhark_mc_task_77125 {
    struct futhark_context *ctx;
    int64_t free_last_res_67379;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70700;
    int64_t free_min_res_72628;
    int64_t free_max_res_72693;
    float free_defunc_1_f_res_72712;
    float *retval_defunc_2_reduce_res_72713;
    float *retval_defunc_2_reduce_res_72714;
    float *retval_defunc_2_reduce_res_72715;
};
struct futhark_mc_segred_stage_1_parloop_struct_77130 {
    struct futhark_context *ctx;
    int64_t free_last_res_67379;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70700;
    int64_t free_min_res_72628;
    int64_t free_max_res_72693;
    float free_defunc_1_f_res_72712;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_73242;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_73244;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_73246;
};
static int futhark_mc_segred_stage_1_parloop_77131(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_73167, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77130
    *futhark_mc_segred_stage_1_parloop_struct_77130 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77130 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77130->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77131_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77131_start = get_wall_time();
    
    int64_t last_res_67379 =
            futhark_mc_segred_stage_1_parloop_struct_77130->free_last_res_67379;
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77130->free_mem_70694,
                                 .size =0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77130->free_mem_70700,
                                 .size =0, .references =NULL};
    int64_t min_res_72628 =
            futhark_mc_segred_stage_1_parloop_struct_77130->free_min_res_72628;
    int64_t max_res_72693 =
            futhark_mc_segred_stage_1_parloop_struct_77130->free_max_res_72693;
    float defunc_1_f_res_72712 =
          futhark_mc_segred_stage_1_parloop_struct_77130->free_defunc_1_f_res_72712;
    struct memblock reduce_stage_1_tid_res_arr_mem_73242 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_73242",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77130->free_reduce_stage_1_tid_res_arr_mem_73242,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_73244 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_73244",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77130->free_reduce_stage_1_tid_res_arr_mem_73244,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_73246 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_73246",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77130->free_reduce_stage_1_tid_res_arr_mem_73246,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73248 = start;
    float x_73169;
    float x_73170;
    float x_73172;
    float x_73173;
    float x_73175;
    float x_73176;
    float local_acc_73249 = 0.0F;
    float local_acc_73250 = 0.0F;
    float local_acc_73251 = 0.0F;
    
    for (; iter_73248 < end; iter_73248++) {
        int64_t gtid_73168 = iter_73248;
        float x_73178;
        
        x_73178 = ((float *) mem_70700.mem)[gtid_73168];
        
        bool cond_73179 = sle64(last_res_67379, gtid_73168);
        int64_t defunc_0_f_res_73180;
        
        if (cond_73179) {
            defunc_0_f_res_73180 = (int64_t) 0;
        } else {
            int64_t i_73181 = add64(max_res_72693, gtid_73168);
            int64_t defunc_0_add_arg_73182;
            
            defunc_0_add_arg_73182 = ((int64_t *) mem_70694.mem)[i_73181];
            
            int64_t defunc_1_add_res_73183 = add64((int64_t) 1,
                                                   defunc_0_add_arg_73182);
            
            defunc_0_f_res_73180 = defunc_1_add_res_73183;
        }
        
        int64_t binop_p_73184 = sub64(defunc_0_f_res_73180, min_res_72628);
        float defunc_0_f_res_73185 = sitofp_i64_f32(binop_p_73184);
        float abs_res_73186 = (float) fabs(defunc_0_f_res_73185);
        float tmp1_73187 = abs_res_73186 / defunc_1_f_res_72712;
        float x_73188 = tmp1_73187 * tmp1_73187;
        float y_73189 = tmp1_73187 * x_73188;
        float tmp2_73190 = 1.0F - y_73189;
        float x_73191 = tmp2_73190 * tmp2_73190;
        float tmp3_73192 = tmp2_73190 * x_73191;
        float w_j_73193 = x_73178 * tmp3_73192;
        float xw_j_73194 = defunc_0_f_res_73185 * w_j_73193;
        float x2w_j_73195 = defunc_0_f_res_73185 * xw_j_73194;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_73169 = local_acc_73249;
        }
        // Load next params
        {
            x_73170 = w_j_73193;
        }
        // Red body
        {
            float defunc_1_op_res_73171 = x_73169 + x_73170;
            
            local_acc_73249 = defunc_1_op_res_73171;
        }
        // Load accum params
        {
            x_73172 = local_acc_73250;
        }
        // Load next params
        {
            x_73173 = xw_j_73194;
        }
        // Red body
        {
            float defunc_1_op_res_73174 = x_73172 + x_73173;
            
            local_acc_73250 = defunc_1_op_res_73174;
        }
        // Load accum params
        {
            x_73175 = local_acc_73251;
        }
        // Load next params
        {
            x_73176 = x2w_j_73195;
        }
        // Red body
        {
            float defunc_1_op_res_73177 = x_73175 + x_73176;
            
            local_acc_73251 = defunc_1_op_res_73177;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_73242.mem)[flat_tid_73167] =
        local_acc_73249;
    ((float *) reduce_stage_1_tid_res_arr_mem_73244.mem)[flat_tid_73167] =
        local_acc_73250;
    ((float *) reduce_stage_1_tid_res_arr_mem_73246.mem)[flat_tid_73167] =
        local_acc_73251;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77131_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77131_end -
                 futhark_mc_segred_stage_1_parloop_77131_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77131_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77131_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77131_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77126(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73167 = tid;
    int num_tasks_73241 = info.nsubtasks;
    struct futhark_mc_task_77125 *futhark_mc_task_77125 =
                                 (struct futhark_mc_task_77125 *) args;
    struct futhark_context *ctx = futhark_mc_task_77125->ctx;
    uint64_t futhark_mc_segred_task_77126_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77126_start = get_wall_time();
    
    int64_t last_res_67379 = futhark_mc_task_77125->free_last_res_67379;
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_task_77125->free_mem_70694, .size =
                                 0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_task_77125->free_mem_70700, .size =
                                 0, .references =NULL};
    int64_t min_res_72628 = futhark_mc_task_77125->free_min_res_72628;
    int64_t max_res_72693 = futhark_mc_task_77125->free_max_res_72693;
    float defunc_1_f_res_72712 =
          futhark_mc_task_77125->free_defunc_1_f_res_72712;
    float defunc_2_reduce_res_72713 =
          *futhark_mc_task_77125->retval_defunc_2_reduce_res_72713;
    float defunc_2_reduce_res_72714 =
          *futhark_mc_task_77125->retval_defunc_2_reduce_res_72714;
    float defunc_2_reduce_res_72715 =
          *futhark_mc_task_77125->retval_defunc_2_reduce_res_72715;
    size_t reduce_stage_1_tid_res_arr_mem_73242_cached_sizze_77127 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_73242 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_73244_cached_sizze_77128 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_73244 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_73246_cached_sizze_77129 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_73246 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_73242_cached_sizze_77127 <
        (size_t) ((int64_t) 4 * num_tasks_73241)) {
        reduce_stage_1_tid_res_arr_mem_73242 =
            realloc(reduce_stage_1_tid_res_arr_mem_73242, (int64_t) 4 *
                    num_tasks_73241);
        reduce_stage_1_tid_res_arr_mem_73242_cached_sizze_77127 = (int64_t) 4 *
            num_tasks_73241;
    }
    if (reduce_stage_1_tid_res_arr_mem_73244_cached_sizze_77128 <
        (size_t) ((int64_t) 4 * num_tasks_73241)) {
        reduce_stage_1_tid_res_arr_mem_73244 =
            realloc(reduce_stage_1_tid_res_arr_mem_73244, (int64_t) 4 *
                    num_tasks_73241);
        reduce_stage_1_tid_res_arr_mem_73244_cached_sizze_77128 = (int64_t) 4 *
            num_tasks_73241;
    }
    if (reduce_stage_1_tid_res_arr_mem_73246_cached_sizze_77129 <
        (size_t) ((int64_t) 4 * num_tasks_73241)) {
        reduce_stage_1_tid_res_arr_mem_73246 =
            realloc(reduce_stage_1_tid_res_arr_mem_73246, (int64_t) 4 *
                    num_tasks_73241);
        reduce_stage_1_tid_res_arr_mem_73246_cached_sizze_77129 = (int64_t) 4 *
            num_tasks_73241;
    }
    
    int64_t iter_73248;
    struct futhark_mc_segred_stage_1_parloop_struct_77130
    futhark_mc_segred_stage_1_parloop_struct_77130;
    
    futhark_mc_segred_stage_1_parloop_struct_77130.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_last_res_67379 =
        last_res_67379;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_mem_70694 =
        mem_70694.mem;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_mem_70700 =
        mem_70700.mem;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_min_res_72628 =
        min_res_72628;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_max_res_72693 =
        max_res_72693;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_defunc_1_f_res_72712 =
        defunc_1_f_res_72712;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_reduce_stage_1_tid_res_arr_mem_73242 =
        reduce_stage_1_tid_res_arr_mem_73242;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_reduce_stage_1_tid_res_arr_mem_73244 =
        reduce_stage_1_tid_res_arr_mem_73244;
    futhark_mc_segred_stage_1_parloop_struct_77130.free_reduce_stage_1_tid_res_arr_mem_73246 =
        reduce_stage_1_tid_res_arr_mem_73246;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77131_task;
    
    futhark_mc_segred_stage_1_parloop_77131_task.name =
        "futhark_mc_segred_stage_1_parloop_77131";
    futhark_mc_segred_stage_1_parloop_77131_task.fn =
        futhark_mc_segred_stage_1_parloop_77131;
    futhark_mc_segred_stage_1_parloop_77131_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77130;
    futhark_mc_segred_stage_1_parloop_77131_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77131_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77131_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77131_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77131_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77131_task);
    
    if (futhark_mc_segred_stage_1_parloop_77131_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77131_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77131_total_end -
                 futhark_mc_segred_stage_1_parloop_77131_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77131_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77131_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77131_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_72713 = 0.0F;
        defunc_2_reduce_res_72714 = 0.0F;
        defunc_2_reduce_res_72715 = 0.0F;
    }
    
    float x_73252;
    float x_73253;
    float x_73255;
    float x_73256;
    float x_73258;
    float x_73259;
    
    for (int32_t i_73261 = 0; i_73261 < num_tasks_73241; i_73261++) {
        flat_tid_73167 = i_73261;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_73252 = defunc_2_reduce_res_72713;
            }
            // load next params
            {
                x_73253 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_73242)[flat_tid_73167];
            }
            // red body
            {
                float defunc_1_op_res_73254 = x_73252 + x_73253;
                
                defunc_2_reduce_res_72713 = defunc_1_op_res_73254;
            }
            // load acc params
            {
                x_73255 = defunc_2_reduce_res_72714;
            }
            // load next params
            {
                x_73256 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_73244)[flat_tid_73167];
            }
            // red body
            {
                float defunc_1_op_res_73257 = x_73255 + x_73256;
                
                defunc_2_reduce_res_72714 = defunc_1_op_res_73257;
            }
            // load acc params
            {
                x_73258 = defunc_2_reduce_res_72715;
            }
            // load next params
            {
                x_73259 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_73246)[flat_tid_73167];
            }
            // red body
            {
                float defunc_1_op_res_73260 = x_73258 + x_73259;
                
                defunc_2_reduce_res_72715 = defunc_1_op_res_73260;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_73242);
        free(reduce_stage_1_tid_res_arr_mem_73244);
        free(reduce_stage_1_tid_res_arr_mem_73246);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77126_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77126_end -
                 futhark_mc_segred_task_77126_start;
        
        ctx->futhark_mc_segred_task_77126_runs[tid]++;
        ctx->futhark_mc_segred_task_77126_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77126_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77125->retval_defunc_2_reduce_res_72713 =
            defunc_2_reduce_res_72713;
        *futhark_mc_task_77125->retval_defunc_2_reduce_res_72714 =
            defunc_2_reduce_res_72714;
        *futhark_mc_task_77125->retval_defunc_2_reduce_res_72715 =
            defunc_2_reduce_res_72715;
    }
    return err;
}
struct futhark_mc_task_77132 {
    struct futhark_context *ctx;
    int64_t free_last_res_67379;
    unsigned char *free_mem_70691;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70700;
    int64_t free_min_res_72628;
    int64_t free_max_res_72693;
    float free_defunc_1_f_res_72712;
    float free_a11_72749;
    float free_b11_72751;
    float free_c11_72752;
    float *retval_defunc_2_reduce_res_72753;
    float *retval_defunc_2_reduce_res_72754;
};
struct futhark_mc_segred_stage_1_parloop_struct_77136 {
    struct futhark_context *ctx;
    int64_t free_last_res_67379;
    unsigned char *free_mem_70691;
    unsigned char *free_mem_70694;
    unsigned char *free_mem_70700;
    int64_t free_min_res_72628;
    int64_t free_max_res_72693;
    float free_defunc_1_f_res_72712;
    float free_a11_72749;
    float free_b11_72751;
    float free_c11_72752;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_73263;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_73265;
};
static int futhark_mc_segred_stage_1_parloop_77137(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_73196, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77136
    *futhark_mc_segred_stage_1_parloop_struct_77136 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77136 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77136->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77137_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77137_start = get_wall_time();
    
    int64_t last_res_67379 =
            futhark_mc_segred_stage_1_parloop_struct_77136->free_last_res_67379;
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77136->free_mem_70691,
                                 .size =0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77136->free_mem_70694,
                                 .size =0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77136->free_mem_70700,
                                 .size =0, .references =NULL};
    int64_t min_res_72628 =
            futhark_mc_segred_stage_1_parloop_struct_77136->free_min_res_72628;
    int64_t max_res_72693 =
            futhark_mc_segred_stage_1_parloop_struct_77136->free_max_res_72693;
    float defunc_1_f_res_72712 =
          futhark_mc_segred_stage_1_parloop_struct_77136->free_defunc_1_f_res_72712;
    float a11_72749 =
          futhark_mc_segred_stage_1_parloop_struct_77136->free_a11_72749;
    float b11_72751 =
          futhark_mc_segred_stage_1_parloop_struct_77136->free_b11_72751;
    float c11_72752 =
          futhark_mc_segred_stage_1_parloop_struct_77136->free_c11_72752;
    struct memblock reduce_stage_1_tid_res_arr_mem_73263 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_73263",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77136->free_reduce_stage_1_tid_res_arr_mem_73263,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_73265 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_73265",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77136->free_reduce_stage_1_tid_res_arr_mem_73265,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73267 = start;
    float x_73198;
    float x_73199;
    float x_73201;
    float x_73202;
    float local_acc_73268 = 0.0F;
    float local_acc_73269 = 0.0F;
    
    for (; iter_73267 < end; iter_73267++) {
        int64_t gtid_73197 = iter_73267;
        float x_73204;
        
        x_73204 = ((float *) mem_70700.mem)[gtid_73197];
        
        bool cond_73205 = sle64(last_res_67379, gtid_73197);
        int64_t defunc_0_f_res_73206;
        
        if (cond_73205) {
            defunc_0_f_res_73206 = (int64_t) 0;
        } else {
            int64_t i_73207 = add64(max_res_72693, gtid_73197);
            int64_t defunc_0_add_arg_73208;
            
            defunc_0_add_arg_73208 = ((int64_t *) mem_70694.mem)[i_73207];
            
            int64_t defunc_1_add_res_73209 = add64((int64_t) 1,
                                                   defunc_0_add_arg_73208);
            
            defunc_0_f_res_73206 = defunc_1_add_res_73209;
        }
        
        int64_t binop_p_73210 = sub64(defunc_0_f_res_73206, min_res_72628);
        float defunc_0_f_res_73211 = sitofp_i64_f32(binop_p_73210);
        float abs_res_73212 = (float) fabs(defunc_0_f_res_73211);
        float tmp1_73213 = abs_res_73212 / defunc_1_f_res_72712;
        float x_73214 = tmp1_73213 * tmp1_73213;
        float y_73215 = tmp1_73213 * x_73214;
        float tmp2_73216 = 1.0F - y_73215;
        float x_73217 = tmp2_73216 * tmp2_73216;
        float tmp3_73218 = tmp2_73216 * x_73217;
        float tmp4_73219 = x_73204 * tmp3_73218;
        float defunc_1_f_res_73220 = defunc_0_f_res_73211 * tmp4_73219;
        float defunc_0_f_res_73221;
        
        if (cond_73205) {
            defunc_0_f_res_73221 = 0.0F;
        } else {
            int64_t i_73222 = add64(max_res_72693, gtid_73197);
            float defunc_0_add_arg_73223;
            
            defunc_0_add_arg_73223 = ((float *) mem_70691.mem)[i_73222];
            defunc_0_f_res_73221 = defunc_0_add_arg_73223;
        }
        
        float x_73224 = a11_72749 * tmp4_73219;
        float y_73225 = b11_72751 * defunc_1_f_res_73220;
        float x_73226 = x_73224 + y_73225;
        float defunc_9_fit_fun_res_73227 = defunc_0_f_res_73221 * x_73226;
        float x_73228 = b11_72751 * tmp4_73219;
        float y_73229 = c11_72752 * defunc_1_f_res_73220;
        float x_73230 = x_73228 + y_73229;
        float defunc_9_slope_fun_res_73231 = defunc_0_f_res_73221 * x_73230;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_73198 = local_acc_73268;
        }
        // Load next params
        {
            x_73199 = defunc_9_fit_fun_res_73227;
        }
        // Red body
        {
            float defunc_1_op_res_73200 = x_73198 + x_73199;
            
            local_acc_73268 = defunc_1_op_res_73200;
        }
        // Load accum params
        {
            x_73201 = local_acc_73269;
        }
        // Load next params
        {
            x_73202 = defunc_9_slope_fun_res_73231;
        }
        // Red body
        {
            float defunc_1_op_res_73203 = x_73201 + x_73202;
            
            local_acc_73269 = defunc_1_op_res_73203;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_73263.mem)[flat_tid_73196] =
        local_acc_73268;
    ((float *) reduce_stage_1_tid_res_arr_mem_73265.mem)[flat_tid_73196] =
        local_acc_73269;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77137_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77137_end -
                 futhark_mc_segred_stage_1_parloop_77137_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77137_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77137_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77137_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77133(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73196 = tid;
    int num_tasks_73262 = info.nsubtasks;
    struct futhark_mc_task_77132 *futhark_mc_task_77132 =
                                 (struct futhark_mc_task_77132 *) args;
    struct futhark_context *ctx = futhark_mc_task_77132->ctx;
    uint64_t futhark_mc_segred_task_77133_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77133_start = get_wall_time();
    
    int64_t last_res_67379 = futhark_mc_task_77132->free_last_res_67379;
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_task_77132->free_mem_70691, .size =
                                 0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_task_77132->free_mem_70694, .size =
                                 0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_task_77132->free_mem_70700, .size =
                                 0, .references =NULL};
    int64_t min_res_72628 = futhark_mc_task_77132->free_min_res_72628;
    int64_t max_res_72693 = futhark_mc_task_77132->free_max_res_72693;
    float defunc_1_f_res_72712 =
          futhark_mc_task_77132->free_defunc_1_f_res_72712;
    float a11_72749 = futhark_mc_task_77132->free_a11_72749;
    float b11_72751 = futhark_mc_task_77132->free_b11_72751;
    float c11_72752 = futhark_mc_task_77132->free_c11_72752;
    float defunc_2_reduce_res_72753 =
          *futhark_mc_task_77132->retval_defunc_2_reduce_res_72753;
    float defunc_2_reduce_res_72754 =
          *futhark_mc_task_77132->retval_defunc_2_reduce_res_72754;
    size_t reduce_stage_1_tid_res_arr_mem_73263_cached_sizze_77134 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_73263 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_73265_cached_sizze_77135 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_73265 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_73263_cached_sizze_77134 <
        (size_t) ((int64_t) 4 * num_tasks_73262)) {
        reduce_stage_1_tid_res_arr_mem_73263 =
            realloc(reduce_stage_1_tid_res_arr_mem_73263, (int64_t) 4 *
                    num_tasks_73262);
        reduce_stage_1_tid_res_arr_mem_73263_cached_sizze_77134 = (int64_t) 4 *
            num_tasks_73262;
    }
    if (reduce_stage_1_tid_res_arr_mem_73265_cached_sizze_77135 <
        (size_t) ((int64_t) 4 * num_tasks_73262)) {
        reduce_stage_1_tid_res_arr_mem_73265 =
            realloc(reduce_stage_1_tid_res_arr_mem_73265, (int64_t) 4 *
                    num_tasks_73262);
        reduce_stage_1_tid_res_arr_mem_73265_cached_sizze_77135 = (int64_t) 4 *
            num_tasks_73262;
    }
    
    int64_t iter_73267;
    struct futhark_mc_segred_stage_1_parloop_struct_77136
    futhark_mc_segred_stage_1_parloop_struct_77136;
    
    futhark_mc_segred_stage_1_parloop_struct_77136.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_last_res_67379 =
        last_res_67379;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_mem_70691 =
        mem_70691.mem;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_mem_70694 =
        mem_70694.mem;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_mem_70700 =
        mem_70700.mem;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_min_res_72628 =
        min_res_72628;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_max_res_72693 =
        max_res_72693;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_defunc_1_f_res_72712 =
        defunc_1_f_res_72712;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_a11_72749 = a11_72749;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_b11_72751 = b11_72751;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_c11_72752 = c11_72752;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_reduce_stage_1_tid_res_arr_mem_73263 =
        reduce_stage_1_tid_res_arr_mem_73263;
    futhark_mc_segred_stage_1_parloop_struct_77136.free_reduce_stage_1_tid_res_arr_mem_73265 =
        reduce_stage_1_tid_res_arr_mem_73265;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77137_task;
    
    futhark_mc_segred_stage_1_parloop_77137_task.name =
        "futhark_mc_segred_stage_1_parloop_77137";
    futhark_mc_segred_stage_1_parloop_77137_task.fn =
        futhark_mc_segred_stage_1_parloop_77137;
    futhark_mc_segred_stage_1_parloop_77137_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77136;
    futhark_mc_segred_stage_1_parloop_77137_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77137_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77137_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77137_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77137_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77137_task);
    
    if (futhark_mc_segred_stage_1_parloop_77137_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77137_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77137_total_end -
                 futhark_mc_segred_stage_1_parloop_77137_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77137_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77137_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77137_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_72753 = 0.0F;
        defunc_2_reduce_res_72754 = 0.0F;
    }
    
    float x_73270;
    float x_73271;
    float x_73273;
    float x_73274;
    
    for (int32_t i_73276 = 0; i_73276 < num_tasks_73262; i_73276++) {
        flat_tid_73196 = i_73276;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_73270 = defunc_2_reduce_res_72753;
            }
            // load next params
            {
                x_73271 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_73263)[flat_tid_73196];
            }
            // red body
            {
                float defunc_1_op_res_73272 = x_73270 + x_73271;
                
                defunc_2_reduce_res_72753 = defunc_1_op_res_73272;
            }
            // load acc params
            {
                x_73273 = defunc_2_reduce_res_72754;
            }
            // load next params
            {
                x_73274 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_73265)[flat_tid_73196];
            }
            // red body
            {
                float defunc_1_op_res_73275 = x_73273 + x_73274;
                
                defunc_2_reduce_res_72754 = defunc_1_op_res_73275;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_73263);
        free(reduce_stage_1_tid_res_arr_mem_73265);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77133_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77133_end -
                 futhark_mc_segred_task_77133_start;
        
        ctx->futhark_mc_segred_task_77133_runs[tid]++;
        ctx->futhark_mc_segred_task_77133_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77133_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77132->retval_defunc_2_reduce_res_72753 =
            defunc_2_reduce_res_72753;
        *futhark_mc_task_77132->retval_defunc_2_reduce_res_72754 =
            defunc_2_reduce_res_72754;
    }
    return err;
}
static int futhark_mc_segmap_parloop_77124(void *args, int64_t start,
                                           int64_t end, int flat_tid_72625,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77123
    *futhark_mc_segmap_parloop_struct_77123 =
    (struct futhark_mc_segmap_parloop_struct_77123 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77123->ctx;
    uint64_t futhark_mc_segmap_parloop_77124_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77124_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77123->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77123->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77123->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77123->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77123->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77123->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77123->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77123->free_loop_cond_65369;
    int64_t last_res_67379 =
            futhark_mc_segmap_parloop_struct_77123->free_last_res_67379;
    int64_t min_arg_67398 =
            futhark_mc_segmap_parloop_struct_77123->free_min_arg_67398;
    int64_t min_arg_67399 =
            futhark_mc_segmap_parloop_struct_77123->free_min_arg_67399;
    int64_t min_res_67400 =
            futhark_mc_segmap_parloop_struct_77123->free_min_res_67400;
    float max_res_67404 =
          futhark_mc_segmap_parloop_struct_77123->free_max_res_67404;
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_segmap_parloop_struct_77123->free_mem_70691,
                                 .size =0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_segmap_parloop_struct_77123->free_mem_70694,
                                 .size =0, .references =NULL};
    struct memblock mem_70697 = {.desc ="mem_70697", .mem =
                                 futhark_mc_segmap_parloop_struct_77123->free_mem_70697,
                                 .size =0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_segmap_parloop_struct_77123->free_mem_70700,
                                 .size =0, .references =NULL};
    struct memblock mem_70703 = {.desc ="mem_70703", .mem =
                                 futhark_mc_segmap_parloop_struct_77123->free_mem_70703,
                                 .size =0, .references =NULL};
    struct memblock mem_70706 = {.desc ="mem_70706", .mem =
                                 futhark_mc_segmap_parloop_struct_77123->free_mem_70706,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73111 = start;
    
    for (; iter_73111 < end; iter_73111++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_73232 = n_m_65352;
        int64_t gtid_72626 = iter_73111;
        int64_t remnant_73233 = iter_73111 - gtid_72626;
        int64_t min_arg_72627 = mul64(jump_65348, gtid_72626);
        int64_t min_res_72628 = smin64(i_65358, min_arg_72627);
        int64_t defunc_0_g_res_72629 = add64((int64_t) 1, min_res_72628);
        bool init_idx_72630;
        int64_t init_idx_72631;
        int64_t init_idx_72632;
        bool loop_while_73112;
        int64_t low_73113;
        int64_t high_73114;
        
        loop_while_73112 = x_65359;
        low_73113 = (int64_t) 0;
        high_73114 = i_65358;
        while (loop_while_73112) {
            int64_t x_73115 = add64(low_73113, high_73114);
            int64_t mid_73116 = sdiv64(x_73115, (int64_t) 2);
            bool x_73117 = sle64((int64_t) 0, mid_73116);
            bool y_73118 = slt64(mid_73116, n_65344);
            bool bounds_check_73119 = x_73117 && y_73118;
            bool index_certs_73120;
            
            if (!bounds_check_73119) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_73116,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_73121;
            
            mid_id_73121 = ((int64_t *) mem_70697.mem)[mid_73116];
            
            bool cond_73122 = slt64(mid_id_73121, (int64_t) 0);
            int64_t mid_idx_73123;
            
            if (cond_73122) {
                mid_idx_73123 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_73123 = mid_id_73121;
            }
            
            bool cond_73124 = sle64(defunc_0_g_res_72629, mid_idx_73123);
            int64_t loopres_73125;
            int64_t loopres_73126;
            
            if (cond_73124) {
                int64_t loopres_t_res_73127 = sub64(mid_73116, (int64_t) 1);
                
                loopres_73125 = low_73113;
                loopres_73126 = loopres_t_res_73127;
            } else {
                int64_t loopres_f_res_73128 = add64((int64_t) 1, mid_73116);
                
                loopres_73125 = loopres_f_res_73128;
                loopres_73126 = high_73114;
            }
            
            bool loop_cond_73129 = sle64(loopres_73125, loopres_73126);
            bool loop_while_tmp_73234 = loop_cond_73129;
            int64_t low_tmp_73235 = loopres_73125;
            int64_t high_tmp_73236 = loopres_73126;
            
            loop_while_73112 = loop_while_tmp_73234;
            low_73113 = low_tmp_73235;
            high_73114 = high_tmp_73236;
        }
        init_idx_72630 = loop_while_73112;
        init_idx_72631 = low_73113;
        init_idx_72632 = high_73114;
        
        bool idx_72651;
        int64_t idx_72652;
        int64_t idx_72653;
        int64_t idx_72654;
        bool loop_while_73130;
        int64_t l_idx_73131;
        int64_t r_idx_73132;
        int64_t span_73133;
        
        loop_while_73130 = loop_cond_65369;
        l_idx_73131 = init_idx_72631;
        r_idx_73132 = init_idx_72631;
        span_73133 = (int64_t) 1;
        while (loop_while_73130) {
            int64_t max_arg_73134 = sub64(l_idx_73131, (int64_t) 1);
            int64_t max_res_73135 = smax64((int64_t) 0, max_arg_73134);
            int64_t min_arg_73136 = add64((int64_t) 1, r_idx_73132);
            int64_t min_res_73137 = smin64(min_arg_67398, min_arg_73136);
            bool x_73138 = sle64((int64_t) 0, max_res_73135);
            bool y_73139 = slt64(max_res_73135, n_65344);
            bool bounds_check_73140 = x_73138 && y_73139;
            bool index_certs_73141;
            
            if (!bounds_check_73140) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_73135,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_73142;
            
            x_73142 = ((int64_t *) mem_70697.mem)[max_res_73135];
            
            int64_t abs_arg_73143 = sub64(x_73142, defunc_0_g_res_72629);
            int64_t abs_res_73144 = abs64(abs_arg_73143);
            bool x_73145 = sle64((int64_t) 0, min_res_73137);
            bool y_73146 = slt64(min_res_73137, n_65344);
            bool bounds_check_73147 = x_73145 && y_73146;
            bool index_certs_73148;
            
            if (!bounds_check_73147) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_73137,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_73149;
            
            x_73149 = ((int64_t *) mem_70697.mem)[min_res_73137];
            
            int64_t abs_arg_73150 = sub64(x_73149, defunc_0_g_res_72629);
            int64_t abs_res_73151 = abs64(abs_arg_73150);
            bool cond_73152 = max_res_73135 == l_idx_73131;
            int64_t loopres_73153;
            int64_t loopres_73154;
            int64_t loopres_73155;
            
            if (cond_73152) {
                loopres_73153 = l_idx_73131;
                loopres_73154 = r_idx_73132;
                loopres_73155 = min_res_65364;
            } else {
                bool cond_73156 = slt64(abs_res_73144, abs_res_73151);
                bool cond_f_res_73157 = min_res_73137 == r_idx_73132;
                bool x_73158 = !cond_73156;
                bool y_73159 = cond_f_res_73157 && x_73158;
                bool cond_73160 = cond_73156 || y_73159;
                int64_t loopres_f_res_73161;
                
                if (cond_73160) {
                    loopres_f_res_73161 = max_res_73135;
                } else {
                    loopres_f_res_73161 = l_idx_73131;
                }
                
                int64_t loopres_f_res_73162;
                
                if (cond_73160) {
                    loopres_f_res_73162 = r_idx_73132;
                } else {
                    loopres_f_res_73162 = min_res_73137;
                }
                
                int64_t loopres_f_res_73163;
                
                if (cond_73160) {
                    int64_t loopres_f_res_t_res_73164 = add64((int64_t) 1,
                                                              span_73133);
                    
                    loopres_f_res_73163 = loopres_f_res_t_res_73164;
                } else {
                    int64_t loopres_f_res_f_res_73165 = add64((int64_t) 1,
                                                              span_73133);
                    
                    loopres_f_res_73163 = loopres_f_res_f_res_73165;
                }
                loopres_73153 = loopres_f_res_73161;
                loopres_73154 = loopres_f_res_73162;
                loopres_73155 = loopres_f_res_73163;
            }
            
            bool loop_cond_73166 = slt64(loopres_73155, min_res_65364);
            bool loop_while_tmp_73237 = loop_cond_73166;
            int64_t l_idx_tmp_73238 = loopres_73153;
            int64_t r_idx_tmp_73239 = loopres_73154;
            int64_t span_tmp_73240 = loopres_73155;
            
            loop_while_73130 = loop_while_tmp_73237;
            l_idx_73131 = l_idx_tmp_73238;
            r_idx_73132 = r_idx_tmp_73239;
            span_73133 = span_tmp_73240;
        }
        idx_72651 = loop_while_73130;
        idx_72652 = l_idx_73131;
        idx_72653 = r_idx_73132;
        idx_72654 = span_73133;
        
        int64_t min_res_72692 = smin64(min_arg_67399, idx_72652);
        int64_t max_res_72693 = smax64((int64_t) 0, min_res_72692);
        int64_t x_72694 = add64(min_res_67400, max_res_72693);
        int64_t r_72695 = sub64(x_72694, (int64_t) 1);
        bool x_72696 = sle64((int64_t) 0, r_72695);
        bool y_72697 = slt64(r_72695, n_65344);
        bool bounds_check_72698 = x_72696 && y_72697;
        bool index_certs_72699;
        
        if (!bounds_check_72698) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_72695,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_72700;
        
        x_72700 = ((int64_t *) mem_70694.mem)[r_72695];
        
        int64_t abs_arg_72701 = sub64(x_72700, min_res_72628);
        int64_t abs_res_72702 = abs64(abs_arg_72701);
        bool x_72703 = sle64((int64_t) 0, max_res_72693);
        bool y_72704 = slt64(max_res_72693, n_65344);
        bool bounds_check_72705 = x_72703 && y_72704;
        bool index_certs_72706;
        
        if (!bounds_check_72705) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_72693,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_72707;
        
        x_72707 = ((int64_t *) mem_70694.mem)[max_res_72693];
        
        int64_t abs_arg_72708 = sub64(x_72707, min_res_72628);
        int64_t abs_res_72709 = abs64(abs_arg_72708);
        int64_t max_res_72710 = smax64(abs_res_72702, abs_res_72709);
        float defunc_0_f_res_72711 = sitofp_i64_f32(max_res_72710);
        float defunc_1_f_res_72712 = max_res_67404 + defunc_0_f_res_72711;
        float defunc_2_reduce_res_72713;
        float defunc_2_reduce_res_72714;
        float defunc_2_reduce_res_72715;
        int64_t flat_tid_73167 = (int64_t) 0;
        int32_t num_tasks_73241;
        
        defunc_2_reduce_res_72713 = 0.0F;
        defunc_2_reduce_res_72714 = 0.0F;
        defunc_2_reduce_res_72715 = 0.0F;
        
        struct futhark_mc_task_77125 futhark_mc_task_77125;
        
        futhark_mc_task_77125.ctx = ctx;
        futhark_mc_task_77125.free_last_res_67379 = last_res_67379;
        futhark_mc_task_77125.free_mem_70694 = mem_70694.mem;
        futhark_mc_task_77125.free_mem_70700 = mem_70700.mem;
        futhark_mc_task_77125.free_min_res_72628 = min_res_72628;
        futhark_mc_task_77125.free_max_res_72693 = max_res_72693;
        futhark_mc_task_77125.free_defunc_1_f_res_72712 = defunc_1_f_res_72712;
        futhark_mc_task_77125.retval_defunc_2_reduce_res_72713 =
            &defunc_2_reduce_res_72713;
        futhark_mc_task_77125.retval_defunc_2_reduce_res_72714 =
            &defunc_2_reduce_res_72714;
        futhark_mc_task_77125.retval_defunc_2_reduce_res_72715 =
            &defunc_2_reduce_res_72715;
        
        struct scheduler_segop futhark_mc_task_77125_task;
        
        futhark_mc_task_77125_task.args = &futhark_mc_task_77125;
        futhark_mc_task_77125_task.top_level_fn = futhark_mc_segred_task_77126;
        futhark_mc_task_77125_task.name = "futhark_mc_segred_task_77126";
        futhark_mc_task_77125_task.iterations = q_65346;
        futhark_mc_task_77125_task.task_time =
            &ctx->futhark_mc_segred_task_77126_total_time;
        futhark_mc_task_77125_task.task_iter =
            &ctx->futhark_mc_segred_task_77126_total_iter;
        futhark_mc_task_77125_task.sched = STATIC;
        futhark_mc_task_77125_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77126_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77125_task);
        
        if (futhark_mc_segred_task_77126_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        float x_72745 = defunc_2_reduce_res_72713 * defunc_2_reduce_res_72715;
        float y_72746 = defunc_2_reduce_res_72714 * defunc_2_reduce_res_72714;
        float y_72747 = x_72745 - y_72746;
        float det1_72748 = 1.0F / y_72747;
        float a11_72749 = defunc_2_reduce_res_72715 * det1_72748;
        float x_72750 = 0.0F - defunc_2_reduce_res_72714;
        float b11_72751 = det1_72748 * x_72750;
        float c11_72752 = defunc_2_reduce_res_72713 * det1_72748;
        float defunc_2_reduce_res_72753;
        float defunc_2_reduce_res_72754;
        int64_t flat_tid_73196 = (int64_t) 0;
        int32_t num_tasks_73262;
        
        defunc_2_reduce_res_72753 = 0.0F;
        defunc_2_reduce_res_72754 = 0.0F;
        
        struct futhark_mc_task_77132 futhark_mc_task_77132;
        
        futhark_mc_task_77132.ctx = ctx;
        futhark_mc_task_77132.free_last_res_67379 = last_res_67379;
        futhark_mc_task_77132.free_mem_70691 = mem_70691.mem;
        futhark_mc_task_77132.free_mem_70694 = mem_70694.mem;
        futhark_mc_task_77132.free_mem_70700 = mem_70700.mem;
        futhark_mc_task_77132.free_min_res_72628 = min_res_72628;
        futhark_mc_task_77132.free_max_res_72693 = max_res_72693;
        futhark_mc_task_77132.free_defunc_1_f_res_72712 = defunc_1_f_res_72712;
        futhark_mc_task_77132.free_a11_72749 = a11_72749;
        futhark_mc_task_77132.free_b11_72751 = b11_72751;
        futhark_mc_task_77132.free_c11_72752 = c11_72752;
        futhark_mc_task_77132.retval_defunc_2_reduce_res_72753 =
            &defunc_2_reduce_res_72753;
        futhark_mc_task_77132.retval_defunc_2_reduce_res_72754 =
            &defunc_2_reduce_res_72754;
        
        struct scheduler_segop futhark_mc_task_77132_task;
        
        futhark_mc_task_77132_task.args = &futhark_mc_task_77132;
        futhark_mc_task_77132_task.top_level_fn = futhark_mc_segred_task_77133;
        futhark_mc_task_77132_task.name = "futhark_mc_segred_task_77133";
        futhark_mc_task_77132_task.iterations = q_65346;
        futhark_mc_task_77132_task.task_time =
            &ctx->futhark_mc_segred_task_77133_total_time;
        futhark_mc_task_77132_task.task_iter =
            &ctx->futhark_mc_segred_task_77133_total_iter;
        futhark_mc_task_77132_task.sched = STATIC;
        futhark_mc_task_77132_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77133_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77132_task);
        
        if (futhark_mc_segred_task_77133_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((float *) mem_70703.mem)[gtid_72626] = defunc_2_reduce_res_72753;
        ((float *) mem_70706.mem)[gtid_72626] = defunc_2_reduce_res_72754;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77124_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77124_end -
                 futhark_mc_segmap_parloop_77124_start;
        
        ctx->futhark_mc_segmap_parloop_77124_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77124_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77124_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77122(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_72625 = tid;
    int num_tasks_72982 = info.nsubtasks;
    struct futhark_mc_task_77118 *futhark_mc_task_77118 =
                                 (struct futhark_mc_task_77118 *) args;
    struct futhark_context *ctx = futhark_mc_task_77118->ctx;
    uint64_t futhark_mc_segmap_nested_task_77122_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77122_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77118->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77118->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77118->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77118->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77118->free_i_65358;
    bool x_65359 = futhark_mc_task_77118->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77118->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77118->free_loop_cond_65369;
    int64_t last_res_67379 = futhark_mc_task_77118->free_last_res_67379;
    int64_t min_arg_67398 = futhark_mc_task_77118->free_min_arg_67398;
    int64_t min_arg_67399 = futhark_mc_task_77118->free_min_arg_67399;
    int64_t min_res_67400 = futhark_mc_task_77118->free_min_res_67400;
    float max_res_67404 = futhark_mc_task_77118->free_max_res_67404;
    struct memblock mem_70691 = {.desc ="mem_70691", .mem =
                                 futhark_mc_task_77118->free_mem_70691, .size =
                                 0, .references =NULL};
    struct memblock mem_70694 = {.desc ="mem_70694", .mem =
                                 futhark_mc_task_77118->free_mem_70694, .size =
                                 0, .references =NULL};
    struct memblock mem_70697 = {.desc ="mem_70697", .mem =
                                 futhark_mc_task_77118->free_mem_70697, .size =
                                 0, .references =NULL};
    struct memblock mem_70700 = {.desc ="mem_70700", .mem =
                                 futhark_mc_task_77118->free_mem_70700, .size =
                                 0, .references =NULL};
    struct memblock mem_70703 = {.desc ="mem_70703", .mem =
                                 futhark_mc_task_77118->free_mem_70703, .size =
                                 0, .references =NULL};
    struct memblock mem_70706 = {.desc ="mem_70706", .mem =
                                 futhark_mc_task_77118->free_mem_70706, .size =
                                 0, .references =NULL};
    int64_t iter_73111;
    struct futhark_mc_segmap_parloop_struct_77123
    futhark_mc_segmap_parloop_struct_77123;
    
    futhark_mc_segmap_parloop_struct_77123.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77123.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77123.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77123.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77123.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77123.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77123.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77123.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77123.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77123.free_last_res_67379 = last_res_67379;
    futhark_mc_segmap_parloop_struct_77123.free_min_arg_67398 = min_arg_67398;
    futhark_mc_segmap_parloop_struct_77123.free_min_arg_67399 = min_arg_67399;
    futhark_mc_segmap_parloop_struct_77123.free_min_res_67400 = min_res_67400;
    futhark_mc_segmap_parloop_struct_77123.free_max_res_67404 = max_res_67404;
    futhark_mc_segmap_parloop_struct_77123.free_mem_70691 = mem_70691.mem;
    futhark_mc_segmap_parloop_struct_77123.free_mem_70694 = mem_70694.mem;
    futhark_mc_segmap_parloop_struct_77123.free_mem_70697 = mem_70697.mem;
    futhark_mc_segmap_parloop_struct_77123.free_mem_70700 = mem_70700.mem;
    futhark_mc_segmap_parloop_struct_77123.free_mem_70703 = mem_70703.mem;
    futhark_mc_segmap_parloop_struct_77123.free_mem_70706 = mem_70706.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77124_task;
    
    futhark_mc_segmap_parloop_77124_task.name =
        "futhark_mc_segmap_parloop_77124";
    futhark_mc_segmap_parloop_77124_task.fn = futhark_mc_segmap_parloop_77124;
    futhark_mc_segmap_parloop_77124_task.args =
        &futhark_mc_segmap_parloop_struct_77123;
    futhark_mc_segmap_parloop_77124_task.iterations = iterations;
    futhark_mc_segmap_parloop_77124_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77124_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77124_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77124_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77124_task);
    
    if (futhark_mc_segmap_parloop_77124_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77124_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77124_total_end -
                 futhark_mc_segmap_parloop_77124_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77124_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77124_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77124_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77122_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77122_end -
                 futhark_mc_segmap_nested_task_77122_start;
        
        ctx->futhark_mc_segmap_nested_task_77122_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77122_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77122_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_77091(void *args, int64_t start,
                                           int64_t end, int flat_tid_67366,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77090
    *futhark_mc_segmap_parloop_struct_77090 =
    (struct futhark_mc_segmap_parloop_struct_77090 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77090->ctx;
    uint64_t futhark_mc_segmap_parloop_77091_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77091_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77090->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77090->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77090->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77090->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77090->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77090->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77090->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77090->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77090->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77090->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77090->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70687 =
            futhark_mc_segmap_parloop_struct_77090->free_bytes_70687;
    int64_t bytes_70690 =
            futhark_mc_segmap_parloop_struct_77090->free_bytes_70690;
    int64_t bytes_70699 =
            futhark_mc_segmap_parloop_struct_77090->free_bytes_70699;
    int64_t bytes_70702 =
            futhark_mc_segmap_parloop_struct_77090->free_bytes_70702;
    struct memblock mem_70815 = {.desc ="mem_70815", .mem =
                                 futhark_mc_segmap_parloop_struct_77090->free_mem_70815,
                                 .size =0, .references =NULL};
    struct memblock mem_70819 = {.desc ="mem_70819", .mem =
                                 futhark_mc_segmap_parloop_struct_77090->free_mem_70819,
                                 .size =0, .references =NULL};
    size_t mem_70688_cached_sizze_77092 = 0;
    unsigned char *mem_70688 = NULL;
    size_t mem_70691_cached_sizze_77093 = 0;
    unsigned char *mem_70691 = NULL;
    size_t mem_70694_cached_sizze_77094 = 0;
    unsigned char *mem_70694 = NULL;
    size_t mem_70697_cached_sizze_77095 = 0;
    unsigned char *mem_70697 = NULL;
    size_t mem_70700_cached_sizze_77096 = 0;
    unsigned char *mem_70700 = NULL;
    size_t mem_70703_cached_sizze_77097 = 0;
    unsigned char *mem_70703 = NULL;
    size_t mem_70706_cached_sizze_77098 = 0;
    unsigned char *mem_70706 = NULL;
    int64_t iterations = end - start;
    int64_t iter_72599 = start;
    
    if (mem_70688_cached_sizze_77092 < (size_t) bytes_70687) {
        mem_70688 = realloc(mem_70688, bytes_70687);
        mem_70688_cached_sizze_77092 = bytes_70687;
    }
    if (mem_70691_cached_sizze_77093 < (size_t) bytes_70690) {
        mem_70691 = realloc(mem_70691, bytes_70690);
        mem_70691_cached_sizze_77093 = bytes_70690;
    }
    if (mem_70694_cached_sizze_77094 < (size_t) bytes_70687) {
        mem_70694 = realloc(mem_70694, bytes_70687);
        mem_70694_cached_sizze_77094 = bytes_70687;
    }
    if (mem_70697_cached_sizze_77095 < (size_t) bytes_70687) {
        mem_70697 = realloc(mem_70697, bytes_70687);
        mem_70697_cached_sizze_77095 = bytes_70687;
    }
    if (mem_70700_cached_sizze_77096 < (size_t) bytes_70699) {
        mem_70700 = realloc(mem_70700, bytes_70699);
        mem_70700_cached_sizze_77096 = bytes_70699;
    }
    if (mem_70703_cached_sizze_77097 < (size_t) bytes_70702) {
        mem_70703 = realloc(mem_70703, bytes_70702);
        mem_70703_cached_sizze_77097 = bytes_70702;
    }
    if (mem_70706_cached_sizze_77098 < (size_t) bytes_70702) {
        mem_70706 = realloc(mem_70706, bytes_70702);
        mem_70706_cached_sizze_77098 = bytes_70702;
    }
    for (; iter_72599 < end; iter_72599++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_72950 = m_65343;
        int64_t gtid_67367 = iter_72599;
        int64_t remnant_72951 = iter_72599 - gtid_67367;
        int64_t flat_tid_72600 = (int64_t) 0;
        int32_t num_tasks_72952;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_77099 futhark_mc_task_77099;
        
        futhark_mc_task_77099.ctx = ctx;
        futhark_mc_task_77099.free_n_65344 = n_65344;
        futhark_mc_task_77099.free_gtid_67367 = gtid_67367;
        futhark_mc_task_77099.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77099.free_mem_70688 = mem_70688;
        
        struct scheduler_segop futhark_mc_task_77099_task;
        
        futhark_mc_task_77099_task.args = &futhark_mc_task_77099;
        futhark_mc_task_77099_task.top_level_fn = futhark_mc_segscan_task_77100;
        futhark_mc_task_77099_task.name = "futhark_mc_segscan_task_77100";
        futhark_mc_task_77099_task.iterations = n_65344;
        futhark_mc_task_77099_task.task_time =
            &ctx->futhark_mc_segscan_task_77100_total_time;
        futhark_mc_task_77099_task.task_iter =
            &ctx->futhark_mc_segscan_task_77100_total_iter;
        futhark_mc_task_77099_task.sched = STATIC;
        futhark_mc_task_77099_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_77100_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77099_task);
        
        if (futhark_mc_segscan_task_77100_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_67379;
        
        last_res_67379 = ((int64_t *) mem_70688)[i_65358];
        for (int64_t i_72966 = 0; i_72966 < n_65344; i_72966++) {
            ((float *) mem_70691)[i_72966] = 0.0F;
        }
        for (int64_t i_72967 = 0; i_72967 < n_65344; i_72967++) {
            ((int64_t *) mem_70694)[i_72967] = (int64_t) -1;
        }
        
        int64_t flat_tid_72609 = (int64_t) 0;
        int32_t num_tasks_72968;
        struct futhark_mc_task_77106 futhark_mc_task_77106;
        
        futhark_mc_task_77106.ctx = ctx;
        futhark_mc_task_77106.free_n_65344 = n_65344;
        futhark_mc_task_77106.free_gtid_67367 = gtid_67367;
        futhark_mc_task_77106.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77106.free_mem_70688 = mem_70688;
        futhark_mc_task_77106.free_mem_70691 = mem_70691;
        futhark_mc_task_77106.free_mem_70694 = mem_70694;
        
        struct scheduler_segop futhark_mc_task_77106_task;
        
        futhark_mc_task_77106_task.args = &futhark_mc_task_77106;
        futhark_mc_task_77106_task.top_level_fn = futhark_mc_segmap_task_77107;
        futhark_mc_task_77106_task.name = "futhark_mc_segmap_task_77107";
        futhark_mc_task_77106_task.iterations = n_65344;
        futhark_mc_task_77106_task.task_time =
            &ctx->futhark_mc_segmap_task_77107_total_time;
        futhark_mc_task_77106_task.task_iter =
            &ctx->futhark_mc_segmap_task_77107_total_iter;
        futhark_mc_task_77106_task.sched = STATIC;
        futhark_mc_task_77106_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77107_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77106_task);
        
        if (futhark_mc_segmap_task_77107_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_72617 = (int64_t) 0;
        int32_t num_tasks_72974;
        struct futhark_mc_task_77110 futhark_mc_task_77110;
        
        futhark_mc_task_77110.ctx = ctx;
        futhark_mc_task_77110.free_n_65344 = n_65344;
        futhark_mc_task_77110.free_mem_70694 = mem_70694;
        futhark_mc_task_77110.free_mem_70697 = mem_70697;
        
        struct scheduler_segop futhark_mc_task_77110_task;
        
        futhark_mc_task_77110_task.args = &futhark_mc_task_77110;
        futhark_mc_task_77110_task.top_level_fn = futhark_mc_segmap_task_77111;
        futhark_mc_task_77110_task.name = "futhark_mc_segmap_task_77111";
        futhark_mc_task_77110_task.iterations = n_65344;
        futhark_mc_task_77110_task.task_time =
            &ctx->futhark_mc_segmap_task_77111_total_time;
        futhark_mc_task_77110_task.task_iter =
            &ctx->futhark_mc_segmap_task_77111_total_iter;
        futhark_mc_task_77110_task.sched = STATIC;
        futhark_mc_task_77110_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77111_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77110_task);
        
        if (futhark_mc_segmap_task_77111_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_67398 = sub64(last_res_67379, (int64_t) 1);
        int64_t min_arg_67399 = sub64(last_res_67379, min_res_65364);
        int64_t min_res_67400 = smin64(q_65346, last_res_67379);
        float i64_res_67401 = sitofp_i64_f32(last_res_67379);
        float x_67402 = i64_res_65370 - i64_res_67401;
        float max_arg_67403 = x_67402 / 2.0F;
        float max_res_67404 = fmax32(0.0F, max_arg_67403);
        int64_t flat_tid_72621 = (int64_t) 0;
        int32_t num_tasks_72978;
        struct futhark_mc_task_77114 futhark_mc_task_77114;
        
        futhark_mc_task_77114.ctx = ctx;
        futhark_mc_task_77114.free_q_65346 = q_65346;
        futhark_mc_task_77114.free_last_res_67379 = last_res_67379;
        futhark_mc_task_77114.free_mem_70700 = mem_70700;
        
        struct scheduler_segop futhark_mc_task_77114_task;
        
        futhark_mc_task_77114_task.args = &futhark_mc_task_77114;
        futhark_mc_task_77114_task.top_level_fn = futhark_mc_segmap_task_77115;
        futhark_mc_task_77114_task.name = "futhark_mc_segmap_task_77115";
        futhark_mc_task_77114_task.iterations = q_65346;
        futhark_mc_task_77114_task.task_time =
            &ctx->futhark_mc_segmap_task_77115_total_time;
        futhark_mc_task_77114_task.task_iter =
            &ctx->futhark_mc_segmap_task_77115_total_iter;
        futhark_mc_task_77114_task.sched = STATIC;
        futhark_mc_task_77114_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77115_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77114_task);
        
        if (futhark_mc_segmap_task_77115_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_72791 = (int64_t) 0;
        int32_t num_tasks_72982;
        int64_t flat_tid_72625 = (int64_t) 0;
        struct futhark_mc_task_77118 futhark_mc_task_77118;
        
        futhark_mc_task_77118.ctx = ctx;
        futhark_mc_task_77118.free_n_65344 = n_65344;
        futhark_mc_task_77118.free_q_65346 = q_65346;
        futhark_mc_task_77118.free_jump_65348 = jump_65348;
        futhark_mc_task_77118.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77118.free_i_65358 = i_65358;
        futhark_mc_task_77118.free_x_65359 = x_65359;
        futhark_mc_task_77118.free_min_res_65364 = min_res_65364;
        futhark_mc_task_77118.free_loop_cond_65369 = loop_cond_65369;
        futhark_mc_task_77118.free_last_res_67379 = last_res_67379;
        futhark_mc_task_77118.free_min_arg_67398 = min_arg_67398;
        futhark_mc_task_77118.free_min_arg_67399 = min_arg_67399;
        futhark_mc_task_77118.free_min_res_67400 = min_res_67400;
        futhark_mc_task_77118.free_max_res_67404 = max_res_67404;
        futhark_mc_task_77118.free_mem_70691 = mem_70691;
        futhark_mc_task_77118.free_mem_70694 = mem_70694;
        futhark_mc_task_77118.free_mem_70697 = mem_70697;
        futhark_mc_task_77118.free_mem_70700 = mem_70700;
        futhark_mc_task_77118.free_mem_70703 = mem_70703;
        futhark_mc_task_77118.free_mem_70706 = mem_70706;
        
        struct scheduler_segop futhark_mc_task_77118_task;
        
        futhark_mc_task_77118_task.args = &futhark_mc_task_77118;
        futhark_mc_task_77118_task.top_level_fn = futhark_mc_segmap_task_77119;
        futhark_mc_task_77118_task.name = "futhark_mc_segmap_task_77119";
        futhark_mc_task_77118_task.iterations = n_m_65352;
        futhark_mc_task_77118_task.task_time =
            &ctx->futhark_mc_segmap_task_77119_total_time;
        futhark_mc_task_77118_task.task_iter =
            &ctx->futhark_mc_segmap_task_77119_total_iter;
        futhark_mc_task_77118_task.sched = DYNAMIC;
        futhark_mc_task_77118_task.nested_fn =
            futhark_mc_segmap_nested_task_77122;
        
        int futhark_mc_segmap_task_77119_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77118_task);
        
        if (futhark_mc_segmap_task_77119_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70815.mem + gtid_67367 * n_m_65352 * (int64_t) 4,
                    mem_70703 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70819.mem + gtid_67367 * n_m_65352 * (int64_t) 4,
                    mem_70706 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_70688);
    free(mem_70691);
    free(mem_70694);
    free(mem_70697);
    free(mem_70700);
    free(mem_70703);
    free(mem_70706);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77091_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77091_end -
                 futhark_mc_segmap_parloop_77091_start;
        
        ctx->futhark_mc_segmap_parloop_77091_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77091_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77091_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77089(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_67366 = tid;
    int num_tasks_72380 = info.nsubtasks;
    struct futhark_mc_task_77078 *futhark_mc_task_77078 =
                                 (struct futhark_mc_task_77078 *) args;
    struct futhark_context *ctx = futhark_mc_task_77078->ctx;
    uint64_t futhark_mc_segmap_nested_task_77089_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77089_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77078->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77078->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77078->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77078->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77078->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77078->free_i_65358;
    bool x_65359 = futhark_mc_task_77078->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77078->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77078->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77078->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77078->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70687 = futhark_mc_task_77078->free_bytes_70687;
    int64_t bytes_70690 = futhark_mc_task_77078->free_bytes_70690;
    int64_t bytes_70699 = futhark_mc_task_77078->free_bytes_70699;
    int64_t bytes_70702 = futhark_mc_task_77078->free_bytes_70702;
    struct memblock mem_70815 = {.desc ="mem_70815", .mem =
                                 futhark_mc_task_77078->free_mem_70815, .size =
                                 0, .references =NULL};
    struct memblock mem_70819 = {.desc ="mem_70819", .mem =
                                 futhark_mc_task_77078->free_mem_70819, .size =
                                 0, .references =NULL};
    int64_t iter_72599;
    struct futhark_mc_segmap_parloop_struct_77090
    futhark_mc_segmap_parloop_struct_77090;
    
    futhark_mc_segmap_parloop_struct_77090.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77090.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77090.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77090.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77090.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77090.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77090.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77090.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77090.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77090.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77090.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77090.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77090.free_bytes_70687 = bytes_70687;
    futhark_mc_segmap_parloop_struct_77090.free_bytes_70690 = bytes_70690;
    futhark_mc_segmap_parloop_struct_77090.free_bytes_70699 = bytes_70699;
    futhark_mc_segmap_parloop_struct_77090.free_bytes_70702 = bytes_70702;
    futhark_mc_segmap_parloop_struct_77090.free_mem_70815 = mem_70815.mem;
    futhark_mc_segmap_parloop_struct_77090.free_mem_70819 = mem_70819.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77091_task;
    
    futhark_mc_segmap_parloop_77091_task.name =
        "futhark_mc_segmap_parloop_77091";
    futhark_mc_segmap_parloop_77091_task.fn = futhark_mc_segmap_parloop_77091;
    futhark_mc_segmap_parloop_77091_task.args =
        &futhark_mc_segmap_parloop_struct_77090;
    futhark_mc_segmap_parloop_77091_task.iterations = iterations;
    futhark_mc_segmap_parloop_77091_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77091_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77091_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77091_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77091_task);
    
    if (futhark_mc_segmap_parloop_77091_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77091_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77091_total_end -
                 futhark_mc_segmap_parloop_77091_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77091_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77091_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77091_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77089_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77089_end -
                 futhark_mc_segmap_nested_task_77089_start;
        
        ctx->futhark_mc_segmap_nested_task_77089_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77089_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77089_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77138 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70821;
    int64_t free_bytes_70824;
    int64_t free_bytes_70833;
    int64_t free_bytes_70836;
    unsigned char *free_mem_70949;
    unsigned char *free_mem_70953;
};
struct futhark_mc_segmap_parloop_struct_77140 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70821;
    int64_t free_bytes_70824;
    int64_t free_bytes_70833;
    int64_t free_bytes_70836;
    unsigned char *free_mem_70949;
    unsigned char *free_mem_70953;
};
static int futhark_mc_segmap_parloop_77141(void *args, int64_t start,
                                           int64_t end, int flat_tid_67747,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77140
    *futhark_mc_segmap_parloop_struct_77140 =
    (struct futhark_mc_segmap_parloop_struct_77140 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77140->ctx;
    uint64_t futhark_mc_segmap_parloop_77141_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77141_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77140->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77140->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77140->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77140->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77140->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77140->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77140->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77140->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77140->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77140->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77140->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70821 =
            futhark_mc_segmap_parloop_struct_77140->free_bytes_70821;
    int64_t bytes_70824 =
            futhark_mc_segmap_parloop_struct_77140->free_bytes_70824;
    int64_t bytes_70833 =
            futhark_mc_segmap_parloop_struct_77140->free_bytes_70833;
    int64_t bytes_70836 =
            futhark_mc_segmap_parloop_struct_77140->free_bytes_70836;
    struct memblock mem_70949 = {.desc ="mem_70949", .mem =
                                 futhark_mc_segmap_parloop_struct_77140->free_mem_70949,
                                 .size =0, .references =NULL};
    struct memblock mem_70953 = {.desc ="mem_70953", .mem =
                                 futhark_mc_segmap_parloop_struct_77140->free_mem_70953,
                                 .size =0, .references =NULL};
    size_t mem_70843_cached_sizze_77142 = 0;
    unsigned char *mem_70843 = NULL;
    size_t mem_70858_cached_sizze_77143 = 0;
    unsigned char *mem_70858 = NULL;
    size_t mem_70861_cached_sizze_77144 = 0;
    unsigned char *mem_70861 = NULL;
    size_t mem_70888_cached_sizze_77145 = 0;
    unsigned char *mem_70888 = NULL;
    size_t mem_70903_cached_sizze_77146 = 0;
    unsigned char *mem_70903 = NULL;
    size_t mem_70918_cached_sizze_77147 = 0;
    unsigned char *mem_70918 = NULL;
    size_t mem_70921_cached_sizze_77148 = 0;
    unsigned char *mem_70921 = NULL;
    int64_t iterations = end - start;
    int64_t iter_73278 = start;
    
    if (mem_70843_cached_sizze_77142 < (size_t) bytes_70821) {
        mem_70843 = realloc(mem_70843, bytes_70821);
        mem_70843_cached_sizze_77142 = bytes_70821;
    }
    if (mem_70858_cached_sizze_77143 < (size_t) bytes_70824) {
        mem_70858 = realloc(mem_70858, bytes_70824);
        mem_70858_cached_sizze_77143 = bytes_70824;
    }
    if (mem_70861_cached_sizze_77144 < (size_t) bytes_70821) {
        mem_70861 = realloc(mem_70861, bytes_70821);
        mem_70861_cached_sizze_77144 = bytes_70821;
    }
    if (mem_70888_cached_sizze_77145 < (size_t) bytes_70821) {
        mem_70888 = realloc(mem_70888, bytes_70821);
        mem_70888_cached_sizze_77145 = bytes_70821;
    }
    if (mem_70903_cached_sizze_77146 < (size_t) bytes_70833) {
        mem_70903 = realloc(mem_70903, bytes_70833);
        mem_70903_cached_sizze_77146 = bytes_70833;
    }
    if (mem_70918_cached_sizze_77147 < (size_t) bytes_70836) {
        mem_70918 = realloc(mem_70918, bytes_70836);
        mem_70918_cached_sizze_77147 = bytes_70836;
    }
    if (mem_70921_cached_sizze_77148 < (size_t) bytes_70836) {
        mem_70921 = realloc(mem_70921, bytes_70836);
        mem_70921_cached_sizze_77148 = bytes_70836;
    }
    for (; iter_73278 < end; iter_73278++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_73502 = m_65343;
        int64_t gtid_67748 = iter_73278;
        int64_t remnant_73503 = iter_73278 - gtid_67748;
        int64_t discard_70266;
        int64_t scanacc_73280 = (int64_t) 0;
        
        for (int64_t i_73279 = 0; i_73279 < n_65344; i_73279++) {
            float x_73282;
            
            x_73282 = ((float *) Y_mem_70569.mem)[gtid_67748 * n_65344 +
                                                  i_73279];
            
            bool isnan_res_73283;
            
            isnan_res_73283 = futrts_isnan32(x_73282);
            
            bool defunc_0_p_res_73284 = !isnan_res_73283;
            int64_t defunc_0_f_res_73285 = btoi_bool_i64(defunc_0_p_res_73284);
            int64_t defunc_1_op_res_73286 = add64(defunc_0_f_res_73285,
                                                  scanacc_73280);
            
            ((int64_t *) mem_70843)[i_73279] = defunc_1_op_res_73286;
            
            int64_t scanacc_tmp_73504 = defunc_1_op_res_73286;
            
            scanacc_73280 = scanacc_tmp_73504;
        }
        discard_70266 = scanacc_73280;
        
        int64_t last_res_65777;
        
        last_res_65777 = ((int64_t *) mem_70843)[i_65358];
        for (int64_t i_73506 = 0; i_73506 < n_65344; i_73506++) {
            ((float *) mem_70858)[i_73506] = 0.0F;
        }
        for (int64_t i_73507 = 0; i_73507 < n_65344; i_73507++) {
            ((int64_t *) mem_70861)[i_73507] = (int64_t) -1;
        }
        for (int64_t write_iter_73288 = 0; write_iter_73288 < n_65344;
             write_iter_73288++) {
            float write_iv_73291;
            
            write_iv_73291 = ((float *) Y_mem_70569.mem)[gtid_67748 * n_65344 +
                                                         write_iter_73288];
            
            bool isnan_res_73292;
            
            isnan_res_73292 = futrts_isnan32(write_iv_73291);
            
            bool defunc_0_p_res_73293 = !isnan_res_73292;
            int64_t defunc_1_f_res_73294;
            
            if (defunc_0_p_res_73293) {
                int64_t write_iv_73295;
                
                write_iv_73295 = ((int64_t *) mem_70843)[write_iter_73288];
                
                int64_t defunc_1_f_res_t_res_73296 = sub64(write_iv_73295,
                                                           (int64_t) 1);
                
                defunc_1_f_res_73294 = defunc_1_f_res_t_res_73296;
            } else {
                defunc_1_f_res_73294 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_73294) &&
                slt64(defunc_1_f_res_73294, n_65344)) {
                ((int64_t *) mem_70861)[defunc_1_f_res_73294] =
                    write_iter_73288;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_73294) &&
                slt64(defunc_1_f_res_73294, n_65344)) {
                if ((int64_t) 4 > 0)
                    memmove(mem_70858 + defunc_1_f_res_73294 * (int64_t) 4,
                            Y_mem_70569.mem + (gtid_67748 * n_65344 +
                                               write_iter_73288) * (int64_t) 4,
                            (int64_t) 4);
            }
        }
        for (int64_t i_73300 = 0; i_73300 < n_65344; i_73300++) {
            int64_t x_73302;
            
            x_73302 = ((int64_t *) mem_70861)[i_73300];
            
            int64_t defunc_0_f_res_73303 = add64((int64_t) 1, x_73302);
            
            ((int64_t *) mem_70888)[i_73300] = defunc_0_f_res_73303;
        }
        
        int64_t min_arg_65792 = sub64(last_res_65777, (int64_t) 1);
        int64_t min_arg_65793 = sub64(last_res_65777, min_res_65364);
        int64_t min_res_65794 = smin64(q_65346, last_res_65777);
        float i64_res_65795 = sitofp_i64_f32(last_res_65777);
        float x_65796 = i64_res_65370 - i64_res_65795;
        float max_arg_65797 = x_65796 / 2.0F;
        float max_res_65798 = fmax32(0.0F, max_arg_65797);
        
        for (int64_t i_73305 = 0; i_73305 < q_65346; i_73305++) {
            bool cond_73307 = sle64(last_res_65777, i_73305);
            float defunc_0_f_res_73308;
            
            if (cond_73307) {
                defunc_0_f_res_73308 = 0.0F;
            } else {
                defunc_0_f_res_73308 = 1.0F;
            }
            ((float *) mem_70903)[i_73305] = defunc_0_f_res_73308;
        }
        for (int64_t i_73310 = 0; i_73310 < n_m_65352; i_73310++) {
            int64_t min_arg_73313 = mul64(jump_65348, i_73310);
            int64_t min_res_73314 = smin64(i_65358, min_arg_73313);
            int64_t defunc_0_g_res_73315 = add64((int64_t) 1, min_res_73314);
            bool init_idx_73316;
            int64_t init_idx_73317;
            int64_t init_idx_73318;
            bool loop_while_73319;
            int64_t low_73320;
            int64_t high_73321;
            
            loop_while_73319 = x_65359;
            low_73320 = (int64_t) 0;
            high_73321 = i_65358;
            while (loop_while_73319) {
                int64_t x_73322 = add64(low_73320, high_73321);
                int64_t mid_73323 = sdiv64(x_73322, (int64_t) 2);
                bool x_73324 = sle64((int64_t) 0, mid_73323);
                bool y_73325 = slt64(mid_73323, n_65344);
                bool bounds_check_73326 = x_73324 && y_73325;
                bool index_certs_73327;
                
                if (!bounds_check_73326) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_73323,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_73328;
                
                mid_id_73328 = ((int64_t *) mem_70888)[mid_73323];
                
                bool cond_73329 = slt64(mid_id_73328, (int64_t) 0);
                int64_t mid_idx_73330;
                
                if (cond_73329) {
                    mid_idx_73330 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_73330 = mid_id_73328;
                }
                
                bool cond_73331 = sle64(defunc_0_g_res_73315, mid_idx_73330);
                int64_t loopres_73332;
                int64_t loopres_73333;
                
                if (cond_73331) {
                    int64_t loopres_t_res_73334 = sub64(mid_73323, (int64_t) 1);
                    
                    loopres_73332 = low_73320;
                    loopres_73333 = loopres_t_res_73334;
                } else {
                    int64_t loopres_f_res_73335 = add64((int64_t) 1, mid_73323);
                    
                    loopres_73332 = loopres_f_res_73335;
                    loopres_73333 = high_73321;
                }
                
                bool loop_cond_73336 = sle64(loopres_73332, loopres_73333);
                bool loop_while_tmp_73514 = loop_cond_73336;
                int64_t low_tmp_73515 = loopres_73332;
                int64_t high_tmp_73516 = loopres_73333;
                
                loop_while_73319 = loop_while_tmp_73514;
                low_73320 = low_tmp_73515;
                high_73321 = high_tmp_73516;
            }
            init_idx_73316 = loop_while_73319;
            init_idx_73317 = low_73320;
            init_idx_73318 = high_73321;
            
            bool idx_73337;
            int64_t idx_73338;
            int64_t idx_73339;
            int64_t idx_73340;
            bool loop_while_73341;
            int64_t l_idx_73342;
            int64_t r_idx_73343;
            int64_t span_73344;
            
            loop_while_73341 = loop_cond_65369;
            l_idx_73342 = init_idx_73317;
            r_idx_73343 = init_idx_73317;
            span_73344 = (int64_t) 1;
            while (loop_while_73341) {
                int64_t max_arg_73345 = sub64(l_idx_73342, (int64_t) 1);
                int64_t max_res_73346 = smax64((int64_t) 0, max_arg_73345);
                int64_t min_arg_73347 = add64((int64_t) 1, r_idx_73343);
                int64_t min_res_73348 = smin64(min_arg_65792, min_arg_73347);
                bool x_73349 = sle64((int64_t) 0, max_res_73346);
                bool y_73350 = slt64(max_res_73346, n_65344);
                bool bounds_check_73351 = x_73349 && y_73350;
                bool index_certs_73352;
                
                if (!bounds_check_73351) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_73346,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_73353;
                
                x_73353 = ((int64_t *) mem_70888)[max_res_73346];
                
                int64_t abs_arg_73354 = sub64(x_73353, defunc_0_g_res_73315);
                int64_t abs_res_73355 = abs64(abs_arg_73354);
                bool x_73356 = sle64((int64_t) 0, min_res_73348);
                bool y_73357 = slt64(min_res_73348, n_65344);
                bool bounds_check_73358 = x_73356 && y_73357;
                bool index_certs_73359;
                
                if (!bounds_check_73358) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_73348,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_73360;
                
                x_73360 = ((int64_t *) mem_70888)[min_res_73348];
                
                int64_t abs_arg_73361 = sub64(x_73360, defunc_0_g_res_73315);
                int64_t abs_res_73362 = abs64(abs_arg_73361);
                bool cond_73363 = max_res_73346 == l_idx_73342;
                int64_t loopres_73364;
                int64_t loopres_73365;
                int64_t loopres_73366;
                
                if (cond_73363) {
                    loopres_73364 = l_idx_73342;
                    loopres_73365 = r_idx_73343;
                    loopres_73366 = min_res_65364;
                } else {
                    bool cond_73367 = slt64(abs_res_73355, abs_res_73362);
                    bool cond_f_res_73368 = min_res_73348 == r_idx_73343;
                    bool x_73369 = !cond_73367;
                    bool y_73370 = cond_f_res_73368 && x_73369;
                    bool cond_73371 = cond_73367 || y_73370;
                    int64_t loopres_f_res_73372;
                    
                    if (cond_73371) {
                        loopres_f_res_73372 = max_res_73346;
                    } else {
                        loopres_f_res_73372 = l_idx_73342;
                    }
                    
                    int64_t loopres_f_res_73373;
                    
                    if (cond_73371) {
                        loopres_f_res_73373 = r_idx_73343;
                    } else {
                        loopres_f_res_73373 = min_res_73348;
                    }
                    
                    int64_t loopres_f_res_73374;
                    
                    if (cond_73371) {
                        int64_t loopres_f_res_t_res_73375 = add64((int64_t) 1,
                                                                  span_73344);
                        
                        loopres_f_res_73374 = loopres_f_res_t_res_73375;
                    } else {
                        int64_t loopres_f_res_f_res_73376 = add64((int64_t) 1,
                                                                  span_73344);
                        
                        loopres_f_res_73374 = loopres_f_res_f_res_73376;
                    }
                    loopres_73364 = loopres_f_res_73372;
                    loopres_73365 = loopres_f_res_73373;
                    loopres_73366 = loopres_f_res_73374;
                }
                
                bool loop_cond_73377 = slt64(loopres_73366, min_res_65364);
                bool loop_while_tmp_73517 = loop_cond_73377;
                int64_t l_idx_tmp_73518 = loopres_73364;
                int64_t r_idx_tmp_73519 = loopres_73365;
                int64_t span_tmp_73520 = loopres_73366;
                
                loop_while_73341 = loop_while_tmp_73517;
                l_idx_73342 = l_idx_tmp_73518;
                r_idx_73343 = r_idx_tmp_73519;
                span_73344 = span_tmp_73520;
            }
            idx_73337 = loop_while_73341;
            idx_73338 = l_idx_73342;
            idx_73339 = r_idx_73343;
            idx_73340 = span_73344;
            
            int64_t min_res_73378 = smin64(min_arg_65793, idx_73338);
            int64_t max_res_73379 = smax64((int64_t) 0, min_res_73378);
            int64_t x_73380 = add64(min_res_65794, max_res_73379);
            int64_t r_73381 = sub64(x_73380, (int64_t) 1);
            bool x_73382 = sle64((int64_t) 0, r_73381);
            bool y_73383 = slt64(r_73381, n_65344);
            bool bounds_check_73384 = x_73382 && y_73383;
            bool index_certs_73385;
            
            if (!bounds_check_73384) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_73381,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_73386;
            
            x_73386 = ((int64_t *) mem_70861)[r_73381];
            
            int64_t abs_arg_73387 = sub64(x_73386, min_res_73314);
            int64_t abs_res_73388 = abs64(abs_arg_73387);
            bool x_73389 = sle64((int64_t) 0, max_res_73379);
            bool y_73390 = slt64(max_res_73379, n_65344);
            bool bounds_check_73391 = x_73389 && y_73390;
            bool index_certs_73392;
            
            if (!bounds_check_73391) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_73379,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_73393;
            
            x_73393 = ((int64_t *) mem_70861)[max_res_73379];
            
            int64_t abs_arg_73394 = sub64(x_73393, min_res_73314);
            int64_t abs_res_73395 = abs64(abs_arg_73394);
            int64_t max_res_73396 = smax64(abs_res_73388, abs_res_73395);
            float defunc_0_f_res_73397 = sitofp_i64_f32(max_res_73396);
            float defunc_1_f_res_73398 = max_res_65798 + defunc_0_f_res_73397;
            float defunc_2_reduce_res_73399;
            float defunc_2_reduce_res_73400;
            float defunc_2_reduce_res_73401;
            float defunc_2_reduce_res_73402;
            float defunc_2_reduce_res_73403;
            float redout_73405;
            float redout_73406;
            float redout_73407;
            float redout_73408;
            float redout_73409;
            
            redout_73405 = 0.0F;
            redout_73406 = 0.0F;
            redout_73407 = 0.0F;
            redout_73408 = 0.0F;
            redout_73409 = 0.0F;
            for (int64_t i_73404 = 0; i_73404 < q_65346; i_73404++) {
                float x_73410;
                
                x_73410 = ((float *) mem_70903)[i_73404];
                
                bool cond_73411 = sle64(last_res_65777, i_73404);
                int64_t defunc_0_f_res_73412;
                
                if (cond_73411) {
                    defunc_0_f_res_73412 = (int64_t) 0;
                } else {
                    int64_t i_73413 = add64(max_res_73379, i_73404);
                    int64_t defunc_0_add_arg_73414;
                    
                    defunc_0_add_arg_73414 = ((int64_t *) mem_70861)[i_73413];
                    
                    int64_t defunc_1_add_res_73415 = add64((int64_t) 1,
                                                           defunc_0_add_arg_73414);
                    
                    defunc_0_f_res_73412 = defunc_1_add_res_73415;
                }
                
                int64_t binop_p_73416 = sub64(defunc_0_f_res_73412,
                                              min_res_73314);
                float defunc_0_f_res_73417 = sitofp_i64_f32(binop_p_73416);
                float abs_res_73418 = (float) fabs(defunc_0_f_res_73417);
                float tmp1_73419 = abs_res_73418 / defunc_1_f_res_73398;
                float x_73420 = tmp1_73419 * tmp1_73419;
                float y_73421 = tmp1_73419 * x_73420;
                float tmp2_73422 = 1.0F - y_73421;
                float x_73423 = tmp2_73422 * tmp2_73422;
                float tmp3_73424 = tmp2_73422 * x_73423;
                float w_j_73425 = x_73410 * tmp3_73424;
                float xw_j_73426 = defunc_0_f_res_73417 * w_j_73425;
                float x2w_j_73427 = defunc_0_f_res_73417 * xw_j_73426;
                float x3w_j_73428 = defunc_0_f_res_73417 * x2w_j_73427;
                float x4w_j_73429 = defunc_0_f_res_73417 * x3w_j_73428;
                float defunc_1_op_res_73430 = w_j_73425 + redout_73405;
                float defunc_1_op_res_73431 = xw_j_73426 + redout_73406;
                float defunc_1_op_res_73432 = x2w_j_73427 + redout_73407;
                float defunc_1_op_res_73433 = x3w_j_73428 + redout_73408;
                float defunc_1_op_res_73434 = x4w_j_73429 + redout_73409;
                float redout_tmp_73521 = defunc_1_op_res_73430;
                float redout_tmp_73522 = defunc_1_op_res_73431;
                float redout_tmp_73523 = defunc_1_op_res_73432;
                float redout_tmp_73524 = defunc_1_op_res_73433;
                float redout_tmp_73525 = defunc_1_op_res_73434;
                
                redout_73405 = redout_tmp_73521;
                redout_73406 = redout_tmp_73522;
                redout_73407 = redout_tmp_73523;
                redout_73408 = redout_tmp_73524;
                redout_73409 = redout_tmp_73525;
            }
            defunc_2_reduce_res_73399 = redout_73405;
            defunc_2_reduce_res_73400 = redout_73406;
            defunc_2_reduce_res_73401 = redout_73407;
            defunc_2_reduce_res_73402 = redout_73408;
            defunc_2_reduce_res_73403 = redout_73409;
            
            float x_73435 = defunc_2_reduce_res_73401 *
                  defunc_2_reduce_res_73403;
            float y_73436 = defunc_2_reduce_res_73402 *
                  defunc_2_reduce_res_73402;
            float a12_73437 = x_73435 - y_73436;
            float x_73438 = defunc_2_reduce_res_73401 *
                  defunc_2_reduce_res_73402;
            float y_73439 = defunc_2_reduce_res_73400 *
                  defunc_2_reduce_res_73403;
            float b12_73440 = x_73438 - y_73439;
            float x_73441 = defunc_2_reduce_res_73400 *
                  defunc_2_reduce_res_73402;
            float y_73442 = defunc_2_reduce_res_73401 *
                  defunc_2_reduce_res_73401;
            float c12_73443 = x_73441 - y_73442;
            float x_73444 = defunc_2_reduce_res_73399 *
                  defunc_2_reduce_res_73403;
            float b2_73445 = x_73444 - y_73442;
            float x_73446 = defunc_2_reduce_res_73400 *
                  defunc_2_reduce_res_73401;
            float y_73447 = defunc_2_reduce_res_73399 *
                  defunc_2_reduce_res_73402;
            float c2_73448 = x_73446 - y_73447;
            float x_73449 = defunc_2_reduce_res_73399 * a12_73437;
            float y_73450 = defunc_2_reduce_res_73400 * b12_73440;
            float x_73451 = x_73449 + y_73450;
            float y_73452 = defunc_2_reduce_res_73401 * c12_73443;
            float y_73453 = x_73451 + y_73452;
            float det_73454 = 1.0F / y_73453;
            float a12_73455 = a12_73437 * det_73454;
            float b12_73456 = b12_73440 * det_73454;
            float c12_73457 = c12_73443 * det_73454;
            float b2_73458 = b2_73445 * det_73454;
            float c2_73459 = c2_73448 * det_73454;
            float defunc_2_reduce_res_73460;
            float defunc_2_reduce_res_73461;
            float redout_73463;
            float redout_73464;
            
            redout_73463 = 0.0F;
            redout_73464 = 0.0F;
            for (int64_t i_73462 = 0; i_73462 < q_65346; i_73462++) {
                float x_73465;
                
                x_73465 = ((float *) mem_70903)[i_73462];
                
                bool cond_73466 = sle64(last_res_65777, i_73462);
                int64_t defunc_0_f_res_73467;
                
                if (cond_73466) {
                    defunc_0_f_res_73467 = (int64_t) 0;
                } else {
                    int64_t i_73468 = add64(max_res_73379, i_73462);
                    int64_t defunc_0_add_arg_73469;
                    
                    defunc_0_add_arg_73469 = ((int64_t *) mem_70861)[i_73468];
                    
                    int64_t defunc_1_add_res_73470 = add64((int64_t) 1,
                                                           defunc_0_add_arg_73469);
                    
                    defunc_0_f_res_73467 = defunc_1_add_res_73470;
                }
                
                int64_t binop_p_73471 = sub64(defunc_0_f_res_73467,
                                              min_res_73314);
                float defunc_0_f_res_73472 = sitofp_i64_f32(binop_p_73471);
                float abs_res_73473 = (float) fabs(defunc_0_f_res_73472);
                float tmp1_73474 = abs_res_73473 / defunc_1_f_res_73398;
                float x_73475 = tmp1_73474 * tmp1_73474;
                float y_73476 = tmp1_73474 * x_73475;
                float tmp2_73477 = 1.0F - y_73476;
                float x_73478 = tmp2_73477 * tmp2_73477;
                float tmp3_73479 = tmp2_73477 * x_73478;
                float tmp4_73480 = x_73465 * tmp3_73479;
                float defunc_1_f_res_73481 = defunc_0_f_res_73472 * tmp4_73480;
                float defunc_1_f_res_73482 = defunc_0_f_res_73472 *
                      defunc_1_f_res_73481;
                float defunc_0_f_res_73483;
                
                if (cond_73466) {
                    defunc_0_f_res_73483 = 0.0F;
                } else {
                    int64_t i_73484 = add64(max_res_73379, i_73462);
                    float defunc_0_add_arg_73485;
                    
                    defunc_0_add_arg_73485 = ((float *) mem_70858)[i_73484];
                    defunc_0_f_res_73483 = defunc_0_add_arg_73485;
                }
                
                float x_73486 = a12_73455 * tmp4_73480;
                float y_73487 = b12_73456 * defunc_1_f_res_73481;
                float x_73488 = x_73486 + y_73487;
                float y_73489 = c12_73457 * defunc_1_f_res_73482;
                float x_73490 = x_73488 + y_73489;
                float defunc_9_fit_fun_res_73491 = defunc_0_f_res_73483 *
                      x_73490;
                float x_73492 = b12_73456 * tmp4_73480;
                float y_73493 = b2_73458 * defunc_1_f_res_73481;
                float x_73494 = x_73492 + y_73493;
                float y_73495 = c2_73459 * defunc_1_f_res_73482;
                float x_73496 = x_73494 + y_73495;
                float defunc_9_slope_fun_res_73497 = defunc_0_f_res_73483 *
                      x_73496;
                float defunc_1_op_res_73498 = defunc_9_fit_fun_res_73491 +
                      redout_73463;
                float defunc_1_op_res_73499 = defunc_9_slope_fun_res_73497 +
                      redout_73464;
                float redout_tmp_73526 = defunc_1_op_res_73498;
                float redout_tmp_73527 = defunc_1_op_res_73499;
                
                redout_73463 = redout_tmp_73526;
                redout_73464 = redout_tmp_73527;
            }
            defunc_2_reduce_res_73460 = redout_73463;
            defunc_2_reduce_res_73461 = redout_73464;
            ((float *) mem_70918)[i_73310] = defunc_2_reduce_res_73460;
            ((float *) mem_70921)[i_73310] = defunc_2_reduce_res_73461;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70949.mem + gtid_67748 * n_m_65352 * (int64_t) 4,
                    mem_70918 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70953.mem + gtid_67748 * n_m_65352 * (int64_t) 4,
                    mem_70921 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_70843);
    free(mem_70858);
    free(mem_70861);
    free(mem_70888);
    free(mem_70903);
    free(mem_70918);
    free(mem_70921);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77141_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77141_end -
                 futhark_mc_segmap_parloop_77141_start;
        
        ctx->futhark_mc_segmap_parloop_77141_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77141_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77141_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77139(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_67747 = tid;
    int num_tasks_73277 = info.nsubtasks;
    struct futhark_mc_task_77138 *futhark_mc_task_77138 =
                                 (struct futhark_mc_task_77138 *) args;
    struct futhark_context *ctx = futhark_mc_task_77138->ctx;
    uint64_t futhark_mc_segmap_task_77139_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77139_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77138->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77138->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77138->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77138->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77138->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77138->free_i_65358;
    bool x_65359 = futhark_mc_task_77138->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77138->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77138->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77138->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77138->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70821 = futhark_mc_task_77138->free_bytes_70821;
    int64_t bytes_70824 = futhark_mc_task_77138->free_bytes_70824;
    int64_t bytes_70833 = futhark_mc_task_77138->free_bytes_70833;
    int64_t bytes_70836 = futhark_mc_task_77138->free_bytes_70836;
    struct memblock mem_70949 = {.desc ="mem_70949", .mem =
                                 futhark_mc_task_77138->free_mem_70949, .size =
                                 0, .references =NULL};
    struct memblock mem_70953 = {.desc ="mem_70953", .mem =
                                 futhark_mc_task_77138->free_mem_70953, .size =
                                 0, .references =NULL};
    int64_t iter_73278;
    struct futhark_mc_segmap_parloop_struct_77140
    futhark_mc_segmap_parloop_struct_77140;
    
    futhark_mc_segmap_parloop_struct_77140.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77140.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77140.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77140.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77140.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77140.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77140.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77140.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77140.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77140.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77140.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77140.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77140.free_bytes_70821 = bytes_70821;
    futhark_mc_segmap_parloop_struct_77140.free_bytes_70824 = bytes_70824;
    futhark_mc_segmap_parloop_struct_77140.free_bytes_70833 = bytes_70833;
    futhark_mc_segmap_parloop_struct_77140.free_bytes_70836 = bytes_70836;
    futhark_mc_segmap_parloop_struct_77140.free_mem_70949 = mem_70949.mem;
    futhark_mc_segmap_parloop_struct_77140.free_mem_70953 = mem_70953.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77141_task;
    
    futhark_mc_segmap_parloop_77141_task.name =
        "futhark_mc_segmap_parloop_77141";
    futhark_mc_segmap_parloop_77141_task.fn = futhark_mc_segmap_parloop_77141;
    futhark_mc_segmap_parloop_77141_task.args =
        &futhark_mc_segmap_parloop_struct_77140;
    futhark_mc_segmap_parloop_77141_task.iterations = iterations;
    futhark_mc_segmap_parloop_77141_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77141_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77141_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77141_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77141_task);
    
    if (futhark_mc_segmap_parloop_77141_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77141_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77141_total_end -
                 futhark_mc_segmap_parloop_77141_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77141_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77141_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77141_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77139_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77139_end -
                 futhark_mc_segmap_task_77139_start;
        
        ctx->futhark_mc_segmap_task_77139_runs[tid]++;
        ctx->futhark_mc_segmap_task_77139_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77139_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77150 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70821;
    int64_t free_bytes_70824;
    int64_t free_bytes_70833;
    int64_t free_bytes_70836;
    unsigned char *free_mem_70949;
    unsigned char *free_mem_70953;
};
struct futhark_mc_task_77159 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67969;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70822;
};
struct futhark_mc_scan_stage_1_parloop_struct_77162 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67969;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70822;
};
static int futhark_mc_scan_stage_1_parloop_77163(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_73529, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_77162
    *futhark_mc_scan_stage_1_parloop_struct_77162 =
    (struct futhark_mc_scan_stage_1_parloop_struct_77162 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_77162->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_77163_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77163_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_1_parloop_struct_77162->free_n_65344;
    int64_t gtid_67969 =
            futhark_mc_scan_stage_1_parloop_struct_77162->free_gtid_67969;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_1_parloop_struct_77162->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70822 = {.desc ="mem_70822", .mem =
                                 futhark_mc_scan_stage_1_parloop_struct_77162->free_mem_70822,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73944 = start;
    int64_t x_73531;
    int64_t x_73532;
    
    x_73531 = (int64_t) 0;
    for (; iter_73944 < end; iter_73944++) {
        int64_t gtid_73530 = iter_73944;
        
        // stage 1 scan body
        {
            float x_73534;
            
            x_73534 = ((float *) Y_mem_70569.mem)[gtid_67969 * n_65344 +
                                                  gtid_73530];
            
            bool isnan_res_73535;
            
            isnan_res_73535 = futrts_isnan32(x_73534);
            
            bool defunc_0_p_res_73536 = !isnan_res_73535;
            int64_t defunc_0_f_res_73537 = btoi_bool_i64(defunc_0_p_res_73536);
            
            // write mapped values results to memory
            { }
            x_73531 = x_73531;
            // Read next values
            {
                x_73532 = defunc_0_f_res_73537;
            }
            
            int64_t defunc_1_op_res_73533 = add64(x_73531, x_73532);
            
            ((int64_t *) mem_70822.mem)[gtid_73530] = defunc_1_op_res_73533;
            x_73531 = defunc_1_op_res_73533;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77163_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77163_end -
                 futhark_mc_scan_stage_1_parloop_77163_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_77163_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_77163_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_77163_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_77164 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67969;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70822;
};
static int futhark_mc_scan_stage_3_parloop_77165(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_73529, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_77164
    *futhark_mc_scan_stage_3_parloop_struct_77164 =
    (struct futhark_mc_scan_stage_3_parloop_struct_77164 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_77164->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_77165_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_77165_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_3_parloop_struct_77164->free_n_65344;
    int64_t gtid_67969 =
            futhark_mc_scan_stage_3_parloop_struct_77164->free_gtid_67969;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_3_parloop_struct_77164->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70822 = {.desc ="mem_70822", .mem =
                                 futhark_mc_scan_stage_3_parloop_struct_77164->free_mem_70822,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73956 = start;
    int64_t x_73953;
    int64_t x_73954;
    
    if (iter_73956 == (int64_t) 0) {
        x_73953 = (int64_t) 0;
    } else {
        x_73953 = ((int64_t *) mem_70822.mem)[iter_73956 - (int64_t) 1];
    }
    for (; iter_73956 < end; iter_73956++) {
        int64_t gtid_73530 = iter_73956;
        
        // stage 3 scan body
        {
            float x_73534;
            
            x_73534 = ((float *) Y_mem_70569.mem)[gtid_67969 * n_65344 +
                                                  gtid_73530];
            
            bool isnan_res_73535;
            
            isnan_res_73535 = futrts_isnan32(x_73534);
            
            bool defunc_0_p_res_73536 = !isnan_res_73535;
            int64_t defunc_0_f_res_73537 = btoi_bool_i64(defunc_0_p_res_73536);
            
            x_73953 = x_73953;
            x_73954 = defunc_0_f_res_73537;
            
            int64_t defunc_1_op_res_73955 = add64(x_73953, x_73954);
            
            ((int64_t *) mem_70822.mem)[gtid_73530] = defunc_1_op_res_73955;
            x_73953 = defunc_1_op_res_73955;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_77165_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77165_end -
                 futhark_mc_scan_stage_3_parloop_77165_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_77165_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_77165_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_77165_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_77160(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73529 = tid;
    int num_tasks_73943 = info.nsubtasks;
    struct futhark_mc_task_77159 *futhark_mc_task_77159 =
                                 (struct futhark_mc_task_77159 *) args;
    struct futhark_context *ctx = futhark_mc_task_77159->ctx;
    uint64_t futhark_mc_segscan_task_77160_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_77160_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77159->free_n_65344;
    int64_t gtid_67969 = futhark_mc_task_77159->free_gtid_67969;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77159->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70822 = {.desc ="mem_70822", .mem =
                                 futhark_mc_task_77159->free_mem_70822, .size =
                                 0, .references =NULL};
    size_t scan_stage_2_accum_mem_73950_cached_sizze_77161 = 0;
    unsigned char *scan_stage_2_accum_mem_73950 = NULL;
    int64_t iter_73944;
    struct futhark_mc_scan_stage_1_parloop_struct_77162
    futhark_mc_scan_stage_1_parloop_struct_77162;
    
    futhark_mc_scan_stage_1_parloop_struct_77162.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_77162.free_n_65344 = n_65344;
    futhark_mc_scan_stage_1_parloop_struct_77162.free_gtid_67969 = gtid_67969;
    futhark_mc_scan_stage_1_parloop_struct_77162.free_Y_mem_70569 =
        Y_mem_70569.mem;
    futhark_mc_scan_stage_1_parloop_struct_77162.free_mem_70822 = mem_70822.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_77163_task;
    
    futhark_mc_scan_stage_1_parloop_77163_task.name =
        "futhark_mc_scan_stage_1_parloop_77163";
    futhark_mc_scan_stage_1_parloop_77163_task.fn =
        futhark_mc_scan_stage_1_parloop_77163;
    futhark_mc_scan_stage_1_parloop_77163_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_77162;
    futhark_mc_scan_stage_1_parloop_77163_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_77163_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_77163_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77163_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_77163_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_77163_task);
    
    if (futhark_mc_scan_stage_1_parloop_77163_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77163_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77163_total_end -
                 futhark_mc_scan_stage_1_parloop_77163_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77163_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77163_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77163_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_73943)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_73945;
        int64_t x_73946;
        int64_t offset_73948 = (int64_t) 0;
        int64_t offset_index_73949 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_73950_cached_sizze_77161 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_73950 = realloc(scan_stage_2_accum_mem_73950,
                                                   (int64_t) 8);
            scan_stage_2_accum_mem_73950_cached_sizze_77161 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_73950)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_73952 = 0; i_73952 < num_tasks_73943 - 1; i_73952++) {
            offset_73948 = squot64(n_65344, sext_i32_i64(num_tasks_73943));
            if (slt64(sext_i32_i64(i_73952), srem64(n_65344,
                                                    sext_i32_i64(num_tasks_73943)))) {
                offset_73948 += (int64_t) 1;
            }
            offset_index_73949 += offset_73948;
            
            int64_t gtid_73530 = offset_index_73949;
            float x_73534;
            
            x_73534 = ((float *) Y_mem_70569.mem)[gtid_67969 * n_65344 +
                                                  gtid_73530];
            
            bool isnan_res_73535;
            
            isnan_res_73535 = futrts_isnan32(x_73534);
            
            bool defunc_0_p_res_73536 = !isnan_res_73535;
            int64_t defunc_0_f_res_73537 = btoi_bool_i64(defunc_0_p_res_73536);
            
            // Read carry in
            {
                x_73945 =
                    ((int64_t *) scan_stage_2_accum_mem_73950)[(int64_t) 0];
            }
            // Read next values
            {
                x_73946 = ((int64_t *) mem_70822.mem)[offset_index_73949 -
                                                      (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_73947 = add64(x_73945, x_73946);
            
            ((int64_t *) mem_70822.mem)[offset_index_73949 - (int64_t) 1] =
                defunc_1_op_res_73947;
            ((int64_t *) scan_stage_2_accum_mem_73950)[(int64_t) 0] =
                defunc_1_op_res_73947;
        }
        
        int64_t iter_73956 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_77164
        futhark_mc_scan_stage_3_parloop_struct_77164;
        
        futhark_mc_scan_stage_3_parloop_struct_77164.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_77164.free_n_65344 = n_65344;
        futhark_mc_scan_stage_3_parloop_struct_77164.free_gtid_67969 =
            gtid_67969;
        futhark_mc_scan_stage_3_parloop_struct_77164.free_Y_mem_70569 =
            Y_mem_70569.mem;
        futhark_mc_scan_stage_3_parloop_struct_77164.free_mem_70822 =
            mem_70822.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_77165_task;
        
        futhark_mc_scan_stage_3_parloop_77165_task.name =
            "futhark_mc_scan_stage_3_parloop_77165";
        futhark_mc_scan_stage_3_parloop_77165_task.fn =
            futhark_mc_scan_stage_3_parloop_77165;
        futhark_mc_scan_stage_3_parloop_77165_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_77164;
        futhark_mc_scan_stage_3_parloop_77165_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_77165_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_77165_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_77165_total_start = get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_77165_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_77165_task);
        
        if (futhark_mc_scan_stage_3_parloop_77165_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_77165_total_end =
                     get_wall_time();
            uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77165_total_end -
                     futhark_mc_scan_stage_3_parloop_77165_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77165_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77165_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77165_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_73950);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_77160_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_77160_end -
                 futhark_mc_segscan_task_77160_start;
        
        ctx->futhark_mc_segscan_task_77160_runs[tid]++;
        ctx->futhark_mc_segscan_task_77160_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_77160_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77166 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67969;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70822;
    unsigned char *free_mem_70825;
    unsigned char *free_mem_70828;
};
struct futhark_mc_segmap_parloop_struct_77168 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_67969;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70822;
    unsigned char *free_mem_70825;
    unsigned char *free_mem_70828;
};
static int futhark_mc_segmap_parloop_77169(void *args, int64_t start,
                                           int64_t end, int flat_tid_73538,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77168
    *futhark_mc_segmap_parloop_struct_77168 =
    (struct futhark_mc_segmap_parloop_struct_77168 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77168->ctx;
    uint64_t futhark_mc_segmap_parloop_77169_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77169_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77168->free_n_65344;
    int64_t gtid_67969 =
            futhark_mc_segmap_parloop_struct_77168->free_gtid_67969;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77168->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70822 = {.desc ="mem_70822", .mem =
                                 futhark_mc_segmap_parloop_struct_77168->free_mem_70822,
                                 .size =0, .references =NULL};
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_segmap_parloop_struct_77168->free_mem_70825,
                                 .size =0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_segmap_parloop_struct_77168->free_mem_70828,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73960 = start;
    
    for (; iter_73960 < end; iter_73960++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_73963 = n_65344;
        int64_t gtid_73539 = iter_73960;
        int64_t remnant_73964 = iter_73960 - gtid_73539;
        float x_73540;
        
        x_73540 = ((float *) Y_mem_70569.mem)[gtid_67969 * n_65344 +
                                              gtid_73539];
        
        bool isnan_res_73541;
        
        isnan_res_73541 = futrts_isnan32(x_73540);
        
        bool defunc_0_p_res_73542 = !isnan_res_73541;
        int64_t defunc_1_f_res_73543;
        
        if (defunc_0_p_res_73542) {
            int64_t x_73961;
            
            x_73961 = ((int64_t *) mem_70822.mem)[gtid_73539];
            
            int64_t defunc_1_f_res_t_res_73962 = sub64(x_73961, (int64_t) 1);
            
            defunc_1_f_res_73543 = defunc_1_f_res_t_res_73962;
        } else {
            defunc_1_f_res_73543 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_73543) &&
            slt64(defunc_1_f_res_73543, n_65344)) {
            ((int64_t *) mem_70828.mem)[defunc_1_f_res_73543] = gtid_73539;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_73543) &&
            slt64(defunc_1_f_res_73543, n_65344)) {
            ((float *) mem_70825.mem)[defunc_1_f_res_73543] = x_73540;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77169_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77169_end -
                 futhark_mc_segmap_parloop_77169_start;
        
        ctx->futhark_mc_segmap_parloop_77169_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77169_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77169_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77167(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73538 = tid;
    int num_tasks_73959 = info.nsubtasks;
    struct futhark_mc_task_77166 *futhark_mc_task_77166 =
                                 (struct futhark_mc_task_77166 *) args;
    struct futhark_context *ctx = futhark_mc_task_77166->ctx;
    uint64_t futhark_mc_segmap_task_77167_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77167_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77166->free_n_65344;
    int64_t gtid_67969 = futhark_mc_task_77166->free_gtid_67969;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77166->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70822 = {.desc ="mem_70822", .mem =
                                 futhark_mc_task_77166->free_mem_70822, .size =
                                 0, .references =NULL};
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_task_77166->free_mem_70825, .size =
                                 0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_task_77166->free_mem_70828, .size =
                                 0, .references =NULL};
    int64_t iter_73960;
    struct futhark_mc_segmap_parloop_struct_77168
    futhark_mc_segmap_parloop_struct_77168;
    
    futhark_mc_segmap_parloop_struct_77168.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77168.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77168.free_gtid_67969 = gtid_67969;
    futhark_mc_segmap_parloop_struct_77168.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77168.free_mem_70822 = mem_70822.mem;
    futhark_mc_segmap_parloop_struct_77168.free_mem_70825 = mem_70825.mem;
    futhark_mc_segmap_parloop_struct_77168.free_mem_70828 = mem_70828.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77169_task;
    
    futhark_mc_segmap_parloop_77169_task.name =
        "futhark_mc_segmap_parloop_77169";
    futhark_mc_segmap_parloop_77169_task.fn = futhark_mc_segmap_parloop_77169;
    futhark_mc_segmap_parloop_77169_task.args =
        &futhark_mc_segmap_parloop_struct_77168;
    futhark_mc_segmap_parloop_77169_task.iterations = iterations;
    futhark_mc_segmap_parloop_77169_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77169_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77169_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77169_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77169_task);
    
    if (futhark_mc_segmap_parloop_77169_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77169_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77169_total_end -
                 futhark_mc_segmap_parloop_77169_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77169_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77169_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77169_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77167_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77167_end -
                 futhark_mc_segmap_task_77167_start;
        
        ctx->futhark_mc_segmap_task_77167_runs[tid]++;
        ctx->futhark_mc_segmap_task_77167_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77167_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77170 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70831;
};
struct futhark_mc_segmap_parloop_struct_77172 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70831;
};
static int futhark_mc_segmap_parloop_77173(void *args, int64_t start,
                                           int64_t end, int flat_tid_73546,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77172
    *futhark_mc_segmap_parloop_struct_77172 =
    (struct futhark_mc_segmap_parloop_struct_77172 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77172->ctx;
    uint64_t futhark_mc_segmap_parloop_77173_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77173_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77172->free_n_65344;
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_segmap_parloop_struct_77172->free_mem_70828,
                                 .size =0, .references =NULL};
    struct memblock mem_70831 = {.desc ="mem_70831", .mem =
                                 futhark_mc_segmap_parloop_struct_77172->free_mem_70831,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73966 = start;
    
    for (; iter_73966 < end; iter_73966++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_73967 = n_65344;
        int64_t gtid_73547 = iter_73966;
        int64_t remnant_73968 = iter_73966 - gtid_73547;
        int64_t x_73548;
        
        x_73548 = ((int64_t *) mem_70828.mem)[gtid_73547];
        
        int64_t defunc_0_f_res_73549 = add64((int64_t) 1, x_73548);
        
        ((int64_t *) mem_70831.mem)[gtid_73547] = defunc_0_f_res_73549;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77173_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77173_end -
                 futhark_mc_segmap_parloop_77173_start;
        
        ctx->futhark_mc_segmap_parloop_77173_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77173_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77173_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77171(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73546 = tid;
    int num_tasks_73965 = info.nsubtasks;
    struct futhark_mc_task_77170 *futhark_mc_task_77170 =
                                 (struct futhark_mc_task_77170 *) args;
    struct futhark_context *ctx = futhark_mc_task_77170->ctx;
    uint64_t futhark_mc_segmap_task_77171_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77171_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77170->free_n_65344;
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_task_77170->free_mem_70828, .size =
                                 0, .references =NULL};
    struct memblock mem_70831 = {.desc ="mem_70831", .mem =
                                 futhark_mc_task_77170->free_mem_70831, .size =
                                 0, .references =NULL};
    int64_t iter_73966;
    struct futhark_mc_segmap_parloop_struct_77172
    futhark_mc_segmap_parloop_struct_77172;
    
    futhark_mc_segmap_parloop_struct_77172.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77172.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77172.free_mem_70828 = mem_70828.mem;
    futhark_mc_segmap_parloop_struct_77172.free_mem_70831 = mem_70831.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77173_task;
    
    futhark_mc_segmap_parloop_77173_task.name =
        "futhark_mc_segmap_parloop_77173";
    futhark_mc_segmap_parloop_77173_task.fn = futhark_mc_segmap_parloop_77173;
    futhark_mc_segmap_parloop_77173_task.args =
        &futhark_mc_segmap_parloop_struct_77172;
    futhark_mc_segmap_parloop_77173_task.iterations = iterations;
    futhark_mc_segmap_parloop_77173_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77173_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77173_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77173_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77173_task);
    
    if (futhark_mc_segmap_parloop_77173_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77173_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77173_total_end -
                 futhark_mc_segmap_parloop_77173_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77173_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77173_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77173_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77171_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77171_end -
                 futhark_mc_segmap_task_77171_start;
        
        ctx->futhark_mc_segmap_task_77171_runs[tid]++;
        ctx->futhark_mc_segmap_task_77171_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77171_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77174 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_67981;
    unsigned char *free_mem_70834;
};
struct futhark_mc_segmap_parloop_struct_77176 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_67981;
    unsigned char *free_mem_70834;
};
static int futhark_mc_segmap_parloop_77177(void *args, int64_t start,
                                           int64_t end, int flat_tid_73550,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77176
    *futhark_mc_segmap_parloop_struct_77176 =
    (struct futhark_mc_segmap_parloop_struct_77176 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77176->ctx;
    uint64_t futhark_mc_segmap_parloop_77177_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77177_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77176->free_q_65346;
    int64_t last_res_67981 =
            futhark_mc_segmap_parloop_struct_77176->free_last_res_67981;
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_segmap_parloop_struct_77176->free_mem_70834,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73970 = start;
    
    for (; iter_73970 < end; iter_73970++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_73971 = q_65346;
        int64_t gtid_73551 = iter_73970;
        int64_t remnant_73972 = iter_73970 - gtid_73551;
        bool cond_73552 = sle64(last_res_67981, gtid_73551);
        float defunc_0_f_res_73553;
        
        if (cond_73552) {
            defunc_0_f_res_73553 = 0.0F;
        } else {
            defunc_0_f_res_73553 = 1.0F;
        }
        ((float *) mem_70834.mem)[gtid_73551] = defunc_0_f_res_73553;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77177_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77177_end -
                 futhark_mc_segmap_parloop_77177_start;
        
        ctx->futhark_mc_segmap_parloop_77177_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77177_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77177_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77175(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73550 = tid;
    int num_tasks_73969 = info.nsubtasks;
    struct futhark_mc_task_77174 *futhark_mc_task_77174 =
                                 (struct futhark_mc_task_77174 *) args;
    struct futhark_context *ctx = futhark_mc_task_77174->ctx;
    uint64_t futhark_mc_segmap_task_77175_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77175_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_task_77174->free_q_65346;
    int64_t last_res_67981 = futhark_mc_task_77174->free_last_res_67981;
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_task_77174->free_mem_70834, .size =
                                 0, .references =NULL};
    int64_t iter_73970;
    struct futhark_mc_segmap_parloop_struct_77176
    futhark_mc_segmap_parloop_struct_77176;
    
    futhark_mc_segmap_parloop_struct_77176.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77176.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77176.free_last_res_67981 = last_res_67981;
    futhark_mc_segmap_parloop_struct_77176.free_mem_70834 = mem_70834.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77177_task;
    
    futhark_mc_segmap_parloop_77177_task.name =
        "futhark_mc_segmap_parloop_77177";
    futhark_mc_segmap_parloop_77177_task.fn = futhark_mc_segmap_parloop_77177;
    futhark_mc_segmap_parloop_77177_task.args =
        &futhark_mc_segmap_parloop_struct_77176;
    futhark_mc_segmap_parloop_77177_task.iterations = iterations;
    futhark_mc_segmap_parloop_77177_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77177_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77177_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77177_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77177_task);
    
    if (futhark_mc_segmap_parloop_77177_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77177_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77177_total_end -
                 futhark_mc_segmap_parloop_77177_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77177_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77177_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77177_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77175_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77175_end -
                 futhark_mc_segmap_task_77175_start;
        
        ctx->futhark_mc_segmap_task_77175_runs[tid]++;
        ctx->futhark_mc_segmap_task_77175_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77175_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77178 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_67981;
    int64_t free_min_arg_68000;
    int64_t free_min_arg_68001;
    int64_t free_min_res_68002;
    float free_max_res_68006;
    unsigned char *free_mem_70825;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70831;
    unsigned char *free_mem_70834;
    unsigned char *free_mem_70837;
    unsigned char *free_mem_70840;
};
struct futhark_mc_segmap_parloop_struct_77180 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_67981;
    int64_t free_min_arg_68000;
    int64_t free_min_arg_68001;
    int64_t free_min_res_68002;
    float free_max_res_68006;
    unsigned char *free_mem_70825;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70831;
    unsigned char *free_mem_70834;
    unsigned char *free_mem_70837;
    unsigned char *free_mem_70840;
};
static int futhark_mc_segmap_parloop_77181(void *args, int64_t start,
                                           int64_t end, int flat_tid_73752,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77180
    *futhark_mc_segmap_parloop_struct_77180 =
    (struct futhark_mc_segmap_parloop_struct_77180 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77180->ctx;
    uint64_t futhark_mc_segmap_parloop_77181_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77181_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77180->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77180->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77180->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77180->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77180->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77180->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77180->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77180->free_loop_cond_65369;
    int64_t last_res_67981 =
            futhark_mc_segmap_parloop_struct_77180->free_last_res_67981;
    int64_t min_arg_68000 =
            futhark_mc_segmap_parloop_struct_77180->free_min_arg_68000;
    int64_t min_arg_68001 =
            futhark_mc_segmap_parloop_struct_77180->free_min_arg_68001;
    int64_t min_res_68002 =
            futhark_mc_segmap_parloop_struct_77180->free_min_res_68002;
    float max_res_68006 =
          futhark_mc_segmap_parloop_struct_77180->free_max_res_68006;
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_segmap_parloop_struct_77180->free_mem_70825,
                                 .size =0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_segmap_parloop_struct_77180->free_mem_70828,
                                 .size =0, .references =NULL};
    struct memblock mem_70831 = {.desc ="mem_70831", .mem =
                                 futhark_mc_segmap_parloop_struct_77180->free_mem_70831,
                                 .size =0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_segmap_parloop_struct_77180->free_mem_70834,
                                 .size =0, .references =NULL};
    struct memblock mem_70837 = {.desc ="mem_70837", .mem =
                                 futhark_mc_segmap_parloop_struct_77180->free_mem_70837,
                                 .size =0, .references =NULL};
    struct memblock mem_70840 = {.desc ="mem_70840", .mem =
                                 futhark_mc_segmap_parloop_struct_77180->free_mem_70840,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_73974 = start;
    
    for (; iter_73974 < end; iter_73974++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74099 = n_m_65352;
        int64_t gtid_73753 = iter_73974;
        int64_t remnant_74100 = iter_73974 - gtid_73753;
        int64_t min_arg_73754 = mul64(jump_65348, gtid_73753);
        int64_t min_res_73755 = smin64(i_65358, min_arg_73754);
        int64_t defunc_0_g_res_73756 = add64((int64_t) 1, min_res_73755);
        bool init_idx_73757;
        int64_t init_idx_73758;
        int64_t init_idx_73759;
        bool loop_while_73975;
        int64_t low_73976;
        int64_t high_73977;
        
        loop_while_73975 = x_65359;
        low_73976 = (int64_t) 0;
        high_73977 = i_65358;
        while (loop_while_73975) {
            int64_t x_73978 = add64(low_73976, high_73977);
            int64_t mid_73979 = sdiv64(x_73978, (int64_t) 2);
            bool x_73980 = sle64((int64_t) 0, mid_73979);
            bool y_73981 = slt64(mid_73979, n_65344);
            bool bounds_check_73982 = x_73980 && y_73981;
            bool index_certs_73983;
            
            if (!bounds_check_73982) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_73979,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_73984;
            
            mid_id_73984 = ((int64_t *) mem_70831.mem)[mid_73979];
            
            bool cond_73985 = slt64(mid_id_73984, (int64_t) 0);
            int64_t mid_idx_73986;
            
            if (cond_73985) {
                mid_idx_73986 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_73986 = mid_id_73984;
            }
            
            bool cond_73987 = sle64(defunc_0_g_res_73756, mid_idx_73986);
            int64_t loopres_73988;
            int64_t loopres_73989;
            
            if (cond_73987) {
                int64_t loopres_t_res_73990 = sub64(mid_73979, (int64_t) 1);
                
                loopres_73988 = low_73976;
                loopres_73989 = loopres_t_res_73990;
            } else {
                int64_t loopres_f_res_73991 = add64((int64_t) 1, mid_73979);
                
                loopres_73988 = loopres_f_res_73991;
                loopres_73989 = high_73977;
            }
            
            bool loop_cond_73992 = sle64(loopres_73988, loopres_73989);
            bool loop_while_tmp_74101 = loop_cond_73992;
            int64_t low_tmp_74102 = loopres_73988;
            int64_t high_tmp_74103 = loopres_73989;
            
            loop_while_73975 = loop_while_tmp_74101;
            low_73976 = low_tmp_74102;
            high_73977 = high_tmp_74103;
        }
        init_idx_73757 = loop_while_73975;
        init_idx_73758 = low_73976;
        init_idx_73759 = high_73977;
        
        bool idx_73778;
        int64_t idx_73779;
        int64_t idx_73780;
        int64_t idx_73781;
        bool loop_while_73993;
        int64_t l_idx_73994;
        int64_t r_idx_73995;
        int64_t span_73996;
        
        loop_while_73993 = loop_cond_65369;
        l_idx_73994 = init_idx_73758;
        r_idx_73995 = init_idx_73758;
        span_73996 = (int64_t) 1;
        while (loop_while_73993) {
            int64_t max_arg_73997 = sub64(l_idx_73994, (int64_t) 1);
            int64_t max_res_73998 = smax64((int64_t) 0, max_arg_73997);
            int64_t min_arg_73999 = add64((int64_t) 1, r_idx_73995);
            int64_t min_res_74000 = smin64(min_arg_68000, min_arg_73999);
            bool x_74001 = sle64((int64_t) 0, max_res_73998);
            bool y_74002 = slt64(max_res_73998, n_65344);
            bool bounds_check_74003 = x_74001 && y_74002;
            bool index_certs_74004;
            
            if (!bounds_check_74003) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_73998,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74005;
            
            x_74005 = ((int64_t *) mem_70831.mem)[max_res_73998];
            
            int64_t abs_arg_74006 = sub64(x_74005, defunc_0_g_res_73756);
            int64_t abs_res_74007 = abs64(abs_arg_74006);
            bool x_74008 = sle64((int64_t) 0, min_res_74000);
            bool y_74009 = slt64(min_res_74000, n_65344);
            bool bounds_check_74010 = x_74008 && y_74009;
            bool index_certs_74011;
            
            if (!bounds_check_74010) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_74000,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74012;
            
            x_74012 = ((int64_t *) mem_70831.mem)[min_res_74000];
            
            int64_t abs_arg_74013 = sub64(x_74012, defunc_0_g_res_73756);
            int64_t abs_res_74014 = abs64(abs_arg_74013);
            bool cond_74015 = max_res_73998 == l_idx_73994;
            int64_t loopres_74016;
            int64_t loopres_74017;
            int64_t loopres_74018;
            
            if (cond_74015) {
                loopres_74016 = l_idx_73994;
                loopres_74017 = r_idx_73995;
                loopres_74018 = min_res_65364;
            } else {
                bool cond_74019 = slt64(abs_res_74007, abs_res_74014);
                bool cond_f_res_74020 = min_res_74000 == r_idx_73995;
                bool x_74021 = !cond_74019;
                bool y_74022 = cond_f_res_74020 && x_74021;
                bool cond_74023 = cond_74019 || y_74022;
                int64_t loopres_f_res_74024;
                
                if (cond_74023) {
                    loopres_f_res_74024 = max_res_73998;
                } else {
                    loopres_f_res_74024 = l_idx_73994;
                }
                
                int64_t loopres_f_res_74025;
                
                if (cond_74023) {
                    loopres_f_res_74025 = r_idx_73995;
                } else {
                    loopres_f_res_74025 = min_res_74000;
                }
                
                int64_t loopres_f_res_74026;
                
                if (cond_74023) {
                    int64_t loopres_f_res_t_res_74027 = add64((int64_t) 1,
                                                              span_73996);
                    
                    loopres_f_res_74026 = loopres_f_res_t_res_74027;
                } else {
                    int64_t loopres_f_res_f_res_74028 = add64((int64_t) 1,
                                                              span_73996);
                    
                    loopres_f_res_74026 = loopres_f_res_f_res_74028;
                }
                loopres_74016 = loopres_f_res_74024;
                loopres_74017 = loopres_f_res_74025;
                loopres_74018 = loopres_f_res_74026;
            }
            
            bool loop_cond_74029 = slt64(loopres_74018, min_res_65364);
            bool loop_while_tmp_74104 = loop_cond_74029;
            int64_t l_idx_tmp_74105 = loopres_74016;
            int64_t r_idx_tmp_74106 = loopres_74017;
            int64_t span_tmp_74107 = loopres_74018;
            
            loop_while_73993 = loop_while_tmp_74104;
            l_idx_73994 = l_idx_tmp_74105;
            r_idx_73995 = r_idx_tmp_74106;
            span_73996 = span_tmp_74107;
        }
        idx_73778 = loop_while_73993;
        idx_73779 = l_idx_73994;
        idx_73780 = r_idx_73995;
        idx_73781 = span_73996;
        
        int64_t min_res_73819 = smin64(min_arg_68001, idx_73779);
        int64_t max_res_73820 = smax64((int64_t) 0, min_res_73819);
        int64_t x_73821 = add64(min_res_68002, max_res_73820);
        int64_t r_73822 = sub64(x_73821, (int64_t) 1);
        bool x_73823 = sle64((int64_t) 0, r_73822);
        bool y_73824 = slt64(r_73822, n_65344);
        bool bounds_check_73825 = x_73823 && y_73824;
        bool index_certs_73826;
        
        if (!bounds_check_73825) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_73822,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_73827;
        
        x_73827 = ((int64_t *) mem_70828.mem)[r_73822];
        
        int64_t abs_arg_73828 = sub64(x_73827, min_res_73755);
        int64_t abs_res_73829 = abs64(abs_arg_73828);
        bool x_73830 = sle64((int64_t) 0, max_res_73820);
        bool y_73831 = slt64(max_res_73820, n_65344);
        bool bounds_check_73832 = x_73830 && y_73831;
        bool index_certs_73833;
        
        if (!bounds_check_73832) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_73820,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_73834;
        
        x_73834 = ((int64_t *) mem_70828.mem)[max_res_73820];
        
        int64_t abs_arg_73835 = sub64(x_73834, min_res_73755);
        int64_t abs_res_73836 = abs64(abs_arg_73835);
        int64_t max_res_73837 = smax64(abs_res_73829, abs_res_73836);
        float defunc_0_f_res_73838 = sitofp_i64_f32(max_res_73837);
        float defunc_1_f_res_73839 = max_res_68006 + defunc_0_f_res_73838;
        float defunc_2_reduce_res_73840;
        float defunc_2_reduce_res_73841;
        float defunc_2_reduce_res_73842;
        float defunc_2_reduce_res_73843;
        float defunc_2_reduce_res_73844;
        float redout_74031;
        float redout_74032;
        float redout_74033;
        float redout_74034;
        float redout_74035;
        
        redout_74031 = 0.0F;
        redout_74032 = 0.0F;
        redout_74033 = 0.0F;
        redout_74034 = 0.0F;
        redout_74035 = 0.0F;
        for (int64_t i_74030 = 0; i_74030 < q_65346; i_74030++) {
            float x_74036;
            
            x_74036 = ((float *) mem_70834.mem)[i_74030];
            
            bool cond_74037 = sle64(last_res_67981, i_74030);
            int64_t defunc_0_f_res_74038;
            
            if (cond_74037) {
                defunc_0_f_res_74038 = (int64_t) 0;
            } else {
                int64_t i_74039 = add64(max_res_73820, i_74030);
                int64_t defunc_0_add_arg_74040;
                
                defunc_0_add_arg_74040 = ((int64_t *) mem_70828.mem)[i_74039];
                
                int64_t defunc_1_add_res_74041 = add64((int64_t) 1,
                                                       defunc_0_add_arg_74040);
                
                defunc_0_f_res_74038 = defunc_1_add_res_74041;
            }
            
            int64_t binop_p_74042 = sub64(defunc_0_f_res_74038, min_res_73755);
            float defunc_0_f_res_74043 = sitofp_i64_f32(binop_p_74042);
            float abs_res_74044 = (float) fabs(defunc_0_f_res_74043);
            float tmp1_74045 = abs_res_74044 / defunc_1_f_res_73839;
            float x_74046 = tmp1_74045 * tmp1_74045;
            float y_74047 = tmp1_74045 * x_74046;
            float tmp2_74048 = 1.0F - y_74047;
            float x_74049 = tmp2_74048 * tmp2_74048;
            float tmp3_74050 = tmp2_74048 * x_74049;
            float w_j_74051 = x_74036 * tmp3_74050;
            float xw_j_74052 = defunc_0_f_res_74043 * w_j_74051;
            float x2w_j_74053 = defunc_0_f_res_74043 * xw_j_74052;
            float x3w_j_74054 = defunc_0_f_res_74043 * x2w_j_74053;
            float x4w_j_74055 = defunc_0_f_res_74043 * x3w_j_74054;
            float defunc_1_op_res_74056 = w_j_74051 + redout_74031;
            float defunc_1_op_res_74057 = xw_j_74052 + redout_74032;
            float defunc_1_op_res_74058 = x2w_j_74053 + redout_74033;
            float defunc_1_op_res_74059 = x3w_j_74054 + redout_74034;
            float defunc_1_op_res_74060 = x4w_j_74055 + redout_74035;
            float redout_tmp_74108 = defunc_1_op_res_74056;
            float redout_tmp_74109 = defunc_1_op_res_74057;
            float redout_tmp_74110 = defunc_1_op_res_74058;
            float redout_tmp_74111 = defunc_1_op_res_74059;
            float redout_tmp_74112 = defunc_1_op_res_74060;
            
            redout_74031 = redout_tmp_74108;
            redout_74032 = redout_tmp_74109;
            redout_74033 = redout_tmp_74110;
            redout_74034 = redout_tmp_74111;
            redout_74035 = redout_tmp_74112;
        }
        defunc_2_reduce_res_73840 = redout_74031;
        defunc_2_reduce_res_73841 = redout_74032;
        defunc_2_reduce_res_73842 = redout_74033;
        defunc_2_reduce_res_73843 = redout_74034;
        defunc_2_reduce_res_73844 = redout_74035;
        
        float x_73876 = defunc_2_reduce_res_73842 * defunc_2_reduce_res_73844;
        float y_73877 = defunc_2_reduce_res_73843 * defunc_2_reduce_res_73843;
        float a12_73878 = x_73876 - y_73877;
        float x_73879 = defunc_2_reduce_res_73842 * defunc_2_reduce_res_73843;
        float y_73880 = defunc_2_reduce_res_73841 * defunc_2_reduce_res_73844;
        float b12_73881 = x_73879 - y_73880;
        float x_73882 = defunc_2_reduce_res_73841 * defunc_2_reduce_res_73843;
        float y_73883 = defunc_2_reduce_res_73842 * defunc_2_reduce_res_73842;
        float c12_73884 = x_73882 - y_73883;
        float x_73885 = defunc_2_reduce_res_73840 * defunc_2_reduce_res_73844;
        float b2_73886 = x_73885 - y_73883;
        float x_73887 = defunc_2_reduce_res_73841 * defunc_2_reduce_res_73842;
        float y_73888 = defunc_2_reduce_res_73840 * defunc_2_reduce_res_73843;
        float c2_73889 = x_73887 - y_73888;
        float x_73890 = defunc_2_reduce_res_73840 * a12_73878;
        float y_73891 = defunc_2_reduce_res_73841 * b12_73881;
        float x_73892 = x_73890 + y_73891;
        float y_73893 = defunc_2_reduce_res_73842 * c12_73884;
        float y_73894 = x_73892 + y_73893;
        float det_73895 = 1.0F / y_73894;
        float a12_73896 = a12_73878 * det_73895;
        float b12_73897 = b12_73881 * det_73895;
        float c12_73898 = c12_73884 * det_73895;
        float b2_73899 = b2_73886 * det_73895;
        float c2_73900 = c2_73889 * det_73895;
        float defunc_2_reduce_res_73901;
        float defunc_2_reduce_res_73902;
        float redout_74062;
        float redout_74063;
        
        redout_74062 = 0.0F;
        redout_74063 = 0.0F;
        for (int64_t i_74061 = 0; i_74061 < q_65346; i_74061++) {
            float x_74064;
            
            x_74064 = ((float *) mem_70834.mem)[i_74061];
            
            bool cond_74065 = sle64(last_res_67981, i_74061);
            int64_t defunc_0_f_res_74066;
            
            if (cond_74065) {
                defunc_0_f_res_74066 = (int64_t) 0;
            } else {
                int64_t i_74067 = add64(max_res_73820, i_74061);
                int64_t defunc_0_add_arg_74068;
                
                defunc_0_add_arg_74068 = ((int64_t *) mem_70828.mem)[i_74067];
                
                int64_t defunc_1_add_res_74069 = add64((int64_t) 1,
                                                       defunc_0_add_arg_74068);
                
                defunc_0_f_res_74066 = defunc_1_add_res_74069;
            }
            
            int64_t binop_p_74070 = sub64(defunc_0_f_res_74066, min_res_73755);
            float defunc_0_f_res_74071 = sitofp_i64_f32(binop_p_74070);
            float abs_res_74072 = (float) fabs(defunc_0_f_res_74071);
            float tmp1_74073 = abs_res_74072 / defunc_1_f_res_73839;
            float x_74074 = tmp1_74073 * tmp1_74073;
            float y_74075 = tmp1_74073 * x_74074;
            float tmp2_74076 = 1.0F - y_74075;
            float x_74077 = tmp2_74076 * tmp2_74076;
            float tmp3_74078 = tmp2_74076 * x_74077;
            float tmp4_74079 = x_74064 * tmp3_74078;
            float defunc_1_f_res_74080 = defunc_0_f_res_74071 * tmp4_74079;
            float defunc_1_f_res_74081 = defunc_0_f_res_74071 *
                  defunc_1_f_res_74080;
            float defunc_0_f_res_74082;
            
            if (cond_74065) {
                defunc_0_f_res_74082 = 0.0F;
            } else {
                int64_t i_74083 = add64(max_res_73820, i_74061);
                float defunc_0_add_arg_74084;
                
                defunc_0_add_arg_74084 = ((float *) mem_70825.mem)[i_74083];
                defunc_0_f_res_74082 = defunc_0_add_arg_74084;
            }
            
            float x_74085 = a12_73896 * tmp4_74079;
            float y_74086 = b12_73897 * defunc_1_f_res_74080;
            float x_74087 = x_74085 + y_74086;
            float y_74088 = c12_73898 * defunc_1_f_res_74081;
            float x_74089 = x_74087 + y_74088;
            float defunc_9_fit_fun_res_74090 = defunc_0_f_res_74082 * x_74089;
            float x_74091 = b12_73897 * tmp4_74079;
            float y_74092 = b2_73899 * defunc_1_f_res_74080;
            float x_74093 = x_74091 + y_74092;
            float y_74094 = c2_73900 * defunc_1_f_res_74081;
            float x_74095 = x_74093 + y_74094;
            float defunc_9_slope_fun_res_74096 = defunc_0_f_res_74082 * x_74095;
            float defunc_1_op_res_74097 = defunc_9_fit_fun_res_74090 +
                  redout_74062;
            float defunc_1_op_res_74098 = defunc_9_slope_fun_res_74096 +
                  redout_74063;
            float redout_tmp_74113 = defunc_1_op_res_74097;
            float redout_tmp_74114 = defunc_1_op_res_74098;
            
            redout_74062 = redout_tmp_74113;
            redout_74063 = redout_tmp_74114;
        }
        defunc_2_reduce_res_73901 = redout_74062;
        defunc_2_reduce_res_73902 = redout_74063;
        ((float *) mem_70837.mem)[gtid_73753] = defunc_2_reduce_res_73901;
        ((float *) mem_70840.mem)[gtid_73753] = defunc_2_reduce_res_73902;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77181_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77181_end -
                 futhark_mc_segmap_parloop_77181_start;
        
        ctx->futhark_mc_segmap_parloop_77181_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77181_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77181_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77179(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73752 = tid;
    int num_tasks_73973 = info.nsubtasks;
    struct futhark_mc_task_77178 *futhark_mc_task_77178 =
                                 (struct futhark_mc_task_77178 *) args;
    struct futhark_context *ctx = futhark_mc_task_77178->ctx;
    uint64_t futhark_mc_segmap_task_77179_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77179_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77178->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77178->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77178->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77178->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77178->free_i_65358;
    bool x_65359 = futhark_mc_task_77178->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77178->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77178->free_loop_cond_65369;
    int64_t last_res_67981 = futhark_mc_task_77178->free_last_res_67981;
    int64_t min_arg_68000 = futhark_mc_task_77178->free_min_arg_68000;
    int64_t min_arg_68001 = futhark_mc_task_77178->free_min_arg_68001;
    int64_t min_res_68002 = futhark_mc_task_77178->free_min_res_68002;
    float max_res_68006 = futhark_mc_task_77178->free_max_res_68006;
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_task_77178->free_mem_70825, .size =
                                 0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_task_77178->free_mem_70828, .size =
                                 0, .references =NULL};
    struct memblock mem_70831 = {.desc ="mem_70831", .mem =
                                 futhark_mc_task_77178->free_mem_70831, .size =
                                 0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_task_77178->free_mem_70834, .size =
                                 0, .references =NULL};
    struct memblock mem_70837 = {.desc ="mem_70837", .mem =
                                 futhark_mc_task_77178->free_mem_70837, .size =
                                 0, .references =NULL};
    struct memblock mem_70840 = {.desc ="mem_70840", .mem =
                                 futhark_mc_task_77178->free_mem_70840, .size =
                                 0, .references =NULL};
    int64_t iter_73974;
    struct futhark_mc_segmap_parloop_struct_77180
    futhark_mc_segmap_parloop_struct_77180;
    
    futhark_mc_segmap_parloop_struct_77180.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77180.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77180.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77180.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77180.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77180.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77180.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77180.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77180.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77180.free_last_res_67981 = last_res_67981;
    futhark_mc_segmap_parloop_struct_77180.free_min_arg_68000 = min_arg_68000;
    futhark_mc_segmap_parloop_struct_77180.free_min_arg_68001 = min_arg_68001;
    futhark_mc_segmap_parloop_struct_77180.free_min_res_68002 = min_res_68002;
    futhark_mc_segmap_parloop_struct_77180.free_max_res_68006 = max_res_68006;
    futhark_mc_segmap_parloop_struct_77180.free_mem_70825 = mem_70825.mem;
    futhark_mc_segmap_parloop_struct_77180.free_mem_70828 = mem_70828.mem;
    futhark_mc_segmap_parloop_struct_77180.free_mem_70831 = mem_70831.mem;
    futhark_mc_segmap_parloop_struct_77180.free_mem_70834 = mem_70834.mem;
    futhark_mc_segmap_parloop_struct_77180.free_mem_70837 = mem_70837.mem;
    futhark_mc_segmap_parloop_struct_77180.free_mem_70840 = mem_70840.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77181_task;
    
    futhark_mc_segmap_parloop_77181_task.name =
        "futhark_mc_segmap_parloop_77181";
    futhark_mc_segmap_parloop_77181_task.fn = futhark_mc_segmap_parloop_77181;
    futhark_mc_segmap_parloop_77181_task.args =
        &futhark_mc_segmap_parloop_struct_77180;
    futhark_mc_segmap_parloop_77181_task.iterations = iterations;
    futhark_mc_segmap_parloop_77181_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77181_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77181_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77181_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77181_task);
    
    if (futhark_mc_segmap_parloop_77181_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77181_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77181_total_end -
                 futhark_mc_segmap_parloop_77181_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77181_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77181_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77181_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77179_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77179_end -
                 futhark_mc_segmap_task_77179_start;
        
        ctx->futhark_mc_segmap_task_77179_runs[tid]++;
        ctx->futhark_mc_segmap_task_77179_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77179_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77183 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_67981;
    int64_t free_min_arg_68000;
    int64_t free_min_arg_68001;
    int64_t free_min_res_68002;
    float free_max_res_68006;
    unsigned char *free_mem_70825;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70831;
    unsigned char *free_mem_70834;
    unsigned char *free_mem_70837;
    unsigned char *free_mem_70840;
};
struct futhark_mc_task_77185 {
    struct futhark_context *ctx;
    int64_t free_last_res_67981;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70834;
    int64_t free_min_res_73557;
    int64_t free_max_res_73622;
    float free_defunc_1_f_res_73641;
    float *retval_defunc_2_reduce_res_73642;
    float *retval_defunc_2_reduce_res_73643;
    float *retval_defunc_2_reduce_res_73644;
    float *retval_defunc_2_reduce_res_73645;
    float *retval_defunc_2_reduce_res_73646;
};
struct futhark_mc_segred_stage_1_parloop_struct_77192 {
    struct futhark_context *ctx;
    int64_t free_last_res_67981;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70834;
    int64_t free_min_res_73557;
    int64_t free_max_res_73622;
    float free_defunc_1_f_res_73641;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74259;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74261;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74263;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74265;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74267;
};
static int futhark_mc_segred_stage_1_parloop_77193(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_74171, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77192
    *futhark_mc_segred_stage_1_parloop_struct_77192 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77192 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77192->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77193_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77193_start = get_wall_time();
    
    int64_t last_res_67981 =
            futhark_mc_segred_stage_1_parloop_struct_77192->free_last_res_67981;
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77192->free_mem_70828,
                                 .size =0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77192->free_mem_70834,
                                 .size =0, .references =NULL};
    int64_t min_res_73557 =
            futhark_mc_segred_stage_1_parloop_struct_77192->free_min_res_73557;
    int64_t max_res_73622 =
            futhark_mc_segred_stage_1_parloop_struct_77192->free_max_res_73622;
    float defunc_1_f_res_73641 =
          futhark_mc_segred_stage_1_parloop_struct_77192->free_defunc_1_f_res_73641;
    struct memblock reduce_stage_1_tid_res_arr_mem_74259 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74259",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77192->free_reduce_stage_1_tid_res_arr_mem_74259,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_74261 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74261",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77192->free_reduce_stage_1_tid_res_arr_mem_74261,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_74263 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74263",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77192->free_reduce_stage_1_tid_res_arr_mem_74263,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_74265 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74265",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77192->free_reduce_stage_1_tid_res_arr_mem_74265,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_74267 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74267",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77192->free_reduce_stage_1_tid_res_arr_mem_74267,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74269 = start;
    float x_74173;
    float x_74174;
    float x_74176;
    float x_74177;
    float x_74179;
    float x_74180;
    float x_74182;
    float x_74183;
    float x_74185;
    float x_74186;
    float local_acc_74270 = 0.0F;
    float local_acc_74271 = 0.0F;
    float local_acc_74272 = 0.0F;
    float local_acc_74273 = 0.0F;
    float local_acc_74274 = 0.0F;
    
    for (; iter_74269 < end; iter_74269++) {
        int64_t gtid_74172 = iter_74269;
        float x_74188;
        
        x_74188 = ((float *) mem_70834.mem)[gtid_74172];
        
        bool cond_74189 = sle64(last_res_67981, gtid_74172);
        int64_t defunc_0_f_res_74190;
        
        if (cond_74189) {
            defunc_0_f_res_74190 = (int64_t) 0;
        } else {
            int64_t i_74191 = add64(max_res_73622, gtid_74172);
            int64_t defunc_0_add_arg_74192;
            
            defunc_0_add_arg_74192 = ((int64_t *) mem_70828.mem)[i_74191];
            
            int64_t defunc_1_add_res_74193 = add64((int64_t) 1,
                                                   defunc_0_add_arg_74192);
            
            defunc_0_f_res_74190 = defunc_1_add_res_74193;
        }
        
        int64_t binop_p_74194 = sub64(defunc_0_f_res_74190, min_res_73557);
        float defunc_0_f_res_74195 = sitofp_i64_f32(binop_p_74194);
        float abs_res_74196 = (float) fabs(defunc_0_f_res_74195);
        float tmp1_74197 = abs_res_74196 / defunc_1_f_res_73641;
        float x_74198 = tmp1_74197 * tmp1_74197;
        float y_74199 = tmp1_74197 * x_74198;
        float tmp2_74200 = 1.0F - y_74199;
        float x_74201 = tmp2_74200 * tmp2_74200;
        float tmp3_74202 = tmp2_74200 * x_74201;
        float w_j_74203 = x_74188 * tmp3_74202;
        float xw_j_74204 = defunc_0_f_res_74195 * w_j_74203;
        float x2w_j_74205 = defunc_0_f_res_74195 * xw_j_74204;
        float x3w_j_74206 = defunc_0_f_res_74195 * x2w_j_74205;
        float x4w_j_74207 = defunc_0_f_res_74195 * x3w_j_74206;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_74173 = local_acc_74270;
        }
        // Load next params
        {
            x_74174 = w_j_74203;
        }
        // Red body
        {
            float defunc_1_op_res_74175 = x_74173 + x_74174;
            
            local_acc_74270 = defunc_1_op_res_74175;
        }
        // Load accum params
        {
            x_74176 = local_acc_74271;
        }
        // Load next params
        {
            x_74177 = xw_j_74204;
        }
        // Red body
        {
            float defunc_1_op_res_74178 = x_74176 + x_74177;
            
            local_acc_74271 = defunc_1_op_res_74178;
        }
        // Load accum params
        {
            x_74179 = local_acc_74272;
        }
        // Load next params
        {
            x_74180 = x2w_j_74205;
        }
        // Red body
        {
            float defunc_1_op_res_74181 = x_74179 + x_74180;
            
            local_acc_74272 = defunc_1_op_res_74181;
        }
        // Load accum params
        {
            x_74182 = local_acc_74273;
        }
        // Load next params
        {
            x_74183 = x3w_j_74206;
        }
        // Red body
        {
            float defunc_1_op_res_74184 = x_74182 + x_74183;
            
            local_acc_74273 = defunc_1_op_res_74184;
        }
        // Load accum params
        {
            x_74185 = local_acc_74274;
        }
        // Load next params
        {
            x_74186 = x4w_j_74207;
        }
        // Red body
        {
            float defunc_1_op_res_74187 = x_74185 + x_74186;
            
            local_acc_74274 = defunc_1_op_res_74187;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_74259.mem)[flat_tid_74171] =
        local_acc_74270;
    ((float *) reduce_stage_1_tid_res_arr_mem_74261.mem)[flat_tid_74171] =
        local_acc_74271;
    ((float *) reduce_stage_1_tid_res_arr_mem_74263.mem)[flat_tid_74171] =
        local_acc_74272;
    ((float *) reduce_stage_1_tid_res_arr_mem_74265.mem)[flat_tid_74171] =
        local_acc_74273;
    ((float *) reduce_stage_1_tid_res_arr_mem_74267.mem)[flat_tid_74171] =
        local_acc_74274;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77193_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77193_end -
                 futhark_mc_segred_stage_1_parloop_77193_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77193_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77193_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77193_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77186(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74171 = tid;
    int num_tasks_74258 = info.nsubtasks;
    struct futhark_mc_task_77185 *futhark_mc_task_77185 =
                                 (struct futhark_mc_task_77185 *) args;
    struct futhark_context *ctx = futhark_mc_task_77185->ctx;
    uint64_t futhark_mc_segred_task_77186_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77186_start = get_wall_time();
    
    int64_t last_res_67981 = futhark_mc_task_77185->free_last_res_67981;
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_task_77185->free_mem_70828, .size =
                                 0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_task_77185->free_mem_70834, .size =
                                 0, .references =NULL};
    int64_t min_res_73557 = futhark_mc_task_77185->free_min_res_73557;
    int64_t max_res_73622 = futhark_mc_task_77185->free_max_res_73622;
    float defunc_1_f_res_73641 =
          futhark_mc_task_77185->free_defunc_1_f_res_73641;
    float defunc_2_reduce_res_73642 =
          *futhark_mc_task_77185->retval_defunc_2_reduce_res_73642;
    float defunc_2_reduce_res_73643 =
          *futhark_mc_task_77185->retval_defunc_2_reduce_res_73643;
    float defunc_2_reduce_res_73644 =
          *futhark_mc_task_77185->retval_defunc_2_reduce_res_73644;
    float defunc_2_reduce_res_73645 =
          *futhark_mc_task_77185->retval_defunc_2_reduce_res_73645;
    float defunc_2_reduce_res_73646 =
          *futhark_mc_task_77185->retval_defunc_2_reduce_res_73646;
    size_t reduce_stage_1_tid_res_arr_mem_74259_cached_sizze_77187 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74259 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_74261_cached_sizze_77188 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74261 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_74263_cached_sizze_77189 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74263 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_74265_cached_sizze_77190 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74265 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_74267_cached_sizze_77191 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74267 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_74259_cached_sizze_77187 <
        (size_t) ((int64_t) 4 * num_tasks_74258)) {
        reduce_stage_1_tid_res_arr_mem_74259 =
            realloc(reduce_stage_1_tid_res_arr_mem_74259, (int64_t) 4 *
                    num_tasks_74258);
        reduce_stage_1_tid_res_arr_mem_74259_cached_sizze_77187 = (int64_t) 4 *
            num_tasks_74258;
    }
    if (reduce_stage_1_tid_res_arr_mem_74261_cached_sizze_77188 <
        (size_t) ((int64_t) 4 * num_tasks_74258)) {
        reduce_stage_1_tid_res_arr_mem_74261 =
            realloc(reduce_stage_1_tid_res_arr_mem_74261, (int64_t) 4 *
                    num_tasks_74258);
        reduce_stage_1_tid_res_arr_mem_74261_cached_sizze_77188 = (int64_t) 4 *
            num_tasks_74258;
    }
    if (reduce_stage_1_tid_res_arr_mem_74263_cached_sizze_77189 <
        (size_t) ((int64_t) 4 * num_tasks_74258)) {
        reduce_stage_1_tid_res_arr_mem_74263 =
            realloc(reduce_stage_1_tid_res_arr_mem_74263, (int64_t) 4 *
                    num_tasks_74258);
        reduce_stage_1_tid_res_arr_mem_74263_cached_sizze_77189 = (int64_t) 4 *
            num_tasks_74258;
    }
    if (reduce_stage_1_tid_res_arr_mem_74265_cached_sizze_77190 <
        (size_t) ((int64_t) 4 * num_tasks_74258)) {
        reduce_stage_1_tid_res_arr_mem_74265 =
            realloc(reduce_stage_1_tid_res_arr_mem_74265, (int64_t) 4 *
                    num_tasks_74258);
        reduce_stage_1_tid_res_arr_mem_74265_cached_sizze_77190 = (int64_t) 4 *
            num_tasks_74258;
    }
    if (reduce_stage_1_tid_res_arr_mem_74267_cached_sizze_77191 <
        (size_t) ((int64_t) 4 * num_tasks_74258)) {
        reduce_stage_1_tid_res_arr_mem_74267 =
            realloc(reduce_stage_1_tid_res_arr_mem_74267, (int64_t) 4 *
                    num_tasks_74258);
        reduce_stage_1_tid_res_arr_mem_74267_cached_sizze_77191 = (int64_t) 4 *
            num_tasks_74258;
    }
    
    int64_t iter_74269;
    struct futhark_mc_segred_stage_1_parloop_struct_77192
    futhark_mc_segred_stage_1_parloop_struct_77192;
    
    futhark_mc_segred_stage_1_parloop_struct_77192.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_last_res_67981 =
        last_res_67981;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_mem_70828 =
        mem_70828.mem;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_mem_70834 =
        mem_70834.mem;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_min_res_73557 =
        min_res_73557;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_max_res_73622 =
        max_res_73622;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_defunc_1_f_res_73641 =
        defunc_1_f_res_73641;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_reduce_stage_1_tid_res_arr_mem_74259 =
        reduce_stage_1_tid_res_arr_mem_74259;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_reduce_stage_1_tid_res_arr_mem_74261 =
        reduce_stage_1_tid_res_arr_mem_74261;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_reduce_stage_1_tid_res_arr_mem_74263 =
        reduce_stage_1_tid_res_arr_mem_74263;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_reduce_stage_1_tid_res_arr_mem_74265 =
        reduce_stage_1_tid_res_arr_mem_74265;
    futhark_mc_segred_stage_1_parloop_struct_77192.free_reduce_stage_1_tid_res_arr_mem_74267 =
        reduce_stage_1_tid_res_arr_mem_74267;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77193_task;
    
    futhark_mc_segred_stage_1_parloop_77193_task.name =
        "futhark_mc_segred_stage_1_parloop_77193";
    futhark_mc_segred_stage_1_parloop_77193_task.fn =
        futhark_mc_segred_stage_1_parloop_77193;
    futhark_mc_segred_stage_1_parloop_77193_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77192;
    futhark_mc_segred_stage_1_parloop_77193_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77193_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77193_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77193_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77193_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77193_task);
    
    if (futhark_mc_segred_stage_1_parloop_77193_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77193_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77193_total_end -
                 futhark_mc_segred_stage_1_parloop_77193_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77193_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77193_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77193_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_73642 = 0.0F;
        defunc_2_reduce_res_73643 = 0.0F;
        defunc_2_reduce_res_73644 = 0.0F;
        defunc_2_reduce_res_73645 = 0.0F;
        defunc_2_reduce_res_73646 = 0.0F;
    }
    
    float x_74275;
    float x_74276;
    float x_74278;
    float x_74279;
    float x_74281;
    float x_74282;
    float x_74284;
    float x_74285;
    float x_74287;
    float x_74288;
    
    for (int32_t i_74290 = 0; i_74290 < num_tasks_74258; i_74290++) {
        flat_tid_74171 = i_74290;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_74275 = defunc_2_reduce_res_73642;
            }
            // load next params
            {
                x_74276 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74259)[flat_tid_74171];
            }
            // red body
            {
                float defunc_1_op_res_74277 = x_74275 + x_74276;
                
                defunc_2_reduce_res_73642 = defunc_1_op_res_74277;
            }
            // load acc params
            {
                x_74278 = defunc_2_reduce_res_73643;
            }
            // load next params
            {
                x_74279 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74261)[flat_tid_74171];
            }
            // red body
            {
                float defunc_1_op_res_74280 = x_74278 + x_74279;
                
                defunc_2_reduce_res_73643 = defunc_1_op_res_74280;
            }
            // load acc params
            {
                x_74281 = defunc_2_reduce_res_73644;
            }
            // load next params
            {
                x_74282 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74263)[flat_tid_74171];
            }
            // red body
            {
                float defunc_1_op_res_74283 = x_74281 + x_74282;
                
                defunc_2_reduce_res_73644 = defunc_1_op_res_74283;
            }
            // load acc params
            {
                x_74284 = defunc_2_reduce_res_73645;
            }
            // load next params
            {
                x_74285 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74265)[flat_tid_74171];
            }
            // red body
            {
                float defunc_1_op_res_74286 = x_74284 + x_74285;
                
                defunc_2_reduce_res_73645 = defunc_1_op_res_74286;
            }
            // load acc params
            {
                x_74287 = defunc_2_reduce_res_73646;
            }
            // load next params
            {
                x_74288 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74267)[flat_tid_74171];
            }
            // red body
            {
                float defunc_1_op_res_74289 = x_74287 + x_74288;
                
                defunc_2_reduce_res_73646 = defunc_1_op_res_74289;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_74259);
        free(reduce_stage_1_tid_res_arr_mem_74261);
        free(reduce_stage_1_tid_res_arr_mem_74263);
        free(reduce_stage_1_tid_res_arr_mem_74265);
        free(reduce_stage_1_tid_res_arr_mem_74267);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77186_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77186_end -
                 futhark_mc_segred_task_77186_start;
        
        ctx->futhark_mc_segred_task_77186_runs[tid]++;
        ctx->futhark_mc_segred_task_77186_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77186_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77185->retval_defunc_2_reduce_res_73642 =
            defunc_2_reduce_res_73642;
        *futhark_mc_task_77185->retval_defunc_2_reduce_res_73643 =
            defunc_2_reduce_res_73643;
        *futhark_mc_task_77185->retval_defunc_2_reduce_res_73644 =
            defunc_2_reduce_res_73644;
        *futhark_mc_task_77185->retval_defunc_2_reduce_res_73645 =
            defunc_2_reduce_res_73645;
        *futhark_mc_task_77185->retval_defunc_2_reduce_res_73646 =
            defunc_2_reduce_res_73646;
    }
    return err;
}
struct futhark_mc_task_77194 {
    struct futhark_context *ctx;
    int64_t free_last_res_67981;
    unsigned char *free_mem_70825;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70834;
    int64_t free_min_res_73557;
    int64_t free_max_res_73622;
    float free_defunc_1_f_res_73641;
    float free_a12_73704;
    float free_b12_73705;
    float free_c12_73706;
    float free_b2_73707;
    float free_c2_73708;
    float *retval_defunc_2_reduce_res_73709;
    float *retval_defunc_2_reduce_res_73710;
};
struct futhark_mc_segred_stage_1_parloop_struct_77198 {
    struct futhark_context *ctx;
    int64_t free_last_res_67981;
    unsigned char *free_mem_70825;
    unsigned char *free_mem_70828;
    unsigned char *free_mem_70834;
    int64_t free_min_res_73557;
    int64_t free_max_res_73622;
    float free_defunc_1_f_res_73641;
    float free_a12_73704;
    float free_b12_73705;
    float free_c12_73706;
    float free_b2_73707;
    float free_c2_73708;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74292;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74294;
};
static int futhark_mc_segred_stage_1_parloop_77199(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_74208, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77198
    *futhark_mc_segred_stage_1_parloop_struct_77198 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77198 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77198->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77199_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77199_start = get_wall_time();
    
    int64_t last_res_67981 =
            futhark_mc_segred_stage_1_parloop_struct_77198->free_last_res_67981;
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77198->free_mem_70825,
                                 .size =0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77198->free_mem_70828,
                                 .size =0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77198->free_mem_70834,
                                 .size =0, .references =NULL};
    int64_t min_res_73557 =
            futhark_mc_segred_stage_1_parloop_struct_77198->free_min_res_73557;
    int64_t max_res_73622 =
            futhark_mc_segred_stage_1_parloop_struct_77198->free_max_res_73622;
    float defunc_1_f_res_73641 =
          futhark_mc_segred_stage_1_parloop_struct_77198->free_defunc_1_f_res_73641;
    float a12_73704 =
          futhark_mc_segred_stage_1_parloop_struct_77198->free_a12_73704;
    float b12_73705 =
          futhark_mc_segred_stage_1_parloop_struct_77198->free_b12_73705;
    float c12_73706 =
          futhark_mc_segred_stage_1_parloop_struct_77198->free_c12_73706;
    float b2_73707 =
          futhark_mc_segred_stage_1_parloop_struct_77198->free_b2_73707;
    float c2_73708 =
          futhark_mc_segred_stage_1_parloop_struct_77198->free_c2_73708;
    struct memblock reduce_stage_1_tid_res_arr_mem_74292 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74292",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77198->free_reduce_stage_1_tid_res_arr_mem_74292,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_74294 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74294",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77198->free_reduce_stage_1_tid_res_arr_mem_74294,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74296 = start;
    float x_74210;
    float x_74211;
    float x_74213;
    float x_74214;
    float local_acc_74297 = 0.0F;
    float local_acc_74298 = 0.0F;
    
    for (; iter_74296 < end; iter_74296++) {
        int64_t gtid_74209 = iter_74296;
        float x_74216;
        
        x_74216 = ((float *) mem_70834.mem)[gtid_74209];
        
        bool cond_74217 = sle64(last_res_67981, gtid_74209);
        int64_t defunc_0_f_res_74218;
        
        if (cond_74217) {
            defunc_0_f_res_74218 = (int64_t) 0;
        } else {
            int64_t i_74219 = add64(max_res_73622, gtid_74209);
            int64_t defunc_0_add_arg_74220;
            
            defunc_0_add_arg_74220 = ((int64_t *) mem_70828.mem)[i_74219];
            
            int64_t defunc_1_add_res_74221 = add64((int64_t) 1,
                                                   defunc_0_add_arg_74220);
            
            defunc_0_f_res_74218 = defunc_1_add_res_74221;
        }
        
        int64_t binop_p_74222 = sub64(defunc_0_f_res_74218, min_res_73557);
        float defunc_0_f_res_74223 = sitofp_i64_f32(binop_p_74222);
        float abs_res_74224 = (float) fabs(defunc_0_f_res_74223);
        float tmp1_74225 = abs_res_74224 / defunc_1_f_res_73641;
        float x_74226 = tmp1_74225 * tmp1_74225;
        float y_74227 = tmp1_74225 * x_74226;
        float tmp2_74228 = 1.0F - y_74227;
        float x_74229 = tmp2_74228 * tmp2_74228;
        float tmp3_74230 = tmp2_74228 * x_74229;
        float tmp4_74231 = x_74216 * tmp3_74230;
        float defunc_1_f_res_74232 = defunc_0_f_res_74223 * tmp4_74231;
        float defunc_1_f_res_74233 = defunc_0_f_res_74223 *
              defunc_1_f_res_74232;
        float defunc_0_f_res_74234;
        
        if (cond_74217) {
            defunc_0_f_res_74234 = 0.0F;
        } else {
            int64_t i_74235 = add64(max_res_73622, gtid_74209);
            float defunc_0_add_arg_74236;
            
            defunc_0_add_arg_74236 = ((float *) mem_70825.mem)[i_74235];
            defunc_0_f_res_74234 = defunc_0_add_arg_74236;
        }
        
        float x_74237 = a12_73704 * tmp4_74231;
        float y_74238 = b12_73705 * defunc_1_f_res_74232;
        float x_74239 = x_74237 + y_74238;
        float y_74240 = c12_73706 * defunc_1_f_res_74233;
        float x_74241 = x_74239 + y_74240;
        float defunc_9_fit_fun_res_74242 = defunc_0_f_res_74234 * x_74241;
        float x_74243 = b12_73705 * tmp4_74231;
        float y_74244 = b2_73707 * defunc_1_f_res_74232;
        float x_74245 = x_74243 + y_74244;
        float y_74246 = c2_73708 * defunc_1_f_res_74233;
        float x_74247 = x_74245 + y_74246;
        float defunc_9_slope_fun_res_74248 = defunc_0_f_res_74234 * x_74247;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_74210 = local_acc_74297;
        }
        // Load next params
        {
            x_74211 = defunc_9_fit_fun_res_74242;
        }
        // Red body
        {
            float defunc_1_op_res_74212 = x_74210 + x_74211;
            
            local_acc_74297 = defunc_1_op_res_74212;
        }
        // Load accum params
        {
            x_74213 = local_acc_74298;
        }
        // Load next params
        {
            x_74214 = defunc_9_slope_fun_res_74248;
        }
        // Red body
        {
            float defunc_1_op_res_74215 = x_74213 + x_74214;
            
            local_acc_74298 = defunc_1_op_res_74215;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_74292.mem)[flat_tid_74208] =
        local_acc_74297;
    ((float *) reduce_stage_1_tid_res_arr_mem_74294.mem)[flat_tid_74208] =
        local_acc_74298;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77199_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77199_end -
                 futhark_mc_segred_stage_1_parloop_77199_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77199_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77199_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77199_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77195(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74208 = tid;
    int num_tasks_74291 = info.nsubtasks;
    struct futhark_mc_task_77194 *futhark_mc_task_77194 =
                                 (struct futhark_mc_task_77194 *) args;
    struct futhark_context *ctx = futhark_mc_task_77194->ctx;
    uint64_t futhark_mc_segred_task_77195_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77195_start = get_wall_time();
    
    int64_t last_res_67981 = futhark_mc_task_77194->free_last_res_67981;
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_task_77194->free_mem_70825, .size =
                                 0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_task_77194->free_mem_70828, .size =
                                 0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_task_77194->free_mem_70834, .size =
                                 0, .references =NULL};
    int64_t min_res_73557 = futhark_mc_task_77194->free_min_res_73557;
    int64_t max_res_73622 = futhark_mc_task_77194->free_max_res_73622;
    float defunc_1_f_res_73641 =
          futhark_mc_task_77194->free_defunc_1_f_res_73641;
    float a12_73704 = futhark_mc_task_77194->free_a12_73704;
    float b12_73705 = futhark_mc_task_77194->free_b12_73705;
    float c12_73706 = futhark_mc_task_77194->free_c12_73706;
    float b2_73707 = futhark_mc_task_77194->free_b2_73707;
    float c2_73708 = futhark_mc_task_77194->free_c2_73708;
    float defunc_2_reduce_res_73709 =
          *futhark_mc_task_77194->retval_defunc_2_reduce_res_73709;
    float defunc_2_reduce_res_73710 =
          *futhark_mc_task_77194->retval_defunc_2_reduce_res_73710;
    size_t reduce_stage_1_tid_res_arr_mem_74292_cached_sizze_77196 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74292 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_74294_cached_sizze_77197 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74294 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_74292_cached_sizze_77196 <
        (size_t) ((int64_t) 4 * num_tasks_74291)) {
        reduce_stage_1_tid_res_arr_mem_74292 =
            realloc(reduce_stage_1_tid_res_arr_mem_74292, (int64_t) 4 *
                    num_tasks_74291);
        reduce_stage_1_tid_res_arr_mem_74292_cached_sizze_77196 = (int64_t) 4 *
            num_tasks_74291;
    }
    if (reduce_stage_1_tid_res_arr_mem_74294_cached_sizze_77197 <
        (size_t) ((int64_t) 4 * num_tasks_74291)) {
        reduce_stage_1_tid_res_arr_mem_74294 =
            realloc(reduce_stage_1_tid_res_arr_mem_74294, (int64_t) 4 *
                    num_tasks_74291);
        reduce_stage_1_tid_res_arr_mem_74294_cached_sizze_77197 = (int64_t) 4 *
            num_tasks_74291;
    }
    
    int64_t iter_74296;
    struct futhark_mc_segred_stage_1_parloop_struct_77198
    futhark_mc_segred_stage_1_parloop_struct_77198;
    
    futhark_mc_segred_stage_1_parloop_struct_77198.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_last_res_67981 =
        last_res_67981;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_mem_70825 =
        mem_70825.mem;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_mem_70828 =
        mem_70828.mem;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_mem_70834 =
        mem_70834.mem;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_min_res_73557 =
        min_res_73557;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_max_res_73622 =
        max_res_73622;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_defunc_1_f_res_73641 =
        defunc_1_f_res_73641;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_a12_73704 = a12_73704;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_b12_73705 = b12_73705;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_c12_73706 = c12_73706;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_b2_73707 = b2_73707;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_c2_73708 = c2_73708;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_reduce_stage_1_tid_res_arr_mem_74292 =
        reduce_stage_1_tid_res_arr_mem_74292;
    futhark_mc_segred_stage_1_parloop_struct_77198.free_reduce_stage_1_tid_res_arr_mem_74294 =
        reduce_stage_1_tid_res_arr_mem_74294;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77199_task;
    
    futhark_mc_segred_stage_1_parloop_77199_task.name =
        "futhark_mc_segred_stage_1_parloop_77199";
    futhark_mc_segred_stage_1_parloop_77199_task.fn =
        futhark_mc_segred_stage_1_parloop_77199;
    futhark_mc_segred_stage_1_parloop_77199_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77198;
    futhark_mc_segred_stage_1_parloop_77199_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77199_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77199_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77199_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77199_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77199_task);
    
    if (futhark_mc_segred_stage_1_parloop_77199_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77199_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77199_total_end -
                 futhark_mc_segred_stage_1_parloop_77199_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77199_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77199_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77199_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_73709 = 0.0F;
        defunc_2_reduce_res_73710 = 0.0F;
    }
    
    float x_74299;
    float x_74300;
    float x_74302;
    float x_74303;
    
    for (int32_t i_74305 = 0; i_74305 < num_tasks_74291; i_74305++) {
        flat_tid_74208 = i_74305;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_74299 = defunc_2_reduce_res_73709;
            }
            // load next params
            {
                x_74300 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74292)[flat_tid_74208];
            }
            // red body
            {
                float defunc_1_op_res_74301 = x_74299 + x_74300;
                
                defunc_2_reduce_res_73709 = defunc_1_op_res_74301;
            }
            // load acc params
            {
                x_74302 = defunc_2_reduce_res_73710;
            }
            // load next params
            {
                x_74303 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74294)[flat_tid_74208];
            }
            // red body
            {
                float defunc_1_op_res_74304 = x_74302 + x_74303;
                
                defunc_2_reduce_res_73710 = defunc_1_op_res_74304;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_74292);
        free(reduce_stage_1_tid_res_arr_mem_74294);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77195_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77195_end -
                 futhark_mc_segred_task_77195_start;
        
        ctx->futhark_mc_segred_task_77195_runs[tid]++;
        ctx->futhark_mc_segred_task_77195_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77195_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77194->retval_defunc_2_reduce_res_73709 =
            defunc_2_reduce_res_73709;
        *futhark_mc_task_77194->retval_defunc_2_reduce_res_73710 =
            defunc_2_reduce_res_73710;
    }
    return err;
}
static int futhark_mc_segmap_parloop_77184(void *args, int64_t start,
                                           int64_t end, int flat_tid_73554,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77183
    *futhark_mc_segmap_parloop_struct_77183 =
    (struct futhark_mc_segmap_parloop_struct_77183 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77183->ctx;
    uint64_t futhark_mc_segmap_parloop_77184_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77184_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77183->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77183->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77183->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77183->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77183->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77183->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77183->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77183->free_loop_cond_65369;
    int64_t last_res_67981 =
            futhark_mc_segmap_parloop_struct_77183->free_last_res_67981;
    int64_t min_arg_68000 =
            futhark_mc_segmap_parloop_struct_77183->free_min_arg_68000;
    int64_t min_arg_68001 =
            futhark_mc_segmap_parloop_struct_77183->free_min_arg_68001;
    int64_t min_res_68002 =
            futhark_mc_segmap_parloop_struct_77183->free_min_res_68002;
    float max_res_68006 =
          futhark_mc_segmap_parloop_struct_77183->free_max_res_68006;
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_segmap_parloop_struct_77183->free_mem_70825,
                                 .size =0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_segmap_parloop_struct_77183->free_mem_70828,
                                 .size =0, .references =NULL};
    struct memblock mem_70831 = {.desc ="mem_70831", .mem =
                                 futhark_mc_segmap_parloop_struct_77183->free_mem_70831,
                                 .size =0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_segmap_parloop_struct_77183->free_mem_70834,
                                 .size =0, .references =NULL};
    struct memblock mem_70837 = {.desc ="mem_70837", .mem =
                                 futhark_mc_segmap_parloop_struct_77183->free_mem_70837,
                                 .size =0, .references =NULL};
    struct memblock mem_70840 = {.desc ="mem_70840", .mem =
                                 futhark_mc_segmap_parloop_struct_77183->free_mem_70840,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74115 = start;
    
    for (; iter_74115 < end; iter_74115++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74249 = n_m_65352;
        int64_t gtid_73555 = iter_74115;
        int64_t remnant_74250 = iter_74115 - gtid_73555;
        int64_t min_arg_73556 = mul64(jump_65348, gtid_73555);
        int64_t min_res_73557 = smin64(i_65358, min_arg_73556);
        int64_t defunc_0_g_res_73558 = add64((int64_t) 1, min_res_73557);
        bool init_idx_73559;
        int64_t init_idx_73560;
        int64_t init_idx_73561;
        bool loop_while_74116;
        int64_t low_74117;
        int64_t high_74118;
        
        loop_while_74116 = x_65359;
        low_74117 = (int64_t) 0;
        high_74118 = i_65358;
        while (loop_while_74116) {
            int64_t x_74119 = add64(low_74117, high_74118);
            int64_t mid_74120 = sdiv64(x_74119, (int64_t) 2);
            bool x_74121 = sle64((int64_t) 0, mid_74120);
            bool y_74122 = slt64(mid_74120, n_65344);
            bool bounds_check_74123 = x_74121 && y_74122;
            bool index_certs_74124;
            
            if (!bounds_check_74123) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_74120,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_74125;
            
            mid_id_74125 = ((int64_t *) mem_70831.mem)[mid_74120];
            
            bool cond_74126 = slt64(mid_id_74125, (int64_t) 0);
            int64_t mid_idx_74127;
            
            if (cond_74126) {
                mid_idx_74127 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_74127 = mid_id_74125;
            }
            
            bool cond_74128 = sle64(defunc_0_g_res_73558, mid_idx_74127);
            int64_t loopres_74129;
            int64_t loopres_74130;
            
            if (cond_74128) {
                int64_t loopres_t_res_74131 = sub64(mid_74120, (int64_t) 1);
                
                loopres_74129 = low_74117;
                loopres_74130 = loopres_t_res_74131;
            } else {
                int64_t loopres_f_res_74132 = add64((int64_t) 1, mid_74120);
                
                loopres_74129 = loopres_f_res_74132;
                loopres_74130 = high_74118;
            }
            
            bool loop_cond_74133 = sle64(loopres_74129, loopres_74130);
            bool loop_while_tmp_74251 = loop_cond_74133;
            int64_t low_tmp_74252 = loopres_74129;
            int64_t high_tmp_74253 = loopres_74130;
            
            loop_while_74116 = loop_while_tmp_74251;
            low_74117 = low_tmp_74252;
            high_74118 = high_tmp_74253;
        }
        init_idx_73559 = loop_while_74116;
        init_idx_73560 = low_74117;
        init_idx_73561 = high_74118;
        
        bool idx_73580;
        int64_t idx_73581;
        int64_t idx_73582;
        int64_t idx_73583;
        bool loop_while_74134;
        int64_t l_idx_74135;
        int64_t r_idx_74136;
        int64_t span_74137;
        
        loop_while_74134 = loop_cond_65369;
        l_idx_74135 = init_idx_73560;
        r_idx_74136 = init_idx_73560;
        span_74137 = (int64_t) 1;
        while (loop_while_74134) {
            int64_t max_arg_74138 = sub64(l_idx_74135, (int64_t) 1);
            int64_t max_res_74139 = smax64((int64_t) 0, max_arg_74138);
            int64_t min_arg_74140 = add64((int64_t) 1, r_idx_74136);
            int64_t min_res_74141 = smin64(min_arg_68000, min_arg_74140);
            bool x_74142 = sle64((int64_t) 0, max_res_74139);
            bool y_74143 = slt64(max_res_74139, n_65344);
            bool bounds_check_74144 = x_74142 && y_74143;
            bool index_certs_74145;
            
            if (!bounds_check_74144) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_74139,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74146;
            
            x_74146 = ((int64_t *) mem_70831.mem)[max_res_74139];
            
            int64_t abs_arg_74147 = sub64(x_74146, defunc_0_g_res_73558);
            int64_t abs_res_74148 = abs64(abs_arg_74147);
            bool x_74149 = sle64((int64_t) 0, min_res_74141);
            bool y_74150 = slt64(min_res_74141, n_65344);
            bool bounds_check_74151 = x_74149 && y_74150;
            bool index_certs_74152;
            
            if (!bounds_check_74151) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_74141,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74153;
            
            x_74153 = ((int64_t *) mem_70831.mem)[min_res_74141];
            
            int64_t abs_arg_74154 = sub64(x_74153, defunc_0_g_res_73558);
            int64_t abs_res_74155 = abs64(abs_arg_74154);
            bool cond_74156 = max_res_74139 == l_idx_74135;
            int64_t loopres_74157;
            int64_t loopres_74158;
            int64_t loopres_74159;
            
            if (cond_74156) {
                loopres_74157 = l_idx_74135;
                loopres_74158 = r_idx_74136;
                loopres_74159 = min_res_65364;
            } else {
                bool cond_74160 = slt64(abs_res_74148, abs_res_74155);
                bool cond_f_res_74161 = min_res_74141 == r_idx_74136;
                bool x_74162 = !cond_74160;
                bool y_74163 = cond_f_res_74161 && x_74162;
                bool cond_74164 = cond_74160 || y_74163;
                int64_t loopres_f_res_74165;
                
                if (cond_74164) {
                    loopres_f_res_74165 = max_res_74139;
                } else {
                    loopres_f_res_74165 = l_idx_74135;
                }
                
                int64_t loopres_f_res_74166;
                
                if (cond_74164) {
                    loopres_f_res_74166 = r_idx_74136;
                } else {
                    loopres_f_res_74166 = min_res_74141;
                }
                
                int64_t loopres_f_res_74167;
                
                if (cond_74164) {
                    int64_t loopres_f_res_t_res_74168 = add64((int64_t) 1,
                                                              span_74137);
                    
                    loopres_f_res_74167 = loopres_f_res_t_res_74168;
                } else {
                    int64_t loopres_f_res_f_res_74169 = add64((int64_t) 1,
                                                              span_74137);
                    
                    loopres_f_res_74167 = loopres_f_res_f_res_74169;
                }
                loopres_74157 = loopres_f_res_74165;
                loopres_74158 = loopres_f_res_74166;
                loopres_74159 = loopres_f_res_74167;
            }
            
            bool loop_cond_74170 = slt64(loopres_74159, min_res_65364);
            bool loop_while_tmp_74254 = loop_cond_74170;
            int64_t l_idx_tmp_74255 = loopres_74157;
            int64_t r_idx_tmp_74256 = loopres_74158;
            int64_t span_tmp_74257 = loopres_74159;
            
            loop_while_74134 = loop_while_tmp_74254;
            l_idx_74135 = l_idx_tmp_74255;
            r_idx_74136 = r_idx_tmp_74256;
            span_74137 = span_tmp_74257;
        }
        idx_73580 = loop_while_74134;
        idx_73581 = l_idx_74135;
        idx_73582 = r_idx_74136;
        idx_73583 = span_74137;
        
        int64_t min_res_73621 = smin64(min_arg_68001, idx_73581);
        int64_t max_res_73622 = smax64((int64_t) 0, min_res_73621);
        int64_t x_73623 = add64(min_res_68002, max_res_73622);
        int64_t r_73624 = sub64(x_73623, (int64_t) 1);
        bool x_73625 = sle64((int64_t) 0, r_73624);
        bool y_73626 = slt64(r_73624, n_65344);
        bool bounds_check_73627 = x_73625 && y_73626;
        bool index_certs_73628;
        
        if (!bounds_check_73627) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_73624,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_73629;
        
        x_73629 = ((int64_t *) mem_70828.mem)[r_73624];
        
        int64_t abs_arg_73630 = sub64(x_73629, min_res_73557);
        int64_t abs_res_73631 = abs64(abs_arg_73630);
        bool x_73632 = sle64((int64_t) 0, max_res_73622);
        bool y_73633 = slt64(max_res_73622, n_65344);
        bool bounds_check_73634 = x_73632 && y_73633;
        bool index_certs_73635;
        
        if (!bounds_check_73634) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_73622,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_73636;
        
        x_73636 = ((int64_t *) mem_70828.mem)[max_res_73622];
        
        int64_t abs_arg_73637 = sub64(x_73636, min_res_73557);
        int64_t abs_res_73638 = abs64(abs_arg_73637);
        int64_t max_res_73639 = smax64(abs_res_73631, abs_res_73638);
        float defunc_0_f_res_73640 = sitofp_i64_f32(max_res_73639);
        float defunc_1_f_res_73641 = max_res_68006 + defunc_0_f_res_73640;
        float defunc_2_reduce_res_73642;
        float defunc_2_reduce_res_73643;
        float defunc_2_reduce_res_73644;
        float defunc_2_reduce_res_73645;
        float defunc_2_reduce_res_73646;
        int64_t flat_tid_74171 = (int64_t) 0;
        int32_t num_tasks_74258;
        
        defunc_2_reduce_res_73642 = 0.0F;
        defunc_2_reduce_res_73643 = 0.0F;
        defunc_2_reduce_res_73644 = 0.0F;
        defunc_2_reduce_res_73645 = 0.0F;
        defunc_2_reduce_res_73646 = 0.0F;
        
        struct futhark_mc_task_77185 futhark_mc_task_77185;
        
        futhark_mc_task_77185.ctx = ctx;
        futhark_mc_task_77185.free_last_res_67981 = last_res_67981;
        futhark_mc_task_77185.free_mem_70828 = mem_70828.mem;
        futhark_mc_task_77185.free_mem_70834 = mem_70834.mem;
        futhark_mc_task_77185.free_min_res_73557 = min_res_73557;
        futhark_mc_task_77185.free_max_res_73622 = max_res_73622;
        futhark_mc_task_77185.free_defunc_1_f_res_73641 = defunc_1_f_res_73641;
        futhark_mc_task_77185.retval_defunc_2_reduce_res_73642 =
            &defunc_2_reduce_res_73642;
        futhark_mc_task_77185.retval_defunc_2_reduce_res_73643 =
            &defunc_2_reduce_res_73643;
        futhark_mc_task_77185.retval_defunc_2_reduce_res_73644 =
            &defunc_2_reduce_res_73644;
        futhark_mc_task_77185.retval_defunc_2_reduce_res_73645 =
            &defunc_2_reduce_res_73645;
        futhark_mc_task_77185.retval_defunc_2_reduce_res_73646 =
            &defunc_2_reduce_res_73646;
        
        struct scheduler_segop futhark_mc_task_77185_task;
        
        futhark_mc_task_77185_task.args = &futhark_mc_task_77185;
        futhark_mc_task_77185_task.top_level_fn = futhark_mc_segred_task_77186;
        futhark_mc_task_77185_task.name = "futhark_mc_segred_task_77186";
        futhark_mc_task_77185_task.iterations = q_65346;
        futhark_mc_task_77185_task.task_time =
            &ctx->futhark_mc_segred_task_77186_total_time;
        futhark_mc_task_77185_task.task_iter =
            &ctx->futhark_mc_segred_task_77186_total_iter;
        futhark_mc_task_77185_task.sched = STATIC;
        futhark_mc_task_77185_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77186_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77185_task);
        
        if (futhark_mc_segred_task_77186_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        float x_73684 = defunc_2_reduce_res_73644 * defunc_2_reduce_res_73646;
        float y_73685 = defunc_2_reduce_res_73645 * defunc_2_reduce_res_73645;
        float a12_73686 = x_73684 - y_73685;
        float x_73687 = defunc_2_reduce_res_73644 * defunc_2_reduce_res_73645;
        float y_73688 = defunc_2_reduce_res_73643 * defunc_2_reduce_res_73646;
        float b12_73689 = x_73687 - y_73688;
        float x_73690 = defunc_2_reduce_res_73643 * defunc_2_reduce_res_73645;
        float y_73691 = defunc_2_reduce_res_73644 * defunc_2_reduce_res_73644;
        float c12_73692 = x_73690 - y_73691;
        float x_73693 = defunc_2_reduce_res_73642 * defunc_2_reduce_res_73646;
        float b2_73694 = x_73693 - y_73691;
        float x_73695 = defunc_2_reduce_res_73643 * defunc_2_reduce_res_73644;
        float y_73696 = defunc_2_reduce_res_73642 * defunc_2_reduce_res_73645;
        float c2_73697 = x_73695 - y_73696;
        float x_73698 = defunc_2_reduce_res_73642 * a12_73686;
        float y_73699 = defunc_2_reduce_res_73643 * b12_73689;
        float x_73700 = x_73698 + y_73699;
        float y_73701 = defunc_2_reduce_res_73644 * c12_73692;
        float y_73702 = x_73700 + y_73701;
        float det_73703 = 1.0F / y_73702;
        float a12_73704 = a12_73686 * det_73703;
        float b12_73705 = b12_73689 * det_73703;
        float c12_73706 = c12_73692 * det_73703;
        float b2_73707 = b2_73694 * det_73703;
        float c2_73708 = c2_73697 * det_73703;
        float defunc_2_reduce_res_73709;
        float defunc_2_reduce_res_73710;
        int64_t flat_tid_74208 = (int64_t) 0;
        int32_t num_tasks_74291;
        
        defunc_2_reduce_res_73709 = 0.0F;
        defunc_2_reduce_res_73710 = 0.0F;
        
        struct futhark_mc_task_77194 futhark_mc_task_77194;
        
        futhark_mc_task_77194.ctx = ctx;
        futhark_mc_task_77194.free_last_res_67981 = last_res_67981;
        futhark_mc_task_77194.free_mem_70825 = mem_70825.mem;
        futhark_mc_task_77194.free_mem_70828 = mem_70828.mem;
        futhark_mc_task_77194.free_mem_70834 = mem_70834.mem;
        futhark_mc_task_77194.free_min_res_73557 = min_res_73557;
        futhark_mc_task_77194.free_max_res_73622 = max_res_73622;
        futhark_mc_task_77194.free_defunc_1_f_res_73641 = defunc_1_f_res_73641;
        futhark_mc_task_77194.free_a12_73704 = a12_73704;
        futhark_mc_task_77194.free_b12_73705 = b12_73705;
        futhark_mc_task_77194.free_c12_73706 = c12_73706;
        futhark_mc_task_77194.free_b2_73707 = b2_73707;
        futhark_mc_task_77194.free_c2_73708 = c2_73708;
        futhark_mc_task_77194.retval_defunc_2_reduce_res_73709 =
            &defunc_2_reduce_res_73709;
        futhark_mc_task_77194.retval_defunc_2_reduce_res_73710 =
            &defunc_2_reduce_res_73710;
        
        struct scheduler_segop futhark_mc_task_77194_task;
        
        futhark_mc_task_77194_task.args = &futhark_mc_task_77194;
        futhark_mc_task_77194_task.top_level_fn = futhark_mc_segred_task_77195;
        futhark_mc_task_77194_task.name = "futhark_mc_segred_task_77195";
        futhark_mc_task_77194_task.iterations = q_65346;
        futhark_mc_task_77194_task.task_time =
            &ctx->futhark_mc_segred_task_77195_total_time;
        futhark_mc_task_77194_task.task_iter =
            &ctx->futhark_mc_segred_task_77195_total_iter;
        futhark_mc_task_77194_task.sched = STATIC;
        futhark_mc_task_77194_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77195_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77194_task);
        
        if (futhark_mc_segred_task_77195_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((float *) mem_70837.mem)[gtid_73555] = defunc_2_reduce_res_73709;
        ((float *) mem_70840.mem)[gtid_73555] = defunc_2_reduce_res_73710;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77184_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77184_end -
                 futhark_mc_segmap_parloop_77184_start;
        
        ctx->futhark_mc_segmap_parloop_77184_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77184_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77184_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77182(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_73554 = tid;
    int num_tasks_73973 = info.nsubtasks;
    struct futhark_mc_task_77178 *futhark_mc_task_77178 =
                                 (struct futhark_mc_task_77178 *) args;
    struct futhark_context *ctx = futhark_mc_task_77178->ctx;
    uint64_t futhark_mc_segmap_nested_task_77182_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77182_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77178->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77178->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77178->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77178->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77178->free_i_65358;
    bool x_65359 = futhark_mc_task_77178->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77178->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77178->free_loop_cond_65369;
    int64_t last_res_67981 = futhark_mc_task_77178->free_last_res_67981;
    int64_t min_arg_68000 = futhark_mc_task_77178->free_min_arg_68000;
    int64_t min_arg_68001 = futhark_mc_task_77178->free_min_arg_68001;
    int64_t min_res_68002 = futhark_mc_task_77178->free_min_res_68002;
    float max_res_68006 = futhark_mc_task_77178->free_max_res_68006;
    struct memblock mem_70825 = {.desc ="mem_70825", .mem =
                                 futhark_mc_task_77178->free_mem_70825, .size =
                                 0, .references =NULL};
    struct memblock mem_70828 = {.desc ="mem_70828", .mem =
                                 futhark_mc_task_77178->free_mem_70828, .size =
                                 0, .references =NULL};
    struct memblock mem_70831 = {.desc ="mem_70831", .mem =
                                 futhark_mc_task_77178->free_mem_70831, .size =
                                 0, .references =NULL};
    struct memblock mem_70834 = {.desc ="mem_70834", .mem =
                                 futhark_mc_task_77178->free_mem_70834, .size =
                                 0, .references =NULL};
    struct memblock mem_70837 = {.desc ="mem_70837", .mem =
                                 futhark_mc_task_77178->free_mem_70837, .size =
                                 0, .references =NULL};
    struct memblock mem_70840 = {.desc ="mem_70840", .mem =
                                 futhark_mc_task_77178->free_mem_70840, .size =
                                 0, .references =NULL};
    int64_t iter_74115;
    struct futhark_mc_segmap_parloop_struct_77183
    futhark_mc_segmap_parloop_struct_77183;
    
    futhark_mc_segmap_parloop_struct_77183.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77183.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77183.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77183.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77183.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77183.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77183.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77183.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77183.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77183.free_last_res_67981 = last_res_67981;
    futhark_mc_segmap_parloop_struct_77183.free_min_arg_68000 = min_arg_68000;
    futhark_mc_segmap_parloop_struct_77183.free_min_arg_68001 = min_arg_68001;
    futhark_mc_segmap_parloop_struct_77183.free_min_res_68002 = min_res_68002;
    futhark_mc_segmap_parloop_struct_77183.free_max_res_68006 = max_res_68006;
    futhark_mc_segmap_parloop_struct_77183.free_mem_70825 = mem_70825.mem;
    futhark_mc_segmap_parloop_struct_77183.free_mem_70828 = mem_70828.mem;
    futhark_mc_segmap_parloop_struct_77183.free_mem_70831 = mem_70831.mem;
    futhark_mc_segmap_parloop_struct_77183.free_mem_70834 = mem_70834.mem;
    futhark_mc_segmap_parloop_struct_77183.free_mem_70837 = mem_70837.mem;
    futhark_mc_segmap_parloop_struct_77183.free_mem_70840 = mem_70840.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77184_task;
    
    futhark_mc_segmap_parloop_77184_task.name =
        "futhark_mc_segmap_parloop_77184";
    futhark_mc_segmap_parloop_77184_task.fn = futhark_mc_segmap_parloop_77184;
    futhark_mc_segmap_parloop_77184_task.args =
        &futhark_mc_segmap_parloop_struct_77183;
    futhark_mc_segmap_parloop_77184_task.iterations = iterations;
    futhark_mc_segmap_parloop_77184_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77184_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77184_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77184_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77184_task);
    
    if (futhark_mc_segmap_parloop_77184_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77184_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77184_total_end -
                 futhark_mc_segmap_parloop_77184_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77184_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77184_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77184_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77182_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77182_end -
                 futhark_mc_segmap_nested_task_77182_start;
        
        ctx->futhark_mc_segmap_nested_task_77182_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77182_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77182_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_77151(void *args, int64_t start,
                                           int64_t end, int flat_tid_67968,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77150
    *futhark_mc_segmap_parloop_struct_77150 =
    (struct futhark_mc_segmap_parloop_struct_77150 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77150->ctx;
    uint64_t futhark_mc_segmap_parloop_77151_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77151_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77150->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77150->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77150->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77150->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77150->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77150->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77150->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77150->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77150->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77150->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77150->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70821 =
            futhark_mc_segmap_parloop_struct_77150->free_bytes_70821;
    int64_t bytes_70824 =
            futhark_mc_segmap_parloop_struct_77150->free_bytes_70824;
    int64_t bytes_70833 =
            futhark_mc_segmap_parloop_struct_77150->free_bytes_70833;
    int64_t bytes_70836 =
            futhark_mc_segmap_parloop_struct_77150->free_bytes_70836;
    struct memblock mem_70949 = {.desc ="mem_70949", .mem =
                                 futhark_mc_segmap_parloop_struct_77150->free_mem_70949,
                                 .size =0, .references =NULL};
    struct memblock mem_70953 = {.desc ="mem_70953", .mem =
                                 futhark_mc_segmap_parloop_struct_77150->free_mem_70953,
                                 .size =0, .references =NULL};
    size_t mem_70822_cached_sizze_77152 = 0;
    unsigned char *mem_70822 = NULL;
    size_t mem_70825_cached_sizze_77153 = 0;
    unsigned char *mem_70825 = NULL;
    size_t mem_70828_cached_sizze_77154 = 0;
    unsigned char *mem_70828 = NULL;
    size_t mem_70831_cached_sizze_77155 = 0;
    unsigned char *mem_70831 = NULL;
    size_t mem_70834_cached_sizze_77156 = 0;
    unsigned char *mem_70834 = NULL;
    size_t mem_70837_cached_sizze_77157 = 0;
    unsigned char *mem_70837 = NULL;
    size_t mem_70840_cached_sizze_77158 = 0;
    unsigned char *mem_70840 = NULL;
    int64_t iterations = end - start;
    int64_t iter_73528 = start;
    
    if (mem_70822_cached_sizze_77152 < (size_t) bytes_70821) {
        mem_70822 = realloc(mem_70822, bytes_70821);
        mem_70822_cached_sizze_77152 = bytes_70821;
    }
    if (mem_70825_cached_sizze_77153 < (size_t) bytes_70824) {
        mem_70825 = realloc(mem_70825, bytes_70824);
        mem_70825_cached_sizze_77153 = bytes_70824;
    }
    if (mem_70828_cached_sizze_77154 < (size_t) bytes_70821) {
        mem_70828 = realloc(mem_70828, bytes_70821);
        mem_70828_cached_sizze_77154 = bytes_70821;
    }
    if (mem_70831_cached_sizze_77155 < (size_t) bytes_70821) {
        mem_70831 = realloc(mem_70831, bytes_70821);
        mem_70831_cached_sizze_77155 = bytes_70821;
    }
    if (mem_70834_cached_sizze_77156 < (size_t) bytes_70833) {
        mem_70834 = realloc(mem_70834, bytes_70833);
        mem_70834_cached_sizze_77156 = bytes_70833;
    }
    if (mem_70837_cached_sizze_77157 < (size_t) bytes_70836) {
        mem_70837 = realloc(mem_70837, bytes_70836);
        mem_70837_cached_sizze_77157 = bytes_70836;
    }
    if (mem_70840_cached_sizze_77158 < (size_t) bytes_70836) {
        mem_70840 = realloc(mem_70840, bytes_70836);
        mem_70840_cached_sizze_77158 = bytes_70836;
    }
    for (; iter_73528 < end; iter_73528++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_73941 = m_65343;
        int64_t gtid_67969 = iter_73528;
        int64_t remnant_73942 = iter_73528 - gtid_67969;
        int64_t flat_tid_73529 = (int64_t) 0;
        int32_t num_tasks_73943;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_77159 futhark_mc_task_77159;
        
        futhark_mc_task_77159.ctx = ctx;
        futhark_mc_task_77159.free_n_65344 = n_65344;
        futhark_mc_task_77159.free_gtid_67969 = gtid_67969;
        futhark_mc_task_77159.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77159.free_mem_70822 = mem_70822;
        
        struct scheduler_segop futhark_mc_task_77159_task;
        
        futhark_mc_task_77159_task.args = &futhark_mc_task_77159;
        futhark_mc_task_77159_task.top_level_fn = futhark_mc_segscan_task_77160;
        futhark_mc_task_77159_task.name = "futhark_mc_segscan_task_77160";
        futhark_mc_task_77159_task.iterations = n_65344;
        futhark_mc_task_77159_task.task_time =
            &ctx->futhark_mc_segscan_task_77160_total_time;
        futhark_mc_task_77159_task.task_iter =
            &ctx->futhark_mc_segscan_task_77160_total_iter;
        futhark_mc_task_77159_task.sched = STATIC;
        futhark_mc_task_77159_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_77160_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77159_task);
        
        if (futhark_mc_segscan_task_77160_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_67981;
        
        last_res_67981 = ((int64_t *) mem_70822)[i_65358];
        for (int64_t i_73957 = 0; i_73957 < n_65344; i_73957++) {
            ((float *) mem_70825)[i_73957] = 0.0F;
        }
        for (int64_t i_73958 = 0; i_73958 < n_65344; i_73958++) {
            ((int64_t *) mem_70828)[i_73958] = (int64_t) -1;
        }
        
        int64_t flat_tid_73538 = (int64_t) 0;
        int32_t num_tasks_73959;
        struct futhark_mc_task_77166 futhark_mc_task_77166;
        
        futhark_mc_task_77166.ctx = ctx;
        futhark_mc_task_77166.free_n_65344 = n_65344;
        futhark_mc_task_77166.free_gtid_67969 = gtid_67969;
        futhark_mc_task_77166.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77166.free_mem_70822 = mem_70822;
        futhark_mc_task_77166.free_mem_70825 = mem_70825;
        futhark_mc_task_77166.free_mem_70828 = mem_70828;
        
        struct scheduler_segop futhark_mc_task_77166_task;
        
        futhark_mc_task_77166_task.args = &futhark_mc_task_77166;
        futhark_mc_task_77166_task.top_level_fn = futhark_mc_segmap_task_77167;
        futhark_mc_task_77166_task.name = "futhark_mc_segmap_task_77167";
        futhark_mc_task_77166_task.iterations = n_65344;
        futhark_mc_task_77166_task.task_time =
            &ctx->futhark_mc_segmap_task_77167_total_time;
        futhark_mc_task_77166_task.task_iter =
            &ctx->futhark_mc_segmap_task_77167_total_iter;
        futhark_mc_task_77166_task.sched = STATIC;
        futhark_mc_task_77166_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77167_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77166_task);
        
        if (futhark_mc_segmap_task_77167_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_73546 = (int64_t) 0;
        int32_t num_tasks_73965;
        struct futhark_mc_task_77170 futhark_mc_task_77170;
        
        futhark_mc_task_77170.ctx = ctx;
        futhark_mc_task_77170.free_n_65344 = n_65344;
        futhark_mc_task_77170.free_mem_70828 = mem_70828;
        futhark_mc_task_77170.free_mem_70831 = mem_70831;
        
        struct scheduler_segop futhark_mc_task_77170_task;
        
        futhark_mc_task_77170_task.args = &futhark_mc_task_77170;
        futhark_mc_task_77170_task.top_level_fn = futhark_mc_segmap_task_77171;
        futhark_mc_task_77170_task.name = "futhark_mc_segmap_task_77171";
        futhark_mc_task_77170_task.iterations = n_65344;
        futhark_mc_task_77170_task.task_time =
            &ctx->futhark_mc_segmap_task_77171_total_time;
        futhark_mc_task_77170_task.task_iter =
            &ctx->futhark_mc_segmap_task_77171_total_iter;
        futhark_mc_task_77170_task.sched = STATIC;
        futhark_mc_task_77170_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77171_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77170_task);
        
        if (futhark_mc_segmap_task_77171_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_68000 = sub64(last_res_67981, (int64_t) 1);
        int64_t min_arg_68001 = sub64(last_res_67981, min_res_65364);
        int64_t min_res_68002 = smin64(q_65346, last_res_67981);
        float i64_res_68003 = sitofp_i64_f32(last_res_67981);
        float x_68004 = i64_res_65370 - i64_res_68003;
        float max_arg_68005 = x_68004 / 2.0F;
        float max_res_68006 = fmax32(0.0F, max_arg_68005);
        int64_t flat_tid_73550 = (int64_t) 0;
        int32_t num_tasks_73969;
        struct futhark_mc_task_77174 futhark_mc_task_77174;
        
        futhark_mc_task_77174.ctx = ctx;
        futhark_mc_task_77174.free_q_65346 = q_65346;
        futhark_mc_task_77174.free_last_res_67981 = last_res_67981;
        futhark_mc_task_77174.free_mem_70834 = mem_70834;
        
        struct scheduler_segop futhark_mc_task_77174_task;
        
        futhark_mc_task_77174_task.args = &futhark_mc_task_77174;
        futhark_mc_task_77174_task.top_level_fn = futhark_mc_segmap_task_77175;
        futhark_mc_task_77174_task.name = "futhark_mc_segmap_task_77175";
        futhark_mc_task_77174_task.iterations = q_65346;
        futhark_mc_task_77174_task.task_time =
            &ctx->futhark_mc_segmap_task_77175_total_time;
        futhark_mc_task_77174_task.task_iter =
            &ctx->futhark_mc_segmap_task_77175_total_iter;
        futhark_mc_task_77174_task.sched = STATIC;
        futhark_mc_task_77174_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77175_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77174_task);
        
        if (futhark_mc_segmap_task_77175_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_73752 = (int64_t) 0;
        int32_t num_tasks_73973;
        int64_t flat_tid_73554 = (int64_t) 0;
        struct futhark_mc_task_77178 futhark_mc_task_77178;
        
        futhark_mc_task_77178.ctx = ctx;
        futhark_mc_task_77178.free_n_65344 = n_65344;
        futhark_mc_task_77178.free_q_65346 = q_65346;
        futhark_mc_task_77178.free_jump_65348 = jump_65348;
        futhark_mc_task_77178.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77178.free_i_65358 = i_65358;
        futhark_mc_task_77178.free_x_65359 = x_65359;
        futhark_mc_task_77178.free_min_res_65364 = min_res_65364;
        futhark_mc_task_77178.free_loop_cond_65369 = loop_cond_65369;
        futhark_mc_task_77178.free_last_res_67981 = last_res_67981;
        futhark_mc_task_77178.free_min_arg_68000 = min_arg_68000;
        futhark_mc_task_77178.free_min_arg_68001 = min_arg_68001;
        futhark_mc_task_77178.free_min_res_68002 = min_res_68002;
        futhark_mc_task_77178.free_max_res_68006 = max_res_68006;
        futhark_mc_task_77178.free_mem_70825 = mem_70825;
        futhark_mc_task_77178.free_mem_70828 = mem_70828;
        futhark_mc_task_77178.free_mem_70831 = mem_70831;
        futhark_mc_task_77178.free_mem_70834 = mem_70834;
        futhark_mc_task_77178.free_mem_70837 = mem_70837;
        futhark_mc_task_77178.free_mem_70840 = mem_70840;
        
        struct scheduler_segop futhark_mc_task_77178_task;
        
        futhark_mc_task_77178_task.args = &futhark_mc_task_77178;
        futhark_mc_task_77178_task.top_level_fn = futhark_mc_segmap_task_77179;
        futhark_mc_task_77178_task.name = "futhark_mc_segmap_task_77179";
        futhark_mc_task_77178_task.iterations = n_m_65352;
        futhark_mc_task_77178_task.task_time =
            &ctx->futhark_mc_segmap_task_77179_total_time;
        futhark_mc_task_77178_task.task_iter =
            &ctx->futhark_mc_segmap_task_77179_total_iter;
        futhark_mc_task_77178_task.sched = DYNAMIC;
        futhark_mc_task_77178_task.nested_fn =
            futhark_mc_segmap_nested_task_77182;
        
        int futhark_mc_segmap_task_77179_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77178_task);
        
        if (futhark_mc_segmap_task_77179_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70949.mem + gtid_67969 * n_m_65352 * (int64_t) 4,
                    mem_70837 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_70953.mem + gtid_67969 * n_m_65352 * (int64_t) 4,
                    mem_70840 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_70822);
    free(mem_70825);
    free(mem_70828);
    free(mem_70831);
    free(mem_70834);
    free(mem_70837);
    free(mem_70840);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77151_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77151_end -
                 futhark_mc_segmap_parloop_77151_start;
        
        ctx->futhark_mc_segmap_parloop_77151_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77151_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77151_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77149(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_67968 = tid;
    int num_tasks_73277 = info.nsubtasks;
    struct futhark_mc_task_77138 *futhark_mc_task_77138 =
                                 (struct futhark_mc_task_77138 *) args;
    struct futhark_context *ctx = futhark_mc_task_77138->ctx;
    uint64_t futhark_mc_segmap_nested_task_77149_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77149_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77138->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77138->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77138->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77138->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77138->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77138->free_i_65358;
    bool x_65359 = futhark_mc_task_77138->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77138->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77138->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77138->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77138->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70821 = futhark_mc_task_77138->free_bytes_70821;
    int64_t bytes_70824 = futhark_mc_task_77138->free_bytes_70824;
    int64_t bytes_70833 = futhark_mc_task_77138->free_bytes_70833;
    int64_t bytes_70836 = futhark_mc_task_77138->free_bytes_70836;
    struct memblock mem_70949 = {.desc ="mem_70949", .mem =
                                 futhark_mc_task_77138->free_mem_70949, .size =
                                 0, .references =NULL};
    struct memblock mem_70953 = {.desc ="mem_70953", .mem =
                                 futhark_mc_task_77138->free_mem_70953, .size =
                                 0, .references =NULL};
    int64_t iter_73528;
    struct futhark_mc_segmap_parloop_struct_77150
    futhark_mc_segmap_parloop_struct_77150;
    
    futhark_mc_segmap_parloop_struct_77150.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77150.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77150.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77150.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77150.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77150.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77150.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77150.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77150.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77150.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77150.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77150.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77150.free_bytes_70821 = bytes_70821;
    futhark_mc_segmap_parloop_struct_77150.free_bytes_70824 = bytes_70824;
    futhark_mc_segmap_parloop_struct_77150.free_bytes_70833 = bytes_70833;
    futhark_mc_segmap_parloop_struct_77150.free_bytes_70836 = bytes_70836;
    futhark_mc_segmap_parloop_struct_77150.free_mem_70949 = mem_70949.mem;
    futhark_mc_segmap_parloop_struct_77150.free_mem_70953 = mem_70953.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77151_task;
    
    futhark_mc_segmap_parloop_77151_task.name =
        "futhark_mc_segmap_parloop_77151";
    futhark_mc_segmap_parloop_77151_task.fn = futhark_mc_segmap_parloop_77151;
    futhark_mc_segmap_parloop_77151_task.args =
        &futhark_mc_segmap_parloop_struct_77150;
    futhark_mc_segmap_parloop_77151_task.iterations = iterations;
    futhark_mc_segmap_parloop_77151_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77151_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77151_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77151_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77151_task);
    
    if (futhark_mc_segmap_parloop_77151_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77151_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77151_total_end -
                 futhark_mc_segmap_parloop_77151_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77151_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77151_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77151_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77149_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77149_end -
                 futhark_mc_segmap_nested_task_77149_start;
        
        ctx->futhark_mc_segmap_nested_task_77149_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77149_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77149_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77200 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70963;
    int64_t free_bytes_70966;
    int64_t free_bytes_70975;
    int64_t free_bytes_70996;
    unsigned char *free_mem_71106;
};
struct futhark_mc_segmap_parloop_struct_77202 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70963;
    int64_t free_bytes_70966;
    int64_t free_bytes_70975;
    int64_t free_bytes_70996;
    unsigned char *free_mem_71106;
};
static int futhark_mc_segmap_parloop_77203(void *args, int64_t start,
                                           int64_t end, int flat_tid_68413,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77202
    *futhark_mc_segmap_parloop_struct_77202 =
    (struct futhark_mc_segmap_parloop_struct_77202 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77202->ctx;
    uint64_t futhark_mc_segmap_parloop_77203_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77203_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77202->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77202->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77202->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77202->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77202->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77202->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77202->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77202->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77202->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77202->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77202->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70963 =
            futhark_mc_segmap_parloop_struct_77202->free_bytes_70963;
    int64_t bytes_70966 =
            futhark_mc_segmap_parloop_struct_77202->free_bytes_70966;
    int64_t bytes_70975 =
            futhark_mc_segmap_parloop_struct_77202->free_bytes_70975;
    int64_t bytes_70996 =
            futhark_mc_segmap_parloop_struct_77202->free_bytes_70996;
    struct memblock mem_71106 = {.desc ="mem_71106", .mem =
                                 futhark_mc_segmap_parloop_struct_77202->free_mem_71106,
                                 .size =0, .references =NULL};
    size_t mem_71000_cached_sizze_77204 = 0;
    unsigned char *mem_71000 = NULL;
    size_t mem_71015_cached_sizze_77205 = 0;
    unsigned char *mem_71015 = NULL;
    size_t mem_71018_cached_sizze_77206 = 0;
    unsigned char *mem_71018 = NULL;
    size_t mem_71045_cached_sizze_77207 = 0;
    unsigned char *mem_71045 = NULL;
    size_t mem_71060_cached_sizze_77208 = 0;
    unsigned char *mem_71060 = NULL;
    size_t mem_71075_cached_sizze_77209 = 0;
    unsigned char *mem_71075 = NULL;
    size_t mem_71085_cached_sizze_77210 = 0;
    unsigned char *mem_71085 = NULL;
    int64_t iterations = end - start;
    int64_t iter_74309 = start;
    
    if (mem_71000_cached_sizze_77204 < (size_t) bytes_70963) {
        mem_71000 = realloc(mem_71000, bytes_70963);
        mem_71000_cached_sizze_77204 = bytes_70963;
    }
    if (mem_71015_cached_sizze_77205 < (size_t) bytes_70966) {
        mem_71015 = realloc(mem_71015, bytes_70966);
        mem_71015_cached_sizze_77205 = bytes_70966;
    }
    if (mem_71018_cached_sizze_77206 < (size_t) bytes_70963) {
        mem_71018 = realloc(mem_71018, bytes_70963);
        mem_71018_cached_sizze_77206 = bytes_70963;
    }
    if (mem_71045_cached_sizze_77207 < (size_t) bytes_70963) {
        mem_71045 = realloc(mem_71045, bytes_70963);
        mem_71045_cached_sizze_77207 = bytes_70963;
    }
    if (mem_71060_cached_sizze_77208 < (size_t) bytes_70975) {
        mem_71060 = realloc(mem_71060, bytes_70975);
        mem_71060_cached_sizze_77208 = bytes_70975;
    }
    if (mem_71075_cached_sizze_77209 < (size_t) bytes_70996) {
        mem_71075 = realloc(mem_71075, bytes_70996);
        mem_71075_cached_sizze_77209 = bytes_70996;
    }
    if (mem_71085_cached_sizze_77210 < (size_t) bytes_70975) {
        mem_71085 = realloc(mem_71085, bytes_70975);
        mem_71085_cached_sizze_77210 = bytes_70975;
    }
    for (; iter_74309 < end; iter_74309++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74466 = m_65343;
        int64_t gtid_68414 = iter_74309;
        int64_t remnant_74467 = iter_74309 - gtid_68414;
        int64_t discard_70311;
        int64_t scanacc_74311 = (int64_t) 0;
        
        for (int64_t i_74310 = 0; i_74310 < n_65344; i_74310++) {
            float x_74313;
            
            x_74313 = ((float *) Y_mem_70569.mem)[gtid_68414 * n_65344 +
                                                  i_74310];
            
            bool isnan_res_74314;
            
            isnan_res_74314 = futrts_isnan32(x_74313);
            
            bool defunc_0_p_res_74315 = !isnan_res_74314;
            int64_t defunc_0_f_res_74316 = btoi_bool_i64(defunc_0_p_res_74315);
            int64_t defunc_1_op_res_74317 = add64(defunc_0_f_res_74316,
                                                  scanacc_74311);
            
            ((int64_t *) mem_71000)[i_74310] = defunc_1_op_res_74317;
            
            int64_t scanacc_tmp_74468 = defunc_1_op_res_74317;
            
            scanacc_74311 = scanacc_tmp_74468;
        }
        discard_70311 = scanacc_74311;
        
        int64_t last_res_66017;
        
        last_res_66017 = ((int64_t *) mem_71000)[i_65358];
        for (int64_t i_74470 = 0; i_74470 < n_65344; i_74470++) {
            ((float *) mem_71015)[i_74470] = 0.0F;
        }
        for (int64_t i_74471 = 0; i_74471 < n_65344; i_74471++) {
            ((int64_t *) mem_71018)[i_74471] = (int64_t) -1;
        }
        for (int64_t write_iter_74319 = 0; write_iter_74319 < n_65344;
             write_iter_74319++) {
            float write_iv_74322;
            
            write_iv_74322 = ((float *) Y_mem_70569.mem)[gtid_68414 * n_65344 +
                                                         write_iter_74319];
            
            bool isnan_res_74323;
            
            isnan_res_74323 = futrts_isnan32(write_iv_74322);
            
            bool defunc_0_p_res_74324 = !isnan_res_74323;
            int64_t defunc_1_f_res_74325;
            
            if (defunc_0_p_res_74324) {
                int64_t write_iv_74326;
                
                write_iv_74326 = ((int64_t *) mem_71000)[write_iter_74319];
                
                int64_t defunc_1_f_res_t_res_74327 = sub64(write_iv_74326,
                                                           (int64_t) 1);
                
                defunc_1_f_res_74325 = defunc_1_f_res_t_res_74327;
            } else {
                defunc_1_f_res_74325 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_74325) &&
                slt64(defunc_1_f_res_74325, n_65344)) {
                ((int64_t *) mem_71018)[defunc_1_f_res_74325] =
                    write_iter_74319;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_74325) &&
                slt64(defunc_1_f_res_74325, n_65344)) {
                if ((int64_t) 4 > 0)
                    memmove(mem_71015 + defunc_1_f_res_74325 * (int64_t) 4,
                            Y_mem_70569.mem + (gtid_68414 * n_65344 +
                                               write_iter_74319) * (int64_t) 4,
                            (int64_t) 4);
            }
        }
        for (int64_t i_74331 = 0; i_74331 < n_65344; i_74331++) {
            int64_t x_74333;
            
            x_74333 = ((int64_t *) mem_71018)[i_74331];
            
            int64_t defunc_0_f_res_74334 = add64((int64_t) 1, x_74333);
            
            ((int64_t *) mem_71045)[i_74331] = defunc_0_f_res_74334;
        }
        
        int64_t min_arg_66032 = sub64(last_res_66017, (int64_t) 1);
        int64_t min_arg_66033 = sub64(last_res_66017, min_res_65364);
        int64_t min_res_66034 = smin64(q_65346, last_res_66017);
        float i64_res_66035 = sitofp_i64_f32(last_res_66017);
        float x_66036 = i64_res_65370 - i64_res_66035;
        float max_arg_66037 = x_66036 / 2.0F;
        float max_res_66038 = fmax32(0.0F, max_arg_66037);
        
        for (int64_t i_74336 = 0; i_74336 < q_65346; i_74336++) {
            bool cond_74338 = sle64(last_res_66017, i_74336);
            float defunc_0_f_res_74339;
            
            if (cond_74338) {
                defunc_0_f_res_74339 = 0.0F;
            } else {
                defunc_0_f_res_74339 = 1.0F;
            }
            ((float *) mem_71060)[i_74336] = defunc_0_f_res_74339;
        }
        for (int64_t i_74341 = 0; i_74341 < n_m_65352; i_74341++) {
            int64_t min_arg_74343 = mul64(jump_65348, i_74341);
            int64_t min_res_74344 = smin64(i_65358, min_arg_74343);
            int64_t defunc_0_g_res_74345 = add64((int64_t) 1, min_res_74344);
            bool init_idx_74346;
            int64_t init_idx_74347;
            int64_t init_idx_74348;
            bool loop_while_74349;
            int64_t low_74350;
            int64_t high_74351;
            
            loop_while_74349 = x_65359;
            low_74350 = (int64_t) 0;
            high_74351 = i_65358;
            while (loop_while_74349) {
                int64_t x_74352 = add64(low_74350, high_74351);
                int64_t mid_74353 = sdiv64(x_74352, (int64_t) 2);
                bool x_74354 = sle64((int64_t) 0, mid_74353);
                bool y_74355 = slt64(mid_74353, n_65344);
                bool bounds_check_74356 = x_74354 && y_74355;
                bool index_certs_74357;
                
                if (!bounds_check_74356) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_74353,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_74358;
                
                mid_id_74358 = ((int64_t *) mem_71045)[mid_74353];
                
                bool cond_74359 = slt64(mid_id_74358, (int64_t) 0);
                int64_t mid_idx_74360;
                
                if (cond_74359) {
                    mid_idx_74360 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_74360 = mid_id_74358;
                }
                
                bool cond_74361 = sle64(defunc_0_g_res_74345, mid_idx_74360);
                int64_t loopres_74362;
                int64_t loopres_74363;
                
                if (cond_74361) {
                    int64_t loopres_t_res_74364 = sub64(mid_74353, (int64_t) 1);
                    
                    loopres_74362 = low_74350;
                    loopres_74363 = loopres_t_res_74364;
                } else {
                    int64_t loopres_f_res_74365 = add64((int64_t) 1, mid_74353);
                    
                    loopres_74362 = loopres_f_res_74365;
                    loopres_74363 = high_74351;
                }
                
                bool loop_cond_74366 = sle64(loopres_74362, loopres_74363);
                bool loop_while_tmp_74477 = loop_cond_74366;
                int64_t low_tmp_74478 = loopres_74362;
                int64_t high_tmp_74479 = loopres_74363;
                
                loop_while_74349 = loop_while_tmp_74477;
                low_74350 = low_tmp_74478;
                high_74351 = high_tmp_74479;
            }
            init_idx_74346 = loop_while_74349;
            init_idx_74347 = low_74350;
            init_idx_74348 = high_74351;
            
            bool idx_74367;
            int64_t idx_74368;
            int64_t idx_74369;
            int64_t idx_74370;
            bool loop_while_74371;
            int64_t l_idx_74372;
            int64_t r_idx_74373;
            int64_t span_74374;
            
            loop_while_74371 = loop_cond_65369;
            l_idx_74372 = init_idx_74347;
            r_idx_74373 = init_idx_74347;
            span_74374 = (int64_t) 1;
            while (loop_while_74371) {
                int64_t max_arg_74375 = sub64(l_idx_74372, (int64_t) 1);
                int64_t max_res_74376 = smax64((int64_t) 0, max_arg_74375);
                int64_t min_arg_74377 = add64((int64_t) 1, r_idx_74373);
                int64_t min_res_74378 = smin64(min_arg_66032, min_arg_74377);
                bool x_74379 = sle64((int64_t) 0, max_res_74376);
                bool y_74380 = slt64(max_res_74376, n_65344);
                bool bounds_check_74381 = x_74379 && y_74380;
                bool index_certs_74382;
                
                if (!bounds_check_74381) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_74376,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_74383;
                
                x_74383 = ((int64_t *) mem_71045)[max_res_74376];
                
                int64_t abs_arg_74384 = sub64(x_74383, defunc_0_g_res_74345);
                int64_t abs_res_74385 = abs64(abs_arg_74384);
                bool x_74386 = sle64((int64_t) 0, min_res_74378);
                bool y_74387 = slt64(min_res_74378, n_65344);
                bool bounds_check_74388 = x_74386 && y_74387;
                bool index_certs_74389;
                
                if (!bounds_check_74388) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_74378,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_74390;
                
                x_74390 = ((int64_t *) mem_71045)[min_res_74378];
                
                int64_t abs_arg_74391 = sub64(x_74390, defunc_0_g_res_74345);
                int64_t abs_res_74392 = abs64(abs_arg_74391);
                bool cond_74393 = max_res_74376 == l_idx_74372;
                int64_t loopres_74394;
                int64_t loopres_74395;
                int64_t loopres_74396;
                
                if (cond_74393) {
                    loopres_74394 = l_idx_74372;
                    loopres_74395 = r_idx_74373;
                    loopres_74396 = min_res_65364;
                } else {
                    bool cond_74397 = slt64(abs_res_74385, abs_res_74392);
                    bool cond_f_res_74398 = min_res_74378 == r_idx_74373;
                    bool x_74399 = !cond_74397;
                    bool y_74400 = cond_f_res_74398 && x_74399;
                    bool cond_74401 = cond_74397 || y_74400;
                    int64_t loopres_f_res_74402;
                    
                    if (cond_74401) {
                        loopres_f_res_74402 = max_res_74376;
                    } else {
                        loopres_f_res_74402 = l_idx_74372;
                    }
                    
                    int64_t loopres_f_res_74403;
                    
                    if (cond_74401) {
                        loopres_f_res_74403 = r_idx_74373;
                    } else {
                        loopres_f_res_74403 = min_res_74378;
                    }
                    
                    int64_t loopres_f_res_74404;
                    
                    if (cond_74401) {
                        int64_t loopres_f_res_t_res_74405 = add64((int64_t) 1,
                                                                  span_74374);
                        
                        loopres_f_res_74404 = loopres_f_res_t_res_74405;
                    } else {
                        int64_t loopres_f_res_f_res_74406 = add64((int64_t) 1,
                                                                  span_74374);
                        
                        loopres_f_res_74404 = loopres_f_res_f_res_74406;
                    }
                    loopres_74394 = loopres_f_res_74402;
                    loopres_74395 = loopres_f_res_74403;
                    loopres_74396 = loopres_f_res_74404;
                }
                
                bool loop_cond_74407 = slt64(loopres_74396, min_res_65364);
                bool loop_while_tmp_74480 = loop_cond_74407;
                int64_t l_idx_tmp_74481 = loopres_74394;
                int64_t r_idx_tmp_74482 = loopres_74395;
                int64_t span_tmp_74483 = loopres_74396;
                
                loop_while_74371 = loop_while_tmp_74480;
                l_idx_74372 = l_idx_tmp_74481;
                r_idx_74373 = r_idx_tmp_74482;
                span_74374 = span_tmp_74483;
            }
            idx_74367 = loop_while_74371;
            idx_74368 = l_idx_74372;
            idx_74369 = r_idx_74373;
            idx_74370 = span_74374;
            
            int64_t min_res_74408 = smin64(min_arg_66033, idx_74368);
            int64_t max_res_74409 = smax64((int64_t) 0, min_res_74408);
            int64_t x_74410 = add64(min_res_66034, max_res_74409);
            int64_t r_74411 = sub64(x_74410, (int64_t) 1);
            bool x_74412 = sle64((int64_t) 0, r_74411);
            bool y_74413 = slt64(r_74411, n_65344);
            bool bounds_check_74414 = x_74412 && y_74413;
            bool index_certs_74415;
            
            if (!bounds_check_74414) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_74411,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74416;
            
            x_74416 = ((int64_t *) mem_71018)[r_74411];
            
            int64_t abs_arg_74417 = sub64(x_74416, min_res_74344);
            int64_t abs_res_74418 = abs64(abs_arg_74417);
            bool x_74419 = sle64((int64_t) 0, max_res_74409);
            bool y_74420 = slt64(max_res_74409, n_65344);
            bool bounds_check_74421 = x_74419 && y_74420;
            bool index_certs_74422;
            
            if (!bounds_check_74421) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_74409,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74423;
            
            x_74423 = ((int64_t *) mem_71018)[max_res_74409];
            
            int64_t abs_arg_74424 = sub64(x_74423, min_res_74344);
            int64_t abs_res_74425 = abs64(abs_arg_74424);
            int64_t max_res_74426 = smax64(abs_res_74418, abs_res_74425);
            float defunc_0_f_res_74427 = sitofp_i64_f32(max_res_74426);
            float defunc_1_f_res_74428 = max_res_66038 + defunc_0_f_res_74427;
            float defunc_2_reduce_res_74430;
            float redout_74433 = 0.0F;
            
            for (int64_t i_74432 = 0; i_74432 < q_65346; i_74432++) {
                float x_74435;
                
                x_74435 = ((float *) mem_71060)[i_74432];
                
                bool cond_74436 = sle64(last_res_66017, i_74432);
                int64_t defunc_0_f_res_74437;
                
                if (cond_74436) {
                    defunc_0_f_res_74437 = (int64_t) 0;
                } else {
                    int64_t i_74438 = add64(max_res_74409, i_74432);
                    int64_t defunc_0_add_arg_74439;
                    
                    defunc_0_add_arg_74439 = ((int64_t *) mem_71018)[i_74438];
                    
                    int64_t defunc_1_add_res_74440 = add64((int64_t) 1,
                                                           defunc_0_add_arg_74439);
                    
                    defunc_0_f_res_74437 = defunc_1_add_res_74440;
                }
                
                int64_t binop_p_74441 = sub64(defunc_0_f_res_74437,
                                              min_res_74344);
                float defunc_0_f_res_74442 = sitofp_i64_f32(binop_p_74441);
                float abs_res_74443 = (float) fabs(defunc_0_f_res_74442);
                float tmp1_74444 = abs_res_74443 / defunc_1_f_res_74428;
                float x_74445 = tmp1_74444 * tmp1_74444;
                float y_74446 = tmp1_74444 * x_74445;
                float tmp2_74447 = 1.0F - y_74446;
                float x_74448 = tmp2_74447 * tmp2_74447;
                float tmp3_74449 = tmp2_74447 * x_74448;
                float tmp4_74450 = x_74435 * tmp3_74449;
                float defunc_1_op_res_74451 = tmp4_74450 + redout_74433;
                
                ((float *) mem_71085)[i_74432] = tmp4_74450;
                
                float redout_tmp_74484 = defunc_1_op_res_74451;
                
                redout_74433 = redout_tmp_74484;
            }
            defunc_2_reduce_res_74430 = redout_74433;
            
            float a0_74453 = 1.0F / defunc_2_reduce_res_74430;
            float defunc_2_reduce_res_74454;
            float redout_74456 = 0.0F;
            
            for (int64_t i_74455 = 0; i_74455 < q_65346; i_74455++) {
                float x_74457;
                
                x_74457 = ((float *) mem_71085)[i_74455];
                
                bool cond_74458 = sle64(last_res_66017, i_74455);
                float defunc_0_f_res_74459;
                
                if (cond_74458) {
                    defunc_0_f_res_74459 = 0.0F;
                } else {
                    int64_t i_74460 = add64(max_res_74409, i_74455);
                    float defunc_0_add_arg_74461;
                    
                    defunc_0_add_arg_74461 = ((float *) mem_71015)[i_74460];
                    defunc_0_f_res_74459 = defunc_0_add_arg_74461;
                }
                
                float x_74462 = a0_74453 * x_74457;
                float defunc_9_fit_fun_res_74463 = defunc_0_f_res_74459 *
                      x_74462;
                float defunc_1_op_res_74464 = defunc_9_fit_fun_res_74463 +
                      redout_74456;
                float redout_tmp_74486 = defunc_1_op_res_74464;
                
                redout_74456 = redout_tmp_74486;
            }
            defunc_2_reduce_res_74454 = redout_74456;
            ((float *) mem_71075)[i_74341] = defunc_2_reduce_res_74454;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71106.mem + gtid_68414 * n_m_65352 * (int64_t) 4,
                    mem_71075 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_71000);
    free(mem_71015);
    free(mem_71018);
    free(mem_71045);
    free(mem_71060);
    free(mem_71075);
    free(mem_71085);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77203_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77203_end -
                 futhark_mc_segmap_parloop_77203_start;
        
        ctx->futhark_mc_segmap_parloop_77203_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77203_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77203_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77201(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_68413 = tid;
    int num_tasks_74308 = info.nsubtasks;
    struct futhark_mc_task_77200 *futhark_mc_task_77200 =
                                 (struct futhark_mc_task_77200 *) args;
    struct futhark_context *ctx = futhark_mc_task_77200->ctx;
    uint64_t futhark_mc_segmap_task_77201_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77201_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77200->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77200->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77200->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77200->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77200->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77200->free_i_65358;
    bool x_65359 = futhark_mc_task_77200->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77200->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77200->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77200->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77200->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70963 = futhark_mc_task_77200->free_bytes_70963;
    int64_t bytes_70966 = futhark_mc_task_77200->free_bytes_70966;
    int64_t bytes_70975 = futhark_mc_task_77200->free_bytes_70975;
    int64_t bytes_70996 = futhark_mc_task_77200->free_bytes_70996;
    struct memblock mem_71106 = {.desc ="mem_71106", .mem =
                                 futhark_mc_task_77200->free_mem_71106, .size =
                                 0, .references =NULL};
    int64_t iter_74309;
    struct futhark_mc_segmap_parloop_struct_77202
    futhark_mc_segmap_parloop_struct_77202;
    
    futhark_mc_segmap_parloop_struct_77202.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77202.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77202.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77202.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77202.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77202.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77202.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77202.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77202.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77202.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77202.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77202.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77202.free_bytes_70963 = bytes_70963;
    futhark_mc_segmap_parloop_struct_77202.free_bytes_70966 = bytes_70966;
    futhark_mc_segmap_parloop_struct_77202.free_bytes_70975 = bytes_70975;
    futhark_mc_segmap_parloop_struct_77202.free_bytes_70996 = bytes_70996;
    futhark_mc_segmap_parloop_struct_77202.free_mem_71106 = mem_71106.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77203_task;
    
    futhark_mc_segmap_parloop_77203_task.name =
        "futhark_mc_segmap_parloop_77203";
    futhark_mc_segmap_parloop_77203_task.fn = futhark_mc_segmap_parloop_77203;
    futhark_mc_segmap_parloop_77203_task.args =
        &futhark_mc_segmap_parloop_struct_77202;
    futhark_mc_segmap_parloop_77203_task.iterations = iterations;
    futhark_mc_segmap_parloop_77203_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77203_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77203_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77203_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77203_task);
    
    if (futhark_mc_segmap_parloop_77203_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77203_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77203_total_end -
                 futhark_mc_segmap_parloop_77203_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77203_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77203_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77203_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77201_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77201_end -
                 futhark_mc_segmap_task_77201_start;
        
        ctx->futhark_mc_segmap_task_77201_runs[tid]++;
        ctx->futhark_mc_segmap_task_77201_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77201_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77212 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_70963;
    int64_t free_bytes_70966;
    int64_t free_bytes_70975;
    int64_t free_bytes_70996;
    unsigned char *free_mem_71106;
};
struct futhark_mc_task_77220 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_68562;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70964;
};
struct futhark_mc_scan_stage_1_parloop_struct_77223 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_68562;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70964;
};
static int futhark_mc_scan_stage_1_parloop_77224(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_74488, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_77223
    *futhark_mc_scan_stage_1_parloop_struct_77223 =
    (struct futhark_mc_scan_stage_1_parloop_struct_77223 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_77223->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_77224_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77224_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_1_parloop_struct_77223->free_n_65344;
    int64_t gtid_68562 =
            futhark_mc_scan_stage_1_parloop_struct_77223->free_gtid_68562;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_1_parloop_struct_77223->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70964 = {.desc ="mem_70964", .mem =
                                 futhark_mc_scan_stage_1_parloop_struct_77223->free_mem_70964,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74767 = start;
    int64_t x_74490;
    int64_t x_74491;
    
    x_74490 = (int64_t) 0;
    for (; iter_74767 < end; iter_74767++) {
        int64_t gtid_74489 = iter_74767;
        
        // stage 1 scan body
        {
            float x_74493;
            
            x_74493 = ((float *) Y_mem_70569.mem)[gtid_68562 * n_65344 +
                                                  gtid_74489];
            
            bool isnan_res_74494;
            
            isnan_res_74494 = futrts_isnan32(x_74493);
            
            bool defunc_0_p_res_74495 = !isnan_res_74494;
            int64_t defunc_0_f_res_74496 = btoi_bool_i64(defunc_0_p_res_74495);
            
            // write mapped values results to memory
            { }
            x_74490 = x_74490;
            // Read next values
            {
                x_74491 = defunc_0_f_res_74496;
            }
            
            int64_t defunc_1_op_res_74492 = add64(x_74490, x_74491);
            
            ((int64_t *) mem_70964.mem)[gtid_74489] = defunc_1_op_res_74492;
            x_74490 = defunc_1_op_res_74492;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77224_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77224_end -
                 futhark_mc_scan_stage_1_parloop_77224_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_77224_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_77224_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_77224_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_77225 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_68562;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70964;
};
static int futhark_mc_scan_stage_3_parloop_77226(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_74488, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_77225
    *futhark_mc_scan_stage_3_parloop_struct_77225 =
    (struct futhark_mc_scan_stage_3_parloop_struct_77225 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_77225->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_77226_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_77226_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_3_parloop_struct_77225->free_n_65344;
    int64_t gtid_68562 =
            futhark_mc_scan_stage_3_parloop_struct_77225->free_gtid_68562;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_3_parloop_struct_77225->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70964 = {.desc ="mem_70964", .mem =
                                 futhark_mc_scan_stage_3_parloop_struct_77225->free_mem_70964,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74779 = start;
    int64_t x_74776;
    int64_t x_74777;
    
    if (iter_74779 == (int64_t) 0) {
        x_74776 = (int64_t) 0;
    } else {
        x_74776 = ((int64_t *) mem_70964.mem)[iter_74779 - (int64_t) 1];
    }
    for (; iter_74779 < end; iter_74779++) {
        int64_t gtid_74489 = iter_74779;
        
        // stage 3 scan body
        {
            float x_74493;
            
            x_74493 = ((float *) Y_mem_70569.mem)[gtid_68562 * n_65344 +
                                                  gtid_74489];
            
            bool isnan_res_74494;
            
            isnan_res_74494 = futrts_isnan32(x_74493);
            
            bool defunc_0_p_res_74495 = !isnan_res_74494;
            int64_t defunc_0_f_res_74496 = btoi_bool_i64(defunc_0_p_res_74495);
            
            x_74776 = x_74776;
            x_74777 = defunc_0_f_res_74496;
            
            int64_t defunc_1_op_res_74778 = add64(x_74776, x_74777);
            
            ((int64_t *) mem_70964.mem)[gtid_74489] = defunc_1_op_res_74778;
            x_74776 = defunc_1_op_res_74778;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_77226_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77226_end -
                 futhark_mc_scan_stage_3_parloop_77226_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_77226_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_77226_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_77226_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_77221(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74488 = tid;
    int num_tasks_74766 = info.nsubtasks;
    struct futhark_mc_task_77220 *futhark_mc_task_77220 =
                                 (struct futhark_mc_task_77220 *) args;
    struct futhark_context *ctx = futhark_mc_task_77220->ctx;
    uint64_t futhark_mc_segscan_task_77221_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_77221_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77220->free_n_65344;
    int64_t gtid_68562 = futhark_mc_task_77220->free_gtid_68562;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77220->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70964 = {.desc ="mem_70964", .mem =
                                 futhark_mc_task_77220->free_mem_70964, .size =
                                 0, .references =NULL};
    size_t scan_stage_2_accum_mem_74773_cached_sizze_77222 = 0;
    unsigned char *scan_stage_2_accum_mem_74773 = NULL;
    int64_t iter_74767;
    struct futhark_mc_scan_stage_1_parloop_struct_77223
    futhark_mc_scan_stage_1_parloop_struct_77223;
    
    futhark_mc_scan_stage_1_parloop_struct_77223.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_77223.free_n_65344 = n_65344;
    futhark_mc_scan_stage_1_parloop_struct_77223.free_gtid_68562 = gtid_68562;
    futhark_mc_scan_stage_1_parloop_struct_77223.free_Y_mem_70569 =
        Y_mem_70569.mem;
    futhark_mc_scan_stage_1_parloop_struct_77223.free_mem_70964 = mem_70964.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_77224_task;
    
    futhark_mc_scan_stage_1_parloop_77224_task.name =
        "futhark_mc_scan_stage_1_parloop_77224";
    futhark_mc_scan_stage_1_parloop_77224_task.fn =
        futhark_mc_scan_stage_1_parloop_77224;
    futhark_mc_scan_stage_1_parloop_77224_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_77223;
    futhark_mc_scan_stage_1_parloop_77224_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_77224_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_77224_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77224_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_77224_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_77224_task);
    
    if (futhark_mc_scan_stage_1_parloop_77224_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77224_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77224_total_end -
                 futhark_mc_scan_stage_1_parloop_77224_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77224_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77224_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77224_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_74766)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_74768;
        int64_t x_74769;
        int64_t offset_74771 = (int64_t) 0;
        int64_t offset_index_74772 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_74773_cached_sizze_77222 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_74773 = realloc(scan_stage_2_accum_mem_74773,
                                                   (int64_t) 8);
            scan_stage_2_accum_mem_74773_cached_sizze_77222 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_74773)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_74775 = 0; i_74775 < num_tasks_74766 - 1; i_74775++) {
            offset_74771 = squot64(n_65344, sext_i32_i64(num_tasks_74766));
            if (slt64(sext_i32_i64(i_74775), srem64(n_65344,
                                                    sext_i32_i64(num_tasks_74766)))) {
                offset_74771 += (int64_t) 1;
            }
            offset_index_74772 += offset_74771;
            
            int64_t gtid_74489 = offset_index_74772;
            float x_74493;
            
            x_74493 = ((float *) Y_mem_70569.mem)[gtid_68562 * n_65344 +
                                                  gtid_74489];
            
            bool isnan_res_74494;
            
            isnan_res_74494 = futrts_isnan32(x_74493);
            
            bool defunc_0_p_res_74495 = !isnan_res_74494;
            int64_t defunc_0_f_res_74496 = btoi_bool_i64(defunc_0_p_res_74495);
            
            // Read carry in
            {
                x_74768 =
                    ((int64_t *) scan_stage_2_accum_mem_74773)[(int64_t) 0];
            }
            // Read next values
            {
                x_74769 = ((int64_t *) mem_70964.mem)[offset_index_74772 -
                                                      (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_74770 = add64(x_74768, x_74769);
            
            ((int64_t *) mem_70964.mem)[offset_index_74772 - (int64_t) 1] =
                defunc_1_op_res_74770;
            ((int64_t *) scan_stage_2_accum_mem_74773)[(int64_t) 0] =
                defunc_1_op_res_74770;
        }
        
        int64_t iter_74779 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_77225
        futhark_mc_scan_stage_3_parloop_struct_77225;
        
        futhark_mc_scan_stage_3_parloop_struct_77225.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_77225.free_n_65344 = n_65344;
        futhark_mc_scan_stage_3_parloop_struct_77225.free_gtid_68562 =
            gtid_68562;
        futhark_mc_scan_stage_3_parloop_struct_77225.free_Y_mem_70569 =
            Y_mem_70569.mem;
        futhark_mc_scan_stage_3_parloop_struct_77225.free_mem_70964 =
            mem_70964.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_77226_task;
        
        futhark_mc_scan_stage_3_parloop_77226_task.name =
            "futhark_mc_scan_stage_3_parloop_77226";
        futhark_mc_scan_stage_3_parloop_77226_task.fn =
            futhark_mc_scan_stage_3_parloop_77226;
        futhark_mc_scan_stage_3_parloop_77226_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_77225;
        futhark_mc_scan_stage_3_parloop_77226_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_77226_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_77226_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_77226_total_start = get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_77226_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_77226_task);
        
        if (futhark_mc_scan_stage_3_parloop_77226_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_77226_total_end =
                     get_wall_time();
            uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77226_total_end -
                     futhark_mc_scan_stage_3_parloop_77226_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77226_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77226_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77226_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_74773);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_77221_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_77221_end -
                 futhark_mc_segscan_task_77221_start;
        
        ctx->futhark_mc_segscan_task_77221_runs[tid]++;
        ctx->futhark_mc_segscan_task_77221_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_77221_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77227 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_68562;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70964;
    unsigned char *free_mem_70967;
    unsigned char *free_mem_70970;
};
struct futhark_mc_segmap_parloop_struct_77229 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_68562;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_70964;
    unsigned char *free_mem_70967;
    unsigned char *free_mem_70970;
};
static int futhark_mc_segmap_parloop_77230(void *args, int64_t start,
                                           int64_t end, int flat_tid_74497,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77229
    *futhark_mc_segmap_parloop_struct_77229 =
    (struct futhark_mc_segmap_parloop_struct_77229 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77229->ctx;
    uint64_t futhark_mc_segmap_parloop_77230_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77230_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77229->free_n_65344;
    int64_t gtid_68562 =
            futhark_mc_segmap_parloop_struct_77229->free_gtid_68562;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77229->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70964 = {.desc ="mem_70964", .mem =
                                 futhark_mc_segmap_parloop_struct_77229->free_mem_70964,
                                 .size =0, .references =NULL};
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_segmap_parloop_struct_77229->free_mem_70967,
                                 .size =0, .references =NULL};
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_segmap_parloop_struct_77229->free_mem_70970,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74783 = start;
    
    for (; iter_74783 < end; iter_74783++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74786 = n_65344;
        int64_t gtid_74498 = iter_74783;
        int64_t remnant_74787 = iter_74783 - gtid_74498;
        float x_74499;
        
        x_74499 = ((float *) Y_mem_70569.mem)[gtid_68562 * n_65344 +
                                              gtid_74498];
        
        bool isnan_res_74500;
        
        isnan_res_74500 = futrts_isnan32(x_74499);
        
        bool defunc_0_p_res_74501 = !isnan_res_74500;
        int64_t defunc_1_f_res_74502;
        
        if (defunc_0_p_res_74501) {
            int64_t x_74784;
            
            x_74784 = ((int64_t *) mem_70964.mem)[gtid_74498];
            
            int64_t defunc_1_f_res_t_res_74785 = sub64(x_74784, (int64_t) 1);
            
            defunc_1_f_res_74502 = defunc_1_f_res_t_res_74785;
        } else {
            defunc_1_f_res_74502 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_74502) &&
            slt64(defunc_1_f_res_74502, n_65344)) {
            ((int64_t *) mem_70970.mem)[defunc_1_f_res_74502] = gtid_74498;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_74502) &&
            slt64(defunc_1_f_res_74502, n_65344)) {
            ((float *) mem_70967.mem)[defunc_1_f_res_74502] = x_74499;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77230_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77230_end -
                 futhark_mc_segmap_parloop_77230_start;
        
        ctx->futhark_mc_segmap_parloop_77230_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77230_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77230_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77228(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74497 = tid;
    int num_tasks_74782 = info.nsubtasks;
    struct futhark_mc_task_77227 *futhark_mc_task_77227 =
                                 (struct futhark_mc_task_77227 *) args;
    struct futhark_context *ctx = futhark_mc_task_77227->ctx;
    uint64_t futhark_mc_segmap_task_77228_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77228_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77227->free_n_65344;
    int64_t gtid_68562 = futhark_mc_task_77227->free_gtid_68562;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77227->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_70964 = {.desc ="mem_70964", .mem =
                                 futhark_mc_task_77227->free_mem_70964, .size =
                                 0, .references =NULL};
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_task_77227->free_mem_70967, .size =
                                 0, .references =NULL};
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_task_77227->free_mem_70970, .size =
                                 0, .references =NULL};
    int64_t iter_74783;
    struct futhark_mc_segmap_parloop_struct_77229
    futhark_mc_segmap_parloop_struct_77229;
    
    futhark_mc_segmap_parloop_struct_77229.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77229.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77229.free_gtid_68562 = gtid_68562;
    futhark_mc_segmap_parloop_struct_77229.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77229.free_mem_70964 = mem_70964.mem;
    futhark_mc_segmap_parloop_struct_77229.free_mem_70967 = mem_70967.mem;
    futhark_mc_segmap_parloop_struct_77229.free_mem_70970 = mem_70970.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77230_task;
    
    futhark_mc_segmap_parloop_77230_task.name =
        "futhark_mc_segmap_parloop_77230";
    futhark_mc_segmap_parloop_77230_task.fn = futhark_mc_segmap_parloop_77230;
    futhark_mc_segmap_parloop_77230_task.args =
        &futhark_mc_segmap_parloop_struct_77229;
    futhark_mc_segmap_parloop_77230_task.iterations = iterations;
    futhark_mc_segmap_parloop_77230_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77230_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77230_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77230_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77230_task);
    
    if (futhark_mc_segmap_parloop_77230_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77230_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77230_total_end -
                 futhark_mc_segmap_parloop_77230_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77230_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77230_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77230_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77228_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77228_end -
                 futhark_mc_segmap_task_77228_start;
        
        ctx->futhark_mc_segmap_task_77228_runs[tid]++;
        ctx->futhark_mc_segmap_task_77228_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77228_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77231 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70970;
    unsigned char *free_mem_70973;
};
struct futhark_mc_segmap_parloop_struct_77233 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_70970;
    unsigned char *free_mem_70973;
};
static int futhark_mc_segmap_parloop_77234(void *args, int64_t start,
                                           int64_t end, int flat_tid_74505,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77233
    *futhark_mc_segmap_parloop_struct_77233 =
    (struct futhark_mc_segmap_parloop_struct_77233 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77233->ctx;
    uint64_t futhark_mc_segmap_parloop_77234_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77234_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77233->free_n_65344;
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_segmap_parloop_struct_77233->free_mem_70970,
                                 .size =0, .references =NULL};
    struct memblock mem_70973 = {.desc ="mem_70973", .mem =
                                 futhark_mc_segmap_parloop_struct_77233->free_mem_70973,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74789 = start;
    
    for (; iter_74789 < end; iter_74789++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74790 = n_65344;
        int64_t gtid_74506 = iter_74789;
        int64_t remnant_74791 = iter_74789 - gtid_74506;
        int64_t x_74507;
        
        x_74507 = ((int64_t *) mem_70970.mem)[gtid_74506];
        
        int64_t defunc_0_f_res_74508 = add64((int64_t) 1, x_74507);
        
        ((int64_t *) mem_70973.mem)[gtid_74506] = defunc_0_f_res_74508;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77234_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77234_end -
                 futhark_mc_segmap_parloop_77234_start;
        
        ctx->futhark_mc_segmap_parloop_77234_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77234_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77234_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77232(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74505 = tid;
    int num_tasks_74788 = info.nsubtasks;
    struct futhark_mc_task_77231 *futhark_mc_task_77231 =
                                 (struct futhark_mc_task_77231 *) args;
    struct futhark_context *ctx = futhark_mc_task_77231->ctx;
    uint64_t futhark_mc_segmap_task_77232_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77232_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77231->free_n_65344;
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_task_77231->free_mem_70970, .size =
                                 0, .references =NULL};
    struct memblock mem_70973 = {.desc ="mem_70973", .mem =
                                 futhark_mc_task_77231->free_mem_70973, .size =
                                 0, .references =NULL};
    int64_t iter_74789;
    struct futhark_mc_segmap_parloop_struct_77233
    futhark_mc_segmap_parloop_struct_77233;
    
    futhark_mc_segmap_parloop_struct_77233.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77233.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77233.free_mem_70970 = mem_70970.mem;
    futhark_mc_segmap_parloop_struct_77233.free_mem_70973 = mem_70973.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77234_task;
    
    futhark_mc_segmap_parloop_77234_task.name =
        "futhark_mc_segmap_parloop_77234";
    futhark_mc_segmap_parloop_77234_task.fn = futhark_mc_segmap_parloop_77234;
    futhark_mc_segmap_parloop_77234_task.args =
        &futhark_mc_segmap_parloop_struct_77233;
    futhark_mc_segmap_parloop_77234_task.iterations = iterations;
    futhark_mc_segmap_parloop_77234_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77234_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77234_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77234_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77234_task);
    
    if (futhark_mc_segmap_parloop_77234_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77234_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77234_total_end -
                 futhark_mc_segmap_parloop_77234_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77234_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77234_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77234_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77232_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77232_end -
                 futhark_mc_segmap_task_77232_start;
        
        ctx->futhark_mc_segmap_task_77232_runs[tid]++;
        ctx->futhark_mc_segmap_task_77232_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77232_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77235 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_68574;
    unsigned char *free_mem_70976;
};
struct futhark_mc_segmap_parloop_struct_77237 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_68574;
    unsigned char *free_mem_70976;
};
static int futhark_mc_segmap_parloop_77238(void *args, int64_t start,
                                           int64_t end, int flat_tid_74509,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77237
    *futhark_mc_segmap_parloop_struct_77237 =
    (struct futhark_mc_segmap_parloop_struct_77237 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77237->ctx;
    uint64_t futhark_mc_segmap_parloop_77238_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77238_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77237->free_q_65346;
    int64_t last_res_68574 =
            futhark_mc_segmap_parloop_struct_77237->free_last_res_68574;
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_segmap_parloop_struct_77237->free_mem_70976,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74793 = start;
    
    for (; iter_74793 < end; iter_74793++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74794 = q_65346;
        int64_t gtid_74510 = iter_74793;
        int64_t remnant_74795 = iter_74793 - gtid_74510;
        bool cond_74511 = sle64(last_res_68574, gtid_74510);
        float defunc_0_f_res_74512;
        
        if (cond_74511) {
            defunc_0_f_res_74512 = 0.0F;
        } else {
            defunc_0_f_res_74512 = 1.0F;
        }
        ((float *) mem_70976.mem)[gtid_74510] = defunc_0_f_res_74512;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77238_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77238_end -
                 futhark_mc_segmap_parloop_77238_start;
        
        ctx->futhark_mc_segmap_parloop_77238_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77238_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77238_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77236(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74509 = tid;
    int num_tasks_74792 = info.nsubtasks;
    struct futhark_mc_task_77235 *futhark_mc_task_77235 =
                                 (struct futhark_mc_task_77235 *) args;
    struct futhark_context *ctx = futhark_mc_task_77235->ctx;
    uint64_t futhark_mc_segmap_task_77236_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77236_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_task_77235->free_q_65346;
    int64_t last_res_68574 = futhark_mc_task_77235->free_last_res_68574;
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_task_77235->free_mem_70976, .size =
                                 0, .references =NULL};
    int64_t iter_74793;
    struct futhark_mc_segmap_parloop_struct_77237
    futhark_mc_segmap_parloop_struct_77237;
    
    futhark_mc_segmap_parloop_struct_77237.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77237.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77237.free_last_res_68574 = last_res_68574;
    futhark_mc_segmap_parloop_struct_77237.free_mem_70976 = mem_70976.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77238_task;
    
    futhark_mc_segmap_parloop_77238_task.name =
        "futhark_mc_segmap_parloop_77238";
    futhark_mc_segmap_parloop_77238_task.fn = futhark_mc_segmap_parloop_77238;
    futhark_mc_segmap_parloop_77238_task.args =
        &futhark_mc_segmap_parloop_struct_77237;
    futhark_mc_segmap_parloop_77238_task.iterations = iterations;
    futhark_mc_segmap_parloop_77238_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77238_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77238_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77238_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77238_task);
    
    if (futhark_mc_segmap_parloop_77238_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77238_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77238_total_end -
                 futhark_mc_segmap_parloop_77238_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77238_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77238_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77238_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77236_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77236_end -
                 futhark_mc_segmap_task_77236_start;
        
        ctx->futhark_mc_segmap_task_77236_runs[tid]++;
        ctx->futhark_mc_segmap_task_77236_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77236_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77239 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_68574;
    int64_t free_min_arg_68593;
    int64_t free_min_arg_68594;
    int64_t free_min_res_68595;
    float free_max_res_68599;
    unsigned char *free_mem_70967;
    unsigned char *free_mem_70970;
    unsigned char *free_mem_70973;
    int64_t free_bytes_70975;
    unsigned char *free_mem_70976;
    unsigned char *free_mem_70997;
};
struct futhark_mc_segmap_parloop_struct_77241 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_68574;
    int64_t free_min_arg_68593;
    int64_t free_min_arg_68594;
    int64_t free_min_res_68595;
    float free_max_res_68599;
    unsigned char *free_mem_70967;
    unsigned char *free_mem_70970;
    unsigned char *free_mem_70973;
    int64_t free_bytes_70975;
    unsigned char *free_mem_70976;
    unsigned char *free_mem_70997;
};
static int futhark_mc_segmap_parloop_77242(void *args, int64_t start,
                                           int64_t end, int flat_tid_74639,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77241
    *futhark_mc_segmap_parloop_struct_77241 =
    (struct futhark_mc_segmap_parloop_struct_77241 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77241->ctx;
    uint64_t futhark_mc_segmap_parloop_77242_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77242_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77241->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77241->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77241->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77241->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77241->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77241->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77241->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77241->free_loop_cond_65369;
    int64_t last_res_68574 =
            futhark_mc_segmap_parloop_struct_77241->free_last_res_68574;
    int64_t min_arg_68593 =
            futhark_mc_segmap_parloop_struct_77241->free_min_arg_68593;
    int64_t min_arg_68594 =
            futhark_mc_segmap_parloop_struct_77241->free_min_arg_68594;
    int64_t min_res_68595 =
            futhark_mc_segmap_parloop_struct_77241->free_min_res_68595;
    float max_res_68599 =
          futhark_mc_segmap_parloop_struct_77241->free_max_res_68599;
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_segmap_parloop_struct_77241->free_mem_70967,
                                 .size =0, .references =NULL};
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_segmap_parloop_struct_77241->free_mem_70970,
                                 .size =0, .references =NULL};
    struct memblock mem_70973 = {.desc ="mem_70973", .mem =
                                 futhark_mc_segmap_parloop_struct_77241->free_mem_70973,
                                 .size =0, .references =NULL};
    int64_t bytes_70975 =
            futhark_mc_segmap_parloop_struct_77241->free_bytes_70975;
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_segmap_parloop_struct_77241->free_mem_70976,
                                 .size =0, .references =NULL};
    struct memblock mem_70997 = {.desc ="mem_70997", .mem =
                                 futhark_mc_segmap_parloop_struct_77241->free_mem_70997,
                                 .size =0, .references =NULL};
    size_t mem_74727_cached_sizze_77243 = 0;
    unsigned char *mem_74727 = NULL;
    int64_t iterations = end - start;
    int64_t iter_74797 = start;
    
    if (mem_74727_cached_sizze_77243 < (size_t) bytes_70975) {
        mem_74727 = realloc(mem_74727, bytes_70975);
        mem_74727_cached_sizze_77243 = bytes_70975;
    }
    for (; iter_74797 < end; iter_74797++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74884 = n_m_65352;
        int64_t gtid_74640 = iter_74797;
        int64_t remnant_74885 = iter_74797 - gtid_74640;
        int64_t min_arg_74641 = mul64(jump_65348, gtid_74640);
        int64_t min_res_74642 = smin64(i_65358, min_arg_74641);
        int64_t defunc_0_g_res_74643 = add64((int64_t) 1, min_res_74642);
        bool init_idx_74644;
        int64_t init_idx_74645;
        int64_t init_idx_74646;
        bool loop_while_74798;
        int64_t low_74799;
        int64_t high_74800;
        
        loop_while_74798 = x_65359;
        low_74799 = (int64_t) 0;
        high_74800 = i_65358;
        while (loop_while_74798) {
            int64_t x_74801 = add64(low_74799, high_74800);
            int64_t mid_74802 = sdiv64(x_74801, (int64_t) 2);
            bool x_74803 = sle64((int64_t) 0, mid_74802);
            bool y_74804 = slt64(mid_74802, n_65344);
            bool bounds_check_74805 = x_74803 && y_74804;
            bool index_certs_74806;
            
            if (!bounds_check_74805) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_74802,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_74807;
            
            mid_id_74807 = ((int64_t *) mem_70973.mem)[mid_74802];
            
            bool cond_74808 = slt64(mid_id_74807, (int64_t) 0);
            int64_t mid_idx_74809;
            
            if (cond_74808) {
                mid_idx_74809 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_74809 = mid_id_74807;
            }
            
            bool cond_74810 = sle64(defunc_0_g_res_74643, mid_idx_74809);
            int64_t loopres_74811;
            int64_t loopres_74812;
            
            if (cond_74810) {
                int64_t loopres_t_res_74813 = sub64(mid_74802, (int64_t) 1);
                
                loopres_74811 = low_74799;
                loopres_74812 = loopres_t_res_74813;
            } else {
                int64_t loopres_f_res_74814 = add64((int64_t) 1, mid_74802);
                
                loopres_74811 = loopres_f_res_74814;
                loopres_74812 = high_74800;
            }
            
            bool loop_cond_74815 = sle64(loopres_74811, loopres_74812);
            bool loop_while_tmp_74886 = loop_cond_74815;
            int64_t low_tmp_74887 = loopres_74811;
            int64_t high_tmp_74888 = loopres_74812;
            
            loop_while_74798 = loop_while_tmp_74886;
            low_74799 = low_tmp_74887;
            high_74800 = high_tmp_74888;
        }
        init_idx_74644 = loop_while_74798;
        init_idx_74645 = low_74799;
        init_idx_74646 = high_74800;
        
        bool idx_74665;
        int64_t idx_74666;
        int64_t idx_74667;
        int64_t idx_74668;
        bool loop_while_74816;
        int64_t l_idx_74817;
        int64_t r_idx_74818;
        int64_t span_74819;
        
        loop_while_74816 = loop_cond_65369;
        l_idx_74817 = init_idx_74645;
        r_idx_74818 = init_idx_74645;
        span_74819 = (int64_t) 1;
        while (loop_while_74816) {
            int64_t max_arg_74820 = sub64(l_idx_74817, (int64_t) 1);
            int64_t max_res_74821 = smax64((int64_t) 0, max_arg_74820);
            int64_t min_arg_74822 = add64((int64_t) 1, r_idx_74818);
            int64_t min_res_74823 = smin64(min_arg_68593, min_arg_74822);
            bool x_74824 = sle64((int64_t) 0, max_res_74821);
            bool y_74825 = slt64(max_res_74821, n_65344);
            bool bounds_check_74826 = x_74824 && y_74825;
            bool index_certs_74827;
            
            if (!bounds_check_74826) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_74821,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74828;
            
            x_74828 = ((int64_t *) mem_70973.mem)[max_res_74821];
            
            int64_t abs_arg_74829 = sub64(x_74828, defunc_0_g_res_74643);
            int64_t abs_res_74830 = abs64(abs_arg_74829);
            bool x_74831 = sle64((int64_t) 0, min_res_74823);
            bool y_74832 = slt64(min_res_74823, n_65344);
            bool bounds_check_74833 = x_74831 && y_74832;
            bool index_certs_74834;
            
            if (!bounds_check_74833) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_74823,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74835;
            
            x_74835 = ((int64_t *) mem_70973.mem)[min_res_74823];
            
            int64_t abs_arg_74836 = sub64(x_74835, defunc_0_g_res_74643);
            int64_t abs_res_74837 = abs64(abs_arg_74836);
            bool cond_74838 = max_res_74821 == l_idx_74817;
            int64_t loopres_74839;
            int64_t loopres_74840;
            int64_t loopres_74841;
            
            if (cond_74838) {
                loopres_74839 = l_idx_74817;
                loopres_74840 = r_idx_74818;
                loopres_74841 = min_res_65364;
            } else {
                bool cond_74842 = slt64(abs_res_74830, abs_res_74837);
                bool cond_f_res_74843 = min_res_74823 == r_idx_74818;
                bool x_74844 = !cond_74842;
                bool y_74845 = cond_f_res_74843 && x_74844;
                bool cond_74846 = cond_74842 || y_74845;
                int64_t loopres_f_res_74847;
                
                if (cond_74846) {
                    loopres_f_res_74847 = max_res_74821;
                } else {
                    loopres_f_res_74847 = l_idx_74817;
                }
                
                int64_t loopres_f_res_74848;
                
                if (cond_74846) {
                    loopres_f_res_74848 = r_idx_74818;
                } else {
                    loopres_f_res_74848 = min_res_74823;
                }
                
                int64_t loopres_f_res_74849;
                
                if (cond_74846) {
                    int64_t loopres_f_res_t_res_74850 = add64((int64_t) 1,
                                                              span_74819);
                    
                    loopres_f_res_74849 = loopres_f_res_t_res_74850;
                } else {
                    int64_t loopres_f_res_f_res_74851 = add64((int64_t) 1,
                                                              span_74819);
                    
                    loopres_f_res_74849 = loopres_f_res_f_res_74851;
                }
                loopres_74839 = loopres_f_res_74847;
                loopres_74840 = loopres_f_res_74848;
                loopres_74841 = loopres_f_res_74849;
            }
            
            bool loop_cond_74852 = slt64(loopres_74841, min_res_65364);
            bool loop_while_tmp_74889 = loop_cond_74852;
            int64_t l_idx_tmp_74890 = loopres_74839;
            int64_t r_idx_tmp_74891 = loopres_74840;
            int64_t span_tmp_74892 = loopres_74841;
            
            loop_while_74816 = loop_while_tmp_74889;
            l_idx_74817 = l_idx_tmp_74890;
            r_idx_74818 = r_idx_tmp_74891;
            span_74819 = span_tmp_74892;
        }
        idx_74665 = loop_while_74816;
        idx_74666 = l_idx_74817;
        idx_74667 = r_idx_74818;
        idx_74668 = span_74819;
        
        int64_t min_res_74706 = smin64(min_arg_68594, idx_74666);
        int64_t max_res_74707 = smax64((int64_t) 0, min_res_74706);
        int64_t x_74708 = add64(min_res_68595, max_res_74707);
        int64_t r_74709 = sub64(x_74708, (int64_t) 1);
        bool x_74710 = sle64((int64_t) 0, r_74709);
        bool y_74711 = slt64(r_74709, n_65344);
        bool bounds_check_74712 = x_74710 && y_74711;
        bool index_certs_74713;
        
        if (!bounds_check_74712) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_74709,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_74714;
        
        x_74714 = ((int64_t *) mem_70970.mem)[r_74709];
        
        int64_t abs_arg_74715 = sub64(x_74714, min_res_74642);
        int64_t abs_res_74716 = abs64(abs_arg_74715);
        bool x_74717 = sle64((int64_t) 0, max_res_74707);
        bool y_74718 = slt64(max_res_74707, n_65344);
        bool bounds_check_74719 = x_74717 && y_74718;
        bool index_certs_74720;
        
        if (!bounds_check_74719) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_74707,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_74721;
        
        x_74721 = ((int64_t *) mem_70970.mem)[max_res_74707];
        
        int64_t abs_arg_74722 = sub64(x_74721, min_res_74642);
        int64_t abs_res_74723 = abs64(abs_arg_74722);
        int64_t max_res_74724 = smax64(abs_res_74716, abs_res_74723);
        float defunc_0_f_res_74725 = sitofp_i64_f32(max_res_74724);
        float defunc_1_f_res_74726 = max_res_68599 + defunc_0_f_res_74725;
        float defunc_2_reduce_res_74729;
        float redout_74854 = 0.0F;
        
        for (int64_t i_74853 = 0; i_74853 < q_65346; i_74853++) {
            float x_74856;
            
            x_74856 = ((float *) mem_70976.mem)[i_74853];
            
            bool cond_74857 = sle64(last_res_68574, i_74853);
            int64_t defunc_0_f_res_74858;
            
            if (cond_74857) {
                defunc_0_f_res_74858 = (int64_t) 0;
            } else {
                int64_t i_74859 = add64(max_res_74707, i_74853);
                int64_t defunc_0_add_arg_74860;
                
                defunc_0_add_arg_74860 = ((int64_t *) mem_70970.mem)[i_74859];
                
                int64_t defunc_1_add_res_74861 = add64((int64_t) 1,
                                                       defunc_0_add_arg_74860);
                
                defunc_0_f_res_74858 = defunc_1_add_res_74861;
            }
            
            int64_t binop_p_74862 = sub64(defunc_0_f_res_74858, min_res_74642);
            float defunc_0_f_res_74863 = sitofp_i64_f32(binop_p_74862);
            float abs_res_74864 = (float) fabs(defunc_0_f_res_74863);
            float tmp1_74865 = abs_res_74864 / defunc_1_f_res_74726;
            float x_74866 = tmp1_74865 * tmp1_74865;
            float y_74867 = tmp1_74865 * x_74866;
            float tmp2_74868 = 1.0F - y_74867;
            float x_74869 = tmp2_74868 * tmp2_74868;
            float tmp3_74870 = tmp2_74868 * x_74869;
            float tmp4_74871 = x_74856 * tmp3_74870;
            float defunc_1_op_res_74872 = tmp4_74871 + redout_74854;
            
            ((float *) mem_74727)[i_74853] = tmp4_74871;
            
            float redout_tmp_74893 = defunc_1_op_res_74872;
            
            redout_74854 = redout_tmp_74893;
        }
        defunc_2_reduce_res_74729 = redout_74854;
        
        float a0_74752 = 1.0F / defunc_2_reduce_res_74729;
        float defunc_2_reduce_res_74753;
        float redout_74875 = 0.0F;
        
        for (int64_t i_74874 = 0; i_74874 < q_65346; i_74874++) {
            float x_74876;
            
            x_74876 = ((float *) mem_74727)[i_74874];
            
            bool cond_74877 = sle64(last_res_68574, i_74874);
            float defunc_0_f_res_74878;
            
            if (cond_74877) {
                defunc_0_f_res_74878 = 0.0F;
            } else {
                int64_t i_74879 = add64(max_res_74707, i_74874);
                float defunc_0_add_arg_74880;
                
                defunc_0_add_arg_74880 = ((float *) mem_70967.mem)[i_74879];
                defunc_0_f_res_74878 = defunc_0_add_arg_74880;
            }
            
            float x_74881 = a0_74752 * x_74876;
            float defunc_9_fit_fun_res_74882 = defunc_0_f_res_74878 * x_74881;
            float defunc_1_op_res_74883 = defunc_9_fit_fun_res_74882 +
                  redout_74875;
            float redout_tmp_74895 = defunc_1_op_res_74883;
            
            redout_74875 = redout_tmp_74895;
        }
        defunc_2_reduce_res_74753 = redout_74875;
        ((float *) mem_70997.mem)[gtid_74640] = defunc_2_reduce_res_74753;
    }
    
  cleanup:
    { }
    free(mem_74727);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77242_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77242_end -
                 futhark_mc_segmap_parloop_77242_start;
        
        ctx->futhark_mc_segmap_parloop_77242_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77242_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77242_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77240(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74639 = tid;
    int num_tasks_74796 = info.nsubtasks;
    struct futhark_mc_task_77239 *futhark_mc_task_77239 =
                                 (struct futhark_mc_task_77239 *) args;
    struct futhark_context *ctx = futhark_mc_task_77239->ctx;
    uint64_t futhark_mc_segmap_task_77240_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77240_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77239->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77239->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77239->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77239->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77239->free_i_65358;
    bool x_65359 = futhark_mc_task_77239->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77239->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77239->free_loop_cond_65369;
    int64_t last_res_68574 = futhark_mc_task_77239->free_last_res_68574;
    int64_t min_arg_68593 = futhark_mc_task_77239->free_min_arg_68593;
    int64_t min_arg_68594 = futhark_mc_task_77239->free_min_arg_68594;
    int64_t min_res_68595 = futhark_mc_task_77239->free_min_res_68595;
    float max_res_68599 = futhark_mc_task_77239->free_max_res_68599;
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_task_77239->free_mem_70967, .size =
                                 0, .references =NULL};
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_task_77239->free_mem_70970, .size =
                                 0, .references =NULL};
    struct memblock mem_70973 = {.desc ="mem_70973", .mem =
                                 futhark_mc_task_77239->free_mem_70973, .size =
                                 0, .references =NULL};
    int64_t bytes_70975 = futhark_mc_task_77239->free_bytes_70975;
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_task_77239->free_mem_70976, .size =
                                 0, .references =NULL};
    struct memblock mem_70997 = {.desc ="mem_70997", .mem =
                                 futhark_mc_task_77239->free_mem_70997, .size =
                                 0, .references =NULL};
    int64_t iter_74797;
    struct futhark_mc_segmap_parloop_struct_77241
    futhark_mc_segmap_parloop_struct_77241;
    
    futhark_mc_segmap_parloop_struct_77241.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77241.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77241.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77241.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77241.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77241.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77241.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77241.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77241.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77241.free_last_res_68574 = last_res_68574;
    futhark_mc_segmap_parloop_struct_77241.free_min_arg_68593 = min_arg_68593;
    futhark_mc_segmap_parloop_struct_77241.free_min_arg_68594 = min_arg_68594;
    futhark_mc_segmap_parloop_struct_77241.free_min_res_68595 = min_res_68595;
    futhark_mc_segmap_parloop_struct_77241.free_max_res_68599 = max_res_68599;
    futhark_mc_segmap_parloop_struct_77241.free_mem_70967 = mem_70967.mem;
    futhark_mc_segmap_parloop_struct_77241.free_mem_70970 = mem_70970.mem;
    futhark_mc_segmap_parloop_struct_77241.free_mem_70973 = mem_70973.mem;
    futhark_mc_segmap_parloop_struct_77241.free_bytes_70975 = bytes_70975;
    futhark_mc_segmap_parloop_struct_77241.free_mem_70976 = mem_70976.mem;
    futhark_mc_segmap_parloop_struct_77241.free_mem_70997 = mem_70997.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77242_task;
    
    futhark_mc_segmap_parloop_77242_task.name =
        "futhark_mc_segmap_parloop_77242";
    futhark_mc_segmap_parloop_77242_task.fn = futhark_mc_segmap_parloop_77242;
    futhark_mc_segmap_parloop_77242_task.args =
        &futhark_mc_segmap_parloop_struct_77241;
    futhark_mc_segmap_parloop_77242_task.iterations = iterations;
    futhark_mc_segmap_parloop_77242_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77242_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77242_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77242_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77242_task);
    
    if (futhark_mc_segmap_parloop_77242_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77242_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77242_total_end -
                 futhark_mc_segmap_parloop_77242_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77242_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77242_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77242_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77240_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77240_end -
                 futhark_mc_segmap_task_77240_start;
        
        ctx->futhark_mc_segmap_task_77240_runs[tid]++;
        ctx->futhark_mc_segmap_task_77240_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77240_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77245 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_68574;
    int64_t free_min_arg_68593;
    int64_t free_min_arg_68594;
    int64_t free_min_res_68595;
    float free_max_res_68599;
    unsigned char *free_mem_70967;
    unsigned char *free_mem_70970;
    unsigned char *free_mem_70973;
    int64_t free_bytes_70975;
    unsigned char *free_mem_70976;
    unsigned char *free_mem_70997;
};
struct futhark_mc_task_77248 {
    struct futhark_context *ctx;
    int64_t free_last_res_68574;
    unsigned char *free_mem_70970;
    unsigned char *free_mem_70976;
    int64_t free_min_res_74516;
    int64_t free_max_res_74581;
    float free_defunc_1_f_res_74600;
    float *retval_defunc_2_reduce_res_74602;
    unsigned char *retval_mem_74601;
};
struct futhark_mc_segred_stage_1_parloop_struct_77251 {
    struct futhark_context *ctx;
    int64_t free_last_res_68574;
    unsigned char *free_mem_70970;
    unsigned char *free_mem_70976;
    int64_t free_min_res_74516;
    int64_t free_max_res_74581;
    float free_defunc_1_f_res_74600;
    unsigned char *free_mem_74601;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_74995;
};
static int futhark_mc_segred_stage_1_parloop_77252(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_74952, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77251
    *futhark_mc_segred_stage_1_parloop_struct_77251 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77251 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77251->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77252_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77252_start = get_wall_time();
    
    int64_t last_res_68574 =
            futhark_mc_segred_stage_1_parloop_struct_77251->free_last_res_68574;
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77251->free_mem_70970,
                                 .size =0, .references =NULL};
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77251->free_mem_70976,
                                 .size =0, .references =NULL};
    int64_t min_res_74516 =
            futhark_mc_segred_stage_1_parloop_struct_77251->free_min_res_74516;
    int64_t max_res_74581 =
            futhark_mc_segred_stage_1_parloop_struct_77251->free_max_res_74581;
    float defunc_1_f_res_74600 =
          futhark_mc_segred_stage_1_parloop_struct_77251->free_defunc_1_f_res_74600;
    struct memblock mem_74601 = {.desc ="mem_74601", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77251->free_mem_74601,
                                 .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_74995 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_74995",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77251->free_reduce_stage_1_tid_res_arr_mem_74995,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_74997 = start;
    float x_74954;
    float x_74955;
    float local_acc_74998 = 0.0F;
    
    for (; iter_74997 < end; iter_74997++) {
        int64_t gtid_74953 = iter_74997;
        float x_74957;
        
        x_74957 = ((float *) mem_70976.mem)[gtid_74953];
        
        bool cond_74958 = sle64(last_res_68574, gtid_74953);
        int64_t defunc_0_f_res_74959;
        
        if (cond_74958) {
            defunc_0_f_res_74959 = (int64_t) 0;
        } else {
            int64_t i_74960 = add64(max_res_74581, gtid_74953);
            int64_t defunc_0_add_arg_74961;
            
            defunc_0_add_arg_74961 = ((int64_t *) mem_70970.mem)[i_74960];
            
            int64_t defunc_1_add_res_74962 = add64((int64_t) 1,
                                                   defunc_0_add_arg_74961);
            
            defunc_0_f_res_74959 = defunc_1_add_res_74962;
        }
        
        int64_t binop_p_74963 = sub64(defunc_0_f_res_74959, min_res_74516);
        float defunc_0_f_res_74964 = sitofp_i64_f32(binop_p_74963);
        float abs_res_74965 = (float) fabs(defunc_0_f_res_74964);
        float tmp1_74966 = abs_res_74965 / defunc_1_f_res_74600;
        float x_74967 = tmp1_74966 * tmp1_74966;
        float y_74968 = tmp1_74966 * x_74967;
        float tmp2_74969 = 1.0F - y_74968;
        float x_74970 = tmp2_74969 * tmp2_74969;
        float tmp3_74971 = tmp2_74969 * x_74970;
        float tmp4_74972 = x_74957 * tmp3_74971;
        
        // save map-out results
        {
            ((float *) mem_74601.mem)[gtid_74953] = tmp4_74972;
        }
        // Load accum params
        {
            x_74954 = local_acc_74998;
        }
        // Load next params
        {
            x_74955 = tmp4_74972;
        }
        // Red body
        {
            float defunc_1_op_res_74956 = x_74954 + x_74955;
            
            local_acc_74998 = defunc_1_op_res_74956;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_74995.mem)[flat_tid_74952] =
        local_acc_74998;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77252_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77252_end -
                 futhark_mc_segred_stage_1_parloop_77252_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77252_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77252_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77252_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77249(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74952 = tid;
    int num_tasks_74994 = info.nsubtasks;
    struct futhark_mc_task_77248 *futhark_mc_task_77248 =
                                 (struct futhark_mc_task_77248 *) args;
    struct futhark_context *ctx = futhark_mc_task_77248->ctx;
    uint64_t futhark_mc_segred_task_77249_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77249_start = get_wall_time();
    
    int64_t last_res_68574 = futhark_mc_task_77248->free_last_res_68574;
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_task_77248->free_mem_70970, .size =
                                 0, .references =NULL};
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_task_77248->free_mem_70976, .size =
                                 0, .references =NULL};
    int64_t min_res_74516 = futhark_mc_task_77248->free_min_res_74516;
    int64_t max_res_74581 = futhark_mc_task_77248->free_max_res_74581;
    float defunc_1_f_res_74600 =
          futhark_mc_task_77248->free_defunc_1_f_res_74600;
    float defunc_2_reduce_res_74602 =
          *futhark_mc_task_77248->retval_defunc_2_reduce_res_74602;
    struct memblock mem_74601 = {.desc ="mem_74601", .mem =
                                 futhark_mc_task_77248->retval_mem_74601,
                                 .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_74995_cached_sizze_77250 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_74995 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_74995_cached_sizze_77250 <
        (size_t) ((int64_t) 4 * num_tasks_74994)) {
        reduce_stage_1_tid_res_arr_mem_74995 =
            realloc(reduce_stage_1_tid_res_arr_mem_74995, (int64_t) 4 *
                    num_tasks_74994);
        reduce_stage_1_tid_res_arr_mem_74995_cached_sizze_77250 = (int64_t) 4 *
            num_tasks_74994;
    }
    
    int64_t iter_74997;
    struct futhark_mc_segred_stage_1_parloop_struct_77251
    futhark_mc_segred_stage_1_parloop_struct_77251;
    
    futhark_mc_segred_stage_1_parloop_struct_77251.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_last_res_68574 =
        last_res_68574;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_mem_70970 =
        mem_70970.mem;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_mem_70976 =
        mem_70976.mem;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_min_res_74516 =
        min_res_74516;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_max_res_74581 =
        max_res_74581;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_defunc_1_f_res_74600 =
        defunc_1_f_res_74600;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_mem_74601 =
        mem_74601.mem;
    futhark_mc_segred_stage_1_parloop_struct_77251.free_reduce_stage_1_tid_res_arr_mem_74995 =
        reduce_stage_1_tid_res_arr_mem_74995;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77252_task;
    
    futhark_mc_segred_stage_1_parloop_77252_task.name =
        "futhark_mc_segred_stage_1_parloop_77252";
    futhark_mc_segred_stage_1_parloop_77252_task.fn =
        futhark_mc_segred_stage_1_parloop_77252;
    futhark_mc_segred_stage_1_parloop_77252_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77251;
    futhark_mc_segred_stage_1_parloop_77252_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77252_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77252_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77252_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77252_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77252_task);
    
    if (futhark_mc_segred_stage_1_parloop_77252_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77252_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77252_total_end -
                 futhark_mc_segred_stage_1_parloop_77252_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77252_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77252_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77252_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_74602 = 0.0F;
    }
    
    float x_74999;
    float x_75000;
    
    for (int32_t i_75002 = 0; i_75002 < num_tasks_74994; i_75002++) {
        flat_tid_74952 = i_75002;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_74999 = defunc_2_reduce_res_74602;
            }
            // load next params
            {
                x_75000 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_74995)[flat_tid_74952];
            }
            // red body
            {
                float defunc_1_op_res_75001 = x_74999 + x_75000;
                
                defunc_2_reduce_res_74602 = defunc_1_op_res_75001;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_74995);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77249_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77249_end -
                 futhark_mc_segred_task_77249_start;
        
        ctx->futhark_mc_segred_task_77249_runs[tid]++;
        ctx->futhark_mc_segred_task_77249_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77249_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77248->retval_defunc_2_reduce_res_74602 =
            defunc_2_reduce_res_74602;
        futhark_mc_task_77248->retval_mem_74601 = mem_74601.mem;
    }
    return err;
}
struct futhark_mc_task_77253 {
    struct futhark_context *ctx;
    int64_t free_last_res_68574;
    unsigned char *free_mem_70967;
    int64_t free_max_res_74581;
    unsigned char *free_mem_74601;
    float free_a0_74625;
    float *retval_defunc_2_reduce_res_74626;
};
struct futhark_mc_segred_stage_1_parloop_struct_77256 {
    struct futhark_context *ctx;
    int64_t free_last_res_68574;
    unsigned char *free_mem_70967;
    int64_t free_max_res_74581;
    unsigned char *free_mem_74601;
    float free_a0_74625;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_75004;
};
static int futhark_mc_segred_stage_1_parloop_77257(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_74973, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77256
    *futhark_mc_segred_stage_1_parloop_struct_77256 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77256 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77256->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77257_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77257_start = get_wall_time();
    
    int64_t last_res_68574 =
            futhark_mc_segred_stage_1_parloop_struct_77256->free_last_res_68574;
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77256->free_mem_70967,
                                 .size =0, .references =NULL};
    int64_t max_res_74581 =
            futhark_mc_segred_stage_1_parloop_struct_77256->free_max_res_74581;
    struct memblock mem_74601 = {.desc ="mem_74601", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77256->free_mem_74601,
                                 .size =0, .references =NULL};
    float a0_74625 =
          futhark_mc_segred_stage_1_parloop_struct_77256->free_a0_74625;
    struct memblock reduce_stage_1_tid_res_arr_mem_75004 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_75004",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77256->free_reduce_stage_1_tid_res_arr_mem_75004,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75006 = start;
    float x_74975;
    float x_74976;
    float local_acc_75007 = 0.0F;
    
    for (; iter_75006 < end; iter_75006++) {
        int64_t gtid_74974 = iter_75006;
        float x_74978;
        
        x_74978 = ((float *) mem_74601.mem)[gtid_74974];
        
        bool cond_74979 = sle64(last_res_68574, gtid_74974);
        float defunc_0_f_res_74980;
        
        if (cond_74979) {
            defunc_0_f_res_74980 = 0.0F;
        } else {
            int64_t i_74981 = add64(max_res_74581, gtid_74974);
            float defunc_0_add_arg_74982;
            
            defunc_0_add_arg_74982 = ((float *) mem_70967.mem)[i_74981];
            defunc_0_f_res_74980 = defunc_0_add_arg_74982;
        }
        
        float x_74983 = a0_74625 * x_74978;
        float defunc_9_fit_fun_res_74984 = defunc_0_f_res_74980 * x_74983;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_74975 = local_acc_75007;
        }
        // Load next params
        {
            x_74976 = defunc_9_fit_fun_res_74984;
        }
        // Red body
        {
            float defunc_1_op_res_74977 = x_74975 + x_74976;
            
            local_acc_75007 = defunc_1_op_res_74977;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_75004.mem)[flat_tid_74973] =
        local_acc_75007;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77257_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77257_end -
                 futhark_mc_segred_stage_1_parloop_77257_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77257_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77257_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77257_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77254(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74973 = tid;
    int num_tasks_75003 = info.nsubtasks;
    struct futhark_mc_task_77253 *futhark_mc_task_77253 =
                                 (struct futhark_mc_task_77253 *) args;
    struct futhark_context *ctx = futhark_mc_task_77253->ctx;
    uint64_t futhark_mc_segred_task_77254_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77254_start = get_wall_time();
    
    int64_t last_res_68574 = futhark_mc_task_77253->free_last_res_68574;
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_task_77253->free_mem_70967, .size =
                                 0, .references =NULL};
    int64_t max_res_74581 = futhark_mc_task_77253->free_max_res_74581;
    struct memblock mem_74601 = {.desc ="mem_74601", .mem =
                                 futhark_mc_task_77253->free_mem_74601, .size =
                                 0, .references =NULL};
    float a0_74625 = futhark_mc_task_77253->free_a0_74625;
    float defunc_2_reduce_res_74626 =
          *futhark_mc_task_77253->retval_defunc_2_reduce_res_74626;
    size_t reduce_stage_1_tid_res_arr_mem_75004_cached_sizze_77255 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_75004 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_75004_cached_sizze_77255 <
        (size_t) ((int64_t) 4 * num_tasks_75003)) {
        reduce_stage_1_tid_res_arr_mem_75004 =
            realloc(reduce_stage_1_tid_res_arr_mem_75004, (int64_t) 4 *
                    num_tasks_75003);
        reduce_stage_1_tid_res_arr_mem_75004_cached_sizze_77255 = (int64_t) 4 *
            num_tasks_75003;
    }
    
    int64_t iter_75006;
    struct futhark_mc_segred_stage_1_parloop_struct_77256
    futhark_mc_segred_stage_1_parloop_struct_77256;
    
    futhark_mc_segred_stage_1_parloop_struct_77256.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77256.free_last_res_68574 =
        last_res_68574;
    futhark_mc_segred_stage_1_parloop_struct_77256.free_mem_70967 =
        mem_70967.mem;
    futhark_mc_segred_stage_1_parloop_struct_77256.free_max_res_74581 =
        max_res_74581;
    futhark_mc_segred_stage_1_parloop_struct_77256.free_mem_74601 =
        mem_74601.mem;
    futhark_mc_segred_stage_1_parloop_struct_77256.free_a0_74625 = a0_74625;
    futhark_mc_segred_stage_1_parloop_struct_77256.free_reduce_stage_1_tid_res_arr_mem_75004 =
        reduce_stage_1_tid_res_arr_mem_75004;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77257_task;
    
    futhark_mc_segred_stage_1_parloop_77257_task.name =
        "futhark_mc_segred_stage_1_parloop_77257";
    futhark_mc_segred_stage_1_parloop_77257_task.fn =
        futhark_mc_segred_stage_1_parloop_77257;
    futhark_mc_segred_stage_1_parloop_77257_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77256;
    futhark_mc_segred_stage_1_parloop_77257_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77257_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77257_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77257_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77257_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77257_task);
    
    if (futhark_mc_segred_stage_1_parloop_77257_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77257_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77257_total_end -
                 futhark_mc_segred_stage_1_parloop_77257_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77257_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77257_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77257_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_74626 = 0.0F;
    }
    
    float x_75008;
    float x_75009;
    
    for (int32_t i_75011 = 0; i_75011 < num_tasks_75003; i_75011++) {
        flat_tid_74973 = i_75011;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_75008 = defunc_2_reduce_res_74626;
            }
            // load next params
            {
                x_75009 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_75004)[flat_tid_74973];
            }
            // red body
            {
                float defunc_1_op_res_75010 = x_75008 + x_75009;
                
                defunc_2_reduce_res_74626 = defunc_1_op_res_75010;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_75004);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77254_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77254_end -
                 futhark_mc_segred_task_77254_start;
        
        ctx->futhark_mc_segred_task_77254_runs[tid]++;
        ctx->futhark_mc_segred_task_77254_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77254_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77253->retval_defunc_2_reduce_res_74626 =
            defunc_2_reduce_res_74626;
    }
    return err;
}
static int futhark_mc_segmap_parloop_77246(void *args, int64_t start,
                                           int64_t end, int flat_tid_74513,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77245
    *futhark_mc_segmap_parloop_struct_77245 =
    (struct futhark_mc_segmap_parloop_struct_77245 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77245->ctx;
    uint64_t futhark_mc_segmap_parloop_77246_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77246_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77245->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77245->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77245->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77245->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77245->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77245->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77245->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77245->free_loop_cond_65369;
    int64_t last_res_68574 =
            futhark_mc_segmap_parloop_struct_77245->free_last_res_68574;
    int64_t min_arg_68593 =
            futhark_mc_segmap_parloop_struct_77245->free_min_arg_68593;
    int64_t min_arg_68594 =
            futhark_mc_segmap_parloop_struct_77245->free_min_arg_68594;
    int64_t min_res_68595 =
            futhark_mc_segmap_parloop_struct_77245->free_min_res_68595;
    float max_res_68599 =
          futhark_mc_segmap_parloop_struct_77245->free_max_res_68599;
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_segmap_parloop_struct_77245->free_mem_70967,
                                 .size =0, .references =NULL};
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_segmap_parloop_struct_77245->free_mem_70970,
                                 .size =0, .references =NULL};
    struct memblock mem_70973 = {.desc ="mem_70973", .mem =
                                 futhark_mc_segmap_parloop_struct_77245->free_mem_70973,
                                 .size =0, .references =NULL};
    int64_t bytes_70975 =
            futhark_mc_segmap_parloop_struct_77245->free_bytes_70975;
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_segmap_parloop_struct_77245->free_mem_70976,
                                 .size =0, .references =NULL};
    struct memblock mem_70997 = {.desc ="mem_70997", .mem =
                                 futhark_mc_segmap_parloop_struct_77245->free_mem_70997,
                                 .size =0, .references =NULL};
    size_t mem_74601_cached_sizze_77247 = 0;
    unsigned char *mem_74601 = NULL;
    int64_t iterations = end - start;
    int64_t iter_74896 = start;
    
    if (mem_74601_cached_sizze_77247 < (size_t) bytes_70975) {
        mem_74601 = realloc(mem_74601, bytes_70975);
        mem_74601_cached_sizze_77247 = bytes_70975;
    }
    for (; iter_74896 < end; iter_74896++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74985 = n_m_65352;
        int64_t gtid_74514 = iter_74896;
        int64_t remnant_74986 = iter_74896 - gtid_74514;
        int64_t min_arg_74515 = mul64(jump_65348, gtid_74514);
        int64_t min_res_74516 = smin64(i_65358, min_arg_74515);
        int64_t defunc_0_g_res_74517 = add64((int64_t) 1, min_res_74516);
        bool init_idx_74518;
        int64_t init_idx_74519;
        int64_t init_idx_74520;
        bool loop_while_74897;
        int64_t low_74898;
        int64_t high_74899;
        
        loop_while_74897 = x_65359;
        low_74898 = (int64_t) 0;
        high_74899 = i_65358;
        while (loop_while_74897) {
            int64_t x_74900 = add64(low_74898, high_74899);
            int64_t mid_74901 = sdiv64(x_74900, (int64_t) 2);
            bool x_74902 = sle64((int64_t) 0, mid_74901);
            bool y_74903 = slt64(mid_74901, n_65344);
            bool bounds_check_74904 = x_74902 && y_74903;
            bool index_certs_74905;
            
            if (!bounds_check_74904) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_74901,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_74906;
            
            mid_id_74906 = ((int64_t *) mem_70973.mem)[mid_74901];
            
            bool cond_74907 = slt64(mid_id_74906, (int64_t) 0);
            int64_t mid_idx_74908;
            
            if (cond_74907) {
                mid_idx_74908 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_74908 = mid_id_74906;
            }
            
            bool cond_74909 = sle64(defunc_0_g_res_74517, mid_idx_74908);
            int64_t loopres_74910;
            int64_t loopres_74911;
            
            if (cond_74909) {
                int64_t loopres_t_res_74912 = sub64(mid_74901, (int64_t) 1);
                
                loopres_74910 = low_74898;
                loopres_74911 = loopres_t_res_74912;
            } else {
                int64_t loopres_f_res_74913 = add64((int64_t) 1, mid_74901);
                
                loopres_74910 = loopres_f_res_74913;
                loopres_74911 = high_74899;
            }
            
            bool loop_cond_74914 = sle64(loopres_74910, loopres_74911);
            bool loop_while_tmp_74987 = loop_cond_74914;
            int64_t low_tmp_74988 = loopres_74910;
            int64_t high_tmp_74989 = loopres_74911;
            
            loop_while_74897 = loop_while_tmp_74987;
            low_74898 = low_tmp_74988;
            high_74899 = high_tmp_74989;
        }
        init_idx_74518 = loop_while_74897;
        init_idx_74519 = low_74898;
        init_idx_74520 = high_74899;
        
        bool idx_74539;
        int64_t idx_74540;
        int64_t idx_74541;
        int64_t idx_74542;
        bool loop_while_74915;
        int64_t l_idx_74916;
        int64_t r_idx_74917;
        int64_t span_74918;
        
        loop_while_74915 = loop_cond_65369;
        l_idx_74916 = init_idx_74519;
        r_idx_74917 = init_idx_74519;
        span_74918 = (int64_t) 1;
        while (loop_while_74915) {
            int64_t max_arg_74919 = sub64(l_idx_74916, (int64_t) 1);
            int64_t max_res_74920 = smax64((int64_t) 0, max_arg_74919);
            int64_t min_arg_74921 = add64((int64_t) 1, r_idx_74917);
            int64_t min_res_74922 = smin64(min_arg_68593, min_arg_74921);
            bool x_74923 = sle64((int64_t) 0, max_res_74920);
            bool y_74924 = slt64(max_res_74920, n_65344);
            bool bounds_check_74925 = x_74923 && y_74924;
            bool index_certs_74926;
            
            if (!bounds_check_74925) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_74920,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74927;
            
            x_74927 = ((int64_t *) mem_70973.mem)[max_res_74920];
            
            int64_t abs_arg_74928 = sub64(x_74927, defunc_0_g_res_74517);
            int64_t abs_res_74929 = abs64(abs_arg_74928);
            bool x_74930 = sle64((int64_t) 0, min_res_74922);
            bool y_74931 = slt64(min_res_74922, n_65344);
            bool bounds_check_74932 = x_74930 && y_74931;
            bool index_certs_74933;
            
            if (!bounds_check_74932) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_74922,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_74934;
            
            x_74934 = ((int64_t *) mem_70973.mem)[min_res_74922];
            
            int64_t abs_arg_74935 = sub64(x_74934, defunc_0_g_res_74517);
            int64_t abs_res_74936 = abs64(abs_arg_74935);
            bool cond_74937 = max_res_74920 == l_idx_74916;
            int64_t loopres_74938;
            int64_t loopres_74939;
            int64_t loopres_74940;
            
            if (cond_74937) {
                loopres_74938 = l_idx_74916;
                loopres_74939 = r_idx_74917;
                loopres_74940 = min_res_65364;
            } else {
                bool cond_74941 = slt64(abs_res_74929, abs_res_74936);
                bool cond_f_res_74942 = min_res_74922 == r_idx_74917;
                bool x_74943 = !cond_74941;
                bool y_74944 = cond_f_res_74942 && x_74943;
                bool cond_74945 = cond_74941 || y_74944;
                int64_t loopres_f_res_74946;
                
                if (cond_74945) {
                    loopres_f_res_74946 = max_res_74920;
                } else {
                    loopres_f_res_74946 = l_idx_74916;
                }
                
                int64_t loopres_f_res_74947;
                
                if (cond_74945) {
                    loopres_f_res_74947 = r_idx_74917;
                } else {
                    loopres_f_res_74947 = min_res_74922;
                }
                
                int64_t loopres_f_res_74948;
                
                if (cond_74945) {
                    int64_t loopres_f_res_t_res_74949 = add64((int64_t) 1,
                                                              span_74918);
                    
                    loopres_f_res_74948 = loopres_f_res_t_res_74949;
                } else {
                    int64_t loopres_f_res_f_res_74950 = add64((int64_t) 1,
                                                              span_74918);
                    
                    loopres_f_res_74948 = loopres_f_res_f_res_74950;
                }
                loopres_74938 = loopres_f_res_74946;
                loopres_74939 = loopres_f_res_74947;
                loopres_74940 = loopres_f_res_74948;
            }
            
            bool loop_cond_74951 = slt64(loopres_74940, min_res_65364);
            bool loop_while_tmp_74990 = loop_cond_74951;
            int64_t l_idx_tmp_74991 = loopres_74938;
            int64_t r_idx_tmp_74992 = loopres_74939;
            int64_t span_tmp_74993 = loopres_74940;
            
            loop_while_74915 = loop_while_tmp_74990;
            l_idx_74916 = l_idx_tmp_74991;
            r_idx_74917 = r_idx_tmp_74992;
            span_74918 = span_tmp_74993;
        }
        idx_74539 = loop_while_74915;
        idx_74540 = l_idx_74916;
        idx_74541 = r_idx_74917;
        idx_74542 = span_74918;
        
        int64_t min_res_74580 = smin64(min_arg_68594, idx_74540);
        int64_t max_res_74581 = smax64((int64_t) 0, min_res_74580);
        int64_t x_74582 = add64(min_res_68595, max_res_74581);
        int64_t r_74583 = sub64(x_74582, (int64_t) 1);
        bool x_74584 = sle64((int64_t) 0, r_74583);
        bool y_74585 = slt64(r_74583, n_65344);
        bool bounds_check_74586 = x_74584 && y_74585;
        bool index_certs_74587;
        
        if (!bounds_check_74586) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_74583,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_74588;
        
        x_74588 = ((int64_t *) mem_70970.mem)[r_74583];
        
        int64_t abs_arg_74589 = sub64(x_74588, min_res_74516);
        int64_t abs_res_74590 = abs64(abs_arg_74589);
        bool x_74591 = sle64((int64_t) 0, max_res_74581);
        bool y_74592 = slt64(max_res_74581, n_65344);
        bool bounds_check_74593 = x_74591 && y_74592;
        bool index_certs_74594;
        
        if (!bounds_check_74593) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_74581,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_74595;
        
        x_74595 = ((int64_t *) mem_70970.mem)[max_res_74581];
        
        int64_t abs_arg_74596 = sub64(x_74595, min_res_74516);
        int64_t abs_res_74597 = abs64(abs_arg_74596);
        int64_t max_res_74598 = smax64(abs_res_74590, abs_res_74597);
        float defunc_0_f_res_74599 = sitofp_i64_f32(max_res_74598);
        float defunc_1_f_res_74600 = max_res_68599 + defunc_0_f_res_74599;
        float defunc_2_reduce_res_74602;
        int64_t flat_tid_74952 = (int64_t) 0;
        int32_t num_tasks_74994;
        
        defunc_2_reduce_res_74602 = 0.0F;
        
        struct futhark_mc_task_77248 futhark_mc_task_77248;
        
        futhark_mc_task_77248.ctx = ctx;
        futhark_mc_task_77248.free_last_res_68574 = last_res_68574;
        futhark_mc_task_77248.free_mem_70970 = mem_70970.mem;
        futhark_mc_task_77248.free_mem_70976 = mem_70976.mem;
        futhark_mc_task_77248.free_min_res_74516 = min_res_74516;
        futhark_mc_task_77248.free_max_res_74581 = max_res_74581;
        futhark_mc_task_77248.free_defunc_1_f_res_74600 = defunc_1_f_res_74600;
        futhark_mc_task_77248.retval_defunc_2_reduce_res_74602 =
            &defunc_2_reduce_res_74602;
        futhark_mc_task_77248.retval_mem_74601 = mem_74601;
        
        struct scheduler_segop futhark_mc_task_77248_task;
        
        futhark_mc_task_77248_task.args = &futhark_mc_task_77248;
        futhark_mc_task_77248_task.top_level_fn = futhark_mc_segred_task_77249;
        futhark_mc_task_77248_task.name = "futhark_mc_segred_task_77249";
        futhark_mc_task_77248_task.iterations = q_65346;
        futhark_mc_task_77248_task.task_time =
            &ctx->futhark_mc_segred_task_77249_total_time;
        futhark_mc_task_77248_task.task_iter =
            &ctx->futhark_mc_segred_task_77249_total_iter;
        futhark_mc_task_77248_task.sched = STATIC;
        futhark_mc_task_77248_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77249_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77248_task);
        
        if (futhark_mc_segred_task_77249_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        float a0_74625 = 1.0F / defunc_2_reduce_res_74602;
        float defunc_2_reduce_res_74626;
        int64_t flat_tid_74973 = (int64_t) 0;
        int32_t num_tasks_75003;
        
        defunc_2_reduce_res_74626 = 0.0F;
        
        struct futhark_mc_task_77253 futhark_mc_task_77253;
        
        futhark_mc_task_77253.ctx = ctx;
        futhark_mc_task_77253.free_last_res_68574 = last_res_68574;
        futhark_mc_task_77253.free_mem_70967 = mem_70967.mem;
        futhark_mc_task_77253.free_max_res_74581 = max_res_74581;
        futhark_mc_task_77253.free_mem_74601 = mem_74601;
        futhark_mc_task_77253.free_a0_74625 = a0_74625;
        futhark_mc_task_77253.retval_defunc_2_reduce_res_74626 =
            &defunc_2_reduce_res_74626;
        
        struct scheduler_segop futhark_mc_task_77253_task;
        
        futhark_mc_task_77253_task.args = &futhark_mc_task_77253;
        futhark_mc_task_77253_task.top_level_fn = futhark_mc_segred_task_77254;
        futhark_mc_task_77253_task.name = "futhark_mc_segred_task_77254";
        futhark_mc_task_77253_task.iterations = q_65346;
        futhark_mc_task_77253_task.task_time =
            &ctx->futhark_mc_segred_task_77254_total_time;
        futhark_mc_task_77253_task.task_iter =
            &ctx->futhark_mc_segred_task_77254_total_iter;
        futhark_mc_task_77253_task.sched = STATIC;
        futhark_mc_task_77253_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77254_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77253_task);
        
        if (futhark_mc_segred_task_77254_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((float *) mem_70997.mem)[gtid_74514] = defunc_2_reduce_res_74626;
    }
    
  cleanup:
    { }
    free(mem_74601);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77246_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77246_end -
                 futhark_mc_segmap_parloop_77246_start;
        
        ctx->futhark_mc_segmap_parloop_77246_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77246_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77246_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77244(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_74513 = tid;
    int num_tasks_74796 = info.nsubtasks;
    struct futhark_mc_task_77239 *futhark_mc_task_77239 =
                                 (struct futhark_mc_task_77239 *) args;
    struct futhark_context *ctx = futhark_mc_task_77239->ctx;
    uint64_t futhark_mc_segmap_nested_task_77244_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77244_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77239->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77239->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77239->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77239->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77239->free_i_65358;
    bool x_65359 = futhark_mc_task_77239->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77239->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77239->free_loop_cond_65369;
    int64_t last_res_68574 = futhark_mc_task_77239->free_last_res_68574;
    int64_t min_arg_68593 = futhark_mc_task_77239->free_min_arg_68593;
    int64_t min_arg_68594 = futhark_mc_task_77239->free_min_arg_68594;
    int64_t min_res_68595 = futhark_mc_task_77239->free_min_res_68595;
    float max_res_68599 = futhark_mc_task_77239->free_max_res_68599;
    struct memblock mem_70967 = {.desc ="mem_70967", .mem =
                                 futhark_mc_task_77239->free_mem_70967, .size =
                                 0, .references =NULL};
    struct memblock mem_70970 = {.desc ="mem_70970", .mem =
                                 futhark_mc_task_77239->free_mem_70970, .size =
                                 0, .references =NULL};
    struct memblock mem_70973 = {.desc ="mem_70973", .mem =
                                 futhark_mc_task_77239->free_mem_70973, .size =
                                 0, .references =NULL};
    int64_t bytes_70975 = futhark_mc_task_77239->free_bytes_70975;
    struct memblock mem_70976 = {.desc ="mem_70976", .mem =
                                 futhark_mc_task_77239->free_mem_70976, .size =
                                 0, .references =NULL};
    struct memblock mem_70997 = {.desc ="mem_70997", .mem =
                                 futhark_mc_task_77239->free_mem_70997, .size =
                                 0, .references =NULL};
    int64_t iter_74896;
    struct futhark_mc_segmap_parloop_struct_77245
    futhark_mc_segmap_parloop_struct_77245;
    
    futhark_mc_segmap_parloop_struct_77245.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77245.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77245.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77245.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77245.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77245.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77245.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77245.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77245.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77245.free_last_res_68574 = last_res_68574;
    futhark_mc_segmap_parloop_struct_77245.free_min_arg_68593 = min_arg_68593;
    futhark_mc_segmap_parloop_struct_77245.free_min_arg_68594 = min_arg_68594;
    futhark_mc_segmap_parloop_struct_77245.free_min_res_68595 = min_res_68595;
    futhark_mc_segmap_parloop_struct_77245.free_max_res_68599 = max_res_68599;
    futhark_mc_segmap_parloop_struct_77245.free_mem_70967 = mem_70967.mem;
    futhark_mc_segmap_parloop_struct_77245.free_mem_70970 = mem_70970.mem;
    futhark_mc_segmap_parloop_struct_77245.free_mem_70973 = mem_70973.mem;
    futhark_mc_segmap_parloop_struct_77245.free_bytes_70975 = bytes_70975;
    futhark_mc_segmap_parloop_struct_77245.free_mem_70976 = mem_70976.mem;
    futhark_mc_segmap_parloop_struct_77245.free_mem_70997 = mem_70997.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77246_task;
    
    futhark_mc_segmap_parloop_77246_task.name =
        "futhark_mc_segmap_parloop_77246";
    futhark_mc_segmap_parloop_77246_task.fn = futhark_mc_segmap_parloop_77246;
    futhark_mc_segmap_parloop_77246_task.args =
        &futhark_mc_segmap_parloop_struct_77245;
    futhark_mc_segmap_parloop_77246_task.iterations = iterations;
    futhark_mc_segmap_parloop_77246_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77246_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77246_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77246_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77246_task);
    
    if (futhark_mc_segmap_parloop_77246_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77246_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77246_total_end -
                 futhark_mc_segmap_parloop_77246_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77246_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77246_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77246_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77244_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77244_end -
                 futhark_mc_segmap_nested_task_77244_start;
        
        ctx->futhark_mc_segmap_nested_task_77244_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77244_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77244_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_77213(void *args, int64_t start,
                                           int64_t end, int flat_tid_68561,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77212
    *futhark_mc_segmap_parloop_struct_77212 =
    (struct futhark_mc_segmap_parloop_struct_77212 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77212->ctx;
    uint64_t futhark_mc_segmap_parloop_77213_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77213_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77212->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77212->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77212->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77212->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77212->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77212->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77212->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77212->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77212->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77212->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77212->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70963 =
            futhark_mc_segmap_parloop_struct_77212->free_bytes_70963;
    int64_t bytes_70966 =
            futhark_mc_segmap_parloop_struct_77212->free_bytes_70966;
    int64_t bytes_70975 =
            futhark_mc_segmap_parloop_struct_77212->free_bytes_70975;
    int64_t bytes_70996 =
            futhark_mc_segmap_parloop_struct_77212->free_bytes_70996;
    struct memblock mem_71106 = {.desc ="mem_71106", .mem =
                                 futhark_mc_segmap_parloop_struct_77212->free_mem_71106,
                                 .size =0, .references =NULL};
    size_t mem_70964_cached_sizze_77214 = 0;
    unsigned char *mem_70964 = NULL;
    size_t mem_70967_cached_sizze_77215 = 0;
    unsigned char *mem_70967 = NULL;
    size_t mem_70970_cached_sizze_77216 = 0;
    unsigned char *mem_70970 = NULL;
    size_t mem_70973_cached_sizze_77217 = 0;
    unsigned char *mem_70973 = NULL;
    size_t mem_70976_cached_sizze_77218 = 0;
    unsigned char *mem_70976 = NULL;
    size_t mem_70997_cached_sizze_77219 = 0;
    unsigned char *mem_70997 = NULL;
    int64_t iterations = end - start;
    int64_t iter_74487 = start;
    
    if (mem_70964_cached_sizze_77214 < (size_t) bytes_70963) {
        mem_70964 = realloc(mem_70964, bytes_70963);
        mem_70964_cached_sizze_77214 = bytes_70963;
    }
    if (mem_70967_cached_sizze_77215 < (size_t) bytes_70966) {
        mem_70967 = realloc(mem_70967, bytes_70966);
        mem_70967_cached_sizze_77215 = bytes_70966;
    }
    if (mem_70970_cached_sizze_77216 < (size_t) bytes_70963) {
        mem_70970 = realloc(mem_70970, bytes_70963);
        mem_70970_cached_sizze_77216 = bytes_70963;
    }
    if (mem_70973_cached_sizze_77217 < (size_t) bytes_70963) {
        mem_70973 = realloc(mem_70973, bytes_70963);
        mem_70973_cached_sizze_77217 = bytes_70963;
    }
    if (mem_70976_cached_sizze_77218 < (size_t) bytes_70975) {
        mem_70976 = realloc(mem_70976, bytes_70975);
        mem_70976_cached_sizze_77218 = bytes_70975;
    }
    if (mem_70997_cached_sizze_77219 < (size_t) bytes_70996) {
        mem_70997 = realloc(mem_70997, bytes_70996);
        mem_70997_cached_sizze_77219 = bytes_70996;
    }
    for (; iter_74487 < end; iter_74487++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_74764 = m_65343;
        int64_t gtid_68562 = iter_74487;
        int64_t remnant_74765 = iter_74487 - gtid_68562;
        int64_t flat_tid_74488 = (int64_t) 0;
        int32_t num_tasks_74766;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_77220 futhark_mc_task_77220;
        
        futhark_mc_task_77220.ctx = ctx;
        futhark_mc_task_77220.free_n_65344 = n_65344;
        futhark_mc_task_77220.free_gtid_68562 = gtid_68562;
        futhark_mc_task_77220.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77220.free_mem_70964 = mem_70964;
        
        struct scheduler_segop futhark_mc_task_77220_task;
        
        futhark_mc_task_77220_task.args = &futhark_mc_task_77220;
        futhark_mc_task_77220_task.top_level_fn = futhark_mc_segscan_task_77221;
        futhark_mc_task_77220_task.name = "futhark_mc_segscan_task_77221";
        futhark_mc_task_77220_task.iterations = n_65344;
        futhark_mc_task_77220_task.task_time =
            &ctx->futhark_mc_segscan_task_77221_total_time;
        futhark_mc_task_77220_task.task_iter =
            &ctx->futhark_mc_segscan_task_77221_total_iter;
        futhark_mc_task_77220_task.sched = STATIC;
        futhark_mc_task_77220_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_77221_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77220_task);
        
        if (futhark_mc_segscan_task_77221_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_68574;
        
        last_res_68574 = ((int64_t *) mem_70964)[i_65358];
        for (int64_t i_74780 = 0; i_74780 < n_65344; i_74780++) {
            ((float *) mem_70967)[i_74780] = 0.0F;
        }
        for (int64_t i_74781 = 0; i_74781 < n_65344; i_74781++) {
            ((int64_t *) mem_70970)[i_74781] = (int64_t) -1;
        }
        
        int64_t flat_tid_74497 = (int64_t) 0;
        int32_t num_tasks_74782;
        struct futhark_mc_task_77227 futhark_mc_task_77227;
        
        futhark_mc_task_77227.ctx = ctx;
        futhark_mc_task_77227.free_n_65344 = n_65344;
        futhark_mc_task_77227.free_gtid_68562 = gtid_68562;
        futhark_mc_task_77227.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77227.free_mem_70964 = mem_70964;
        futhark_mc_task_77227.free_mem_70967 = mem_70967;
        futhark_mc_task_77227.free_mem_70970 = mem_70970;
        
        struct scheduler_segop futhark_mc_task_77227_task;
        
        futhark_mc_task_77227_task.args = &futhark_mc_task_77227;
        futhark_mc_task_77227_task.top_level_fn = futhark_mc_segmap_task_77228;
        futhark_mc_task_77227_task.name = "futhark_mc_segmap_task_77228";
        futhark_mc_task_77227_task.iterations = n_65344;
        futhark_mc_task_77227_task.task_time =
            &ctx->futhark_mc_segmap_task_77228_total_time;
        futhark_mc_task_77227_task.task_iter =
            &ctx->futhark_mc_segmap_task_77228_total_iter;
        futhark_mc_task_77227_task.sched = STATIC;
        futhark_mc_task_77227_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77228_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77227_task);
        
        if (futhark_mc_segmap_task_77228_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_74505 = (int64_t) 0;
        int32_t num_tasks_74788;
        struct futhark_mc_task_77231 futhark_mc_task_77231;
        
        futhark_mc_task_77231.ctx = ctx;
        futhark_mc_task_77231.free_n_65344 = n_65344;
        futhark_mc_task_77231.free_mem_70970 = mem_70970;
        futhark_mc_task_77231.free_mem_70973 = mem_70973;
        
        struct scheduler_segop futhark_mc_task_77231_task;
        
        futhark_mc_task_77231_task.args = &futhark_mc_task_77231;
        futhark_mc_task_77231_task.top_level_fn = futhark_mc_segmap_task_77232;
        futhark_mc_task_77231_task.name = "futhark_mc_segmap_task_77232";
        futhark_mc_task_77231_task.iterations = n_65344;
        futhark_mc_task_77231_task.task_time =
            &ctx->futhark_mc_segmap_task_77232_total_time;
        futhark_mc_task_77231_task.task_iter =
            &ctx->futhark_mc_segmap_task_77232_total_iter;
        futhark_mc_task_77231_task.sched = STATIC;
        futhark_mc_task_77231_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77232_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77231_task);
        
        if (futhark_mc_segmap_task_77232_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_68593 = sub64(last_res_68574, (int64_t) 1);
        int64_t min_arg_68594 = sub64(last_res_68574, min_res_65364);
        int64_t min_res_68595 = smin64(q_65346, last_res_68574);
        float i64_res_68596 = sitofp_i64_f32(last_res_68574);
        float x_68597 = i64_res_65370 - i64_res_68596;
        float max_arg_68598 = x_68597 / 2.0F;
        float max_res_68599 = fmax32(0.0F, max_arg_68598);
        int64_t flat_tid_74509 = (int64_t) 0;
        int32_t num_tasks_74792;
        struct futhark_mc_task_77235 futhark_mc_task_77235;
        
        futhark_mc_task_77235.ctx = ctx;
        futhark_mc_task_77235.free_q_65346 = q_65346;
        futhark_mc_task_77235.free_last_res_68574 = last_res_68574;
        futhark_mc_task_77235.free_mem_70976 = mem_70976;
        
        struct scheduler_segop futhark_mc_task_77235_task;
        
        futhark_mc_task_77235_task.args = &futhark_mc_task_77235;
        futhark_mc_task_77235_task.top_level_fn = futhark_mc_segmap_task_77236;
        futhark_mc_task_77235_task.name = "futhark_mc_segmap_task_77236";
        futhark_mc_task_77235_task.iterations = q_65346;
        futhark_mc_task_77235_task.task_time =
            &ctx->futhark_mc_segmap_task_77236_total_time;
        futhark_mc_task_77235_task.task_iter =
            &ctx->futhark_mc_segmap_task_77236_total_iter;
        futhark_mc_task_77235_task.sched = STATIC;
        futhark_mc_task_77235_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77236_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77235_task);
        
        if (futhark_mc_segmap_task_77236_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_74639 = (int64_t) 0;
        int32_t num_tasks_74796;
        int64_t flat_tid_74513 = (int64_t) 0;
        struct futhark_mc_task_77239 futhark_mc_task_77239;
        
        futhark_mc_task_77239.ctx = ctx;
        futhark_mc_task_77239.free_n_65344 = n_65344;
        futhark_mc_task_77239.free_q_65346 = q_65346;
        futhark_mc_task_77239.free_jump_65348 = jump_65348;
        futhark_mc_task_77239.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77239.free_i_65358 = i_65358;
        futhark_mc_task_77239.free_x_65359 = x_65359;
        futhark_mc_task_77239.free_min_res_65364 = min_res_65364;
        futhark_mc_task_77239.free_loop_cond_65369 = loop_cond_65369;
        futhark_mc_task_77239.free_last_res_68574 = last_res_68574;
        futhark_mc_task_77239.free_min_arg_68593 = min_arg_68593;
        futhark_mc_task_77239.free_min_arg_68594 = min_arg_68594;
        futhark_mc_task_77239.free_min_res_68595 = min_res_68595;
        futhark_mc_task_77239.free_max_res_68599 = max_res_68599;
        futhark_mc_task_77239.free_mem_70967 = mem_70967;
        futhark_mc_task_77239.free_mem_70970 = mem_70970;
        futhark_mc_task_77239.free_mem_70973 = mem_70973;
        futhark_mc_task_77239.free_bytes_70975 = bytes_70975;
        futhark_mc_task_77239.free_mem_70976 = mem_70976;
        futhark_mc_task_77239.free_mem_70997 = mem_70997;
        
        struct scheduler_segop futhark_mc_task_77239_task;
        
        futhark_mc_task_77239_task.args = &futhark_mc_task_77239;
        futhark_mc_task_77239_task.top_level_fn = futhark_mc_segmap_task_77240;
        futhark_mc_task_77239_task.name = "futhark_mc_segmap_task_77240";
        futhark_mc_task_77239_task.iterations = n_m_65352;
        futhark_mc_task_77239_task.task_time =
            &ctx->futhark_mc_segmap_task_77240_total_time;
        futhark_mc_task_77239_task.task_iter =
            &ctx->futhark_mc_segmap_task_77240_total_iter;
        futhark_mc_task_77239_task.sched = DYNAMIC;
        futhark_mc_task_77239_task.nested_fn =
            futhark_mc_segmap_nested_task_77244;
        
        int futhark_mc_segmap_task_77240_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77239_task);
        
        if (futhark_mc_segmap_task_77240_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71106.mem + gtid_68562 * n_m_65352 * (int64_t) 4,
                    mem_70997 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_70964);
    free(mem_70967);
    free(mem_70970);
    free(mem_70973);
    free(mem_70976);
    free(mem_70997);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77213_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77213_end -
                 futhark_mc_segmap_parloop_77213_start;
        
        ctx->futhark_mc_segmap_parloop_77213_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77213_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77213_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77211(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_68561 = tid;
    int num_tasks_74308 = info.nsubtasks;
    struct futhark_mc_task_77200 *futhark_mc_task_77200 =
                                 (struct futhark_mc_task_77200 *) args;
    struct futhark_context *ctx = futhark_mc_task_77200->ctx;
    uint64_t futhark_mc_segmap_nested_task_77211_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77211_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77200->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77200->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77200->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77200->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77200->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77200->free_i_65358;
    bool x_65359 = futhark_mc_task_77200->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77200->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77200->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77200->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77200->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_70963 = futhark_mc_task_77200->free_bytes_70963;
    int64_t bytes_70966 = futhark_mc_task_77200->free_bytes_70966;
    int64_t bytes_70975 = futhark_mc_task_77200->free_bytes_70975;
    int64_t bytes_70996 = futhark_mc_task_77200->free_bytes_70996;
    struct memblock mem_71106 = {.desc ="mem_71106", .mem =
                                 futhark_mc_task_77200->free_mem_71106, .size =
                                 0, .references =NULL};
    int64_t iter_74487;
    struct futhark_mc_segmap_parloop_struct_77212
    futhark_mc_segmap_parloop_struct_77212;
    
    futhark_mc_segmap_parloop_struct_77212.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77212.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77212.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77212.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77212.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77212.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77212.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77212.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77212.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77212.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77212.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77212.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77212.free_bytes_70963 = bytes_70963;
    futhark_mc_segmap_parloop_struct_77212.free_bytes_70966 = bytes_70966;
    futhark_mc_segmap_parloop_struct_77212.free_bytes_70975 = bytes_70975;
    futhark_mc_segmap_parloop_struct_77212.free_bytes_70996 = bytes_70996;
    futhark_mc_segmap_parloop_struct_77212.free_mem_71106 = mem_71106.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77213_task;
    
    futhark_mc_segmap_parloop_77213_task.name =
        "futhark_mc_segmap_parloop_77213";
    futhark_mc_segmap_parloop_77213_task.fn = futhark_mc_segmap_parloop_77213;
    futhark_mc_segmap_parloop_77213_task.args =
        &futhark_mc_segmap_parloop_struct_77212;
    futhark_mc_segmap_parloop_77213_task.iterations = iterations;
    futhark_mc_segmap_parloop_77213_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77213_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77213_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77213_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77213_task);
    
    if (futhark_mc_segmap_parloop_77213_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77213_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77213_total_end -
                 futhark_mc_segmap_parloop_77213_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77213_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77213_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77213_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77211_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77211_end -
                 futhark_mc_segmap_nested_task_77211_start;
        
        ctx->futhark_mc_segmap_nested_task_77211_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77211_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77211_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77258 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_71108;
    int64_t free_bytes_71111;
    int64_t free_bytes_71120;
    int64_t free_bytes_71159;
    unsigned char *free_mem_71302;
    unsigned char *free_mem_71306;
};
struct futhark_mc_segmap_parloop_struct_77260 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_71108;
    int64_t free_bytes_71111;
    int64_t free_bytes_71120;
    int64_t free_bytes_71159;
    unsigned char *free_mem_71302;
    unsigned char *free_mem_71306;
};
static int futhark_mc_segmap_parloop_77261(void *args, int64_t start,
                                           int64_t end, int flat_tid_68859,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77260
    *futhark_mc_segmap_parloop_struct_77260 =
    (struct futhark_mc_segmap_parloop_struct_77260 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77260->ctx;
    uint64_t futhark_mc_segmap_parloop_77261_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77261_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77260->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77260->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77260->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77260->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77260->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77260->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77260->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77260->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77260->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77260->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77260->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71108 =
            futhark_mc_segmap_parloop_struct_77260->free_bytes_71108;
    int64_t bytes_71111 =
            futhark_mc_segmap_parloop_struct_77260->free_bytes_71111;
    int64_t bytes_71120 =
            futhark_mc_segmap_parloop_struct_77260->free_bytes_71120;
    int64_t bytes_71159 =
            futhark_mc_segmap_parloop_struct_77260->free_bytes_71159;
    struct memblock mem_71302 = {.desc ="mem_71302", .mem =
                                 futhark_mc_segmap_parloop_struct_77260->free_mem_71302,
                                 .size =0, .references =NULL};
    struct memblock mem_71306 = {.desc ="mem_71306", .mem =
                                 futhark_mc_segmap_parloop_struct_77260->free_mem_71306,
                                 .size =0, .references =NULL};
    size_t mem_71166_cached_sizze_77262 = 0;
    unsigned char *mem_71166 = NULL;
    size_t mem_71181_cached_sizze_77263 = 0;
    unsigned char *mem_71181 = NULL;
    size_t mem_71184_cached_sizze_77264 = 0;
    unsigned char *mem_71184 = NULL;
    size_t mem_71211_cached_sizze_77265 = 0;
    unsigned char *mem_71211 = NULL;
    size_t mem_71226_cached_sizze_77266 = 0;
    unsigned char *mem_71226 = NULL;
    size_t mem_71241_cached_sizze_77267 = 0;
    unsigned char *mem_71241 = NULL;
    size_t mem_71244_cached_sizze_77268 = 0;
    unsigned char *mem_71244 = NULL;
    size_t mem_71261_cached_sizze_77269 = 0;
    unsigned char *mem_71261 = NULL;
    size_t mem_71264_cached_sizze_77270 = 0;
    unsigned char *mem_71264 = NULL;
    int64_t iterations = end - start;
    int64_t iter_75013 = start;
    
    if (mem_71166_cached_sizze_77262 < (size_t) bytes_71108) {
        mem_71166 = realloc(mem_71166, bytes_71108);
        mem_71166_cached_sizze_77262 = bytes_71108;
    }
    if (mem_71181_cached_sizze_77263 < (size_t) bytes_71111) {
        mem_71181 = realloc(mem_71181, bytes_71111);
        mem_71181_cached_sizze_77263 = bytes_71111;
    }
    if (mem_71184_cached_sizze_77264 < (size_t) bytes_71108) {
        mem_71184 = realloc(mem_71184, bytes_71108);
        mem_71184_cached_sizze_77264 = bytes_71108;
    }
    if (mem_71211_cached_sizze_77265 < (size_t) bytes_71108) {
        mem_71211 = realloc(mem_71211, bytes_71108);
        mem_71211_cached_sizze_77265 = bytes_71108;
    }
    if (mem_71226_cached_sizze_77266 < (size_t) bytes_71120) {
        mem_71226 = realloc(mem_71226, bytes_71120);
        mem_71226_cached_sizze_77266 = bytes_71120;
    }
    if (mem_71241_cached_sizze_77267 < (size_t) bytes_71159) {
        mem_71241 = realloc(mem_71241, bytes_71159);
        mem_71241_cached_sizze_77267 = bytes_71159;
    }
    if (mem_71244_cached_sizze_77268 < (size_t) bytes_71159) {
        mem_71244 = realloc(mem_71244, bytes_71159);
        mem_71244_cached_sizze_77268 = bytes_71159;
    }
    if (mem_71261_cached_sizze_77269 < (size_t) bytes_71120) {
        mem_71261 = realloc(mem_71261, bytes_71120);
        mem_71261_cached_sizze_77269 = bytes_71120;
    }
    if (mem_71264_cached_sizze_77270 < (size_t) bytes_71120) {
        mem_71264 = realloc(mem_71264, bytes_71120);
        mem_71264_cached_sizze_77270 = bytes_71120;
    }
    for (; iter_75013 < end; iter_75013++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_75201 = m_65343;
        int64_t gtid_68860 = iter_75013;
        int64_t remnant_75202 = iter_75013 - gtid_68860;
        int64_t discard_70357;
        int64_t scanacc_75015 = (int64_t) 0;
        
        for (int64_t i_75014 = 0; i_75014 < n_65344; i_75014++) {
            float x_75017;
            
            x_75017 = ((float *) Y_mem_70569.mem)[gtid_68860 * n_65344 +
                                                  i_75014];
            
            bool isnan_res_75018;
            
            isnan_res_75018 = futrts_isnan32(x_75017);
            
            bool defunc_0_p_res_75019 = !isnan_res_75018;
            int64_t defunc_0_f_res_75020 = btoi_bool_i64(defunc_0_p_res_75019);
            int64_t defunc_1_op_res_75021 = add64(defunc_0_f_res_75020,
                                                  scanacc_75015);
            
            ((int64_t *) mem_71166)[i_75014] = defunc_1_op_res_75021;
            
            int64_t scanacc_tmp_75203 = defunc_1_op_res_75021;
            
            scanacc_75015 = scanacc_tmp_75203;
        }
        discard_70357 = scanacc_75015;
        
        int64_t last_res_66183;
        
        last_res_66183 = ((int64_t *) mem_71166)[i_65358];
        for (int64_t i_75205 = 0; i_75205 < n_65344; i_75205++) {
            ((float *) mem_71181)[i_75205] = 0.0F;
        }
        for (int64_t i_75206 = 0; i_75206 < n_65344; i_75206++) {
            ((int64_t *) mem_71184)[i_75206] = (int64_t) -1;
        }
        for (int64_t write_iter_75023 = 0; write_iter_75023 < n_65344;
             write_iter_75023++) {
            float write_iv_75026;
            
            write_iv_75026 = ((float *) Y_mem_70569.mem)[gtid_68860 * n_65344 +
                                                         write_iter_75023];
            
            bool isnan_res_75027;
            
            isnan_res_75027 = futrts_isnan32(write_iv_75026);
            
            bool defunc_0_p_res_75028 = !isnan_res_75027;
            int64_t defunc_1_f_res_75029;
            
            if (defunc_0_p_res_75028) {
                int64_t write_iv_75030;
                
                write_iv_75030 = ((int64_t *) mem_71166)[write_iter_75023];
                
                int64_t defunc_1_f_res_t_res_75031 = sub64(write_iv_75030,
                                                           (int64_t) 1);
                
                defunc_1_f_res_75029 = defunc_1_f_res_t_res_75031;
            } else {
                defunc_1_f_res_75029 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_75029) &&
                slt64(defunc_1_f_res_75029, n_65344)) {
                ((int64_t *) mem_71184)[defunc_1_f_res_75029] =
                    write_iter_75023;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_75029) &&
                slt64(defunc_1_f_res_75029, n_65344)) {
                if ((int64_t) 4 > 0)
                    memmove(mem_71181 + defunc_1_f_res_75029 * (int64_t) 4,
                            Y_mem_70569.mem + (gtid_68860 * n_65344 +
                                               write_iter_75023) * (int64_t) 4,
                            (int64_t) 4);
            }
        }
        for (int64_t i_75035 = 0; i_75035 < n_65344; i_75035++) {
            int64_t x_75037;
            
            x_75037 = ((int64_t *) mem_71184)[i_75035];
            
            int64_t defunc_0_f_res_75038 = add64((int64_t) 1, x_75037);
            
            ((int64_t *) mem_71211)[i_75035] = defunc_0_f_res_75038;
        }
        
        int64_t min_arg_66198 = sub64(last_res_66183, (int64_t) 1);
        int64_t min_arg_66199 = sub64(last_res_66183, min_res_65364);
        int64_t min_res_66200 = smin64(q_65346, last_res_66183);
        float i64_res_66201 = sitofp_i64_f32(last_res_66183);
        float x_66202 = i64_res_65370 - i64_res_66201;
        float max_arg_66203 = x_66202 / 2.0F;
        float max_res_66204 = fmax32(0.0F, max_arg_66203);
        
        for (int64_t i_75040 = 0; i_75040 < q_65346; i_75040++) {
            bool cond_75042 = sle64(last_res_66183, i_75040);
            float defunc_0_f_res_75043;
            
            if (cond_75042) {
                defunc_0_f_res_75043 = 0.0F;
            } else {
                defunc_0_f_res_75043 = 1.0F;
            }
            ((float *) mem_71226)[i_75040] = defunc_0_f_res_75043;
        }
        for (int64_t i_75045 = 0; i_75045 < n_m_65352; i_75045++) {
            int64_t min_arg_75048 = mul64(jump_65348, i_75045);
            int64_t min_res_75049 = smin64(i_65358, min_arg_75048);
            int64_t defunc_0_g_res_75050 = add64((int64_t) 1, min_res_75049);
            bool init_idx_75051;
            int64_t init_idx_75052;
            int64_t init_idx_75053;
            bool loop_while_75054;
            int64_t low_75055;
            int64_t high_75056;
            
            loop_while_75054 = x_65359;
            low_75055 = (int64_t) 0;
            high_75056 = i_65358;
            while (loop_while_75054) {
                int64_t x_75057 = add64(low_75055, high_75056);
                int64_t mid_75058 = sdiv64(x_75057, (int64_t) 2);
                bool x_75059 = sle64((int64_t) 0, mid_75058);
                bool y_75060 = slt64(mid_75058, n_65344);
                bool bounds_check_75061 = x_75059 && y_75060;
                bool index_certs_75062;
                
                if (!bounds_check_75061) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_75058,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_75063;
                
                mid_id_75063 = ((int64_t *) mem_71211)[mid_75058];
                
                bool cond_75064 = slt64(mid_id_75063, (int64_t) 0);
                int64_t mid_idx_75065;
                
                if (cond_75064) {
                    mid_idx_75065 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_75065 = mid_id_75063;
                }
                
                bool cond_75066 = sle64(defunc_0_g_res_75050, mid_idx_75065);
                int64_t loopres_75067;
                int64_t loopres_75068;
                
                if (cond_75066) {
                    int64_t loopres_t_res_75069 = sub64(mid_75058, (int64_t) 1);
                    
                    loopres_75067 = low_75055;
                    loopres_75068 = loopres_t_res_75069;
                } else {
                    int64_t loopres_f_res_75070 = add64((int64_t) 1, mid_75058);
                    
                    loopres_75067 = loopres_f_res_75070;
                    loopres_75068 = high_75056;
                }
                
                bool loop_cond_75071 = sle64(loopres_75067, loopres_75068);
                bool loop_while_tmp_75213 = loop_cond_75071;
                int64_t low_tmp_75214 = loopres_75067;
                int64_t high_tmp_75215 = loopres_75068;
                
                loop_while_75054 = loop_while_tmp_75213;
                low_75055 = low_tmp_75214;
                high_75056 = high_tmp_75215;
            }
            init_idx_75051 = loop_while_75054;
            init_idx_75052 = low_75055;
            init_idx_75053 = high_75056;
            
            bool idx_75072;
            int64_t idx_75073;
            int64_t idx_75074;
            int64_t idx_75075;
            bool loop_while_75076;
            int64_t l_idx_75077;
            int64_t r_idx_75078;
            int64_t span_75079;
            
            loop_while_75076 = loop_cond_65369;
            l_idx_75077 = init_idx_75052;
            r_idx_75078 = init_idx_75052;
            span_75079 = (int64_t) 1;
            while (loop_while_75076) {
                int64_t max_arg_75080 = sub64(l_idx_75077, (int64_t) 1);
                int64_t max_res_75081 = smax64((int64_t) 0, max_arg_75080);
                int64_t min_arg_75082 = add64((int64_t) 1, r_idx_75078);
                int64_t min_res_75083 = smin64(min_arg_66198, min_arg_75082);
                bool x_75084 = sle64((int64_t) 0, max_res_75081);
                bool y_75085 = slt64(max_res_75081, n_65344);
                bool bounds_check_75086 = x_75084 && y_75085;
                bool index_certs_75087;
                
                if (!bounds_check_75086) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_75081,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_75088;
                
                x_75088 = ((int64_t *) mem_71211)[max_res_75081];
                
                int64_t abs_arg_75089 = sub64(x_75088, defunc_0_g_res_75050);
                int64_t abs_res_75090 = abs64(abs_arg_75089);
                bool x_75091 = sle64((int64_t) 0, min_res_75083);
                bool y_75092 = slt64(min_res_75083, n_65344);
                bool bounds_check_75093 = x_75091 && y_75092;
                bool index_certs_75094;
                
                if (!bounds_check_75093) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_75083,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_75095;
                
                x_75095 = ((int64_t *) mem_71211)[min_res_75083];
                
                int64_t abs_arg_75096 = sub64(x_75095, defunc_0_g_res_75050);
                int64_t abs_res_75097 = abs64(abs_arg_75096);
                bool cond_75098 = max_res_75081 == l_idx_75077;
                int64_t loopres_75099;
                int64_t loopres_75100;
                int64_t loopres_75101;
                
                if (cond_75098) {
                    loopres_75099 = l_idx_75077;
                    loopres_75100 = r_idx_75078;
                    loopres_75101 = min_res_65364;
                } else {
                    bool cond_75102 = slt64(abs_res_75090, abs_res_75097);
                    bool cond_f_res_75103 = min_res_75083 == r_idx_75078;
                    bool x_75104 = !cond_75102;
                    bool y_75105 = cond_f_res_75103 && x_75104;
                    bool cond_75106 = cond_75102 || y_75105;
                    int64_t loopres_f_res_75107;
                    
                    if (cond_75106) {
                        loopres_f_res_75107 = max_res_75081;
                    } else {
                        loopres_f_res_75107 = l_idx_75077;
                    }
                    
                    int64_t loopres_f_res_75108;
                    
                    if (cond_75106) {
                        loopres_f_res_75108 = r_idx_75078;
                    } else {
                        loopres_f_res_75108 = min_res_75083;
                    }
                    
                    int64_t loopres_f_res_75109;
                    
                    if (cond_75106) {
                        int64_t loopres_f_res_t_res_75110 = add64((int64_t) 1,
                                                                  span_75079);
                        
                        loopres_f_res_75109 = loopres_f_res_t_res_75110;
                    } else {
                        int64_t loopres_f_res_f_res_75111 = add64((int64_t) 1,
                                                                  span_75079);
                        
                        loopres_f_res_75109 = loopres_f_res_f_res_75111;
                    }
                    loopres_75099 = loopres_f_res_75107;
                    loopres_75100 = loopres_f_res_75108;
                    loopres_75101 = loopres_f_res_75109;
                }
                
                bool loop_cond_75112 = slt64(loopres_75101, min_res_65364);
                bool loop_while_tmp_75216 = loop_cond_75112;
                int64_t l_idx_tmp_75217 = loopres_75099;
                int64_t r_idx_tmp_75218 = loopres_75100;
                int64_t span_tmp_75219 = loopres_75101;
                
                loop_while_75076 = loop_while_tmp_75216;
                l_idx_75077 = l_idx_tmp_75217;
                r_idx_75078 = r_idx_tmp_75218;
                span_75079 = span_tmp_75219;
            }
            idx_75072 = loop_while_75076;
            idx_75073 = l_idx_75077;
            idx_75074 = r_idx_75078;
            idx_75075 = span_75079;
            
            int64_t min_res_75113 = smin64(min_arg_66199, idx_75073);
            int64_t max_res_75114 = smax64((int64_t) 0, min_res_75113);
            int64_t x_75115 = add64(min_res_66200, max_res_75114);
            int64_t r_75116 = sub64(x_75115, (int64_t) 1);
            bool x_75117 = sle64((int64_t) 0, r_75116);
            bool y_75118 = slt64(r_75116, n_65344);
            bool bounds_check_75119 = x_75117 && y_75118;
            bool index_certs_75120;
            
            if (!bounds_check_75119) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_75116,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75121;
            
            x_75121 = ((int64_t *) mem_71184)[r_75116];
            
            int64_t abs_arg_75122 = sub64(x_75121, min_res_75049);
            int64_t abs_res_75123 = abs64(abs_arg_75122);
            bool x_75124 = sle64((int64_t) 0, max_res_75114);
            bool y_75125 = slt64(max_res_75114, n_65344);
            bool bounds_check_75126 = x_75124 && y_75125;
            bool index_certs_75127;
            
            if (!bounds_check_75126) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_75114,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75128;
            
            x_75128 = ((int64_t *) mem_71184)[max_res_75114];
            
            int64_t abs_arg_75129 = sub64(x_75128, min_res_75049);
            int64_t abs_res_75130 = abs64(abs_arg_75129);
            int64_t max_res_75131 = smax64(abs_res_75123, abs_res_75130);
            float defunc_0_f_res_75132 = sitofp_i64_f32(max_res_75131);
            float defunc_1_f_res_75133 = max_res_66204 + defunc_0_f_res_75132;
            float defunc_2_reduce_res_75136;
            float defunc_2_reduce_res_75137;
            float defunc_2_reduce_res_75138;
            float redout_75142;
            float redout_75143;
            float redout_75144;
            
            redout_75142 = 0.0F;
            redout_75143 = 0.0F;
            redout_75144 = 0.0F;
            for (int64_t i_75141 = 0; i_75141 < q_65346; i_75141++) {
                float x_75147;
                
                x_75147 = ((float *) mem_71226)[i_75141];
                
                bool cond_75148 = sle64(last_res_66183, i_75141);
                int64_t defunc_0_f_res_75149;
                
                if (cond_75148) {
                    defunc_0_f_res_75149 = (int64_t) 0;
                } else {
                    int64_t i_75150 = add64(max_res_75114, i_75141);
                    int64_t defunc_0_add_arg_75151;
                    
                    defunc_0_add_arg_75151 = ((int64_t *) mem_71184)[i_75150];
                    
                    int64_t defunc_1_add_res_75152 = add64((int64_t) 1,
                                                           defunc_0_add_arg_75151);
                    
                    defunc_0_f_res_75149 = defunc_1_add_res_75152;
                }
                
                int64_t binop_p_75153 = sub64(defunc_0_f_res_75149,
                                              min_res_75049);
                float defunc_0_f_res_75154 = sitofp_i64_f32(binop_p_75153);
                float abs_res_75155 = (float) fabs(defunc_0_f_res_75154);
                float tmp1_75156 = abs_res_75155 / defunc_1_f_res_75133;
                float x_75157 = tmp1_75156 * tmp1_75156;
                float y_75158 = tmp1_75156 * x_75157;
                float tmp2_75159 = 1.0F - y_75158;
                float x_75160 = tmp2_75159 * tmp2_75159;
                float tmp3_75161 = tmp2_75159 * x_75160;
                float tmp4_75162 = x_75147 * tmp3_75161;
                float defunc_1_f_res_75163 = defunc_0_f_res_75154 * tmp4_75162;
                float defunc_1_f_res_75164 = defunc_0_f_res_75154 *
                      defunc_1_f_res_75163;
                float defunc_1_op_res_75165 = tmp4_75162 + redout_75142;
                float defunc_1_op_res_75166 = defunc_1_f_res_75163 +
                      redout_75143;
                float defunc_1_op_res_75167 = defunc_1_f_res_75164 +
                      redout_75144;
                
                ((float *) mem_71261)[i_75141] = defunc_1_f_res_75163;
                ((float *) mem_71264)[i_75141] = tmp4_75162;
                
                float redout_tmp_75220 = defunc_1_op_res_75165;
                float redout_tmp_75221 = defunc_1_op_res_75166;
                float redout_tmp_75222 = defunc_1_op_res_75167;
                
                redout_75142 = redout_tmp_75220;
                redout_75143 = redout_tmp_75221;
                redout_75144 = redout_tmp_75222;
            }
            defunc_2_reduce_res_75136 = redout_75142;
            defunc_2_reduce_res_75137 = redout_75143;
            defunc_2_reduce_res_75138 = redout_75144;
            
            float x_75170 = defunc_2_reduce_res_75136 *
                  defunc_2_reduce_res_75138;
            float y_75171 = defunc_2_reduce_res_75137 *
                  defunc_2_reduce_res_75137;
            float y_75172 = x_75170 - y_75171;
            float det1_75173 = 1.0F / y_75172;
            float a11_75174 = defunc_2_reduce_res_75138 * det1_75173;
            float x_75175 = 0.0F - defunc_2_reduce_res_75137;
            float b11_75176 = det1_75173 * x_75175;
            float c11_75177 = defunc_2_reduce_res_75136 * det1_75173;
            float defunc_2_reduce_res_75178;
            float defunc_2_reduce_res_75179;
            float redout_75181;
            float redout_75182;
            
            redout_75181 = 0.0F;
            redout_75182 = 0.0F;
            for (int64_t i_75180 = 0; i_75180 < q_65346; i_75180++) {
                float x_75183;
                
                x_75183 = ((float *) mem_71264)[i_75180];
                
                float x_75184;
                
                x_75184 = ((float *) mem_71261)[i_75180];
                
                bool cond_75185 = sle64(last_res_66183, i_75180);
                float defunc_0_f_res_75186;
                
                if (cond_75185) {
                    defunc_0_f_res_75186 = 0.0F;
                } else {
                    int64_t i_75187 = add64(max_res_75114, i_75180);
                    float defunc_0_add_arg_75188;
                    
                    defunc_0_add_arg_75188 = ((float *) mem_71181)[i_75187];
                    defunc_0_f_res_75186 = defunc_0_add_arg_75188;
                }
                
                float x_75189 = a11_75174 * x_75183;
                float y_75190 = b11_75176 * x_75184;
                float x_75191 = x_75189 + y_75190;
                float defunc_9_fit_fun_res_75192 = defunc_0_f_res_75186 *
                      x_75191;
                float x_75193 = b11_75176 * x_75183;
                float y_75194 = c11_75177 * x_75184;
                float x_75195 = x_75193 + y_75194;
                float defunc_9_slope_fun_res_75196 = defunc_0_f_res_75186 *
                      x_75195;
                float defunc_1_op_res_75197 = defunc_9_fit_fun_res_75192 +
                      redout_75181;
                float defunc_1_op_res_75198 = defunc_9_slope_fun_res_75196 +
                      redout_75182;
                float redout_tmp_75225 = defunc_1_op_res_75197;
                float redout_tmp_75226 = defunc_1_op_res_75198;
                
                redout_75181 = redout_tmp_75225;
                redout_75182 = redout_tmp_75226;
            }
            defunc_2_reduce_res_75178 = redout_75181;
            defunc_2_reduce_res_75179 = redout_75182;
            ((float *) mem_71241)[i_75045] = defunc_2_reduce_res_75178;
            ((float *) mem_71244)[i_75045] = defunc_2_reduce_res_75179;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71302.mem + gtid_68860 * n_m_65352 * (int64_t) 4,
                    mem_71241 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71306.mem + gtid_68860 * n_m_65352 * (int64_t) 4,
                    mem_71244 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_71166);
    free(mem_71181);
    free(mem_71184);
    free(mem_71211);
    free(mem_71226);
    free(mem_71241);
    free(mem_71244);
    free(mem_71261);
    free(mem_71264);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77261_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77261_end -
                 futhark_mc_segmap_parloop_77261_start;
        
        ctx->futhark_mc_segmap_parloop_77261_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77261_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77261_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77259(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_68859 = tid;
    int num_tasks_75012 = info.nsubtasks;
    struct futhark_mc_task_77258 *futhark_mc_task_77258 =
                                 (struct futhark_mc_task_77258 *) args;
    struct futhark_context *ctx = futhark_mc_task_77258->ctx;
    uint64_t futhark_mc_segmap_task_77259_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77259_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77258->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77258->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77258->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77258->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77258->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77258->free_i_65358;
    bool x_65359 = futhark_mc_task_77258->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77258->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77258->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77258->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77258->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71108 = futhark_mc_task_77258->free_bytes_71108;
    int64_t bytes_71111 = futhark_mc_task_77258->free_bytes_71111;
    int64_t bytes_71120 = futhark_mc_task_77258->free_bytes_71120;
    int64_t bytes_71159 = futhark_mc_task_77258->free_bytes_71159;
    struct memblock mem_71302 = {.desc ="mem_71302", .mem =
                                 futhark_mc_task_77258->free_mem_71302, .size =
                                 0, .references =NULL};
    struct memblock mem_71306 = {.desc ="mem_71306", .mem =
                                 futhark_mc_task_77258->free_mem_71306, .size =
                                 0, .references =NULL};
    int64_t iter_75013;
    struct futhark_mc_segmap_parloop_struct_77260
    futhark_mc_segmap_parloop_struct_77260;
    
    futhark_mc_segmap_parloop_struct_77260.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77260.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77260.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77260.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77260.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77260.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77260.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77260.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77260.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77260.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77260.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77260.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77260.free_bytes_71108 = bytes_71108;
    futhark_mc_segmap_parloop_struct_77260.free_bytes_71111 = bytes_71111;
    futhark_mc_segmap_parloop_struct_77260.free_bytes_71120 = bytes_71120;
    futhark_mc_segmap_parloop_struct_77260.free_bytes_71159 = bytes_71159;
    futhark_mc_segmap_parloop_struct_77260.free_mem_71302 = mem_71302.mem;
    futhark_mc_segmap_parloop_struct_77260.free_mem_71306 = mem_71306.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77261_task;
    
    futhark_mc_segmap_parloop_77261_task.name =
        "futhark_mc_segmap_parloop_77261";
    futhark_mc_segmap_parloop_77261_task.fn = futhark_mc_segmap_parloop_77261;
    futhark_mc_segmap_parloop_77261_task.args =
        &futhark_mc_segmap_parloop_struct_77260;
    futhark_mc_segmap_parloop_77261_task.iterations = iterations;
    futhark_mc_segmap_parloop_77261_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77261_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77261_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77261_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77261_task);
    
    if (futhark_mc_segmap_parloop_77261_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77261_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77261_total_end -
                 futhark_mc_segmap_parloop_77261_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77261_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77261_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77261_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77259_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77259_end -
                 futhark_mc_segmap_task_77259_start;
        
        ctx->futhark_mc_segmap_task_77259_runs[tid]++;
        ctx->futhark_mc_segmap_task_77259_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77259_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77272 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_71108;
    int64_t free_bytes_71111;
    int64_t free_bytes_71120;
    int64_t free_bytes_71159;
    unsigned char *free_mem_71302;
    unsigned char *free_mem_71306;
};
struct futhark_mc_task_77281 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69037;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71109;
};
struct futhark_mc_scan_stage_1_parloop_struct_77284 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69037;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71109;
};
static int futhark_mc_scan_stage_1_parloop_77285(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_75228, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_77284
    *futhark_mc_scan_stage_1_parloop_struct_77284 =
    (struct futhark_mc_scan_stage_1_parloop_struct_77284 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_77284->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_77285_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77285_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_1_parloop_struct_77284->free_n_65344;
    int64_t gtid_69037 =
            futhark_mc_scan_stage_1_parloop_struct_77284->free_gtid_69037;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_1_parloop_struct_77284->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71109 = {.desc ="mem_71109", .mem =
                                 futhark_mc_scan_stage_1_parloop_struct_77284->free_mem_71109,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75567 = start;
    int64_t x_75230;
    int64_t x_75231;
    
    x_75230 = (int64_t) 0;
    for (; iter_75567 < end; iter_75567++) {
        int64_t gtid_75229 = iter_75567;
        
        // stage 1 scan body
        {
            float x_75233;
            
            x_75233 = ((float *) Y_mem_70569.mem)[gtid_69037 * n_65344 +
                                                  gtid_75229];
            
            bool isnan_res_75234;
            
            isnan_res_75234 = futrts_isnan32(x_75233);
            
            bool defunc_0_p_res_75235 = !isnan_res_75234;
            int64_t defunc_0_f_res_75236 = btoi_bool_i64(defunc_0_p_res_75235);
            
            // write mapped values results to memory
            { }
            x_75230 = x_75230;
            // Read next values
            {
                x_75231 = defunc_0_f_res_75236;
            }
            
            int64_t defunc_1_op_res_75232 = add64(x_75230, x_75231);
            
            ((int64_t *) mem_71109.mem)[gtid_75229] = defunc_1_op_res_75232;
            x_75230 = defunc_1_op_res_75232;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77285_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77285_end -
                 futhark_mc_scan_stage_1_parloop_77285_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_77285_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_77285_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_77285_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_77286 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69037;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71109;
};
static int futhark_mc_scan_stage_3_parloop_77287(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_75228, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_77286
    *futhark_mc_scan_stage_3_parloop_struct_77286 =
    (struct futhark_mc_scan_stage_3_parloop_struct_77286 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_77286->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_77287_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_77287_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_3_parloop_struct_77286->free_n_65344;
    int64_t gtid_69037 =
            futhark_mc_scan_stage_3_parloop_struct_77286->free_gtid_69037;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_3_parloop_struct_77286->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71109 = {.desc ="mem_71109", .mem =
                                 futhark_mc_scan_stage_3_parloop_struct_77286->free_mem_71109,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75579 = start;
    int64_t x_75576;
    int64_t x_75577;
    
    if (iter_75579 == (int64_t) 0) {
        x_75576 = (int64_t) 0;
    } else {
        x_75576 = ((int64_t *) mem_71109.mem)[iter_75579 - (int64_t) 1];
    }
    for (; iter_75579 < end; iter_75579++) {
        int64_t gtid_75229 = iter_75579;
        
        // stage 3 scan body
        {
            float x_75233;
            
            x_75233 = ((float *) Y_mem_70569.mem)[gtid_69037 * n_65344 +
                                                  gtid_75229];
            
            bool isnan_res_75234;
            
            isnan_res_75234 = futrts_isnan32(x_75233);
            
            bool defunc_0_p_res_75235 = !isnan_res_75234;
            int64_t defunc_0_f_res_75236 = btoi_bool_i64(defunc_0_p_res_75235);
            
            x_75576 = x_75576;
            x_75577 = defunc_0_f_res_75236;
            
            int64_t defunc_1_op_res_75578 = add64(x_75576, x_75577);
            
            ((int64_t *) mem_71109.mem)[gtid_75229] = defunc_1_op_res_75578;
            x_75576 = defunc_1_op_res_75578;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_77287_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77287_end -
                 futhark_mc_scan_stage_3_parloop_77287_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_77287_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_77287_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_77287_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_77282(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75228 = tid;
    int num_tasks_75566 = info.nsubtasks;
    struct futhark_mc_task_77281 *futhark_mc_task_77281 =
                                 (struct futhark_mc_task_77281 *) args;
    struct futhark_context *ctx = futhark_mc_task_77281->ctx;
    uint64_t futhark_mc_segscan_task_77282_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_77282_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77281->free_n_65344;
    int64_t gtid_69037 = futhark_mc_task_77281->free_gtid_69037;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77281->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71109 = {.desc ="mem_71109", .mem =
                                 futhark_mc_task_77281->free_mem_71109, .size =
                                 0, .references =NULL};
    size_t scan_stage_2_accum_mem_75573_cached_sizze_77283 = 0;
    unsigned char *scan_stage_2_accum_mem_75573 = NULL;
    int64_t iter_75567;
    struct futhark_mc_scan_stage_1_parloop_struct_77284
    futhark_mc_scan_stage_1_parloop_struct_77284;
    
    futhark_mc_scan_stage_1_parloop_struct_77284.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_77284.free_n_65344 = n_65344;
    futhark_mc_scan_stage_1_parloop_struct_77284.free_gtid_69037 = gtid_69037;
    futhark_mc_scan_stage_1_parloop_struct_77284.free_Y_mem_70569 =
        Y_mem_70569.mem;
    futhark_mc_scan_stage_1_parloop_struct_77284.free_mem_71109 = mem_71109.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_77285_task;
    
    futhark_mc_scan_stage_1_parloop_77285_task.name =
        "futhark_mc_scan_stage_1_parloop_77285";
    futhark_mc_scan_stage_1_parloop_77285_task.fn =
        futhark_mc_scan_stage_1_parloop_77285;
    futhark_mc_scan_stage_1_parloop_77285_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_77284;
    futhark_mc_scan_stage_1_parloop_77285_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_77285_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_77285_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77285_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_77285_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_77285_task);
    
    if (futhark_mc_scan_stage_1_parloop_77285_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77285_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77285_total_end -
                 futhark_mc_scan_stage_1_parloop_77285_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77285_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77285_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77285_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_75566)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_75568;
        int64_t x_75569;
        int64_t offset_75571 = (int64_t) 0;
        int64_t offset_index_75572 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_75573_cached_sizze_77283 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_75573 = realloc(scan_stage_2_accum_mem_75573,
                                                   (int64_t) 8);
            scan_stage_2_accum_mem_75573_cached_sizze_77283 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_75573)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_75575 = 0; i_75575 < num_tasks_75566 - 1; i_75575++) {
            offset_75571 = squot64(n_65344, sext_i32_i64(num_tasks_75566));
            if (slt64(sext_i32_i64(i_75575), srem64(n_65344,
                                                    sext_i32_i64(num_tasks_75566)))) {
                offset_75571 += (int64_t) 1;
            }
            offset_index_75572 += offset_75571;
            
            int64_t gtid_75229 = offset_index_75572;
            float x_75233;
            
            x_75233 = ((float *) Y_mem_70569.mem)[gtid_69037 * n_65344 +
                                                  gtid_75229];
            
            bool isnan_res_75234;
            
            isnan_res_75234 = futrts_isnan32(x_75233);
            
            bool defunc_0_p_res_75235 = !isnan_res_75234;
            int64_t defunc_0_f_res_75236 = btoi_bool_i64(defunc_0_p_res_75235);
            
            // Read carry in
            {
                x_75568 =
                    ((int64_t *) scan_stage_2_accum_mem_75573)[(int64_t) 0];
            }
            // Read next values
            {
                x_75569 = ((int64_t *) mem_71109.mem)[offset_index_75572 -
                                                      (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_75570 = add64(x_75568, x_75569);
            
            ((int64_t *) mem_71109.mem)[offset_index_75572 - (int64_t) 1] =
                defunc_1_op_res_75570;
            ((int64_t *) scan_stage_2_accum_mem_75573)[(int64_t) 0] =
                defunc_1_op_res_75570;
        }
        
        int64_t iter_75579 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_77286
        futhark_mc_scan_stage_3_parloop_struct_77286;
        
        futhark_mc_scan_stage_3_parloop_struct_77286.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_77286.free_n_65344 = n_65344;
        futhark_mc_scan_stage_3_parloop_struct_77286.free_gtid_69037 =
            gtid_69037;
        futhark_mc_scan_stage_3_parloop_struct_77286.free_Y_mem_70569 =
            Y_mem_70569.mem;
        futhark_mc_scan_stage_3_parloop_struct_77286.free_mem_71109 =
            mem_71109.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_77287_task;
        
        futhark_mc_scan_stage_3_parloop_77287_task.name =
            "futhark_mc_scan_stage_3_parloop_77287";
        futhark_mc_scan_stage_3_parloop_77287_task.fn =
            futhark_mc_scan_stage_3_parloop_77287;
        futhark_mc_scan_stage_3_parloop_77287_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_77286;
        futhark_mc_scan_stage_3_parloop_77287_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_77287_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_77287_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_77287_total_start = get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_77287_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_77287_task);
        
        if (futhark_mc_scan_stage_3_parloop_77287_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_77287_total_end =
                     get_wall_time();
            uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77287_total_end -
                     futhark_mc_scan_stage_3_parloop_77287_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77287_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77287_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77287_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_75573);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_77282_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_77282_end -
                 futhark_mc_segscan_task_77282_start;
        
        ctx->futhark_mc_segscan_task_77282_runs[tid]++;
        ctx->futhark_mc_segscan_task_77282_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_77282_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77288 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69037;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71109;
    unsigned char *free_mem_71112;
    unsigned char *free_mem_71115;
};
struct futhark_mc_segmap_parloop_struct_77290 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69037;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71109;
    unsigned char *free_mem_71112;
    unsigned char *free_mem_71115;
};
static int futhark_mc_segmap_parloop_77291(void *args, int64_t start,
                                           int64_t end, int flat_tid_75237,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77290
    *futhark_mc_segmap_parloop_struct_77290 =
    (struct futhark_mc_segmap_parloop_struct_77290 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77290->ctx;
    uint64_t futhark_mc_segmap_parloop_77291_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77291_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77290->free_n_65344;
    int64_t gtid_69037 =
            futhark_mc_segmap_parloop_struct_77290->free_gtid_69037;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77290->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71109 = {.desc ="mem_71109", .mem =
                                 futhark_mc_segmap_parloop_struct_77290->free_mem_71109,
                                 .size =0, .references =NULL};
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_segmap_parloop_struct_77290->free_mem_71112,
                                 .size =0, .references =NULL};
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_segmap_parloop_struct_77290->free_mem_71115,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75583 = start;
    
    for (; iter_75583 < end; iter_75583++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_75586 = n_65344;
        int64_t gtid_75238 = iter_75583;
        int64_t remnant_75587 = iter_75583 - gtid_75238;
        float x_75239;
        
        x_75239 = ((float *) Y_mem_70569.mem)[gtid_69037 * n_65344 +
                                              gtid_75238];
        
        bool isnan_res_75240;
        
        isnan_res_75240 = futrts_isnan32(x_75239);
        
        bool defunc_0_p_res_75241 = !isnan_res_75240;
        int64_t defunc_1_f_res_75242;
        
        if (defunc_0_p_res_75241) {
            int64_t x_75584;
            
            x_75584 = ((int64_t *) mem_71109.mem)[gtid_75238];
            
            int64_t defunc_1_f_res_t_res_75585 = sub64(x_75584, (int64_t) 1);
            
            defunc_1_f_res_75242 = defunc_1_f_res_t_res_75585;
        } else {
            defunc_1_f_res_75242 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_75242) &&
            slt64(defunc_1_f_res_75242, n_65344)) {
            ((int64_t *) mem_71115.mem)[defunc_1_f_res_75242] = gtid_75238;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_75242) &&
            slt64(defunc_1_f_res_75242, n_65344)) {
            ((float *) mem_71112.mem)[defunc_1_f_res_75242] = x_75239;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77291_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77291_end -
                 futhark_mc_segmap_parloop_77291_start;
        
        ctx->futhark_mc_segmap_parloop_77291_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77291_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77291_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77289(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75237 = tid;
    int num_tasks_75582 = info.nsubtasks;
    struct futhark_mc_task_77288 *futhark_mc_task_77288 =
                                 (struct futhark_mc_task_77288 *) args;
    struct futhark_context *ctx = futhark_mc_task_77288->ctx;
    uint64_t futhark_mc_segmap_task_77289_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77289_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77288->free_n_65344;
    int64_t gtid_69037 = futhark_mc_task_77288->free_gtid_69037;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77288->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71109 = {.desc ="mem_71109", .mem =
                                 futhark_mc_task_77288->free_mem_71109, .size =
                                 0, .references =NULL};
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_task_77288->free_mem_71112, .size =
                                 0, .references =NULL};
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_task_77288->free_mem_71115, .size =
                                 0, .references =NULL};
    int64_t iter_75583;
    struct futhark_mc_segmap_parloop_struct_77290
    futhark_mc_segmap_parloop_struct_77290;
    
    futhark_mc_segmap_parloop_struct_77290.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77290.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77290.free_gtid_69037 = gtid_69037;
    futhark_mc_segmap_parloop_struct_77290.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77290.free_mem_71109 = mem_71109.mem;
    futhark_mc_segmap_parloop_struct_77290.free_mem_71112 = mem_71112.mem;
    futhark_mc_segmap_parloop_struct_77290.free_mem_71115 = mem_71115.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77291_task;
    
    futhark_mc_segmap_parloop_77291_task.name =
        "futhark_mc_segmap_parloop_77291";
    futhark_mc_segmap_parloop_77291_task.fn = futhark_mc_segmap_parloop_77291;
    futhark_mc_segmap_parloop_77291_task.args =
        &futhark_mc_segmap_parloop_struct_77290;
    futhark_mc_segmap_parloop_77291_task.iterations = iterations;
    futhark_mc_segmap_parloop_77291_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77291_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77291_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77291_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77291_task);
    
    if (futhark_mc_segmap_parloop_77291_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77291_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77291_total_end -
                 futhark_mc_segmap_parloop_77291_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77291_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77291_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77291_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77289_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77289_end -
                 futhark_mc_segmap_task_77289_start;
        
        ctx->futhark_mc_segmap_task_77289_runs[tid]++;
        ctx->futhark_mc_segmap_task_77289_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77289_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77292 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_71115;
    unsigned char *free_mem_71118;
};
struct futhark_mc_segmap_parloop_struct_77294 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_71115;
    unsigned char *free_mem_71118;
};
static int futhark_mc_segmap_parloop_77295(void *args, int64_t start,
                                           int64_t end, int flat_tid_75245,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77294
    *futhark_mc_segmap_parloop_struct_77294 =
    (struct futhark_mc_segmap_parloop_struct_77294 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77294->ctx;
    uint64_t futhark_mc_segmap_parloop_77295_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77295_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77294->free_n_65344;
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_segmap_parloop_struct_77294->free_mem_71115,
                                 .size =0, .references =NULL};
    struct memblock mem_71118 = {.desc ="mem_71118", .mem =
                                 futhark_mc_segmap_parloop_struct_77294->free_mem_71118,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75589 = start;
    
    for (; iter_75589 < end; iter_75589++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_75590 = n_65344;
        int64_t gtid_75246 = iter_75589;
        int64_t remnant_75591 = iter_75589 - gtid_75246;
        int64_t x_75247;
        
        x_75247 = ((int64_t *) mem_71115.mem)[gtid_75246];
        
        int64_t defunc_0_f_res_75248 = add64((int64_t) 1, x_75247);
        
        ((int64_t *) mem_71118.mem)[gtid_75246] = defunc_0_f_res_75248;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77295_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77295_end -
                 futhark_mc_segmap_parloop_77295_start;
        
        ctx->futhark_mc_segmap_parloop_77295_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77295_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77295_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77293(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75245 = tid;
    int num_tasks_75588 = info.nsubtasks;
    struct futhark_mc_task_77292 *futhark_mc_task_77292 =
                                 (struct futhark_mc_task_77292 *) args;
    struct futhark_context *ctx = futhark_mc_task_77292->ctx;
    uint64_t futhark_mc_segmap_task_77293_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77293_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77292->free_n_65344;
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_task_77292->free_mem_71115, .size =
                                 0, .references =NULL};
    struct memblock mem_71118 = {.desc ="mem_71118", .mem =
                                 futhark_mc_task_77292->free_mem_71118, .size =
                                 0, .references =NULL};
    int64_t iter_75589;
    struct futhark_mc_segmap_parloop_struct_77294
    futhark_mc_segmap_parloop_struct_77294;
    
    futhark_mc_segmap_parloop_struct_77294.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77294.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77294.free_mem_71115 = mem_71115.mem;
    futhark_mc_segmap_parloop_struct_77294.free_mem_71118 = mem_71118.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77295_task;
    
    futhark_mc_segmap_parloop_77295_task.name =
        "futhark_mc_segmap_parloop_77295";
    futhark_mc_segmap_parloop_77295_task.fn = futhark_mc_segmap_parloop_77295;
    futhark_mc_segmap_parloop_77295_task.args =
        &futhark_mc_segmap_parloop_struct_77294;
    futhark_mc_segmap_parloop_77295_task.iterations = iterations;
    futhark_mc_segmap_parloop_77295_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77295_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77295_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77295_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77295_task);
    
    if (futhark_mc_segmap_parloop_77295_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77295_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77295_total_end -
                 futhark_mc_segmap_parloop_77295_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77295_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77295_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77295_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77293_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77293_end -
                 futhark_mc_segmap_task_77293_start;
        
        ctx->futhark_mc_segmap_task_77293_runs[tid]++;
        ctx->futhark_mc_segmap_task_77293_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77293_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77296 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_69049;
    unsigned char *free_mem_71121;
};
struct futhark_mc_segmap_parloop_struct_77298 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_69049;
    unsigned char *free_mem_71121;
};
static int futhark_mc_segmap_parloop_77299(void *args, int64_t start,
                                           int64_t end, int flat_tid_75249,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77298
    *futhark_mc_segmap_parloop_struct_77298 =
    (struct futhark_mc_segmap_parloop_struct_77298 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77298->ctx;
    uint64_t futhark_mc_segmap_parloop_77299_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77299_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77298->free_q_65346;
    int64_t last_res_69049 =
            futhark_mc_segmap_parloop_struct_77298->free_last_res_69049;
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_segmap_parloop_struct_77298->free_mem_71121,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75593 = start;
    
    for (; iter_75593 < end; iter_75593++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_75594 = q_65346;
        int64_t gtid_75250 = iter_75593;
        int64_t remnant_75595 = iter_75593 - gtid_75250;
        bool cond_75251 = sle64(last_res_69049, gtid_75250);
        float defunc_0_f_res_75252;
        
        if (cond_75251) {
            defunc_0_f_res_75252 = 0.0F;
        } else {
            defunc_0_f_res_75252 = 1.0F;
        }
        ((float *) mem_71121.mem)[gtid_75250] = defunc_0_f_res_75252;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77299_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77299_end -
                 futhark_mc_segmap_parloop_77299_start;
        
        ctx->futhark_mc_segmap_parloop_77299_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77299_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77299_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77297(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75249 = tid;
    int num_tasks_75592 = info.nsubtasks;
    struct futhark_mc_task_77296 *futhark_mc_task_77296 =
                                 (struct futhark_mc_task_77296 *) args;
    struct futhark_context *ctx = futhark_mc_task_77296->ctx;
    uint64_t futhark_mc_segmap_task_77297_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77297_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_task_77296->free_q_65346;
    int64_t last_res_69049 = futhark_mc_task_77296->free_last_res_69049;
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_task_77296->free_mem_71121, .size =
                                 0, .references =NULL};
    int64_t iter_75593;
    struct futhark_mc_segmap_parloop_struct_77298
    futhark_mc_segmap_parloop_struct_77298;
    
    futhark_mc_segmap_parloop_struct_77298.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77298.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77298.free_last_res_69049 = last_res_69049;
    futhark_mc_segmap_parloop_struct_77298.free_mem_71121 = mem_71121.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77299_task;
    
    futhark_mc_segmap_parloop_77299_task.name =
        "futhark_mc_segmap_parloop_77299";
    futhark_mc_segmap_parloop_77299_task.fn = futhark_mc_segmap_parloop_77299;
    futhark_mc_segmap_parloop_77299_task.args =
        &futhark_mc_segmap_parloop_struct_77298;
    futhark_mc_segmap_parloop_77299_task.iterations = iterations;
    futhark_mc_segmap_parloop_77299_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77299_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77299_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77299_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77299_task);
    
    if (futhark_mc_segmap_parloop_77299_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77299_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77299_total_end -
                 futhark_mc_segmap_parloop_77299_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77299_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77299_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77299_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77297_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77297_end -
                 futhark_mc_segmap_task_77297_start;
        
        ctx->futhark_mc_segmap_task_77297_runs[tid]++;
        ctx->futhark_mc_segmap_task_77297_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77297_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77300 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_69049;
    int64_t free_min_arg_69068;
    int64_t free_min_arg_69069;
    int64_t free_min_res_69070;
    float free_max_res_69074;
    unsigned char *free_mem_71112;
    unsigned char *free_mem_71115;
    unsigned char *free_mem_71118;
    int64_t free_bytes_71120;
    unsigned char *free_mem_71121;
    unsigned char *free_mem_71160;
    unsigned char *free_mem_71163;
};
struct futhark_mc_segmap_parloop_struct_77302 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_69049;
    int64_t free_min_arg_69068;
    int64_t free_min_arg_69069;
    int64_t free_min_res_69070;
    float free_max_res_69074;
    unsigned char *free_mem_71112;
    unsigned char *free_mem_71115;
    unsigned char *free_mem_71118;
    int64_t free_bytes_71120;
    unsigned char *free_mem_71121;
    unsigned char *free_mem_71160;
    unsigned char *free_mem_71163;
};
static int futhark_mc_segmap_parloop_77303(void *args, int64_t start,
                                           int64_t end, int flat_tid_75409,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77302
    *futhark_mc_segmap_parloop_struct_77302 =
    (struct futhark_mc_segmap_parloop_struct_77302 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77302->ctx;
    uint64_t futhark_mc_segmap_parloop_77303_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77303_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77302->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77302->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77302->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77302->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77302->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77302->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77302->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77302->free_loop_cond_65369;
    int64_t last_res_69049 =
            futhark_mc_segmap_parloop_struct_77302->free_last_res_69049;
    int64_t min_arg_69068 =
            futhark_mc_segmap_parloop_struct_77302->free_min_arg_69068;
    int64_t min_arg_69069 =
            futhark_mc_segmap_parloop_struct_77302->free_min_arg_69069;
    int64_t min_res_69070 =
            futhark_mc_segmap_parloop_struct_77302->free_min_res_69070;
    float max_res_69074 =
          futhark_mc_segmap_parloop_struct_77302->free_max_res_69074;
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_segmap_parloop_struct_77302->free_mem_71112,
                                 .size =0, .references =NULL};
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_segmap_parloop_struct_77302->free_mem_71115,
                                 .size =0, .references =NULL};
    struct memblock mem_71118 = {.desc ="mem_71118", .mem =
                                 futhark_mc_segmap_parloop_struct_77302->free_mem_71118,
                                 .size =0, .references =NULL};
    int64_t bytes_71120 =
            futhark_mc_segmap_parloop_struct_77302->free_bytes_71120;
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_segmap_parloop_struct_77302->free_mem_71121,
                                 .size =0, .references =NULL};
    struct memblock mem_71160 = {.desc ="mem_71160", .mem =
                                 futhark_mc_segmap_parloop_struct_77302->free_mem_71160,
                                 .size =0, .references =NULL};
    struct memblock mem_71163 = {.desc ="mem_71163", .mem =
                                 futhark_mc_segmap_parloop_struct_77302->free_mem_71163,
                                 .size =0, .references =NULL};
    size_t mem_75497_cached_sizze_77304 = 0;
    unsigned char *mem_75497 = NULL;
    size_t mem_75499_cached_sizze_77305 = 0;
    unsigned char *mem_75499 = NULL;
    int64_t iterations = end - start;
    int64_t iter_75597 = start;
    
    if (mem_75497_cached_sizze_77304 < (size_t) bytes_71120) {
        mem_75497 = realloc(mem_75497, bytes_71120);
        mem_75497_cached_sizze_77304 = bytes_71120;
    }
    if (mem_75499_cached_sizze_77305 < (size_t) bytes_71120) {
        mem_75499 = realloc(mem_75499, bytes_71120);
        mem_75499_cached_sizze_77305 = bytes_71120;
    }
    for (; iter_75597 < end; iter_75597++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_75701 = n_m_65352;
        int64_t gtid_75410 = iter_75597;
        int64_t remnant_75702 = iter_75597 - gtid_75410;
        int64_t min_arg_75411 = mul64(jump_65348, gtid_75410);
        int64_t min_res_75412 = smin64(i_65358, min_arg_75411);
        int64_t defunc_0_g_res_75413 = add64((int64_t) 1, min_res_75412);
        bool init_idx_75414;
        int64_t init_idx_75415;
        int64_t init_idx_75416;
        bool loop_while_75598;
        int64_t low_75599;
        int64_t high_75600;
        
        loop_while_75598 = x_65359;
        low_75599 = (int64_t) 0;
        high_75600 = i_65358;
        while (loop_while_75598) {
            int64_t x_75601 = add64(low_75599, high_75600);
            int64_t mid_75602 = sdiv64(x_75601, (int64_t) 2);
            bool x_75603 = sle64((int64_t) 0, mid_75602);
            bool y_75604 = slt64(mid_75602, n_65344);
            bool bounds_check_75605 = x_75603 && y_75604;
            bool index_certs_75606;
            
            if (!bounds_check_75605) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_75602,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_75607;
            
            mid_id_75607 = ((int64_t *) mem_71118.mem)[mid_75602];
            
            bool cond_75608 = slt64(mid_id_75607, (int64_t) 0);
            int64_t mid_idx_75609;
            
            if (cond_75608) {
                mid_idx_75609 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_75609 = mid_id_75607;
            }
            
            bool cond_75610 = sle64(defunc_0_g_res_75413, mid_idx_75609);
            int64_t loopres_75611;
            int64_t loopres_75612;
            
            if (cond_75610) {
                int64_t loopres_t_res_75613 = sub64(mid_75602, (int64_t) 1);
                
                loopres_75611 = low_75599;
                loopres_75612 = loopres_t_res_75613;
            } else {
                int64_t loopres_f_res_75614 = add64((int64_t) 1, mid_75602);
                
                loopres_75611 = loopres_f_res_75614;
                loopres_75612 = high_75600;
            }
            
            bool loop_cond_75615 = sle64(loopres_75611, loopres_75612);
            bool loop_while_tmp_75703 = loop_cond_75615;
            int64_t low_tmp_75704 = loopres_75611;
            int64_t high_tmp_75705 = loopres_75612;
            
            loop_while_75598 = loop_while_tmp_75703;
            low_75599 = low_tmp_75704;
            high_75600 = high_tmp_75705;
        }
        init_idx_75414 = loop_while_75598;
        init_idx_75415 = low_75599;
        init_idx_75416 = high_75600;
        
        bool idx_75435;
        int64_t idx_75436;
        int64_t idx_75437;
        int64_t idx_75438;
        bool loop_while_75616;
        int64_t l_idx_75617;
        int64_t r_idx_75618;
        int64_t span_75619;
        
        loop_while_75616 = loop_cond_65369;
        l_idx_75617 = init_idx_75415;
        r_idx_75618 = init_idx_75415;
        span_75619 = (int64_t) 1;
        while (loop_while_75616) {
            int64_t max_arg_75620 = sub64(l_idx_75617, (int64_t) 1);
            int64_t max_res_75621 = smax64((int64_t) 0, max_arg_75620);
            int64_t min_arg_75622 = add64((int64_t) 1, r_idx_75618);
            int64_t min_res_75623 = smin64(min_arg_69068, min_arg_75622);
            bool x_75624 = sle64((int64_t) 0, max_res_75621);
            bool y_75625 = slt64(max_res_75621, n_65344);
            bool bounds_check_75626 = x_75624 && y_75625;
            bool index_certs_75627;
            
            if (!bounds_check_75626) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_75621,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75628;
            
            x_75628 = ((int64_t *) mem_71118.mem)[max_res_75621];
            
            int64_t abs_arg_75629 = sub64(x_75628, defunc_0_g_res_75413);
            int64_t abs_res_75630 = abs64(abs_arg_75629);
            bool x_75631 = sle64((int64_t) 0, min_res_75623);
            bool y_75632 = slt64(min_res_75623, n_65344);
            bool bounds_check_75633 = x_75631 && y_75632;
            bool index_certs_75634;
            
            if (!bounds_check_75633) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_75623,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75635;
            
            x_75635 = ((int64_t *) mem_71118.mem)[min_res_75623];
            
            int64_t abs_arg_75636 = sub64(x_75635, defunc_0_g_res_75413);
            int64_t abs_res_75637 = abs64(abs_arg_75636);
            bool cond_75638 = max_res_75621 == l_idx_75617;
            int64_t loopres_75639;
            int64_t loopres_75640;
            int64_t loopres_75641;
            
            if (cond_75638) {
                loopres_75639 = l_idx_75617;
                loopres_75640 = r_idx_75618;
                loopres_75641 = min_res_65364;
            } else {
                bool cond_75642 = slt64(abs_res_75630, abs_res_75637);
                bool cond_f_res_75643 = min_res_75623 == r_idx_75618;
                bool x_75644 = !cond_75642;
                bool y_75645 = cond_f_res_75643 && x_75644;
                bool cond_75646 = cond_75642 || y_75645;
                int64_t loopres_f_res_75647;
                
                if (cond_75646) {
                    loopres_f_res_75647 = max_res_75621;
                } else {
                    loopres_f_res_75647 = l_idx_75617;
                }
                
                int64_t loopres_f_res_75648;
                
                if (cond_75646) {
                    loopres_f_res_75648 = r_idx_75618;
                } else {
                    loopres_f_res_75648 = min_res_75623;
                }
                
                int64_t loopres_f_res_75649;
                
                if (cond_75646) {
                    int64_t loopres_f_res_t_res_75650 = add64((int64_t) 1,
                                                              span_75619);
                    
                    loopres_f_res_75649 = loopres_f_res_t_res_75650;
                } else {
                    int64_t loopres_f_res_f_res_75651 = add64((int64_t) 1,
                                                              span_75619);
                    
                    loopres_f_res_75649 = loopres_f_res_f_res_75651;
                }
                loopres_75639 = loopres_f_res_75647;
                loopres_75640 = loopres_f_res_75648;
                loopres_75641 = loopres_f_res_75649;
            }
            
            bool loop_cond_75652 = slt64(loopres_75641, min_res_65364);
            bool loop_while_tmp_75706 = loop_cond_75652;
            int64_t l_idx_tmp_75707 = loopres_75639;
            int64_t r_idx_tmp_75708 = loopres_75640;
            int64_t span_tmp_75709 = loopres_75641;
            
            loop_while_75616 = loop_while_tmp_75706;
            l_idx_75617 = l_idx_tmp_75707;
            r_idx_75618 = r_idx_tmp_75708;
            span_75619 = span_tmp_75709;
        }
        idx_75435 = loop_while_75616;
        idx_75436 = l_idx_75617;
        idx_75437 = r_idx_75618;
        idx_75438 = span_75619;
        
        int64_t min_res_75476 = smin64(min_arg_69069, idx_75436);
        int64_t max_res_75477 = smax64((int64_t) 0, min_res_75476);
        int64_t x_75478 = add64(min_res_69070, max_res_75477);
        int64_t r_75479 = sub64(x_75478, (int64_t) 1);
        bool x_75480 = sle64((int64_t) 0, r_75479);
        bool y_75481 = slt64(r_75479, n_65344);
        bool bounds_check_75482 = x_75480 && y_75481;
        bool index_certs_75483;
        
        if (!bounds_check_75482) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_75479,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_75484;
        
        x_75484 = ((int64_t *) mem_71115.mem)[r_75479];
        
        int64_t abs_arg_75485 = sub64(x_75484, min_res_75412);
        int64_t abs_res_75486 = abs64(abs_arg_75485);
        bool x_75487 = sle64((int64_t) 0, max_res_75477);
        bool y_75488 = slt64(max_res_75477, n_65344);
        bool bounds_check_75489 = x_75487 && y_75488;
        bool index_certs_75490;
        
        if (!bounds_check_75489) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_75477,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_75491;
        
        x_75491 = ((int64_t *) mem_71115.mem)[max_res_75477];
        
        int64_t abs_arg_75492 = sub64(x_75491, min_res_75412);
        int64_t abs_res_75493 = abs64(abs_arg_75492);
        int64_t max_res_75494 = smax64(abs_res_75486, abs_res_75493);
        float defunc_0_f_res_75495 = sitofp_i64_f32(max_res_75494);
        float defunc_1_f_res_75496 = max_res_69074 + defunc_0_f_res_75495;
        float defunc_2_reduce_res_75501;
        float defunc_2_reduce_res_75502;
        float defunc_2_reduce_res_75503;
        float redout_75654;
        float redout_75655;
        float redout_75656;
        
        redout_75654 = 0.0F;
        redout_75655 = 0.0F;
        redout_75656 = 0.0F;
        for (int64_t i_75653 = 0; i_75653 < q_65346; i_75653++) {
            float x_75659;
            
            x_75659 = ((float *) mem_71121.mem)[i_75653];
            
            bool cond_75660 = sle64(last_res_69049, i_75653);
            int64_t defunc_0_f_res_75661;
            
            if (cond_75660) {
                defunc_0_f_res_75661 = (int64_t) 0;
            } else {
                int64_t i_75662 = add64(max_res_75477, i_75653);
                int64_t defunc_0_add_arg_75663;
                
                defunc_0_add_arg_75663 = ((int64_t *) mem_71115.mem)[i_75662];
                
                int64_t defunc_1_add_res_75664 = add64((int64_t) 1,
                                                       defunc_0_add_arg_75663);
                
                defunc_0_f_res_75661 = defunc_1_add_res_75664;
            }
            
            int64_t binop_p_75665 = sub64(defunc_0_f_res_75661, min_res_75412);
            float defunc_0_f_res_75666 = sitofp_i64_f32(binop_p_75665);
            float abs_res_75667 = (float) fabs(defunc_0_f_res_75666);
            float tmp1_75668 = abs_res_75667 / defunc_1_f_res_75496;
            float x_75669 = tmp1_75668 * tmp1_75668;
            float y_75670 = tmp1_75668 * x_75669;
            float tmp2_75671 = 1.0F - y_75670;
            float x_75672 = tmp2_75671 * tmp2_75671;
            float tmp3_75673 = tmp2_75671 * x_75672;
            float tmp4_75674 = x_75659 * tmp3_75673;
            float defunc_1_f_res_75675 = defunc_0_f_res_75666 * tmp4_75674;
            float defunc_1_f_res_75676 = defunc_0_f_res_75666 *
                  defunc_1_f_res_75675;
            float defunc_1_op_res_75677 = tmp4_75674 + redout_75654;
            float defunc_1_op_res_75678 = defunc_1_f_res_75675 + redout_75655;
            float defunc_1_op_res_75679 = defunc_1_f_res_75676 + redout_75656;
            
            ((float *) mem_75497)[i_75653] = defunc_1_f_res_75675;
            ((float *) mem_75499)[i_75653] = tmp4_75674;
            
            float redout_tmp_75710 = defunc_1_op_res_75677;
            float redout_tmp_75711 = defunc_1_op_res_75678;
            float redout_tmp_75712 = defunc_1_op_res_75679;
            
            redout_75654 = redout_tmp_75710;
            redout_75655 = redout_tmp_75711;
            redout_75656 = redout_tmp_75712;
        }
        defunc_2_reduce_res_75501 = redout_75654;
        defunc_2_reduce_res_75502 = redout_75655;
        defunc_2_reduce_res_75503 = redout_75656;
        
        float x_75535 = defunc_2_reduce_res_75501 * defunc_2_reduce_res_75503;
        float y_75536 = defunc_2_reduce_res_75502 * defunc_2_reduce_res_75502;
        float y_75537 = x_75535 - y_75536;
        float det1_75538 = 1.0F / y_75537;
        float a11_75539 = defunc_2_reduce_res_75503 * det1_75538;
        float x_75540 = 0.0F - defunc_2_reduce_res_75502;
        float b11_75541 = det1_75538 * x_75540;
        float c11_75542 = defunc_2_reduce_res_75501 * det1_75538;
        float defunc_2_reduce_res_75543;
        float defunc_2_reduce_res_75544;
        float redout_75683;
        float redout_75684;
        
        redout_75683 = 0.0F;
        redout_75684 = 0.0F;
        for (int64_t i_75682 = 0; i_75682 < q_65346; i_75682++) {
            float x_75685;
            
            x_75685 = ((float *) mem_75499)[i_75682];
            
            float x_75686;
            
            x_75686 = ((float *) mem_75497)[i_75682];
            
            bool cond_75687 = sle64(last_res_69049, i_75682);
            float defunc_0_f_res_75688;
            
            if (cond_75687) {
                defunc_0_f_res_75688 = 0.0F;
            } else {
                int64_t i_75689 = add64(max_res_75477, i_75682);
                float defunc_0_add_arg_75690;
                
                defunc_0_add_arg_75690 = ((float *) mem_71112.mem)[i_75689];
                defunc_0_f_res_75688 = defunc_0_add_arg_75690;
            }
            
            float x_75691 = a11_75539 * x_75685;
            float y_75692 = b11_75541 * x_75686;
            float x_75693 = x_75691 + y_75692;
            float defunc_9_fit_fun_res_75694 = defunc_0_f_res_75688 * x_75693;
            float x_75695 = b11_75541 * x_75685;
            float y_75696 = c11_75542 * x_75686;
            float x_75697 = x_75695 + y_75696;
            float defunc_9_slope_fun_res_75698 = defunc_0_f_res_75688 * x_75697;
            float defunc_1_op_res_75699 = defunc_9_fit_fun_res_75694 +
                  redout_75683;
            float defunc_1_op_res_75700 = defunc_9_slope_fun_res_75698 +
                  redout_75684;
            float redout_tmp_75715 = defunc_1_op_res_75699;
            float redout_tmp_75716 = defunc_1_op_res_75700;
            
            redout_75683 = redout_tmp_75715;
            redout_75684 = redout_tmp_75716;
        }
        defunc_2_reduce_res_75543 = redout_75683;
        defunc_2_reduce_res_75544 = redout_75684;
        ((float *) mem_71160.mem)[gtid_75410] = defunc_2_reduce_res_75543;
        ((float *) mem_71163.mem)[gtid_75410] = defunc_2_reduce_res_75544;
    }
    
  cleanup:
    { }
    free(mem_75497);
    free(mem_75499);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77303_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77303_end -
                 futhark_mc_segmap_parloop_77303_start;
        
        ctx->futhark_mc_segmap_parloop_77303_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77303_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77303_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77301(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75409 = tid;
    int num_tasks_75596 = info.nsubtasks;
    struct futhark_mc_task_77300 *futhark_mc_task_77300 =
                                 (struct futhark_mc_task_77300 *) args;
    struct futhark_context *ctx = futhark_mc_task_77300->ctx;
    uint64_t futhark_mc_segmap_task_77301_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77301_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77300->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77300->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77300->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77300->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77300->free_i_65358;
    bool x_65359 = futhark_mc_task_77300->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77300->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77300->free_loop_cond_65369;
    int64_t last_res_69049 = futhark_mc_task_77300->free_last_res_69049;
    int64_t min_arg_69068 = futhark_mc_task_77300->free_min_arg_69068;
    int64_t min_arg_69069 = futhark_mc_task_77300->free_min_arg_69069;
    int64_t min_res_69070 = futhark_mc_task_77300->free_min_res_69070;
    float max_res_69074 = futhark_mc_task_77300->free_max_res_69074;
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_task_77300->free_mem_71112, .size =
                                 0, .references =NULL};
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_task_77300->free_mem_71115, .size =
                                 0, .references =NULL};
    struct memblock mem_71118 = {.desc ="mem_71118", .mem =
                                 futhark_mc_task_77300->free_mem_71118, .size =
                                 0, .references =NULL};
    int64_t bytes_71120 = futhark_mc_task_77300->free_bytes_71120;
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_task_77300->free_mem_71121, .size =
                                 0, .references =NULL};
    struct memblock mem_71160 = {.desc ="mem_71160", .mem =
                                 futhark_mc_task_77300->free_mem_71160, .size =
                                 0, .references =NULL};
    struct memblock mem_71163 = {.desc ="mem_71163", .mem =
                                 futhark_mc_task_77300->free_mem_71163, .size =
                                 0, .references =NULL};
    int64_t iter_75597;
    struct futhark_mc_segmap_parloop_struct_77302
    futhark_mc_segmap_parloop_struct_77302;
    
    futhark_mc_segmap_parloop_struct_77302.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77302.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77302.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77302.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77302.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77302.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77302.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77302.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77302.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77302.free_last_res_69049 = last_res_69049;
    futhark_mc_segmap_parloop_struct_77302.free_min_arg_69068 = min_arg_69068;
    futhark_mc_segmap_parloop_struct_77302.free_min_arg_69069 = min_arg_69069;
    futhark_mc_segmap_parloop_struct_77302.free_min_res_69070 = min_res_69070;
    futhark_mc_segmap_parloop_struct_77302.free_max_res_69074 = max_res_69074;
    futhark_mc_segmap_parloop_struct_77302.free_mem_71112 = mem_71112.mem;
    futhark_mc_segmap_parloop_struct_77302.free_mem_71115 = mem_71115.mem;
    futhark_mc_segmap_parloop_struct_77302.free_mem_71118 = mem_71118.mem;
    futhark_mc_segmap_parloop_struct_77302.free_bytes_71120 = bytes_71120;
    futhark_mc_segmap_parloop_struct_77302.free_mem_71121 = mem_71121.mem;
    futhark_mc_segmap_parloop_struct_77302.free_mem_71160 = mem_71160.mem;
    futhark_mc_segmap_parloop_struct_77302.free_mem_71163 = mem_71163.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77303_task;
    
    futhark_mc_segmap_parloop_77303_task.name =
        "futhark_mc_segmap_parloop_77303";
    futhark_mc_segmap_parloop_77303_task.fn = futhark_mc_segmap_parloop_77303;
    futhark_mc_segmap_parloop_77303_task.args =
        &futhark_mc_segmap_parloop_struct_77302;
    futhark_mc_segmap_parloop_77303_task.iterations = iterations;
    futhark_mc_segmap_parloop_77303_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77303_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77303_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77303_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77303_task);
    
    if (futhark_mc_segmap_parloop_77303_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77303_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77303_total_end -
                 futhark_mc_segmap_parloop_77303_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77303_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77303_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77303_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77301_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77301_end -
                 futhark_mc_segmap_task_77301_start;
        
        ctx->futhark_mc_segmap_task_77301_runs[tid]++;
        ctx->futhark_mc_segmap_task_77301_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77301_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77307 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_69049;
    int64_t free_min_arg_69068;
    int64_t free_min_arg_69069;
    int64_t free_min_res_69070;
    float free_max_res_69074;
    unsigned char *free_mem_71112;
    unsigned char *free_mem_71115;
    unsigned char *free_mem_71118;
    int64_t free_bytes_71120;
    unsigned char *free_mem_71121;
    unsigned char *free_mem_71160;
    unsigned char *free_mem_71163;
};
struct futhark_mc_task_77311 {
    struct futhark_context *ctx;
    int64_t free_last_res_69049;
    unsigned char *free_mem_71115;
    unsigned char *free_mem_71121;
    int64_t free_min_res_75256;
    int64_t free_max_res_75321;
    float free_defunc_1_f_res_75340;
    float *retval_defunc_2_reduce_res_75343;
    float *retval_defunc_2_reduce_res_75344;
    float *retval_defunc_2_reduce_res_75345;
    unsigned char *retval_mem_75341;
    unsigned char *retval_mem_75342;
};
struct futhark_mc_segred_stage_1_parloop_struct_77316 {
    struct futhark_context *ctx;
    int64_t free_last_res_69049;
    unsigned char *free_mem_71115;
    unsigned char *free_mem_71121;
    int64_t free_min_res_75256;
    int64_t free_max_res_75321;
    float free_defunc_1_f_res_75340;
    unsigned char *free_mem_75341;
    unsigned char *free_mem_75342;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_75834;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_75836;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_75838;
};
static int futhark_mc_segred_stage_1_parloop_77317(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_75773, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77316
    *futhark_mc_segred_stage_1_parloop_struct_77316 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77316 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77316->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77317_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77317_start = get_wall_time();
    
    int64_t last_res_69049 =
            futhark_mc_segred_stage_1_parloop_struct_77316->free_last_res_69049;
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77316->free_mem_71115,
                                 .size =0, .references =NULL};
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77316->free_mem_71121,
                                 .size =0, .references =NULL};
    int64_t min_res_75256 =
            futhark_mc_segred_stage_1_parloop_struct_77316->free_min_res_75256;
    int64_t max_res_75321 =
            futhark_mc_segred_stage_1_parloop_struct_77316->free_max_res_75321;
    float defunc_1_f_res_75340 =
          futhark_mc_segred_stage_1_parloop_struct_77316->free_defunc_1_f_res_75340;
    struct memblock mem_75341 = {.desc ="mem_75341", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77316->free_mem_75341,
                                 .size =0, .references =NULL};
    struct memblock mem_75342 = {.desc ="mem_75342", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77316->free_mem_75342,
                                 .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_75834 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_75834",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77316->free_reduce_stage_1_tid_res_arr_mem_75834,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_75836 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_75836",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77316->free_reduce_stage_1_tid_res_arr_mem_75836,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_75838 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_75838",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77316->free_reduce_stage_1_tid_res_arr_mem_75838,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75840 = start;
    float x_75775;
    float x_75776;
    float x_75778;
    float x_75779;
    float x_75781;
    float x_75782;
    float local_acc_75841 = 0.0F;
    float local_acc_75842 = 0.0F;
    float local_acc_75843 = 0.0F;
    
    for (; iter_75840 < end; iter_75840++) {
        int64_t gtid_75774 = iter_75840;
        float x_75784;
        
        x_75784 = ((float *) mem_71121.mem)[gtid_75774];
        
        bool cond_75785 = sle64(last_res_69049, gtid_75774);
        int64_t defunc_0_f_res_75786;
        
        if (cond_75785) {
            defunc_0_f_res_75786 = (int64_t) 0;
        } else {
            int64_t i_75787 = add64(max_res_75321, gtid_75774);
            int64_t defunc_0_add_arg_75788;
            
            defunc_0_add_arg_75788 = ((int64_t *) mem_71115.mem)[i_75787];
            
            int64_t defunc_1_add_res_75789 = add64((int64_t) 1,
                                                   defunc_0_add_arg_75788);
            
            defunc_0_f_res_75786 = defunc_1_add_res_75789;
        }
        
        int64_t binop_p_75790 = sub64(defunc_0_f_res_75786, min_res_75256);
        float defunc_0_f_res_75791 = sitofp_i64_f32(binop_p_75790);
        float abs_res_75792 = (float) fabs(defunc_0_f_res_75791);
        float tmp1_75793 = abs_res_75792 / defunc_1_f_res_75340;
        float x_75794 = tmp1_75793 * tmp1_75793;
        float y_75795 = tmp1_75793 * x_75794;
        float tmp2_75796 = 1.0F - y_75795;
        float x_75797 = tmp2_75796 * tmp2_75796;
        float tmp3_75798 = tmp2_75796 * x_75797;
        float tmp4_75799 = x_75784 * tmp3_75798;
        float defunc_1_f_res_75800 = defunc_0_f_res_75791 * tmp4_75799;
        float defunc_1_f_res_75801 = defunc_0_f_res_75791 *
              defunc_1_f_res_75800;
        
        // save map-out results
        {
            ((float *) mem_75341.mem)[gtid_75774] = defunc_1_f_res_75800;
            ((float *) mem_75342.mem)[gtid_75774] = tmp4_75799;
        }
        // Load accum params
        {
            x_75775 = local_acc_75841;
        }
        // Load next params
        {
            x_75776 = tmp4_75799;
        }
        // Red body
        {
            float defunc_1_op_res_75777 = x_75775 + x_75776;
            
            local_acc_75841 = defunc_1_op_res_75777;
        }
        // Load accum params
        {
            x_75778 = local_acc_75842;
        }
        // Load next params
        {
            x_75779 = defunc_1_f_res_75800;
        }
        // Red body
        {
            float defunc_1_op_res_75780 = x_75778 + x_75779;
            
            local_acc_75842 = defunc_1_op_res_75780;
        }
        // Load accum params
        {
            x_75781 = local_acc_75843;
        }
        // Load next params
        {
            x_75782 = defunc_1_f_res_75801;
        }
        // Red body
        {
            float defunc_1_op_res_75783 = x_75781 + x_75782;
            
            local_acc_75843 = defunc_1_op_res_75783;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_75834.mem)[flat_tid_75773] =
        local_acc_75841;
    ((float *) reduce_stage_1_tid_res_arr_mem_75836.mem)[flat_tid_75773] =
        local_acc_75842;
    ((float *) reduce_stage_1_tid_res_arr_mem_75838.mem)[flat_tid_75773] =
        local_acc_75843;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77317_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77317_end -
                 futhark_mc_segred_stage_1_parloop_77317_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77317_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77317_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77317_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77312(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75773 = tid;
    int num_tasks_75833 = info.nsubtasks;
    struct futhark_mc_task_77311 *futhark_mc_task_77311 =
                                 (struct futhark_mc_task_77311 *) args;
    struct futhark_context *ctx = futhark_mc_task_77311->ctx;
    uint64_t futhark_mc_segred_task_77312_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77312_start = get_wall_time();
    
    int64_t last_res_69049 = futhark_mc_task_77311->free_last_res_69049;
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_task_77311->free_mem_71115, .size =
                                 0, .references =NULL};
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_task_77311->free_mem_71121, .size =
                                 0, .references =NULL};
    int64_t min_res_75256 = futhark_mc_task_77311->free_min_res_75256;
    int64_t max_res_75321 = futhark_mc_task_77311->free_max_res_75321;
    float defunc_1_f_res_75340 =
          futhark_mc_task_77311->free_defunc_1_f_res_75340;
    float defunc_2_reduce_res_75343 =
          *futhark_mc_task_77311->retval_defunc_2_reduce_res_75343;
    float defunc_2_reduce_res_75344 =
          *futhark_mc_task_77311->retval_defunc_2_reduce_res_75344;
    float defunc_2_reduce_res_75345 =
          *futhark_mc_task_77311->retval_defunc_2_reduce_res_75345;
    struct memblock mem_75341 = {.desc ="mem_75341", .mem =
                                 futhark_mc_task_77311->retval_mem_75341,
                                 .size =0, .references =NULL};
    struct memblock mem_75342 = {.desc ="mem_75342", .mem =
                                 futhark_mc_task_77311->retval_mem_75342,
                                 .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_75834_cached_sizze_77313 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_75834 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_75836_cached_sizze_77314 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_75836 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_75838_cached_sizze_77315 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_75838 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_75834_cached_sizze_77313 <
        (size_t) ((int64_t) 4 * num_tasks_75833)) {
        reduce_stage_1_tid_res_arr_mem_75834 =
            realloc(reduce_stage_1_tid_res_arr_mem_75834, (int64_t) 4 *
                    num_tasks_75833);
        reduce_stage_1_tid_res_arr_mem_75834_cached_sizze_77313 = (int64_t) 4 *
            num_tasks_75833;
    }
    if (reduce_stage_1_tid_res_arr_mem_75836_cached_sizze_77314 <
        (size_t) ((int64_t) 4 * num_tasks_75833)) {
        reduce_stage_1_tid_res_arr_mem_75836 =
            realloc(reduce_stage_1_tid_res_arr_mem_75836, (int64_t) 4 *
                    num_tasks_75833);
        reduce_stage_1_tid_res_arr_mem_75836_cached_sizze_77314 = (int64_t) 4 *
            num_tasks_75833;
    }
    if (reduce_stage_1_tid_res_arr_mem_75838_cached_sizze_77315 <
        (size_t) ((int64_t) 4 * num_tasks_75833)) {
        reduce_stage_1_tid_res_arr_mem_75838 =
            realloc(reduce_stage_1_tid_res_arr_mem_75838, (int64_t) 4 *
                    num_tasks_75833);
        reduce_stage_1_tid_res_arr_mem_75838_cached_sizze_77315 = (int64_t) 4 *
            num_tasks_75833;
    }
    
    int64_t iter_75840;
    struct futhark_mc_segred_stage_1_parloop_struct_77316
    futhark_mc_segred_stage_1_parloop_struct_77316;
    
    futhark_mc_segred_stage_1_parloop_struct_77316.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_last_res_69049 =
        last_res_69049;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_mem_71115 =
        mem_71115.mem;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_mem_71121 =
        mem_71121.mem;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_min_res_75256 =
        min_res_75256;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_max_res_75321 =
        max_res_75321;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_defunc_1_f_res_75340 =
        defunc_1_f_res_75340;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_mem_75341 =
        mem_75341.mem;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_mem_75342 =
        mem_75342.mem;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_reduce_stage_1_tid_res_arr_mem_75834 =
        reduce_stage_1_tid_res_arr_mem_75834;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_reduce_stage_1_tid_res_arr_mem_75836 =
        reduce_stage_1_tid_res_arr_mem_75836;
    futhark_mc_segred_stage_1_parloop_struct_77316.free_reduce_stage_1_tid_res_arr_mem_75838 =
        reduce_stage_1_tid_res_arr_mem_75838;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77317_task;
    
    futhark_mc_segred_stage_1_parloop_77317_task.name =
        "futhark_mc_segred_stage_1_parloop_77317";
    futhark_mc_segred_stage_1_parloop_77317_task.fn =
        futhark_mc_segred_stage_1_parloop_77317;
    futhark_mc_segred_stage_1_parloop_77317_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77316;
    futhark_mc_segred_stage_1_parloop_77317_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77317_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77317_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77317_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77317_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77317_task);
    
    if (futhark_mc_segred_stage_1_parloop_77317_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77317_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77317_total_end -
                 futhark_mc_segred_stage_1_parloop_77317_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77317_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77317_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77317_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_75343 = 0.0F;
        defunc_2_reduce_res_75344 = 0.0F;
        defunc_2_reduce_res_75345 = 0.0F;
    }
    
    float x_75844;
    float x_75845;
    float x_75847;
    float x_75848;
    float x_75850;
    float x_75851;
    
    for (int32_t i_75853 = 0; i_75853 < num_tasks_75833; i_75853++) {
        flat_tid_75773 = i_75853;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_75844 = defunc_2_reduce_res_75343;
            }
            // load next params
            {
                x_75845 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_75834)[flat_tid_75773];
            }
            // red body
            {
                float defunc_1_op_res_75846 = x_75844 + x_75845;
                
                defunc_2_reduce_res_75343 = defunc_1_op_res_75846;
            }
            // load acc params
            {
                x_75847 = defunc_2_reduce_res_75344;
            }
            // load next params
            {
                x_75848 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_75836)[flat_tid_75773];
            }
            // red body
            {
                float defunc_1_op_res_75849 = x_75847 + x_75848;
                
                defunc_2_reduce_res_75344 = defunc_1_op_res_75849;
            }
            // load acc params
            {
                x_75850 = defunc_2_reduce_res_75345;
            }
            // load next params
            {
                x_75851 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_75838)[flat_tid_75773];
            }
            // red body
            {
                float defunc_1_op_res_75852 = x_75850 + x_75851;
                
                defunc_2_reduce_res_75345 = defunc_1_op_res_75852;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_75834);
        free(reduce_stage_1_tid_res_arr_mem_75836);
        free(reduce_stage_1_tid_res_arr_mem_75838);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77312_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77312_end -
                 futhark_mc_segred_task_77312_start;
        
        ctx->futhark_mc_segred_task_77312_runs[tid]++;
        ctx->futhark_mc_segred_task_77312_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77312_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77311->retval_defunc_2_reduce_res_75343 =
            defunc_2_reduce_res_75343;
        *futhark_mc_task_77311->retval_defunc_2_reduce_res_75344 =
            defunc_2_reduce_res_75344;
        *futhark_mc_task_77311->retval_defunc_2_reduce_res_75345 =
            defunc_2_reduce_res_75345;
        futhark_mc_task_77311->retval_mem_75341 = mem_75341.mem;
        futhark_mc_task_77311->retval_mem_75342 = mem_75342.mem;
    }
    return err;
}
struct futhark_mc_task_77318 {
    struct futhark_context *ctx;
    int64_t free_last_res_69049;
    unsigned char *free_mem_71112;
    int64_t free_max_res_75321;
    unsigned char *free_mem_75341;
    unsigned char *free_mem_75342;
    float free_a11_75381;
    float free_b11_75383;
    float free_c11_75384;
    float *retval_defunc_2_reduce_res_75385;
    float *retval_defunc_2_reduce_res_75386;
};
struct futhark_mc_segred_stage_1_parloop_struct_77322 {
    struct futhark_context *ctx;
    int64_t free_last_res_69049;
    unsigned char *free_mem_71112;
    int64_t free_max_res_75321;
    unsigned char *free_mem_75341;
    unsigned char *free_mem_75342;
    float free_a11_75381;
    float free_b11_75383;
    float free_c11_75384;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_75855;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_75857;
};
static int futhark_mc_segred_stage_1_parloop_77323(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_75802, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77322
    *futhark_mc_segred_stage_1_parloop_struct_77322 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77322 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77322->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77323_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77323_start = get_wall_time();
    
    int64_t last_res_69049 =
            futhark_mc_segred_stage_1_parloop_struct_77322->free_last_res_69049;
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77322->free_mem_71112,
                                 .size =0, .references =NULL};
    int64_t max_res_75321 =
            futhark_mc_segred_stage_1_parloop_struct_77322->free_max_res_75321;
    struct memblock mem_75341 = {.desc ="mem_75341", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77322->free_mem_75341,
                                 .size =0, .references =NULL};
    struct memblock mem_75342 = {.desc ="mem_75342", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77322->free_mem_75342,
                                 .size =0, .references =NULL};
    float a11_75381 =
          futhark_mc_segred_stage_1_parloop_struct_77322->free_a11_75381;
    float b11_75383 =
          futhark_mc_segred_stage_1_parloop_struct_77322->free_b11_75383;
    float c11_75384 =
          futhark_mc_segred_stage_1_parloop_struct_77322->free_c11_75384;
    struct memblock reduce_stage_1_tid_res_arr_mem_75855 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_75855",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77322->free_reduce_stage_1_tid_res_arr_mem_75855,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_75857 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_75857",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77322->free_reduce_stage_1_tid_res_arr_mem_75857,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_75859 = start;
    float x_75804;
    float x_75805;
    float x_75807;
    float x_75808;
    float local_acc_75860 = 0.0F;
    float local_acc_75861 = 0.0F;
    
    for (; iter_75859 < end; iter_75859++) {
        int64_t gtid_75803 = iter_75859;
        float x_75810;
        
        x_75810 = ((float *) mem_75342.mem)[gtid_75803];
        
        float x_75811;
        
        x_75811 = ((float *) mem_75341.mem)[gtid_75803];
        
        bool cond_75812 = sle64(last_res_69049, gtid_75803);
        float defunc_0_f_res_75813;
        
        if (cond_75812) {
            defunc_0_f_res_75813 = 0.0F;
        } else {
            int64_t i_75814 = add64(max_res_75321, gtid_75803);
            float defunc_0_add_arg_75815;
            
            defunc_0_add_arg_75815 = ((float *) mem_71112.mem)[i_75814];
            defunc_0_f_res_75813 = defunc_0_add_arg_75815;
        }
        
        float x_75816 = a11_75381 * x_75810;
        float y_75817 = b11_75383 * x_75811;
        float x_75818 = x_75816 + y_75817;
        float defunc_9_fit_fun_res_75819 = defunc_0_f_res_75813 * x_75818;
        float x_75820 = b11_75383 * x_75810;
        float y_75821 = c11_75384 * x_75811;
        float x_75822 = x_75820 + y_75821;
        float defunc_9_slope_fun_res_75823 = defunc_0_f_res_75813 * x_75822;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_75804 = local_acc_75860;
        }
        // Load next params
        {
            x_75805 = defunc_9_fit_fun_res_75819;
        }
        // Red body
        {
            float defunc_1_op_res_75806 = x_75804 + x_75805;
            
            local_acc_75860 = defunc_1_op_res_75806;
        }
        // Load accum params
        {
            x_75807 = local_acc_75861;
        }
        // Load next params
        {
            x_75808 = defunc_9_slope_fun_res_75823;
        }
        // Red body
        {
            float defunc_1_op_res_75809 = x_75807 + x_75808;
            
            local_acc_75861 = defunc_1_op_res_75809;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_75855.mem)[flat_tid_75802] =
        local_acc_75860;
    ((float *) reduce_stage_1_tid_res_arr_mem_75857.mem)[flat_tid_75802] =
        local_acc_75861;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77323_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77323_end -
                 futhark_mc_segred_stage_1_parloop_77323_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77323_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77323_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77323_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77319(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75802 = tid;
    int num_tasks_75854 = info.nsubtasks;
    struct futhark_mc_task_77318 *futhark_mc_task_77318 =
                                 (struct futhark_mc_task_77318 *) args;
    struct futhark_context *ctx = futhark_mc_task_77318->ctx;
    uint64_t futhark_mc_segred_task_77319_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77319_start = get_wall_time();
    
    int64_t last_res_69049 = futhark_mc_task_77318->free_last_res_69049;
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_task_77318->free_mem_71112, .size =
                                 0, .references =NULL};
    int64_t max_res_75321 = futhark_mc_task_77318->free_max_res_75321;
    struct memblock mem_75341 = {.desc ="mem_75341", .mem =
                                 futhark_mc_task_77318->free_mem_75341, .size =
                                 0, .references =NULL};
    struct memblock mem_75342 = {.desc ="mem_75342", .mem =
                                 futhark_mc_task_77318->free_mem_75342, .size =
                                 0, .references =NULL};
    float a11_75381 = futhark_mc_task_77318->free_a11_75381;
    float b11_75383 = futhark_mc_task_77318->free_b11_75383;
    float c11_75384 = futhark_mc_task_77318->free_c11_75384;
    float defunc_2_reduce_res_75385 =
          *futhark_mc_task_77318->retval_defunc_2_reduce_res_75385;
    float defunc_2_reduce_res_75386 =
          *futhark_mc_task_77318->retval_defunc_2_reduce_res_75386;
    size_t reduce_stage_1_tid_res_arr_mem_75855_cached_sizze_77320 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_75855 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_75857_cached_sizze_77321 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_75857 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_75855_cached_sizze_77320 <
        (size_t) ((int64_t) 4 * num_tasks_75854)) {
        reduce_stage_1_tid_res_arr_mem_75855 =
            realloc(reduce_stage_1_tid_res_arr_mem_75855, (int64_t) 4 *
                    num_tasks_75854);
        reduce_stage_1_tid_res_arr_mem_75855_cached_sizze_77320 = (int64_t) 4 *
            num_tasks_75854;
    }
    if (reduce_stage_1_tid_res_arr_mem_75857_cached_sizze_77321 <
        (size_t) ((int64_t) 4 * num_tasks_75854)) {
        reduce_stage_1_tid_res_arr_mem_75857 =
            realloc(reduce_stage_1_tid_res_arr_mem_75857, (int64_t) 4 *
                    num_tasks_75854);
        reduce_stage_1_tid_res_arr_mem_75857_cached_sizze_77321 = (int64_t) 4 *
            num_tasks_75854;
    }
    
    int64_t iter_75859;
    struct futhark_mc_segred_stage_1_parloop_struct_77322
    futhark_mc_segred_stage_1_parloop_struct_77322;
    
    futhark_mc_segred_stage_1_parloop_struct_77322.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_last_res_69049 =
        last_res_69049;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_mem_71112 =
        mem_71112.mem;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_max_res_75321 =
        max_res_75321;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_mem_75341 =
        mem_75341.mem;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_mem_75342 =
        mem_75342.mem;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_a11_75381 = a11_75381;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_b11_75383 = b11_75383;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_c11_75384 = c11_75384;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_reduce_stage_1_tid_res_arr_mem_75855 =
        reduce_stage_1_tid_res_arr_mem_75855;
    futhark_mc_segred_stage_1_parloop_struct_77322.free_reduce_stage_1_tid_res_arr_mem_75857 =
        reduce_stage_1_tid_res_arr_mem_75857;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77323_task;
    
    futhark_mc_segred_stage_1_parloop_77323_task.name =
        "futhark_mc_segred_stage_1_parloop_77323";
    futhark_mc_segred_stage_1_parloop_77323_task.fn =
        futhark_mc_segred_stage_1_parloop_77323;
    futhark_mc_segred_stage_1_parloop_77323_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77322;
    futhark_mc_segred_stage_1_parloop_77323_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77323_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77323_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77323_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77323_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77323_task);
    
    if (futhark_mc_segred_stage_1_parloop_77323_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77323_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77323_total_end -
                 futhark_mc_segred_stage_1_parloop_77323_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77323_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77323_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77323_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_75385 = 0.0F;
        defunc_2_reduce_res_75386 = 0.0F;
    }
    
    float x_75862;
    float x_75863;
    float x_75865;
    float x_75866;
    
    for (int32_t i_75868 = 0; i_75868 < num_tasks_75854; i_75868++) {
        flat_tid_75802 = i_75868;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_75862 = defunc_2_reduce_res_75385;
            }
            // load next params
            {
                x_75863 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_75855)[flat_tid_75802];
            }
            // red body
            {
                float defunc_1_op_res_75864 = x_75862 + x_75863;
                
                defunc_2_reduce_res_75385 = defunc_1_op_res_75864;
            }
            // load acc params
            {
                x_75865 = defunc_2_reduce_res_75386;
            }
            // load next params
            {
                x_75866 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_75857)[flat_tid_75802];
            }
            // red body
            {
                float defunc_1_op_res_75867 = x_75865 + x_75866;
                
                defunc_2_reduce_res_75386 = defunc_1_op_res_75867;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_75855);
        free(reduce_stage_1_tid_res_arr_mem_75857);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77319_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77319_end -
                 futhark_mc_segred_task_77319_start;
        
        ctx->futhark_mc_segred_task_77319_runs[tid]++;
        ctx->futhark_mc_segred_task_77319_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77319_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77318->retval_defunc_2_reduce_res_75385 =
            defunc_2_reduce_res_75385;
        *futhark_mc_task_77318->retval_defunc_2_reduce_res_75386 =
            defunc_2_reduce_res_75386;
    }
    return err;
}
static int futhark_mc_segmap_parloop_77308(void *args, int64_t start,
                                           int64_t end, int flat_tid_75253,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77307
    *futhark_mc_segmap_parloop_struct_77307 =
    (struct futhark_mc_segmap_parloop_struct_77307 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77307->ctx;
    uint64_t futhark_mc_segmap_parloop_77308_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77308_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77307->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77307->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77307->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77307->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77307->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77307->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77307->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77307->free_loop_cond_65369;
    int64_t last_res_69049 =
            futhark_mc_segmap_parloop_struct_77307->free_last_res_69049;
    int64_t min_arg_69068 =
            futhark_mc_segmap_parloop_struct_77307->free_min_arg_69068;
    int64_t min_arg_69069 =
            futhark_mc_segmap_parloop_struct_77307->free_min_arg_69069;
    int64_t min_res_69070 =
            futhark_mc_segmap_parloop_struct_77307->free_min_res_69070;
    float max_res_69074 =
          futhark_mc_segmap_parloop_struct_77307->free_max_res_69074;
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_segmap_parloop_struct_77307->free_mem_71112,
                                 .size =0, .references =NULL};
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_segmap_parloop_struct_77307->free_mem_71115,
                                 .size =0, .references =NULL};
    struct memblock mem_71118 = {.desc ="mem_71118", .mem =
                                 futhark_mc_segmap_parloop_struct_77307->free_mem_71118,
                                 .size =0, .references =NULL};
    int64_t bytes_71120 =
            futhark_mc_segmap_parloop_struct_77307->free_bytes_71120;
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_segmap_parloop_struct_77307->free_mem_71121,
                                 .size =0, .references =NULL};
    struct memblock mem_71160 = {.desc ="mem_71160", .mem =
                                 futhark_mc_segmap_parloop_struct_77307->free_mem_71160,
                                 .size =0, .references =NULL};
    struct memblock mem_71163 = {.desc ="mem_71163", .mem =
                                 futhark_mc_segmap_parloop_struct_77307->free_mem_71163,
                                 .size =0, .references =NULL};
    size_t mem_75341_cached_sizze_77309 = 0;
    unsigned char *mem_75341 = NULL;
    size_t mem_75342_cached_sizze_77310 = 0;
    unsigned char *mem_75342 = NULL;
    int64_t iterations = end - start;
    int64_t iter_75717 = start;
    
    if (mem_75341_cached_sizze_77309 < (size_t) bytes_71120) {
        mem_75341 = realloc(mem_75341, bytes_71120);
        mem_75341_cached_sizze_77309 = bytes_71120;
    }
    if (mem_75342_cached_sizze_77310 < (size_t) bytes_71120) {
        mem_75342 = realloc(mem_75342, bytes_71120);
        mem_75342_cached_sizze_77310 = bytes_71120;
    }
    for (; iter_75717 < end; iter_75717++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_75824 = n_m_65352;
        int64_t gtid_75254 = iter_75717;
        int64_t remnant_75825 = iter_75717 - gtid_75254;
        int64_t min_arg_75255 = mul64(jump_65348, gtid_75254);
        int64_t min_res_75256 = smin64(i_65358, min_arg_75255);
        int64_t defunc_0_g_res_75257 = add64((int64_t) 1, min_res_75256);
        bool init_idx_75258;
        int64_t init_idx_75259;
        int64_t init_idx_75260;
        bool loop_while_75718;
        int64_t low_75719;
        int64_t high_75720;
        
        loop_while_75718 = x_65359;
        low_75719 = (int64_t) 0;
        high_75720 = i_65358;
        while (loop_while_75718) {
            int64_t x_75721 = add64(low_75719, high_75720);
            int64_t mid_75722 = sdiv64(x_75721, (int64_t) 2);
            bool x_75723 = sle64((int64_t) 0, mid_75722);
            bool y_75724 = slt64(mid_75722, n_65344);
            bool bounds_check_75725 = x_75723 && y_75724;
            bool index_certs_75726;
            
            if (!bounds_check_75725) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_75722,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_75727;
            
            mid_id_75727 = ((int64_t *) mem_71118.mem)[mid_75722];
            
            bool cond_75728 = slt64(mid_id_75727, (int64_t) 0);
            int64_t mid_idx_75729;
            
            if (cond_75728) {
                mid_idx_75729 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_75729 = mid_id_75727;
            }
            
            bool cond_75730 = sle64(defunc_0_g_res_75257, mid_idx_75729);
            int64_t loopres_75731;
            int64_t loopres_75732;
            
            if (cond_75730) {
                int64_t loopres_t_res_75733 = sub64(mid_75722, (int64_t) 1);
                
                loopres_75731 = low_75719;
                loopres_75732 = loopres_t_res_75733;
            } else {
                int64_t loopres_f_res_75734 = add64((int64_t) 1, mid_75722);
                
                loopres_75731 = loopres_f_res_75734;
                loopres_75732 = high_75720;
            }
            
            bool loop_cond_75735 = sle64(loopres_75731, loopres_75732);
            bool loop_while_tmp_75826 = loop_cond_75735;
            int64_t low_tmp_75827 = loopres_75731;
            int64_t high_tmp_75828 = loopres_75732;
            
            loop_while_75718 = loop_while_tmp_75826;
            low_75719 = low_tmp_75827;
            high_75720 = high_tmp_75828;
        }
        init_idx_75258 = loop_while_75718;
        init_idx_75259 = low_75719;
        init_idx_75260 = high_75720;
        
        bool idx_75279;
        int64_t idx_75280;
        int64_t idx_75281;
        int64_t idx_75282;
        bool loop_while_75736;
        int64_t l_idx_75737;
        int64_t r_idx_75738;
        int64_t span_75739;
        
        loop_while_75736 = loop_cond_65369;
        l_idx_75737 = init_idx_75259;
        r_idx_75738 = init_idx_75259;
        span_75739 = (int64_t) 1;
        while (loop_while_75736) {
            int64_t max_arg_75740 = sub64(l_idx_75737, (int64_t) 1);
            int64_t max_res_75741 = smax64((int64_t) 0, max_arg_75740);
            int64_t min_arg_75742 = add64((int64_t) 1, r_idx_75738);
            int64_t min_res_75743 = smin64(min_arg_69068, min_arg_75742);
            bool x_75744 = sle64((int64_t) 0, max_res_75741);
            bool y_75745 = slt64(max_res_75741, n_65344);
            bool bounds_check_75746 = x_75744 && y_75745;
            bool index_certs_75747;
            
            if (!bounds_check_75746) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_75741,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75748;
            
            x_75748 = ((int64_t *) mem_71118.mem)[max_res_75741];
            
            int64_t abs_arg_75749 = sub64(x_75748, defunc_0_g_res_75257);
            int64_t abs_res_75750 = abs64(abs_arg_75749);
            bool x_75751 = sle64((int64_t) 0, min_res_75743);
            bool y_75752 = slt64(min_res_75743, n_65344);
            bool bounds_check_75753 = x_75751 && y_75752;
            bool index_certs_75754;
            
            if (!bounds_check_75753) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_75743,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75755;
            
            x_75755 = ((int64_t *) mem_71118.mem)[min_res_75743];
            
            int64_t abs_arg_75756 = sub64(x_75755, defunc_0_g_res_75257);
            int64_t abs_res_75757 = abs64(abs_arg_75756);
            bool cond_75758 = max_res_75741 == l_idx_75737;
            int64_t loopres_75759;
            int64_t loopres_75760;
            int64_t loopres_75761;
            
            if (cond_75758) {
                loopres_75759 = l_idx_75737;
                loopres_75760 = r_idx_75738;
                loopres_75761 = min_res_65364;
            } else {
                bool cond_75762 = slt64(abs_res_75750, abs_res_75757);
                bool cond_f_res_75763 = min_res_75743 == r_idx_75738;
                bool x_75764 = !cond_75762;
                bool y_75765 = cond_f_res_75763 && x_75764;
                bool cond_75766 = cond_75762 || y_75765;
                int64_t loopres_f_res_75767;
                
                if (cond_75766) {
                    loopres_f_res_75767 = max_res_75741;
                } else {
                    loopres_f_res_75767 = l_idx_75737;
                }
                
                int64_t loopres_f_res_75768;
                
                if (cond_75766) {
                    loopres_f_res_75768 = r_idx_75738;
                } else {
                    loopres_f_res_75768 = min_res_75743;
                }
                
                int64_t loopres_f_res_75769;
                
                if (cond_75766) {
                    int64_t loopres_f_res_t_res_75770 = add64((int64_t) 1,
                                                              span_75739);
                    
                    loopres_f_res_75769 = loopres_f_res_t_res_75770;
                } else {
                    int64_t loopres_f_res_f_res_75771 = add64((int64_t) 1,
                                                              span_75739);
                    
                    loopres_f_res_75769 = loopres_f_res_f_res_75771;
                }
                loopres_75759 = loopres_f_res_75767;
                loopres_75760 = loopres_f_res_75768;
                loopres_75761 = loopres_f_res_75769;
            }
            
            bool loop_cond_75772 = slt64(loopres_75761, min_res_65364);
            bool loop_while_tmp_75829 = loop_cond_75772;
            int64_t l_idx_tmp_75830 = loopres_75759;
            int64_t r_idx_tmp_75831 = loopres_75760;
            int64_t span_tmp_75832 = loopres_75761;
            
            loop_while_75736 = loop_while_tmp_75829;
            l_idx_75737 = l_idx_tmp_75830;
            r_idx_75738 = r_idx_tmp_75831;
            span_75739 = span_tmp_75832;
        }
        idx_75279 = loop_while_75736;
        idx_75280 = l_idx_75737;
        idx_75281 = r_idx_75738;
        idx_75282 = span_75739;
        
        int64_t min_res_75320 = smin64(min_arg_69069, idx_75280);
        int64_t max_res_75321 = smax64((int64_t) 0, min_res_75320);
        int64_t x_75322 = add64(min_res_69070, max_res_75321);
        int64_t r_75323 = sub64(x_75322, (int64_t) 1);
        bool x_75324 = sle64((int64_t) 0, r_75323);
        bool y_75325 = slt64(r_75323, n_65344);
        bool bounds_check_75326 = x_75324 && y_75325;
        bool index_certs_75327;
        
        if (!bounds_check_75326) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_75323,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_75328;
        
        x_75328 = ((int64_t *) mem_71115.mem)[r_75323];
        
        int64_t abs_arg_75329 = sub64(x_75328, min_res_75256);
        int64_t abs_res_75330 = abs64(abs_arg_75329);
        bool x_75331 = sle64((int64_t) 0, max_res_75321);
        bool y_75332 = slt64(max_res_75321, n_65344);
        bool bounds_check_75333 = x_75331 && y_75332;
        bool index_certs_75334;
        
        if (!bounds_check_75333) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_75321,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_75335;
        
        x_75335 = ((int64_t *) mem_71115.mem)[max_res_75321];
        
        int64_t abs_arg_75336 = sub64(x_75335, min_res_75256);
        int64_t abs_res_75337 = abs64(abs_arg_75336);
        int64_t max_res_75338 = smax64(abs_res_75330, abs_res_75337);
        float defunc_0_f_res_75339 = sitofp_i64_f32(max_res_75338);
        float defunc_1_f_res_75340 = max_res_69074 + defunc_0_f_res_75339;
        float defunc_2_reduce_res_75343;
        float defunc_2_reduce_res_75344;
        float defunc_2_reduce_res_75345;
        int64_t flat_tid_75773 = (int64_t) 0;
        int32_t num_tasks_75833;
        
        defunc_2_reduce_res_75343 = 0.0F;
        defunc_2_reduce_res_75344 = 0.0F;
        defunc_2_reduce_res_75345 = 0.0F;
        
        struct futhark_mc_task_77311 futhark_mc_task_77311;
        
        futhark_mc_task_77311.ctx = ctx;
        futhark_mc_task_77311.free_last_res_69049 = last_res_69049;
        futhark_mc_task_77311.free_mem_71115 = mem_71115.mem;
        futhark_mc_task_77311.free_mem_71121 = mem_71121.mem;
        futhark_mc_task_77311.free_min_res_75256 = min_res_75256;
        futhark_mc_task_77311.free_max_res_75321 = max_res_75321;
        futhark_mc_task_77311.free_defunc_1_f_res_75340 = defunc_1_f_res_75340;
        futhark_mc_task_77311.retval_defunc_2_reduce_res_75343 =
            &defunc_2_reduce_res_75343;
        futhark_mc_task_77311.retval_defunc_2_reduce_res_75344 =
            &defunc_2_reduce_res_75344;
        futhark_mc_task_77311.retval_defunc_2_reduce_res_75345 =
            &defunc_2_reduce_res_75345;
        futhark_mc_task_77311.retval_mem_75341 = mem_75341;
        futhark_mc_task_77311.retval_mem_75342 = mem_75342;
        
        struct scheduler_segop futhark_mc_task_77311_task;
        
        futhark_mc_task_77311_task.args = &futhark_mc_task_77311;
        futhark_mc_task_77311_task.top_level_fn = futhark_mc_segred_task_77312;
        futhark_mc_task_77311_task.name = "futhark_mc_segred_task_77312";
        futhark_mc_task_77311_task.iterations = q_65346;
        futhark_mc_task_77311_task.task_time =
            &ctx->futhark_mc_segred_task_77312_total_time;
        futhark_mc_task_77311_task.task_iter =
            &ctx->futhark_mc_segred_task_77312_total_iter;
        futhark_mc_task_77311_task.sched = STATIC;
        futhark_mc_task_77311_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77312_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77311_task);
        
        if (futhark_mc_segred_task_77312_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        float x_75377 = defunc_2_reduce_res_75343 * defunc_2_reduce_res_75345;
        float y_75378 = defunc_2_reduce_res_75344 * defunc_2_reduce_res_75344;
        float y_75379 = x_75377 - y_75378;
        float det1_75380 = 1.0F / y_75379;
        float a11_75381 = defunc_2_reduce_res_75345 * det1_75380;
        float x_75382 = 0.0F - defunc_2_reduce_res_75344;
        float b11_75383 = det1_75380 * x_75382;
        float c11_75384 = defunc_2_reduce_res_75343 * det1_75380;
        float defunc_2_reduce_res_75385;
        float defunc_2_reduce_res_75386;
        int64_t flat_tid_75802 = (int64_t) 0;
        int32_t num_tasks_75854;
        
        defunc_2_reduce_res_75385 = 0.0F;
        defunc_2_reduce_res_75386 = 0.0F;
        
        struct futhark_mc_task_77318 futhark_mc_task_77318;
        
        futhark_mc_task_77318.ctx = ctx;
        futhark_mc_task_77318.free_last_res_69049 = last_res_69049;
        futhark_mc_task_77318.free_mem_71112 = mem_71112.mem;
        futhark_mc_task_77318.free_max_res_75321 = max_res_75321;
        futhark_mc_task_77318.free_mem_75341 = mem_75341;
        futhark_mc_task_77318.free_mem_75342 = mem_75342;
        futhark_mc_task_77318.free_a11_75381 = a11_75381;
        futhark_mc_task_77318.free_b11_75383 = b11_75383;
        futhark_mc_task_77318.free_c11_75384 = c11_75384;
        futhark_mc_task_77318.retval_defunc_2_reduce_res_75385 =
            &defunc_2_reduce_res_75385;
        futhark_mc_task_77318.retval_defunc_2_reduce_res_75386 =
            &defunc_2_reduce_res_75386;
        
        struct scheduler_segop futhark_mc_task_77318_task;
        
        futhark_mc_task_77318_task.args = &futhark_mc_task_77318;
        futhark_mc_task_77318_task.top_level_fn = futhark_mc_segred_task_77319;
        futhark_mc_task_77318_task.name = "futhark_mc_segred_task_77319";
        futhark_mc_task_77318_task.iterations = q_65346;
        futhark_mc_task_77318_task.task_time =
            &ctx->futhark_mc_segred_task_77319_total_time;
        futhark_mc_task_77318_task.task_iter =
            &ctx->futhark_mc_segred_task_77319_total_iter;
        futhark_mc_task_77318_task.sched = STATIC;
        futhark_mc_task_77318_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77319_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77318_task);
        
        if (futhark_mc_segred_task_77319_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((float *) mem_71160.mem)[gtid_75254] = defunc_2_reduce_res_75385;
        ((float *) mem_71163.mem)[gtid_75254] = defunc_2_reduce_res_75386;
    }
    
  cleanup:
    { }
    free(mem_75341);
    free(mem_75342);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77308_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77308_end -
                 futhark_mc_segmap_parloop_77308_start;
        
        ctx->futhark_mc_segmap_parloop_77308_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77308_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77308_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77306(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_75253 = tid;
    int num_tasks_75596 = info.nsubtasks;
    struct futhark_mc_task_77300 *futhark_mc_task_77300 =
                                 (struct futhark_mc_task_77300 *) args;
    struct futhark_context *ctx = futhark_mc_task_77300->ctx;
    uint64_t futhark_mc_segmap_nested_task_77306_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77306_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77300->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77300->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77300->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77300->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77300->free_i_65358;
    bool x_65359 = futhark_mc_task_77300->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77300->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77300->free_loop_cond_65369;
    int64_t last_res_69049 = futhark_mc_task_77300->free_last_res_69049;
    int64_t min_arg_69068 = futhark_mc_task_77300->free_min_arg_69068;
    int64_t min_arg_69069 = futhark_mc_task_77300->free_min_arg_69069;
    int64_t min_res_69070 = futhark_mc_task_77300->free_min_res_69070;
    float max_res_69074 = futhark_mc_task_77300->free_max_res_69074;
    struct memblock mem_71112 = {.desc ="mem_71112", .mem =
                                 futhark_mc_task_77300->free_mem_71112, .size =
                                 0, .references =NULL};
    struct memblock mem_71115 = {.desc ="mem_71115", .mem =
                                 futhark_mc_task_77300->free_mem_71115, .size =
                                 0, .references =NULL};
    struct memblock mem_71118 = {.desc ="mem_71118", .mem =
                                 futhark_mc_task_77300->free_mem_71118, .size =
                                 0, .references =NULL};
    int64_t bytes_71120 = futhark_mc_task_77300->free_bytes_71120;
    struct memblock mem_71121 = {.desc ="mem_71121", .mem =
                                 futhark_mc_task_77300->free_mem_71121, .size =
                                 0, .references =NULL};
    struct memblock mem_71160 = {.desc ="mem_71160", .mem =
                                 futhark_mc_task_77300->free_mem_71160, .size =
                                 0, .references =NULL};
    struct memblock mem_71163 = {.desc ="mem_71163", .mem =
                                 futhark_mc_task_77300->free_mem_71163, .size =
                                 0, .references =NULL};
    int64_t iter_75717;
    struct futhark_mc_segmap_parloop_struct_77307
    futhark_mc_segmap_parloop_struct_77307;
    
    futhark_mc_segmap_parloop_struct_77307.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77307.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77307.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77307.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77307.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77307.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77307.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77307.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77307.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77307.free_last_res_69049 = last_res_69049;
    futhark_mc_segmap_parloop_struct_77307.free_min_arg_69068 = min_arg_69068;
    futhark_mc_segmap_parloop_struct_77307.free_min_arg_69069 = min_arg_69069;
    futhark_mc_segmap_parloop_struct_77307.free_min_res_69070 = min_res_69070;
    futhark_mc_segmap_parloop_struct_77307.free_max_res_69074 = max_res_69074;
    futhark_mc_segmap_parloop_struct_77307.free_mem_71112 = mem_71112.mem;
    futhark_mc_segmap_parloop_struct_77307.free_mem_71115 = mem_71115.mem;
    futhark_mc_segmap_parloop_struct_77307.free_mem_71118 = mem_71118.mem;
    futhark_mc_segmap_parloop_struct_77307.free_bytes_71120 = bytes_71120;
    futhark_mc_segmap_parloop_struct_77307.free_mem_71121 = mem_71121.mem;
    futhark_mc_segmap_parloop_struct_77307.free_mem_71160 = mem_71160.mem;
    futhark_mc_segmap_parloop_struct_77307.free_mem_71163 = mem_71163.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77308_task;
    
    futhark_mc_segmap_parloop_77308_task.name =
        "futhark_mc_segmap_parloop_77308";
    futhark_mc_segmap_parloop_77308_task.fn = futhark_mc_segmap_parloop_77308;
    futhark_mc_segmap_parloop_77308_task.args =
        &futhark_mc_segmap_parloop_struct_77307;
    futhark_mc_segmap_parloop_77308_task.iterations = iterations;
    futhark_mc_segmap_parloop_77308_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77308_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77308_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77308_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77308_task);
    
    if (futhark_mc_segmap_parloop_77308_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77308_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77308_total_end -
                 futhark_mc_segmap_parloop_77308_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77308_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77308_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77308_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77306_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77306_end -
                 futhark_mc_segmap_nested_task_77306_start;
        
        ctx->futhark_mc_segmap_nested_task_77306_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77306_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77306_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_77273(void *args, int64_t start,
                                           int64_t end, int flat_tid_69036,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77272
    *futhark_mc_segmap_parloop_struct_77272 =
    (struct futhark_mc_segmap_parloop_struct_77272 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77272->ctx;
    uint64_t futhark_mc_segmap_parloop_77273_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77273_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77272->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77272->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77272->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77272->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77272->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77272->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77272->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77272->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77272->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77272->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77272->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71108 =
            futhark_mc_segmap_parloop_struct_77272->free_bytes_71108;
    int64_t bytes_71111 =
            futhark_mc_segmap_parloop_struct_77272->free_bytes_71111;
    int64_t bytes_71120 =
            futhark_mc_segmap_parloop_struct_77272->free_bytes_71120;
    int64_t bytes_71159 =
            futhark_mc_segmap_parloop_struct_77272->free_bytes_71159;
    struct memblock mem_71302 = {.desc ="mem_71302", .mem =
                                 futhark_mc_segmap_parloop_struct_77272->free_mem_71302,
                                 .size =0, .references =NULL};
    struct memblock mem_71306 = {.desc ="mem_71306", .mem =
                                 futhark_mc_segmap_parloop_struct_77272->free_mem_71306,
                                 .size =0, .references =NULL};
    size_t mem_71109_cached_sizze_77274 = 0;
    unsigned char *mem_71109 = NULL;
    size_t mem_71112_cached_sizze_77275 = 0;
    unsigned char *mem_71112 = NULL;
    size_t mem_71115_cached_sizze_77276 = 0;
    unsigned char *mem_71115 = NULL;
    size_t mem_71118_cached_sizze_77277 = 0;
    unsigned char *mem_71118 = NULL;
    size_t mem_71121_cached_sizze_77278 = 0;
    unsigned char *mem_71121 = NULL;
    size_t mem_71160_cached_sizze_77279 = 0;
    unsigned char *mem_71160 = NULL;
    size_t mem_71163_cached_sizze_77280 = 0;
    unsigned char *mem_71163 = NULL;
    int64_t iterations = end - start;
    int64_t iter_75227 = start;
    
    if (mem_71109_cached_sizze_77274 < (size_t) bytes_71108) {
        mem_71109 = realloc(mem_71109, bytes_71108);
        mem_71109_cached_sizze_77274 = bytes_71108;
    }
    if (mem_71112_cached_sizze_77275 < (size_t) bytes_71111) {
        mem_71112 = realloc(mem_71112, bytes_71111);
        mem_71112_cached_sizze_77275 = bytes_71111;
    }
    if (mem_71115_cached_sizze_77276 < (size_t) bytes_71108) {
        mem_71115 = realloc(mem_71115, bytes_71108);
        mem_71115_cached_sizze_77276 = bytes_71108;
    }
    if (mem_71118_cached_sizze_77277 < (size_t) bytes_71108) {
        mem_71118 = realloc(mem_71118, bytes_71108);
        mem_71118_cached_sizze_77277 = bytes_71108;
    }
    if (mem_71121_cached_sizze_77278 < (size_t) bytes_71120) {
        mem_71121 = realloc(mem_71121, bytes_71120);
        mem_71121_cached_sizze_77278 = bytes_71120;
    }
    if (mem_71160_cached_sizze_77279 < (size_t) bytes_71159) {
        mem_71160 = realloc(mem_71160, bytes_71159);
        mem_71160_cached_sizze_77279 = bytes_71159;
    }
    if (mem_71163_cached_sizze_77280 < (size_t) bytes_71159) {
        mem_71163 = realloc(mem_71163, bytes_71159);
        mem_71163_cached_sizze_77280 = bytes_71159;
    }
    for (; iter_75227 < end; iter_75227++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_75564 = m_65343;
        int64_t gtid_69037 = iter_75227;
        int64_t remnant_75565 = iter_75227 - gtid_69037;
        int64_t flat_tid_75228 = (int64_t) 0;
        int32_t num_tasks_75566;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_77281 futhark_mc_task_77281;
        
        futhark_mc_task_77281.ctx = ctx;
        futhark_mc_task_77281.free_n_65344 = n_65344;
        futhark_mc_task_77281.free_gtid_69037 = gtid_69037;
        futhark_mc_task_77281.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77281.free_mem_71109 = mem_71109;
        
        struct scheduler_segop futhark_mc_task_77281_task;
        
        futhark_mc_task_77281_task.args = &futhark_mc_task_77281;
        futhark_mc_task_77281_task.top_level_fn = futhark_mc_segscan_task_77282;
        futhark_mc_task_77281_task.name = "futhark_mc_segscan_task_77282";
        futhark_mc_task_77281_task.iterations = n_65344;
        futhark_mc_task_77281_task.task_time =
            &ctx->futhark_mc_segscan_task_77282_total_time;
        futhark_mc_task_77281_task.task_iter =
            &ctx->futhark_mc_segscan_task_77282_total_iter;
        futhark_mc_task_77281_task.sched = STATIC;
        futhark_mc_task_77281_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_77282_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77281_task);
        
        if (futhark_mc_segscan_task_77282_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_69049;
        
        last_res_69049 = ((int64_t *) mem_71109)[i_65358];
        for (int64_t i_75580 = 0; i_75580 < n_65344; i_75580++) {
            ((float *) mem_71112)[i_75580] = 0.0F;
        }
        for (int64_t i_75581 = 0; i_75581 < n_65344; i_75581++) {
            ((int64_t *) mem_71115)[i_75581] = (int64_t) -1;
        }
        
        int64_t flat_tid_75237 = (int64_t) 0;
        int32_t num_tasks_75582;
        struct futhark_mc_task_77288 futhark_mc_task_77288;
        
        futhark_mc_task_77288.ctx = ctx;
        futhark_mc_task_77288.free_n_65344 = n_65344;
        futhark_mc_task_77288.free_gtid_69037 = gtid_69037;
        futhark_mc_task_77288.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77288.free_mem_71109 = mem_71109;
        futhark_mc_task_77288.free_mem_71112 = mem_71112;
        futhark_mc_task_77288.free_mem_71115 = mem_71115;
        
        struct scheduler_segop futhark_mc_task_77288_task;
        
        futhark_mc_task_77288_task.args = &futhark_mc_task_77288;
        futhark_mc_task_77288_task.top_level_fn = futhark_mc_segmap_task_77289;
        futhark_mc_task_77288_task.name = "futhark_mc_segmap_task_77289";
        futhark_mc_task_77288_task.iterations = n_65344;
        futhark_mc_task_77288_task.task_time =
            &ctx->futhark_mc_segmap_task_77289_total_time;
        futhark_mc_task_77288_task.task_iter =
            &ctx->futhark_mc_segmap_task_77289_total_iter;
        futhark_mc_task_77288_task.sched = STATIC;
        futhark_mc_task_77288_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77289_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77288_task);
        
        if (futhark_mc_segmap_task_77289_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_75245 = (int64_t) 0;
        int32_t num_tasks_75588;
        struct futhark_mc_task_77292 futhark_mc_task_77292;
        
        futhark_mc_task_77292.ctx = ctx;
        futhark_mc_task_77292.free_n_65344 = n_65344;
        futhark_mc_task_77292.free_mem_71115 = mem_71115;
        futhark_mc_task_77292.free_mem_71118 = mem_71118;
        
        struct scheduler_segop futhark_mc_task_77292_task;
        
        futhark_mc_task_77292_task.args = &futhark_mc_task_77292;
        futhark_mc_task_77292_task.top_level_fn = futhark_mc_segmap_task_77293;
        futhark_mc_task_77292_task.name = "futhark_mc_segmap_task_77293";
        futhark_mc_task_77292_task.iterations = n_65344;
        futhark_mc_task_77292_task.task_time =
            &ctx->futhark_mc_segmap_task_77293_total_time;
        futhark_mc_task_77292_task.task_iter =
            &ctx->futhark_mc_segmap_task_77293_total_iter;
        futhark_mc_task_77292_task.sched = STATIC;
        futhark_mc_task_77292_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77293_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77292_task);
        
        if (futhark_mc_segmap_task_77293_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_69068 = sub64(last_res_69049, (int64_t) 1);
        int64_t min_arg_69069 = sub64(last_res_69049, min_res_65364);
        int64_t min_res_69070 = smin64(q_65346, last_res_69049);
        float i64_res_69071 = sitofp_i64_f32(last_res_69049);
        float x_69072 = i64_res_65370 - i64_res_69071;
        float max_arg_69073 = x_69072 / 2.0F;
        float max_res_69074 = fmax32(0.0F, max_arg_69073);
        int64_t flat_tid_75249 = (int64_t) 0;
        int32_t num_tasks_75592;
        struct futhark_mc_task_77296 futhark_mc_task_77296;
        
        futhark_mc_task_77296.ctx = ctx;
        futhark_mc_task_77296.free_q_65346 = q_65346;
        futhark_mc_task_77296.free_last_res_69049 = last_res_69049;
        futhark_mc_task_77296.free_mem_71121 = mem_71121;
        
        struct scheduler_segop futhark_mc_task_77296_task;
        
        futhark_mc_task_77296_task.args = &futhark_mc_task_77296;
        futhark_mc_task_77296_task.top_level_fn = futhark_mc_segmap_task_77297;
        futhark_mc_task_77296_task.name = "futhark_mc_segmap_task_77297";
        futhark_mc_task_77296_task.iterations = q_65346;
        futhark_mc_task_77296_task.task_time =
            &ctx->futhark_mc_segmap_task_77297_total_time;
        futhark_mc_task_77296_task.task_iter =
            &ctx->futhark_mc_segmap_task_77297_total_iter;
        futhark_mc_task_77296_task.sched = STATIC;
        futhark_mc_task_77296_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77297_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77296_task);
        
        if (futhark_mc_segmap_task_77297_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_75409 = (int64_t) 0;
        int32_t num_tasks_75596;
        int64_t flat_tid_75253 = (int64_t) 0;
        struct futhark_mc_task_77300 futhark_mc_task_77300;
        
        futhark_mc_task_77300.ctx = ctx;
        futhark_mc_task_77300.free_n_65344 = n_65344;
        futhark_mc_task_77300.free_q_65346 = q_65346;
        futhark_mc_task_77300.free_jump_65348 = jump_65348;
        futhark_mc_task_77300.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77300.free_i_65358 = i_65358;
        futhark_mc_task_77300.free_x_65359 = x_65359;
        futhark_mc_task_77300.free_min_res_65364 = min_res_65364;
        futhark_mc_task_77300.free_loop_cond_65369 = loop_cond_65369;
        futhark_mc_task_77300.free_last_res_69049 = last_res_69049;
        futhark_mc_task_77300.free_min_arg_69068 = min_arg_69068;
        futhark_mc_task_77300.free_min_arg_69069 = min_arg_69069;
        futhark_mc_task_77300.free_min_res_69070 = min_res_69070;
        futhark_mc_task_77300.free_max_res_69074 = max_res_69074;
        futhark_mc_task_77300.free_mem_71112 = mem_71112;
        futhark_mc_task_77300.free_mem_71115 = mem_71115;
        futhark_mc_task_77300.free_mem_71118 = mem_71118;
        futhark_mc_task_77300.free_bytes_71120 = bytes_71120;
        futhark_mc_task_77300.free_mem_71121 = mem_71121;
        futhark_mc_task_77300.free_mem_71160 = mem_71160;
        futhark_mc_task_77300.free_mem_71163 = mem_71163;
        
        struct scheduler_segop futhark_mc_task_77300_task;
        
        futhark_mc_task_77300_task.args = &futhark_mc_task_77300;
        futhark_mc_task_77300_task.top_level_fn = futhark_mc_segmap_task_77301;
        futhark_mc_task_77300_task.name = "futhark_mc_segmap_task_77301";
        futhark_mc_task_77300_task.iterations = n_m_65352;
        futhark_mc_task_77300_task.task_time =
            &ctx->futhark_mc_segmap_task_77301_total_time;
        futhark_mc_task_77300_task.task_iter =
            &ctx->futhark_mc_segmap_task_77301_total_iter;
        futhark_mc_task_77300_task.sched = DYNAMIC;
        futhark_mc_task_77300_task.nested_fn =
            futhark_mc_segmap_nested_task_77306;
        
        int futhark_mc_segmap_task_77301_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77300_task);
        
        if (futhark_mc_segmap_task_77301_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71302.mem + gtid_69037 * n_m_65352 * (int64_t) 4,
                    mem_71160 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71306.mem + gtid_69037 * n_m_65352 * (int64_t) 4,
                    mem_71163 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_71109);
    free(mem_71112);
    free(mem_71115);
    free(mem_71118);
    free(mem_71121);
    free(mem_71160);
    free(mem_71163);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77273_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77273_end -
                 futhark_mc_segmap_parloop_77273_start;
        
        ctx->futhark_mc_segmap_parloop_77273_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77273_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77273_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77271(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_69036 = tid;
    int num_tasks_75012 = info.nsubtasks;
    struct futhark_mc_task_77258 *futhark_mc_task_77258 =
                                 (struct futhark_mc_task_77258 *) args;
    struct futhark_context *ctx = futhark_mc_task_77258->ctx;
    uint64_t futhark_mc_segmap_nested_task_77271_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77271_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77258->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77258->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77258->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77258->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77258->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77258->free_i_65358;
    bool x_65359 = futhark_mc_task_77258->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77258->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77258->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77258->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77258->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71108 = futhark_mc_task_77258->free_bytes_71108;
    int64_t bytes_71111 = futhark_mc_task_77258->free_bytes_71111;
    int64_t bytes_71120 = futhark_mc_task_77258->free_bytes_71120;
    int64_t bytes_71159 = futhark_mc_task_77258->free_bytes_71159;
    struct memblock mem_71302 = {.desc ="mem_71302", .mem =
                                 futhark_mc_task_77258->free_mem_71302, .size =
                                 0, .references =NULL};
    struct memblock mem_71306 = {.desc ="mem_71306", .mem =
                                 futhark_mc_task_77258->free_mem_71306, .size =
                                 0, .references =NULL};
    int64_t iter_75227;
    struct futhark_mc_segmap_parloop_struct_77272
    futhark_mc_segmap_parloop_struct_77272;
    
    futhark_mc_segmap_parloop_struct_77272.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77272.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77272.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77272.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77272.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77272.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77272.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77272.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77272.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77272.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77272.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77272.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77272.free_bytes_71108 = bytes_71108;
    futhark_mc_segmap_parloop_struct_77272.free_bytes_71111 = bytes_71111;
    futhark_mc_segmap_parloop_struct_77272.free_bytes_71120 = bytes_71120;
    futhark_mc_segmap_parloop_struct_77272.free_bytes_71159 = bytes_71159;
    futhark_mc_segmap_parloop_struct_77272.free_mem_71302 = mem_71302.mem;
    futhark_mc_segmap_parloop_struct_77272.free_mem_71306 = mem_71306.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77273_task;
    
    futhark_mc_segmap_parloop_77273_task.name =
        "futhark_mc_segmap_parloop_77273";
    futhark_mc_segmap_parloop_77273_task.fn = futhark_mc_segmap_parloop_77273;
    futhark_mc_segmap_parloop_77273_task.args =
        &futhark_mc_segmap_parloop_struct_77272;
    futhark_mc_segmap_parloop_77273_task.iterations = iterations;
    futhark_mc_segmap_parloop_77273_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77273_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77273_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77273_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77273_task);
    
    if (futhark_mc_segmap_parloop_77273_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77273_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77273_total_end -
                 futhark_mc_segmap_parloop_77273_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77273_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77273_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77273_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77271_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77271_end -
                 futhark_mc_segmap_nested_task_77271_start;
        
        ctx->futhark_mc_segmap_nested_task_77271_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77271_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77271_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77324 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_71308;
    int64_t free_bytes_71311;
    int64_t free_bytes_71320;
    int64_t free_bytes_71395;
    unsigned char *free_mem_71568;
    unsigned char *free_mem_71572;
};
struct futhark_mc_segmap_parloop_struct_77326 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_71308;
    int64_t free_bytes_71311;
    int64_t free_bytes_71320;
    int64_t free_bytes_71395;
    unsigned char *free_mem_71568;
    unsigned char *free_mem_71572;
};
static int futhark_mc_segmap_parloop_77327(void *args, int64_t start,
                                           int64_t end, int flat_tid_69393,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77326
    *futhark_mc_segmap_parloop_struct_77326 =
    (struct futhark_mc_segmap_parloop_struct_77326 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77326->ctx;
    uint64_t futhark_mc_segmap_parloop_77327_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77327_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77326->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77326->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77326->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77326->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77326->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77326->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77326->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77326->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77326->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77326->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77326->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71308 =
            futhark_mc_segmap_parloop_struct_77326->free_bytes_71308;
    int64_t bytes_71311 =
            futhark_mc_segmap_parloop_struct_77326->free_bytes_71311;
    int64_t bytes_71320 =
            futhark_mc_segmap_parloop_struct_77326->free_bytes_71320;
    int64_t bytes_71395 =
            futhark_mc_segmap_parloop_struct_77326->free_bytes_71395;
    struct memblock mem_71568 = {.desc ="mem_71568", .mem =
                                 futhark_mc_segmap_parloop_struct_77326->free_mem_71568,
                                 .size =0, .references =NULL};
    struct memblock mem_71572 = {.desc ="mem_71572", .mem =
                                 futhark_mc_segmap_parloop_struct_77326->free_mem_71572,
                                 .size =0, .references =NULL};
    size_t mem_71402_cached_sizze_77328 = 0;
    unsigned char *mem_71402 = NULL;
    size_t mem_71417_cached_sizze_77329 = 0;
    unsigned char *mem_71417 = NULL;
    size_t mem_71420_cached_sizze_77330 = 0;
    unsigned char *mem_71420 = NULL;
    size_t mem_71447_cached_sizze_77331 = 0;
    unsigned char *mem_71447 = NULL;
    size_t mem_71462_cached_sizze_77332 = 0;
    unsigned char *mem_71462 = NULL;
    size_t mem_71477_cached_sizze_77333 = 0;
    unsigned char *mem_71477 = NULL;
    size_t mem_71480_cached_sizze_77334 = 0;
    unsigned char *mem_71480 = NULL;
    size_t mem_71497_cached_sizze_77335 = 0;
    unsigned char *mem_71497 = NULL;
    size_t mem_71500_cached_sizze_77336 = 0;
    unsigned char *mem_71500 = NULL;
    size_t mem_71527_cached_sizze_77337 = 0;
    unsigned char *mem_71527 = NULL;
    size_t mem_71530_cached_sizze_77338 = 0;
    unsigned char *mem_71530 = NULL;
    int64_t iterations = end - start;
    int64_t iter_75870 = start;
    
    if (mem_71402_cached_sizze_77328 < (size_t) bytes_71308) {
        mem_71402 = realloc(mem_71402, bytes_71308);
        mem_71402_cached_sizze_77328 = bytes_71308;
    }
    if (mem_71417_cached_sizze_77329 < (size_t) bytes_71311) {
        mem_71417 = realloc(mem_71417, bytes_71311);
        mem_71417_cached_sizze_77329 = bytes_71311;
    }
    if (mem_71420_cached_sizze_77330 < (size_t) bytes_71308) {
        mem_71420 = realloc(mem_71420, bytes_71308);
        mem_71420_cached_sizze_77330 = bytes_71308;
    }
    if (mem_71447_cached_sizze_77331 < (size_t) bytes_71308) {
        mem_71447 = realloc(mem_71447, bytes_71308);
        mem_71447_cached_sizze_77331 = bytes_71308;
    }
    if (mem_71462_cached_sizze_77332 < (size_t) bytes_71320) {
        mem_71462 = realloc(mem_71462, bytes_71320);
        mem_71462_cached_sizze_77332 = bytes_71320;
    }
    if (mem_71477_cached_sizze_77333 < (size_t) bytes_71395) {
        mem_71477 = realloc(mem_71477, bytes_71395);
        mem_71477_cached_sizze_77333 = bytes_71395;
    }
    if (mem_71480_cached_sizze_77334 < (size_t) bytes_71395) {
        mem_71480 = realloc(mem_71480, bytes_71395);
        mem_71480_cached_sizze_77334 = bytes_71395;
    }
    if (mem_71497_cached_sizze_77335 < (size_t) bytes_71320) {
        mem_71497 = realloc(mem_71497, bytes_71320);
        mem_71497_cached_sizze_77335 = bytes_71320;
    }
    if (mem_71500_cached_sizze_77336 < (size_t) bytes_71320) {
        mem_71500 = realloc(mem_71500, bytes_71320);
        mem_71500_cached_sizze_77336 = bytes_71320;
    }
    if (mem_71527_cached_sizze_77337 < (size_t) bytes_71320) {
        mem_71527 = realloc(mem_71527, bytes_71320);
        mem_71527_cached_sizze_77337 = bytes_71320;
    }
    if (mem_71530_cached_sizze_77338 < (size_t) bytes_71320) {
        mem_71530 = realloc(mem_71530, bytes_71320);
        mem_71530_cached_sizze_77338 = bytes_71320;
    }
    for (; iter_75870 < end; iter_75870++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76099 = m_65343;
        int64_t gtid_69394 = iter_75870;
        int64_t remnant_76100 = iter_75870 - gtid_69394;
        int64_t discard_70421;
        int64_t scanacc_75872 = (int64_t) 0;
        
        for (int64_t i_75871 = 0; i_75871 < n_65344; i_75871++) {
            float x_75874;
            
            x_75874 = ((float *) Y_mem_70569.mem)[gtid_69394 * n_65344 +
                                                  i_75871];
            
            bool isnan_res_75875;
            
            isnan_res_75875 = futrts_isnan32(x_75874);
            
            bool defunc_0_p_res_75876 = !isnan_res_75875;
            int64_t defunc_0_f_res_75877 = btoi_bool_i64(defunc_0_p_res_75876);
            int64_t defunc_1_op_res_75878 = add64(defunc_0_f_res_75877,
                                                  scanacc_75872);
            
            ((int64_t *) mem_71402)[i_75871] = defunc_1_op_res_75878;
            
            int64_t scanacc_tmp_76101 = defunc_1_op_res_75878;
            
            scanacc_75872 = scanacc_tmp_76101;
        }
        discard_70421 = scanacc_75872;
        
        int64_t last_res_66402;
        
        last_res_66402 = ((int64_t *) mem_71402)[i_65358];
        for (int64_t i_76103 = 0; i_76103 < n_65344; i_76103++) {
            ((float *) mem_71417)[i_76103] = 0.0F;
        }
        for (int64_t i_76104 = 0; i_76104 < n_65344; i_76104++) {
            ((int64_t *) mem_71420)[i_76104] = (int64_t) -1;
        }
        for (int64_t write_iter_75880 = 0; write_iter_75880 < n_65344;
             write_iter_75880++) {
            float write_iv_75883;
            
            write_iv_75883 = ((float *) Y_mem_70569.mem)[gtid_69394 * n_65344 +
                                                         write_iter_75880];
            
            bool isnan_res_75884;
            
            isnan_res_75884 = futrts_isnan32(write_iv_75883);
            
            bool defunc_0_p_res_75885 = !isnan_res_75884;
            int64_t defunc_1_f_res_75886;
            
            if (defunc_0_p_res_75885) {
                int64_t write_iv_75887;
                
                write_iv_75887 = ((int64_t *) mem_71402)[write_iter_75880];
                
                int64_t defunc_1_f_res_t_res_75888 = sub64(write_iv_75887,
                                                           (int64_t) 1);
                
                defunc_1_f_res_75886 = defunc_1_f_res_t_res_75888;
            } else {
                defunc_1_f_res_75886 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_75886) &&
                slt64(defunc_1_f_res_75886, n_65344)) {
                ((int64_t *) mem_71420)[defunc_1_f_res_75886] =
                    write_iter_75880;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_75886) &&
                slt64(defunc_1_f_res_75886, n_65344)) {
                if ((int64_t) 4 > 0)
                    memmove(mem_71417 + defunc_1_f_res_75886 * (int64_t) 4,
                            Y_mem_70569.mem + (gtid_69394 * n_65344 +
                                               write_iter_75880) * (int64_t) 4,
                            (int64_t) 4);
            }
        }
        for (int64_t i_75892 = 0; i_75892 < n_65344; i_75892++) {
            int64_t x_75894;
            
            x_75894 = ((int64_t *) mem_71420)[i_75892];
            
            int64_t defunc_0_f_res_75895 = add64((int64_t) 1, x_75894);
            
            ((int64_t *) mem_71447)[i_75892] = defunc_0_f_res_75895;
        }
        
        int64_t min_arg_66417 = sub64(last_res_66402, (int64_t) 1);
        int64_t min_arg_66418 = sub64(last_res_66402, min_res_65364);
        int64_t min_res_66419 = smin64(q_65346, last_res_66402);
        float i64_res_66420 = sitofp_i64_f32(last_res_66402);
        float x_66421 = i64_res_65370 - i64_res_66420;
        float max_arg_66422 = x_66421 / 2.0F;
        float max_res_66423 = fmax32(0.0F, max_arg_66422);
        
        for (int64_t i_75897 = 0; i_75897 < q_65346; i_75897++) {
            bool cond_75899 = sle64(last_res_66402, i_75897);
            float defunc_0_f_res_75900;
            
            if (cond_75899) {
                defunc_0_f_res_75900 = 0.0F;
            } else {
                defunc_0_f_res_75900 = 1.0F;
            }
            ((float *) mem_71462)[i_75897] = defunc_0_f_res_75900;
        }
        for (int64_t i_75902 = 0; i_75902 < n_m_65352; i_75902++) {
            int64_t min_arg_75905 = mul64(jump_65348, i_75902);
            int64_t min_res_75906 = smin64(i_65358, min_arg_75905);
            int64_t defunc_0_g_res_75907 = add64((int64_t) 1, min_res_75906);
            bool init_idx_75908;
            int64_t init_idx_75909;
            int64_t init_idx_75910;
            bool loop_while_75911;
            int64_t low_75912;
            int64_t high_75913;
            
            loop_while_75911 = x_65359;
            low_75912 = (int64_t) 0;
            high_75913 = i_65358;
            while (loop_while_75911) {
                int64_t x_75914 = add64(low_75912, high_75913);
                int64_t mid_75915 = sdiv64(x_75914, (int64_t) 2);
                bool x_75916 = sle64((int64_t) 0, mid_75915);
                bool y_75917 = slt64(mid_75915, n_65344);
                bool bounds_check_75918 = x_75916 && y_75917;
                bool index_certs_75919;
                
                if (!bounds_check_75918) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) mid_75915,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t mid_id_75920;
                
                mid_id_75920 = ((int64_t *) mem_71447)[mid_75915];
                
                bool cond_75921 = slt64(mid_id_75920, (int64_t) 0);
                int64_t mid_idx_75922;
                
                if (cond_75921) {
                    mid_idx_75922 = (int64_t) 9223372036854775807;
                } else {
                    mid_idx_75922 = mid_id_75920;
                }
                
                bool cond_75923 = sle64(defunc_0_g_res_75907, mid_idx_75922);
                int64_t loopres_75924;
                int64_t loopres_75925;
                
                if (cond_75923) {
                    int64_t loopres_t_res_75926 = sub64(mid_75915, (int64_t) 1);
                    
                    loopres_75924 = low_75912;
                    loopres_75925 = loopres_t_res_75926;
                } else {
                    int64_t loopres_f_res_75927 = add64((int64_t) 1, mid_75915);
                    
                    loopres_75924 = loopres_f_res_75927;
                    loopres_75925 = high_75913;
                }
                
                bool loop_cond_75928 = sle64(loopres_75924, loopres_75925);
                bool loop_while_tmp_76111 = loop_cond_75928;
                int64_t low_tmp_76112 = loopres_75924;
                int64_t high_tmp_76113 = loopres_75925;
                
                loop_while_75911 = loop_while_tmp_76111;
                low_75912 = low_tmp_76112;
                high_75913 = high_tmp_76113;
            }
            init_idx_75908 = loop_while_75911;
            init_idx_75909 = low_75912;
            init_idx_75910 = high_75913;
            
            bool idx_75929;
            int64_t idx_75930;
            int64_t idx_75931;
            int64_t idx_75932;
            bool loop_while_75933;
            int64_t l_idx_75934;
            int64_t r_idx_75935;
            int64_t span_75936;
            
            loop_while_75933 = loop_cond_65369;
            l_idx_75934 = init_idx_75909;
            r_idx_75935 = init_idx_75909;
            span_75936 = (int64_t) 1;
            while (loop_while_75933) {
                int64_t max_arg_75937 = sub64(l_idx_75934, (int64_t) 1);
                int64_t max_res_75938 = smax64((int64_t) 0, max_arg_75937);
                int64_t min_arg_75939 = add64((int64_t) 1, r_idx_75935);
                int64_t min_res_75940 = smin64(min_arg_66417, min_arg_75939);
                bool x_75941 = sle64((int64_t) 0, max_res_75938);
                bool y_75942 = slt64(max_res_75938, n_65344);
                bool bounds_check_75943 = x_75941 && y_75942;
                bool index_certs_75944;
                
                if (!bounds_check_75943) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) max_res_75938,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_75945;
                
                x_75945 = ((int64_t *) mem_71447)[max_res_75938];
                
                int64_t abs_arg_75946 = sub64(x_75945, defunc_0_g_res_75907);
                int64_t abs_res_75947 = abs64(abs_arg_75946);
                bool x_75948 = sle64((int64_t) 0, min_res_75940);
                bool y_75949 = slt64(min_res_75940, n_65344);
                bool bounds_check_75950 = x_75948 && y_75949;
                bool index_certs_75951;
                
                if (!bounds_check_75950) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", (long long) min_res_75940,
                                  "] out of bounds for array of shape [",
                                  (long long) n_65344, "].",
                                  "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                    err = 1;
                    goto cleanup;
                }
                
                int64_t x_75952;
                
                x_75952 = ((int64_t *) mem_71447)[min_res_75940];
                
                int64_t abs_arg_75953 = sub64(x_75952, defunc_0_g_res_75907);
                int64_t abs_res_75954 = abs64(abs_arg_75953);
                bool cond_75955 = max_res_75938 == l_idx_75934;
                int64_t loopres_75956;
                int64_t loopres_75957;
                int64_t loopres_75958;
                
                if (cond_75955) {
                    loopres_75956 = l_idx_75934;
                    loopres_75957 = r_idx_75935;
                    loopres_75958 = min_res_65364;
                } else {
                    bool cond_75959 = slt64(abs_res_75947, abs_res_75954);
                    bool cond_f_res_75960 = min_res_75940 == r_idx_75935;
                    bool x_75961 = !cond_75959;
                    bool y_75962 = cond_f_res_75960 && x_75961;
                    bool cond_75963 = cond_75959 || y_75962;
                    int64_t loopres_f_res_75964;
                    
                    if (cond_75963) {
                        loopres_f_res_75964 = max_res_75938;
                    } else {
                        loopres_f_res_75964 = l_idx_75934;
                    }
                    
                    int64_t loopres_f_res_75965;
                    
                    if (cond_75963) {
                        loopres_f_res_75965 = r_idx_75935;
                    } else {
                        loopres_f_res_75965 = min_res_75940;
                    }
                    
                    int64_t loopres_f_res_75966;
                    
                    if (cond_75963) {
                        int64_t loopres_f_res_t_res_75967 = add64((int64_t) 1,
                                                                  span_75936);
                        
                        loopres_f_res_75966 = loopres_f_res_t_res_75967;
                    } else {
                        int64_t loopres_f_res_f_res_75968 = add64((int64_t) 1,
                                                                  span_75936);
                        
                        loopres_f_res_75966 = loopres_f_res_f_res_75968;
                    }
                    loopres_75956 = loopres_f_res_75964;
                    loopres_75957 = loopres_f_res_75965;
                    loopres_75958 = loopres_f_res_75966;
                }
                
                bool loop_cond_75969 = slt64(loopres_75958, min_res_65364);
                bool loop_while_tmp_76114 = loop_cond_75969;
                int64_t l_idx_tmp_76115 = loopres_75956;
                int64_t r_idx_tmp_76116 = loopres_75957;
                int64_t span_tmp_76117 = loopres_75958;
                
                loop_while_75933 = loop_while_tmp_76114;
                l_idx_75934 = l_idx_tmp_76115;
                r_idx_75935 = r_idx_tmp_76116;
                span_75936 = span_tmp_76117;
            }
            idx_75929 = loop_while_75933;
            idx_75930 = l_idx_75934;
            idx_75931 = r_idx_75935;
            idx_75932 = span_75936;
            
            int64_t min_res_75970 = smin64(min_arg_66418, idx_75930);
            int64_t max_res_75971 = smax64((int64_t) 0, min_res_75970);
            int64_t x_75972 = add64(min_res_66419, max_res_75971);
            int64_t r_75973 = sub64(x_75972, (int64_t) 1);
            bool x_75974 = sle64((int64_t) 0, r_75973);
            bool y_75975 = slt64(r_75973, n_65344);
            bool bounds_check_75976 = x_75974 && y_75975;
            bool index_certs_75977;
            
            if (!bounds_check_75976) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) r_75973,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75978;
            
            x_75978 = ((int64_t *) mem_71420)[r_75973];
            
            int64_t abs_arg_75979 = sub64(x_75978, min_res_75906);
            int64_t abs_res_75980 = abs64(abs_arg_75979);
            bool x_75981 = sle64((int64_t) 0, max_res_75971);
            bool y_75982 = slt64(max_res_75971, n_65344);
            bool bounds_check_75983 = x_75981 && y_75982;
            bool index_certs_75984;
            
            if (!bounds_check_75983) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_75971,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_75985;
            
            x_75985 = ((int64_t *) mem_71420)[max_res_75971];
            
            int64_t abs_arg_75986 = sub64(x_75985, min_res_75906);
            int64_t abs_res_75987 = abs64(abs_arg_75986);
            int64_t max_res_75988 = smax64(abs_res_75980, abs_res_75987);
            float defunc_0_f_res_75989 = sitofp_i64_f32(max_res_75988);
            float defunc_1_f_res_75990 = max_res_66423 + defunc_0_f_res_75989;
            
            for (int64_t i_75995 = 0; i_75995 < q_65346; i_75995++) {
                float x_75998;
                
                x_75998 = ((float *) mem_71462)[i_75995];
                
                bool cond_75999 = sle64(last_res_66402, i_75995);
                int64_t defunc_0_f_res_76000;
                
                if (cond_75999) {
                    defunc_0_f_res_76000 = (int64_t) 0;
                } else {
                    int64_t i_76001 = add64(max_res_75971, i_75995);
                    int64_t defunc_0_add_arg_76002;
                    
                    defunc_0_add_arg_76002 = ((int64_t *) mem_71420)[i_76001];
                    
                    int64_t defunc_1_add_res_76003 = add64((int64_t) 1,
                                                           defunc_0_add_arg_76002);
                    
                    defunc_0_f_res_76000 = defunc_1_add_res_76003;
                }
                
                int64_t binop_p_76004 = sub64(defunc_0_f_res_76000,
                                              min_res_75906);
                float defunc_0_f_res_76005 = sitofp_i64_f32(binop_p_76004);
                float abs_res_76006 = (float) fabs(defunc_0_f_res_76005);
                float tmp1_76007 = abs_res_76006 / defunc_1_f_res_75990;
                float x_76008 = tmp1_76007 * tmp1_76007;
                float y_76009 = tmp1_76007 * x_76008;
                float tmp2_76010 = 1.0F - y_76009;
                float x_76011 = tmp2_76010 * tmp2_76010;
                float tmp3_76012 = tmp2_76010 * x_76011;
                float tmp4_76013 = x_75998 * tmp3_76012;
                
                ((float *) mem_71497)[i_75995] = defunc_0_f_res_76005;
                ((float *) mem_71500)[i_75995] = tmp4_76013;
            }
            
            float defunc_2_reduce_res_76018;
            float defunc_2_reduce_res_76019;
            float defunc_2_reduce_res_76020;
            float defunc_2_reduce_res_76021;
            float defunc_2_reduce_res_76022;
            float redout_76026;
            float redout_76027;
            float redout_76028;
            float redout_76029;
            float redout_76030;
            
            redout_76026 = 0.0F;
            redout_76027 = 0.0F;
            redout_76028 = 0.0F;
            redout_76029 = 0.0F;
            redout_76030 = 0.0F;
            for (int64_t i_76025 = 0; i_76025 < q_65346; i_76025++) {
                float x_76033;
                
                x_76033 = ((float *) mem_71497)[i_76025];
                
                float x_76034;
                
                x_76034 = ((float *) mem_71500)[i_76025];
                
                float defunc_1_f_res_76035 = x_76033 * x_76034;
                float defunc_1_f_res_76036 = x_76033 * defunc_1_f_res_76035;
                float defunc_1_f_res_76037 = x_76033 * defunc_1_f_res_76036;
                float defunc_1_f_res_76038 = x_76033 * defunc_1_f_res_76037;
                float defunc_1_op_res_76039 = x_76034 + redout_76026;
                float defunc_1_op_res_76040 = defunc_1_f_res_76035 +
                      redout_76027;
                float defunc_1_op_res_76041 = defunc_1_f_res_76036 +
                      redout_76028;
                float defunc_1_op_res_76042 = defunc_1_f_res_76037 +
                      redout_76029;
                float defunc_1_op_res_76043 = defunc_1_f_res_76038 +
                      redout_76030;
                
                ((float *) mem_71527)[i_76025] = defunc_1_f_res_76036;
                ((float *) mem_71530)[i_76025] = defunc_1_f_res_76035;
                
                float redout_tmp_76120 = defunc_1_op_res_76039;
                float redout_tmp_76121 = defunc_1_op_res_76040;
                float redout_tmp_76122 = defunc_1_op_res_76041;
                float redout_tmp_76123 = defunc_1_op_res_76042;
                float redout_tmp_76124 = defunc_1_op_res_76043;
                
                redout_76026 = redout_tmp_76120;
                redout_76027 = redout_tmp_76121;
                redout_76028 = redout_tmp_76122;
                redout_76029 = redout_tmp_76123;
                redout_76030 = redout_tmp_76124;
            }
            defunc_2_reduce_res_76018 = redout_76026;
            defunc_2_reduce_res_76019 = redout_76027;
            defunc_2_reduce_res_76020 = redout_76028;
            defunc_2_reduce_res_76021 = redout_76029;
            defunc_2_reduce_res_76022 = redout_76030;
            
            float x_76046 = defunc_2_reduce_res_76020 *
                  defunc_2_reduce_res_76022;
            float y_76047 = defunc_2_reduce_res_76021 *
                  defunc_2_reduce_res_76021;
            float a12_76048 = x_76046 - y_76047;
            float x_76049 = defunc_2_reduce_res_76020 *
                  defunc_2_reduce_res_76021;
            float y_76050 = defunc_2_reduce_res_76019 *
                  defunc_2_reduce_res_76022;
            float b12_76051 = x_76049 - y_76050;
            float x_76052 = defunc_2_reduce_res_76019 *
                  defunc_2_reduce_res_76021;
            float y_76053 = defunc_2_reduce_res_76020 *
                  defunc_2_reduce_res_76020;
            float c12_76054 = x_76052 - y_76053;
            float x_76055 = defunc_2_reduce_res_76018 *
                  defunc_2_reduce_res_76022;
            float b2_76056 = x_76055 - y_76053;
            float x_76057 = defunc_2_reduce_res_76019 *
                  defunc_2_reduce_res_76020;
            float y_76058 = defunc_2_reduce_res_76018 *
                  defunc_2_reduce_res_76021;
            float c2_76059 = x_76057 - y_76058;
            float x_76060 = defunc_2_reduce_res_76018 * a12_76048;
            float y_76061 = defunc_2_reduce_res_76019 * b12_76051;
            float x_76062 = x_76060 + y_76061;
            float y_76063 = defunc_2_reduce_res_76020 * c12_76054;
            float y_76064 = x_76062 + y_76063;
            float det_76065 = 1.0F / y_76064;
            float a12_76066 = a12_76048 * det_76065;
            float b12_76067 = b12_76051 * det_76065;
            float c12_76068 = c12_76054 * det_76065;
            float b2_76069 = b2_76056 * det_76065;
            float c2_76070 = c2_76059 * det_76065;
            float defunc_2_reduce_res_76071;
            float defunc_2_reduce_res_76072;
            float redout_76074;
            float redout_76075;
            
            redout_76074 = 0.0F;
            redout_76075 = 0.0F;
            for (int64_t i_76073 = 0; i_76073 < q_65346; i_76073++) {
                float x_76076;
                
                x_76076 = ((float *) mem_71500)[i_76073];
                
                float x_76077;
                
                x_76077 = ((float *) mem_71530)[i_76073];
                
                float x_76078;
                
                x_76078 = ((float *) mem_71527)[i_76073];
                
                bool cond_76079 = sle64(last_res_66402, i_76073);
                float defunc_0_f_res_76080;
                
                if (cond_76079) {
                    defunc_0_f_res_76080 = 0.0F;
                } else {
                    int64_t i_76081 = add64(max_res_75971, i_76073);
                    float defunc_0_add_arg_76082;
                    
                    defunc_0_add_arg_76082 = ((float *) mem_71417)[i_76081];
                    defunc_0_f_res_76080 = defunc_0_add_arg_76082;
                }
                
                float x_76083 = a12_76066 * x_76076;
                float y_76084 = b12_76067 * x_76077;
                float x_76085 = x_76083 + y_76084;
                float y_76086 = c12_76068 * x_76078;
                float x_76087 = x_76085 + y_76086;
                float defunc_9_fit_fun_res_76088 = defunc_0_f_res_76080 *
                      x_76087;
                float x_76089 = b12_76067 * x_76076;
                float y_76090 = b2_76069 * x_76077;
                float x_76091 = x_76089 + y_76090;
                float y_76092 = c2_76070 * x_76078;
                float x_76093 = x_76091 + y_76092;
                float defunc_9_slope_fun_res_76094 = defunc_0_f_res_76080 *
                      x_76093;
                float defunc_1_op_res_76095 = defunc_9_fit_fun_res_76088 +
                      redout_76074;
                float defunc_1_op_res_76096 = defunc_9_slope_fun_res_76094 +
                      redout_76075;
                float redout_tmp_76127 = defunc_1_op_res_76095;
                float redout_tmp_76128 = defunc_1_op_res_76096;
                
                redout_76074 = redout_tmp_76127;
                redout_76075 = redout_tmp_76128;
            }
            defunc_2_reduce_res_76071 = redout_76074;
            defunc_2_reduce_res_76072 = redout_76075;
            ((float *) mem_71477)[i_75902] = defunc_2_reduce_res_76071;
            ((float *) mem_71480)[i_75902] = defunc_2_reduce_res_76072;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71568.mem + gtid_69394 * n_m_65352 * (int64_t) 4,
                    mem_71477 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71572.mem + gtid_69394 * n_m_65352 * (int64_t) 4,
                    mem_71480 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_71402);
    free(mem_71417);
    free(mem_71420);
    free(mem_71447);
    free(mem_71462);
    free(mem_71477);
    free(mem_71480);
    free(mem_71497);
    free(mem_71500);
    free(mem_71527);
    free(mem_71530);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77327_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77327_end -
                 futhark_mc_segmap_parloop_77327_start;
        
        ctx->futhark_mc_segmap_parloop_77327_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77327_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77327_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77325(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_69393 = tid;
    int num_tasks_75869 = info.nsubtasks;
    struct futhark_mc_task_77324 *futhark_mc_task_77324 =
                                 (struct futhark_mc_task_77324 *) args;
    struct futhark_context *ctx = futhark_mc_task_77324->ctx;
    uint64_t futhark_mc_segmap_task_77325_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77325_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77324->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77324->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77324->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77324->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77324->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77324->free_i_65358;
    bool x_65359 = futhark_mc_task_77324->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77324->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77324->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77324->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77324->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71308 = futhark_mc_task_77324->free_bytes_71308;
    int64_t bytes_71311 = futhark_mc_task_77324->free_bytes_71311;
    int64_t bytes_71320 = futhark_mc_task_77324->free_bytes_71320;
    int64_t bytes_71395 = futhark_mc_task_77324->free_bytes_71395;
    struct memblock mem_71568 = {.desc ="mem_71568", .mem =
                                 futhark_mc_task_77324->free_mem_71568, .size =
                                 0, .references =NULL};
    struct memblock mem_71572 = {.desc ="mem_71572", .mem =
                                 futhark_mc_task_77324->free_mem_71572, .size =
                                 0, .references =NULL};
    int64_t iter_75870;
    struct futhark_mc_segmap_parloop_struct_77326
    futhark_mc_segmap_parloop_struct_77326;
    
    futhark_mc_segmap_parloop_struct_77326.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77326.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77326.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77326.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77326.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77326.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77326.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77326.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77326.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77326.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77326.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77326.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77326.free_bytes_71308 = bytes_71308;
    futhark_mc_segmap_parloop_struct_77326.free_bytes_71311 = bytes_71311;
    futhark_mc_segmap_parloop_struct_77326.free_bytes_71320 = bytes_71320;
    futhark_mc_segmap_parloop_struct_77326.free_bytes_71395 = bytes_71395;
    futhark_mc_segmap_parloop_struct_77326.free_mem_71568 = mem_71568.mem;
    futhark_mc_segmap_parloop_struct_77326.free_mem_71572 = mem_71572.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77327_task;
    
    futhark_mc_segmap_parloop_77327_task.name =
        "futhark_mc_segmap_parloop_77327";
    futhark_mc_segmap_parloop_77327_task.fn = futhark_mc_segmap_parloop_77327;
    futhark_mc_segmap_parloop_77327_task.args =
        &futhark_mc_segmap_parloop_struct_77326;
    futhark_mc_segmap_parloop_77327_task.iterations = iterations;
    futhark_mc_segmap_parloop_77327_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77327_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77327_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77327_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77327_task);
    
    if (futhark_mc_segmap_parloop_77327_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77327_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77327_total_end -
                 futhark_mc_segmap_parloop_77327_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77327_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77327_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77327_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77325_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77325_end -
                 futhark_mc_segmap_task_77325_start;
        
        ctx->futhark_mc_segmap_task_77325_runs[tid]++;
        ctx->futhark_mc_segmap_task_77325_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77325_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77340 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    float free_i64_res_65370;
    unsigned char *free_Y_mem_70569;
    int64_t free_bytes_71308;
    int64_t free_bytes_71311;
    int64_t free_bytes_71320;
    int64_t free_bytes_71395;
    unsigned char *free_mem_71568;
    unsigned char *free_mem_71572;
};
struct futhark_mc_task_77349 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69611;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71309;
};
struct futhark_mc_scan_stage_1_parloop_struct_77352 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69611;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71309;
};
static int futhark_mc_scan_stage_1_parloop_77353(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_76130, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_77352
    *futhark_mc_scan_stage_1_parloop_struct_77352 =
    (struct futhark_mc_scan_stage_1_parloop_struct_77352 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_77352->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_77353_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77353_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_1_parloop_struct_77352->free_n_65344;
    int64_t gtid_69611 =
            futhark_mc_scan_stage_1_parloop_struct_77352->free_gtid_69611;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_1_parloop_struct_77352->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71309 = {.desc ="mem_71309", .mem =
                                 futhark_mc_scan_stage_1_parloop_struct_77352->free_mem_71309,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76552 = start;
    int64_t x_76132;
    int64_t x_76133;
    
    x_76132 = (int64_t) 0;
    for (; iter_76552 < end; iter_76552++) {
        int64_t gtid_76131 = iter_76552;
        
        // stage 1 scan body
        {
            float x_76135;
            
            x_76135 = ((float *) Y_mem_70569.mem)[gtid_69611 * n_65344 +
                                                  gtid_76131];
            
            bool isnan_res_76136;
            
            isnan_res_76136 = futrts_isnan32(x_76135);
            
            bool defunc_0_p_res_76137 = !isnan_res_76136;
            int64_t defunc_0_f_res_76138 = btoi_bool_i64(defunc_0_p_res_76137);
            
            // write mapped values results to memory
            { }
            x_76132 = x_76132;
            // Read next values
            {
                x_76133 = defunc_0_f_res_76138;
            }
            
            int64_t defunc_1_op_res_76134 = add64(x_76132, x_76133);
            
            ((int64_t *) mem_71309.mem)[gtid_76131] = defunc_1_op_res_76134;
            x_76132 = defunc_1_op_res_76134;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77353_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77353_end -
                 futhark_mc_scan_stage_1_parloop_77353_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_77353_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_77353_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_77353_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_77354 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69611;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71309;
};
static int futhark_mc_scan_stage_3_parloop_77355(void *args, int64_t start,
                                                 int64_t end,
                                                 int flat_tid_76130, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_77354
    *futhark_mc_scan_stage_3_parloop_struct_77354 =
    (struct futhark_mc_scan_stage_3_parloop_struct_77354 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_77354->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_77355_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_77355_start = get_wall_time();
    
    int64_t n_65344 =
            futhark_mc_scan_stage_3_parloop_struct_77354->free_n_65344;
    int64_t gtid_69611 =
            futhark_mc_scan_stage_3_parloop_struct_77354->free_gtid_69611;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_scan_stage_3_parloop_struct_77354->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71309 = {.desc ="mem_71309", .mem =
                                 futhark_mc_scan_stage_3_parloop_struct_77354->free_mem_71309,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76564 = start;
    int64_t x_76561;
    int64_t x_76562;
    
    if (iter_76564 == (int64_t) 0) {
        x_76561 = (int64_t) 0;
    } else {
        x_76561 = ((int64_t *) mem_71309.mem)[iter_76564 - (int64_t) 1];
    }
    for (; iter_76564 < end; iter_76564++) {
        int64_t gtid_76131 = iter_76564;
        
        // stage 3 scan body
        {
            float x_76135;
            
            x_76135 = ((float *) Y_mem_70569.mem)[gtid_69611 * n_65344 +
                                                  gtid_76131];
            
            bool isnan_res_76136;
            
            isnan_res_76136 = futrts_isnan32(x_76135);
            
            bool defunc_0_p_res_76137 = !isnan_res_76136;
            int64_t defunc_0_f_res_76138 = btoi_bool_i64(defunc_0_p_res_76137);
            
            x_76561 = x_76561;
            x_76562 = defunc_0_f_res_76138;
            
            int64_t defunc_1_op_res_76563 = add64(x_76561, x_76562);
            
            ((int64_t *) mem_71309.mem)[gtid_76131] = defunc_1_op_res_76563;
            x_76561 = defunc_1_op_res_76563;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_77355_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77355_end -
                 futhark_mc_scan_stage_3_parloop_77355_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_77355_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_77355_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_77355_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_77350(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76130 = tid;
    int num_tasks_76551 = info.nsubtasks;
    struct futhark_mc_task_77349 *futhark_mc_task_77349 =
                                 (struct futhark_mc_task_77349 *) args;
    struct futhark_context *ctx = futhark_mc_task_77349->ctx;
    uint64_t futhark_mc_segscan_task_77350_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_77350_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77349->free_n_65344;
    int64_t gtid_69611 = futhark_mc_task_77349->free_gtid_69611;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77349->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71309 = {.desc ="mem_71309", .mem =
                                 futhark_mc_task_77349->free_mem_71309, .size =
                                 0, .references =NULL};
    size_t scan_stage_2_accum_mem_76558_cached_sizze_77351 = 0;
    unsigned char *scan_stage_2_accum_mem_76558 = NULL;
    int64_t iter_76552;
    struct futhark_mc_scan_stage_1_parloop_struct_77352
    futhark_mc_scan_stage_1_parloop_struct_77352;
    
    futhark_mc_scan_stage_1_parloop_struct_77352.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_77352.free_n_65344 = n_65344;
    futhark_mc_scan_stage_1_parloop_struct_77352.free_gtid_69611 = gtid_69611;
    futhark_mc_scan_stage_1_parloop_struct_77352.free_Y_mem_70569 =
        Y_mem_70569.mem;
    futhark_mc_scan_stage_1_parloop_struct_77352.free_mem_71309 = mem_71309.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_77353_task;
    
    futhark_mc_scan_stage_1_parloop_77353_task.name =
        "futhark_mc_scan_stage_1_parloop_77353";
    futhark_mc_scan_stage_1_parloop_77353_task.fn =
        futhark_mc_scan_stage_1_parloop_77353;
    futhark_mc_scan_stage_1_parloop_77353_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_77352;
    futhark_mc_scan_stage_1_parloop_77353_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_77353_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_77353_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_77353_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_77353_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_77353_task);
    
    if (futhark_mc_scan_stage_1_parloop_77353_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_77353_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_77353_total_end -
                 futhark_mc_scan_stage_1_parloop_77353_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77353_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77353_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_77353_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_76551)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_76553;
        int64_t x_76554;
        int64_t offset_76556 = (int64_t) 0;
        int64_t offset_index_76557 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_76558_cached_sizze_77351 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_76558 = realloc(scan_stage_2_accum_mem_76558,
                                                   (int64_t) 8);
            scan_stage_2_accum_mem_76558_cached_sizze_77351 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_76558)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_76560 = 0; i_76560 < num_tasks_76551 - 1; i_76560++) {
            offset_76556 = squot64(n_65344, sext_i32_i64(num_tasks_76551));
            if (slt64(sext_i32_i64(i_76560), srem64(n_65344,
                                                    sext_i32_i64(num_tasks_76551)))) {
                offset_76556 += (int64_t) 1;
            }
            offset_index_76557 += offset_76556;
            
            int64_t gtid_76131 = offset_index_76557;
            float x_76135;
            
            x_76135 = ((float *) Y_mem_70569.mem)[gtid_69611 * n_65344 +
                                                  gtid_76131];
            
            bool isnan_res_76136;
            
            isnan_res_76136 = futrts_isnan32(x_76135);
            
            bool defunc_0_p_res_76137 = !isnan_res_76136;
            int64_t defunc_0_f_res_76138 = btoi_bool_i64(defunc_0_p_res_76137);
            
            // Read carry in
            {
                x_76553 =
                    ((int64_t *) scan_stage_2_accum_mem_76558)[(int64_t) 0];
            }
            // Read next values
            {
                x_76554 = ((int64_t *) mem_71309.mem)[offset_index_76557 -
                                                      (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_76555 = add64(x_76553, x_76554);
            
            ((int64_t *) mem_71309.mem)[offset_index_76557 - (int64_t) 1] =
                defunc_1_op_res_76555;
            ((int64_t *) scan_stage_2_accum_mem_76558)[(int64_t) 0] =
                defunc_1_op_res_76555;
        }
        
        int64_t iter_76564 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_77354
        futhark_mc_scan_stage_3_parloop_struct_77354;
        
        futhark_mc_scan_stage_3_parloop_struct_77354.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_77354.free_n_65344 = n_65344;
        futhark_mc_scan_stage_3_parloop_struct_77354.free_gtid_69611 =
            gtid_69611;
        futhark_mc_scan_stage_3_parloop_struct_77354.free_Y_mem_70569 =
            Y_mem_70569.mem;
        futhark_mc_scan_stage_3_parloop_struct_77354.free_mem_71309 =
            mem_71309.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_77355_task;
        
        futhark_mc_scan_stage_3_parloop_77355_task.name =
            "futhark_mc_scan_stage_3_parloop_77355";
        futhark_mc_scan_stage_3_parloop_77355_task.fn =
            futhark_mc_scan_stage_3_parloop_77355;
        futhark_mc_scan_stage_3_parloop_77355_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_77354;
        futhark_mc_scan_stage_3_parloop_77355_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_77355_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_77355_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_77355_total_start = get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_77355_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_77355_task);
        
        if (futhark_mc_scan_stage_3_parloop_77355_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_77355_total_end =
                     get_wall_time();
            uint64_t elapsed = futhark_mc_scan_stage_3_parloop_77355_total_end -
                     futhark_mc_scan_stage_3_parloop_77355_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77355_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77355_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_77355_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    
  cleanup:
    {
        free(scan_stage_2_accum_mem_76558);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_77350_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_77350_end -
                 futhark_mc_segscan_task_77350_start;
        
        ctx->futhark_mc_segscan_task_77350_runs[tid]++;
        ctx->futhark_mc_segscan_task_77350_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_77350_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77356 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69611;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71309;
    unsigned char *free_mem_71312;
    unsigned char *free_mem_71315;
};
struct futhark_mc_segmap_parloop_struct_77358 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_gtid_69611;
    unsigned char *free_Y_mem_70569;
    unsigned char *free_mem_71309;
    unsigned char *free_mem_71312;
    unsigned char *free_mem_71315;
};
static int futhark_mc_segmap_parloop_77359(void *args, int64_t start,
                                           int64_t end, int flat_tid_76139,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77358
    *futhark_mc_segmap_parloop_struct_77358 =
    (struct futhark_mc_segmap_parloop_struct_77358 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77358->ctx;
    uint64_t futhark_mc_segmap_parloop_77359_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77359_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77358->free_n_65344;
    int64_t gtid_69611 =
            futhark_mc_segmap_parloop_struct_77358->free_gtid_69611;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77358->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71309 = {.desc ="mem_71309", .mem =
                                 futhark_mc_segmap_parloop_struct_77358->free_mem_71309,
                                 .size =0, .references =NULL};
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_segmap_parloop_struct_77358->free_mem_71312,
                                 .size =0, .references =NULL};
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_segmap_parloop_struct_77358->free_mem_71315,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76568 = start;
    
    for (; iter_76568 < end; iter_76568++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76571 = n_65344;
        int64_t gtid_76140 = iter_76568;
        int64_t remnant_76572 = iter_76568 - gtid_76140;
        float x_76141;
        
        x_76141 = ((float *) Y_mem_70569.mem)[gtid_69611 * n_65344 +
                                              gtid_76140];
        
        bool isnan_res_76142;
        
        isnan_res_76142 = futrts_isnan32(x_76141);
        
        bool defunc_0_p_res_76143 = !isnan_res_76142;
        int64_t defunc_1_f_res_76144;
        
        if (defunc_0_p_res_76143) {
            int64_t x_76569;
            
            x_76569 = ((int64_t *) mem_71309.mem)[gtid_76140];
            
            int64_t defunc_1_f_res_t_res_76570 = sub64(x_76569, (int64_t) 1);
            
            defunc_1_f_res_76144 = defunc_1_f_res_t_res_76570;
        } else {
            defunc_1_f_res_76144 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_76144) &&
            slt64(defunc_1_f_res_76144, n_65344)) {
            ((int64_t *) mem_71315.mem)[defunc_1_f_res_76144] = gtid_76140;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_76144) &&
            slt64(defunc_1_f_res_76144, n_65344)) {
            ((float *) mem_71312.mem)[defunc_1_f_res_76144] = x_76141;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77359_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77359_end -
                 futhark_mc_segmap_parloop_77359_start;
        
        ctx->futhark_mc_segmap_parloop_77359_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77359_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77359_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77357(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76139 = tid;
    int num_tasks_76567 = info.nsubtasks;
    struct futhark_mc_task_77356 *futhark_mc_task_77356 =
                                 (struct futhark_mc_task_77356 *) args;
    struct futhark_context *ctx = futhark_mc_task_77356->ctx;
    uint64_t futhark_mc_segmap_task_77357_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77357_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77356->free_n_65344;
    int64_t gtid_69611 = futhark_mc_task_77356->free_gtid_69611;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77356->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    struct memblock mem_71309 = {.desc ="mem_71309", .mem =
                                 futhark_mc_task_77356->free_mem_71309, .size =
                                 0, .references =NULL};
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_task_77356->free_mem_71312, .size =
                                 0, .references =NULL};
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_task_77356->free_mem_71315, .size =
                                 0, .references =NULL};
    int64_t iter_76568;
    struct futhark_mc_segmap_parloop_struct_77358
    futhark_mc_segmap_parloop_struct_77358;
    
    futhark_mc_segmap_parloop_struct_77358.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77358.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77358.free_gtid_69611 = gtid_69611;
    futhark_mc_segmap_parloop_struct_77358.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77358.free_mem_71309 = mem_71309.mem;
    futhark_mc_segmap_parloop_struct_77358.free_mem_71312 = mem_71312.mem;
    futhark_mc_segmap_parloop_struct_77358.free_mem_71315 = mem_71315.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77359_task;
    
    futhark_mc_segmap_parloop_77359_task.name =
        "futhark_mc_segmap_parloop_77359";
    futhark_mc_segmap_parloop_77359_task.fn = futhark_mc_segmap_parloop_77359;
    futhark_mc_segmap_parloop_77359_task.args =
        &futhark_mc_segmap_parloop_struct_77358;
    futhark_mc_segmap_parloop_77359_task.iterations = iterations;
    futhark_mc_segmap_parloop_77359_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77359_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77359_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77359_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77359_task);
    
    if (futhark_mc_segmap_parloop_77359_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77359_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77359_total_end -
                 futhark_mc_segmap_parloop_77359_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77359_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77359_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77359_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77357_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77357_end -
                 futhark_mc_segmap_task_77357_start;
        
        ctx->futhark_mc_segmap_task_77357_runs[tid]++;
        ctx->futhark_mc_segmap_task_77357_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77357_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77360 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_71315;
    unsigned char *free_mem_71318;
};
struct futhark_mc_segmap_parloop_struct_77362 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    unsigned char *free_mem_71315;
    unsigned char *free_mem_71318;
};
static int futhark_mc_segmap_parloop_77363(void *args, int64_t start,
                                           int64_t end, int flat_tid_76147,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77362
    *futhark_mc_segmap_parloop_struct_77362 =
    (struct futhark_mc_segmap_parloop_struct_77362 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77362->ctx;
    uint64_t futhark_mc_segmap_parloop_77363_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77363_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77362->free_n_65344;
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_segmap_parloop_struct_77362->free_mem_71315,
                                 .size =0, .references =NULL};
    struct memblock mem_71318 = {.desc ="mem_71318", .mem =
                                 futhark_mc_segmap_parloop_struct_77362->free_mem_71318,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76574 = start;
    
    for (; iter_76574 < end; iter_76574++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76575 = n_65344;
        int64_t gtid_76148 = iter_76574;
        int64_t remnant_76576 = iter_76574 - gtid_76148;
        int64_t x_76149;
        
        x_76149 = ((int64_t *) mem_71315.mem)[gtid_76148];
        
        int64_t defunc_0_f_res_76150 = add64((int64_t) 1, x_76149);
        
        ((int64_t *) mem_71318.mem)[gtid_76148] = defunc_0_f_res_76150;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77363_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77363_end -
                 futhark_mc_segmap_parloop_77363_start;
        
        ctx->futhark_mc_segmap_parloop_77363_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77363_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77363_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77361(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76147 = tid;
    int num_tasks_76573 = info.nsubtasks;
    struct futhark_mc_task_77360 *futhark_mc_task_77360 =
                                 (struct futhark_mc_task_77360 *) args;
    struct futhark_context *ctx = futhark_mc_task_77360->ctx;
    uint64_t futhark_mc_segmap_task_77361_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77361_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77360->free_n_65344;
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_task_77360->free_mem_71315, .size =
                                 0, .references =NULL};
    struct memblock mem_71318 = {.desc ="mem_71318", .mem =
                                 futhark_mc_task_77360->free_mem_71318, .size =
                                 0, .references =NULL};
    int64_t iter_76574;
    struct futhark_mc_segmap_parloop_struct_77362
    futhark_mc_segmap_parloop_struct_77362;
    
    futhark_mc_segmap_parloop_struct_77362.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77362.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77362.free_mem_71315 = mem_71315.mem;
    futhark_mc_segmap_parloop_struct_77362.free_mem_71318 = mem_71318.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77363_task;
    
    futhark_mc_segmap_parloop_77363_task.name =
        "futhark_mc_segmap_parloop_77363";
    futhark_mc_segmap_parloop_77363_task.fn = futhark_mc_segmap_parloop_77363;
    futhark_mc_segmap_parloop_77363_task.args =
        &futhark_mc_segmap_parloop_struct_77362;
    futhark_mc_segmap_parloop_77363_task.iterations = iterations;
    futhark_mc_segmap_parloop_77363_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77363_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77363_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77363_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77363_task);
    
    if (futhark_mc_segmap_parloop_77363_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77363_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77363_total_end -
                 futhark_mc_segmap_parloop_77363_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77363_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77363_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77363_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77361_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77361_end -
                 futhark_mc_segmap_task_77361_start;
        
        ctx->futhark_mc_segmap_task_77361_runs[tid]++;
        ctx->futhark_mc_segmap_task_77361_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77361_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77364 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_69623;
    unsigned char *free_mem_71321;
};
struct futhark_mc_segmap_parloop_struct_77366 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_69623;
    unsigned char *free_mem_71321;
};
static int futhark_mc_segmap_parloop_77367(void *args, int64_t start,
                                           int64_t end, int flat_tid_76151,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77366
    *futhark_mc_segmap_parloop_struct_77366 =
    (struct futhark_mc_segmap_parloop_struct_77366 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77366->ctx;
    uint64_t futhark_mc_segmap_parloop_77367_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77367_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77366->free_q_65346;
    int64_t last_res_69623 =
            futhark_mc_segmap_parloop_struct_77366->free_last_res_69623;
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_segmap_parloop_struct_77366->free_mem_71321,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76578 = start;
    
    for (; iter_76578 < end; iter_76578++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76579 = q_65346;
        int64_t gtid_76152 = iter_76578;
        int64_t remnant_76580 = iter_76578 - gtid_76152;
        bool cond_76153 = sle64(last_res_69623, gtid_76152);
        float defunc_0_f_res_76154;
        
        if (cond_76153) {
            defunc_0_f_res_76154 = 0.0F;
        } else {
            defunc_0_f_res_76154 = 1.0F;
        }
        ((float *) mem_71321.mem)[gtid_76152] = defunc_0_f_res_76154;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77367_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77367_end -
                 futhark_mc_segmap_parloop_77367_start;
        
        ctx->futhark_mc_segmap_parloop_77367_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77367_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77367_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77365(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76151 = tid;
    int num_tasks_76577 = info.nsubtasks;
    struct futhark_mc_task_77364 *futhark_mc_task_77364 =
                                 (struct futhark_mc_task_77364 *) args;
    struct futhark_context *ctx = futhark_mc_task_77364->ctx;
    uint64_t futhark_mc_segmap_task_77365_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77365_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_task_77364->free_q_65346;
    int64_t last_res_69623 = futhark_mc_task_77364->free_last_res_69623;
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_task_77364->free_mem_71321, .size =
                                 0, .references =NULL};
    int64_t iter_76578;
    struct futhark_mc_segmap_parloop_struct_77366
    futhark_mc_segmap_parloop_struct_77366;
    
    futhark_mc_segmap_parloop_struct_77366.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77366.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77366.free_last_res_69623 = last_res_69623;
    futhark_mc_segmap_parloop_struct_77366.free_mem_71321 = mem_71321.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77367_task;
    
    futhark_mc_segmap_parloop_77367_task.name =
        "futhark_mc_segmap_parloop_77367";
    futhark_mc_segmap_parloop_77367_task.fn = futhark_mc_segmap_parloop_77367;
    futhark_mc_segmap_parloop_77367_task.args =
        &futhark_mc_segmap_parloop_struct_77366;
    futhark_mc_segmap_parloop_77367_task.iterations = iterations;
    futhark_mc_segmap_parloop_77367_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77367_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77367_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77367_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77367_task);
    
    if (futhark_mc_segmap_parloop_77367_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77367_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77367_total_end -
                 futhark_mc_segmap_parloop_77367_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77367_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77367_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77367_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77365_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77365_end -
                 futhark_mc_segmap_task_77365_start;
        
        ctx->futhark_mc_segmap_task_77365_runs[tid]++;
        ctx->futhark_mc_segmap_task_77365_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77365_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77368 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_69623;
    int64_t free_min_arg_69642;
    int64_t free_min_arg_69643;
    int64_t free_min_res_69644;
    float free_max_res_69648;
    unsigned char *free_mem_71312;
    unsigned char *free_mem_71315;
    unsigned char *free_mem_71318;
    int64_t free_bytes_71320;
    unsigned char *free_mem_71321;
    unsigned char *free_mem_71396;
    unsigned char *free_mem_71399;
};
struct futhark_mc_segmap_parloop_struct_77370 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_69623;
    int64_t free_min_arg_69642;
    int64_t free_min_arg_69643;
    int64_t free_min_res_69644;
    float free_max_res_69648;
    unsigned char *free_mem_71312;
    unsigned char *free_mem_71315;
    unsigned char *free_mem_71318;
    int64_t free_bytes_71320;
    unsigned char *free_mem_71321;
    unsigned char *free_mem_71396;
    unsigned char *free_mem_71399;
};
static int futhark_mc_segmap_parloop_77371(void *args, int64_t start,
                                           int64_t end, int flat_tid_76351,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77370
    *futhark_mc_segmap_parloop_struct_77370 =
    (struct futhark_mc_segmap_parloop_struct_77370 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77370->ctx;
    uint64_t futhark_mc_segmap_parloop_77371_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77371_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77370->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77370->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77370->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77370->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77370->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77370->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77370->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77370->free_loop_cond_65369;
    int64_t last_res_69623 =
            futhark_mc_segmap_parloop_struct_77370->free_last_res_69623;
    int64_t min_arg_69642 =
            futhark_mc_segmap_parloop_struct_77370->free_min_arg_69642;
    int64_t min_arg_69643 =
            futhark_mc_segmap_parloop_struct_77370->free_min_arg_69643;
    int64_t min_res_69644 =
            futhark_mc_segmap_parloop_struct_77370->free_min_res_69644;
    float max_res_69648 =
          futhark_mc_segmap_parloop_struct_77370->free_max_res_69648;
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_segmap_parloop_struct_77370->free_mem_71312,
                                 .size =0, .references =NULL};
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_segmap_parloop_struct_77370->free_mem_71315,
                                 .size =0, .references =NULL};
    struct memblock mem_71318 = {.desc ="mem_71318", .mem =
                                 futhark_mc_segmap_parloop_struct_77370->free_mem_71318,
                                 .size =0, .references =NULL};
    int64_t bytes_71320 =
            futhark_mc_segmap_parloop_struct_77370->free_bytes_71320;
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_segmap_parloop_struct_77370->free_mem_71321,
                                 .size =0, .references =NULL};
    struct memblock mem_71396 = {.desc ="mem_71396", .mem =
                                 futhark_mc_segmap_parloop_struct_77370->free_mem_71396,
                                 .size =0, .references =NULL};
    struct memblock mem_71399 = {.desc ="mem_71399", .mem =
                                 futhark_mc_segmap_parloop_struct_77370->free_mem_71399,
                                 .size =0, .references =NULL};
    size_t mem_76439_cached_sizze_77372 = 0;
    unsigned char *mem_76439 = NULL;
    size_t mem_76441_cached_sizze_77373 = 0;
    unsigned char *mem_76441 = NULL;
    size_t mem_76466_cached_sizze_77374 = 0;
    unsigned char *mem_76466 = NULL;
    size_t mem_76468_cached_sizze_77375 = 0;
    unsigned char *mem_76468 = NULL;
    int64_t iterations = end - start;
    int64_t iter_76582 = start;
    
    if (mem_76439_cached_sizze_77372 < (size_t) bytes_71320) {
        mem_76439 = realloc(mem_76439, bytes_71320);
        mem_76439_cached_sizze_77372 = bytes_71320;
    }
    if (mem_76441_cached_sizze_77373 < (size_t) bytes_71320) {
        mem_76441 = realloc(mem_76441, bytes_71320);
        mem_76441_cached_sizze_77373 = bytes_71320;
    }
    if (mem_76466_cached_sizze_77374 < (size_t) bytes_71320) {
        mem_76466 = realloc(mem_76466, bytes_71320);
        mem_76466_cached_sizze_77374 = bytes_71320;
    }
    if (mem_76468_cached_sizze_77375 < (size_t) bytes_71320) {
        mem_76468 = realloc(mem_76468, bytes_71320);
        mem_76468_cached_sizze_77375 = bytes_71320;
    }
    for (; iter_76582 < end; iter_76582++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76704 = n_m_65352;
        int64_t gtid_76352 = iter_76582;
        int64_t remnant_76705 = iter_76582 - gtid_76352;
        int64_t min_arg_76353 = mul64(jump_65348, gtid_76352);
        int64_t min_res_76354 = smin64(i_65358, min_arg_76353);
        int64_t defunc_0_g_res_76355 = add64((int64_t) 1, min_res_76354);
        bool init_idx_76356;
        int64_t init_idx_76357;
        int64_t init_idx_76358;
        bool loop_while_76583;
        int64_t low_76584;
        int64_t high_76585;
        
        loop_while_76583 = x_65359;
        low_76584 = (int64_t) 0;
        high_76585 = i_65358;
        while (loop_while_76583) {
            int64_t x_76586 = add64(low_76584, high_76585);
            int64_t mid_76587 = sdiv64(x_76586, (int64_t) 2);
            bool x_76588 = sle64((int64_t) 0, mid_76587);
            bool y_76589 = slt64(mid_76587, n_65344);
            bool bounds_check_76590 = x_76588 && y_76589;
            bool index_certs_76591;
            
            if (!bounds_check_76590) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_76587,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_76592;
            
            mid_id_76592 = ((int64_t *) mem_71318.mem)[mid_76587];
            
            bool cond_76593 = slt64(mid_id_76592, (int64_t) 0);
            int64_t mid_idx_76594;
            
            if (cond_76593) {
                mid_idx_76594 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_76594 = mid_id_76592;
            }
            
            bool cond_76595 = sle64(defunc_0_g_res_76355, mid_idx_76594);
            int64_t loopres_76596;
            int64_t loopres_76597;
            
            if (cond_76595) {
                int64_t loopres_t_res_76598 = sub64(mid_76587, (int64_t) 1);
                
                loopres_76596 = low_76584;
                loopres_76597 = loopres_t_res_76598;
            } else {
                int64_t loopres_f_res_76599 = add64((int64_t) 1, mid_76587);
                
                loopres_76596 = loopres_f_res_76599;
                loopres_76597 = high_76585;
            }
            
            bool loop_cond_76600 = sle64(loopres_76596, loopres_76597);
            bool loop_while_tmp_76706 = loop_cond_76600;
            int64_t low_tmp_76707 = loopres_76596;
            int64_t high_tmp_76708 = loopres_76597;
            
            loop_while_76583 = loop_while_tmp_76706;
            low_76584 = low_tmp_76707;
            high_76585 = high_tmp_76708;
        }
        init_idx_76356 = loop_while_76583;
        init_idx_76357 = low_76584;
        init_idx_76358 = high_76585;
        
        bool idx_76377;
        int64_t idx_76378;
        int64_t idx_76379;
        int64_t idx_76380;
        bool loop_while_76601;
        int64_t l_idx_76602;
        int64_t r_idx_76603;
        int64_t span_76604;
        
        loop_while_76601 = loop_cond_65369;
        l_idx_76602 = init_idx_76357;
        r_idx_76603 = init_idx_76357;
        span_76604 = (int64_t) 1;
        while (loop_while_76601) {
            int64_t max_arg_76605 = sub64(l_idx_76602, (int64_t) 1);
            int64_t max_res_76606 = smax64((int64_t) 0, max_arg_76605);
            int64_t min_arg_76607 = add64((int64_t) 1, r_idx_76603);
            int64_t min_res_76608 = smin64(min_arg_69642, min_arg_76607);
            bool x_76609 = sle64((int64_t) 0, max_res_76606);
            bool y_76610 = slt64(max_res_76606, n_65344);
            bool bounds_check_76611 = x_76609 && y_76610;
            bool index_certs_76612;
            
            if (!bounds_check_76611) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_76606,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_76613;
            
            x_76613 = ((int64_t *) mem_71318.mem)[max_res_76606];
            
            int64_t abs_arg_76614 = sub64(x_76613, defunc_0_g_res_76355);
            int64_t abs_res_76615 = abs64(abs_arg_76614);
            bool x_76616 = sle64((int64_t) 0, min_res_76608);
            bool y_76617 = slt64(min_res_76608, n_65344);
            bool bounds_check_76618 = x_76616 && y_76617;
            bool index_certs_76619;
            
            if (!bounds_check_76618) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_76608,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_76620;
            
            x_76620 = ((int64_t *) mem_71318.mem)[min_res_76608];
            
            int64_t abs_arg_76621 = sub64(x_76620, defunc_0_g_res_76355);
            int64_t abs_res_76622 = abs64(abs_arg_76621);
            bool cond_76623 = max_res_76606 == l_idx_76602;
            int64_t loopres_76624;
            int64_t loopres_76625;
            int64_t loopres_76626;
            
            if (cond_76623) {
                loopres_76624 = l_idx_76602;
                loopres_76625 = r_idx_76603;
                loopres_76626 = min_res_65364;
            } else {
                bool cond_76627 = slt64(abs_res_76615, abs_res_76622);
                bool cond_f_res_76628 = min_res_76608 == r_idx_76603;
                bool x_76629 = !cond_76627;
                bool y_76630 = cond_f_res_76628 && x_76629;
                bool cond_76631 = cond_76627 || y_76630;
                int64_t loopres_f_res_76632;
                
                if (cond_76631) {
                    loopres_f_res_76632 = max_res_76606;
                } else {
                    loopres_f_res_76632 = l_idx_76602;
                }
                
                int64_t loopres_f_res_76633;
                
                if (cond_76631) {
                    loopres_f_res_76633 = r_idx_76603;
                } else {
                    loopres_f_res_76633 = min_res_76608;
                }
                
                int64_t loopres_f_res_76634;
                
                if (cond_76631) {
                    int64_t loopres_f_res_t_res_76635 = add64((int64_t) 1,
                                                              span_76604);
                    
                    loopres_f_res_76634 = loopres_f_res_t_res_76635;
                } else {
                    int64_t loopres_f_res_f_res_76636 = add64((int64_t) 1,
                                                              span_76604);
                    
                    loopres_f_res_76634 = loopres_f_res_f_res_76636;
                }
                loopres_76624 = loopres_f_res_76632;
                loopres_76625 = loopres_f_res_76633;
                loopres_76626 = loopres_f_res_76634;
            }
            
            bool loop_cond_76637 = slt64(loopres_76626, min_res_65364);
            bool loop_while_tmp_76709 = loop_cond_76637;
            int64_t l_idx_tmp_76710 = loopres_76624;
            int64_t r_idx_tmp_76711 = loopres_76625;
            int64_t span_tmp_76712 = loopres_76626;
            
            loop_while_76601 = loop_while_tmp_76709;
            l_idx_76602 = l_idx_tmp_76710;
            r_idx_76603 = r_idx_tmp_76711;
            span_76604 = span_tmp_76712;
        }
        idx_76377 = loop_while_76601;
        idx_76378 = l_idx_76602;
        idx_76379 = r_idx_76603;
        idx_76380 = span_76604;
        
        int64_t min_res_76418 = smin64(min_arg_69643, idx_76378);
        int64_t max_res_76419 = smax64((int64_t) 0, min_res_76418);
        int64_t x_76420 = add64(min_res_69644, max_res_76419);
        int64_t r_76421 = sub64(x_76420, (int64_t) 1);
        bool x_76422 = sle64((int64_t) 0, r_76421);
        bool y_76423 = slt64(r_76421, n_65344);
        bool bounds_check_76424 = x_76422 && y_76423;
        bool index_certs_76425;
        
        if (!bounds_check_76424) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_76421,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_76426;
        
        x_76426 = ((int64_t *) mem_71315.mem)[r_76421];
        
        int64_t abs_arg_76427 = sub64(x_76426, min_res_76354);
        int64_t abs_res_76428 = abs64(abs_arg_76427);
        bool x_76429 = sle64((int64_t) 0, max_res_76419);
        bool y_76430 = slt64(max_res_76419, n_65344);
        bool bounds_check_76431 = x_76429 && y_76430;
        bool index_certs_76432;
        
        if (!bounds_check_76431) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_76419,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_76433;
        
        x_76433 = ((int64_t *) mem_71315.mem)[max_res_76419];
        
        int64_t abs_arg_76434 = sub64(x_76433, min_res_76354);
        int64_t abs_res_76435 = abs64(abs_arg_76434);
        int64_t max_res_76436 = smax64(abs_res_76428, abs_res_76435);
        float defunc_0_f_res_76437 = sitofp_i64_f32(max_res_76436);
        float defunc_1_f_res_76438 = max_res_69648 + defunc_0_f_res_76437;
        
        for (int64_t i_76638 = 0; i_76638 < q_65346; i_76638++) {
            float x_76641;
            
            x_76641 = ((float *) mem_71321.mem)[i_76638];
            
            bool cond_76642 = sle64(last_res_69623, i_76638);
            int64_t defunc_0_f_res_76643;
            
            if (cond_76642) {
                defunc_0_f_res_76643 = (int64_t) 0;
            } else {
                int64_t i_76644 = add64(max_res_76419, i_76638);
                int64_t defunc_0_add_arg_76645;
                
                defunc_0_add_arg_76645 = ((int64_t *) mem_71315.mem)[i_76644];
                
                int64_t defunc_1_add_res_76646 = add64((int64_t) 1,
                                                       defunc_0_add_arg_76645);
                
                defunc_0_f_res_76643 = defunc_1_add_res_76646;
            }
            
            int64_t binop_p_76647 = sub64(defunc_0_f_res_76643, min_res_76354);
            float defunc_0_f_res_76648 = sitofp_i64_f32(binop_p_76647);
            float abs_res_76649 = (float) fabs(defunc_0_f_res_76648);
            float tmp1_76650 = abs_res_76649 / defunc_1_f_res_76438;
            float x_76651 = tmp1_76650 * tmp1_76650;
            float y_76652 = tmp1_76650 * x_76651;
            float tmp2_76653 = 1.0F - y_76652;
            float x_76654 = tmp2_76653 * tmp2_76653;
            float tmp3_76655 = tmp2_76653 * x_76654;
            float tmp4_76656 = x_76641 * tmp3_76655;
            
            ((float *) mem_76439)[i_76638] = defunc_0_f_res_76648;
            ((float *) mem_76441)[i_76638] = tmp4_76656;
        }
        
        float defunc_2_reduce_res_76470;
        float defunc_2_reduce_res_76471;
        float defunc_2_reduce_res_76472;
        float defunc_2_reduce_res_76473;
        float defunc_2_reduce_res_76474;
        float redout_76660;
        float redout_76661;
        float redout_76662;
        float redout_76663;
        float redout_76664;
        
        redout_76660 = 0.0F;
        redout_76661 = 0.0F;
        redout_76662 = 0.0F;
        redout_76663 = 0.0F;
        redout_76664 = 0.0F;
        for (int64_t i_76659 = 0; i_76659 < q_65346; i_76659++) {
            float x_76667;
            
            x_76667 = ((float *) mem_76439)[i_76659];
            
            float x_76668;
            
            x_76668 = ((float *) mem_76441)[i_76659];
            
            float defunc_1_f_res_76669 = x_76667 * x_76668;
            float defunc_1_f_res_76670 = x_76667 * defunc_1_f_res_76669;
            float defunc_1_f_res_76671 = x_76667 * defunc_1_f_res_76670;
            float defunc_1_f_res_76672 = x_76667 * defunc_1_f_res_76671;
            float defunc_1_op_res_76673 = x_76668 + redout_76660;
            float defunc_1_op_res_76674 = defunc_1_f_res_76669 + redout_76661;
            float defunc_1_op_res_76675 = defunc_1_f_res_76670 + redout_76662;
            float defunc_1_op_res_76676 = defunc_1_f_res_76671 + redout_76663;
            float defunc_1_op_res_76677 = defunc_1_f_res_76672 + redout_76664;
            
            ((float *) mem_76466)[i_76659] = defunc_1_f_res_76670;
            ((float *) mem_76468)[i_76659] = defunc_1_f_res_76669;
            
            float redout_tmp_76715 = defunc_1_op_res_76673;
            float redout_tmp_76716 = defunc_1_op_res_76674;
            float redout_tmp_76717 = defunc_1_op_res_76675;
            float redout_tmp_76718 = defunc_1_op_res_76676;
            float redout_tmp_76719 = defunc_1_op_res_76677;
            
            redout_76660 = redout_tmp_76715;
            redout_76661 = redout_tmp_76716;
            redout_76662 = redout_tmp_76717;
            redout_76663 = redout_tmp_76718;
            redout_76664 = redout_tmp_76719;
        }
        defunc_2_reduce_res_76470 = redout_76660;
        defunc_2_reduce_res_76471 = redout_76661;
        defunc_2_reduce_res_76472 = redout_76662;
        defunc_2_reduce_res_76473 = redout_76663;
        defunc_2_reduce_res_76474 = redout_76664;
        
        float x_76498 = defunc_2_reduce_res_76472 * defunc_2_reduce_res_76474;
        float y_76499 = defunc_2_reduce_res_76473 * defunc_2_reduce_res_76473;
        float a12_76500 = x_76498 - y_76499;
        float x_76501 = defunc_2_reduce_res_76472 * defunc_2_reduce_res_76473;
        float y_76502 = defunc_2_reduce_res_76471 * defunc_2_reduce_res_76474;
        float b12_76503 = x_76501 - y_76502;
        float x_76504 = defunc_2_reduce_res_76471 * defunc_2_reduce_res_76473;
        float y_76505 = defunc_2_reduce_res_76472 * defunc_2_reduce_res_76472;
        float c12_76506 = x_76504 - y_76505;
        float x_76507 = defunc_2_reduce_res_76470 * defunc_2_reduce_res_76474;
        float b2_76508 = x_76507 - y_76505;
        float x_76509 = defunc_2_reduce_res_76471 * defunc_2_reduce_res_76472;
        float y_76510 = defunc_2_reduce_res_76470 * defunc_2_reduce_res_76473;
        float c2_76511 = x_76509 - y_76510;
        float x_76512 = defunc_2_reduce_res_76470 * a12_76500;
        float y_76513 = defunc_2_reduce_res_76471 * b12_76503;
        float x_76514 = x_76512 + y_76513;
        float y_76515 = defunc_2_reduce_res_76472 * c12_76506;
        float y_76516 = x_76514 + y_76515;
        float det_76517 = 1.0F / y_76516;
        float a12_76518 = a12_76500 * det_76517;
        float b12_76519 = b12_76503 * det_76517;
        float c12_76520 = c12_76506 * det_76517;
        float b2_76521 = b2_76508 * det_76517;
        float c2_76522 = c2_76511 * det_76517;
        float defunc_2_reduce_res_76523;
        float defunc_2_reduce_res_76524;
        float redout_76681;
        float redout_76682;
        
        redout_76681 = 0.0F;
        redout_76682 = 0.0F;
        for (int64_t i_76680 = 0; i_76680 < q_65346; i_76680++) {
            float x_76683;
            
            x_76683 = ((float *) mem_76441)[i_76680];
            
            float x_76684;
            
            x_76684 = ((float *) mem_76468)[i_76680];
            
            float x_76685;
            
            x_76685 = ((float *) mem_76466)[i_76680];
            
            bool cond_76686 = sle64(last_res_69623, i_76680);
            float defunc_0_f_res_76687;
            
            if (cond_76686) {
                defunc_0_f_res_76687 = 0.0F;
            } else {
                int64_t i_76688 = add64(max_res_76419, i_76680);
                float defunc_0_add_arg_76689;
                
                defunc_0_add_arg_76689 = ((float *) mem_71312.mem)[i_76688];
                defunc_0_f_res_76687 = defunc_0_add_arg_76689;
            }
            
            float x_76690 = a12_76518 * x_76683;
            float y_76691 = b12_76519 * x_76684;
            float x_76692 = x_76690 + y_76691;
            float y_76693 = c12_76520 * x_76685;
            float x_76694 = x_76692 + y_76693;
            float defunc_9_fit_fun_res_76695 = defunc_0_f_res_76687 * x_76694;
            float x_76696 = b12_76519 * x_76683;
            float y_76697 = b2_76521 * x_76684;
            float x_76698 = x_76696 + y_76697;
            float y_76699 = c2_76522 * x_76685;
            float x_76700 = x_76698 + y_76699;
            float defunc_9_slope_fun_res_76701 = defunc_0_f_res_76687 * x_76700;
            float defunc_1_op_res_76702 = defunc_9_fit_fun_res_76695 +
                  redout_76681;
            float defunc_1_op_res_76703 = defunc_9_slope_fun_res_76701 +
                  redout_76682;
            float redout_tmp_76722 = defunc_1_op_res_76702;
            float redout_tmp_76723 = defunc_1_op_res_76703;
            
            redout_76681 = redout_tmp_76722;
            redout_76682 = redout_tmp_76723;
        }
        defunc_2_reduce_res_76523 = redout_76681;
        defunc_2_reduce_res_76524 = redout_76682;
        ((float *) mem_71396.mem)[gtid_76352] = defunc_2_reduce_res_76523;
        ((float *) mem_71399.mem)[gtid_76352] = defunc_2_reduce_res_76524;
    }
    
  cleanup:
    { }
    free(mem_76439);
    free(mem_76441);
    free(mem_76466);
    free(mem_76468);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77371_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77371_end -
                 futhark_mc_segmap_parloop_77371_start;
        
        ctx->futhark_mc_segmap_parloop_77371_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77371_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77371_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77369(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76351 = tid;
    int num_tasks_76581 = info.nsubtasks;
    struct futhark_mc_task_77368 *futhark_mc_task_77368 =
                                 (struct futhark_mc_task_77368 *) args;
    struct futhark_context *ctx = futhark_mc_task_77368->ctx;
    uint64_t futhark_mc_segmap_task_77369_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77369_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77368->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77368->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77368->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77368->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77368->free_i_65358;
    bool x_65359 = futhark_mc_task_77368->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77368->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77368->free_loop_cond_65369;
    int64_t last_res_69623 = futhark_mc_task_77368->free_last_res_69623;
    int64_t min_arg_69642 = futhark_mc_task_77368->free_min_arg_69642;
    int64_t min_arg_69643 = futhark_mc_task_77368->free_min_arg_69643;
    int64_t min_res_69644 = futhark_mc_task_77368->free_min_res_69644;
    float max_res_69648 = futhark_mc_task_77368->free_max_res_69648;
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_task_77368->free_mem_71312, .size =
                                 0, .references =NULL};
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_task_77368->free_mem_71315, .size =
                                 0, .references =NULL};
    struct memblock mem_71318 = {.desc ="mem_71318", .mem =
                                 futhark_mc_task_77368->free_mem_71318, .size =
                                 0, .references =NULL};
    int64_t bytes_71320 = futhark_mc_task_77368->free_bytes_71320;
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_task_77368->free_mem_71321, .size =
                                 0, .references =NULL};
    struct memblock mem_71396 = {.desc ="mem_71396", .mem =
                                 futhark_mc_task_77368->free_mem_71396, .size =
                                 0, .references =NULL};
    struct memblock mem_71399 = {.desc ="mem_71399", .mem =
                                 futhark_mc_task_77368->free_mem_71399, .size =
                                 0, .references =NULL};
    int64_t iter_76582;
    struct futhark_mc_segmap_parloop_struct_77370
    futhark_mc_segmap_parloop_struct_77370;
    
    futhark_mc_segmap_parloop_struct_77370.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77370.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77370.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77370.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77370.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77370.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77370.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77370.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77370.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77370.free_last_res_69623 = last_res_69623;
    futhark_mc_segmap_parloop_struct_77370.free_min_arg_69642 = min_arg_69642;
    futhark_mc_segmap_parloop_struct_77370.free_min_arg_69643 = min_arg_69643;
    futhark_mc_segmap_parloop_struct_77370.free_min_res_69644 = min_res_69644;
    futhark_mc_segmap_parloop_struct_77370.free_max_res_69648 = max_res_69648;
    futhark_mc_segmap_parloop_struct_77370.free_mem_71312 = mem_71312.mem;
    futhark_mc_segmap_parloop_struct_77370.free_mem_71315 = mem_71315.mem;
    futhark_mc_segmap_parloop_struct_77370.free_mem_71318 = mem_71318.mem;
    futhark_mc_segmap_parloop_struct_77370.free_bytes_71320 = bytes_71320;
    futhark_mc_segmap_parloop_struct_77370.free_mem_71321 = mem_71321.mem;
    futhark_mc_segmap_parloop_struct_77370.free_mem_71396 = mem_71396.mem;
    futhark_mc_segmap_parloop_struct_77370.free_mem_71399 = mem_71399.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77371_task;
    
    futhark_mc_segmap_parloop_77371_task.name =
        "futhark_mc_segmap_parloop_77371";
    futhark_mc_segmap_parloop_77371_task.fn = futhark_mc_segmap_parloop_77371;
    futhark_mc_segmap_parloop_77371_task.args =
        &futhark_mc_segmap_parloop_struct_77370;
    futhark_mc_segmap_parloop_77371_task.iterations = iterations;
    futhark_mc_segmap_parloop_77371_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77371_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77371_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77371_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77371_task);
    
    if (futhark_mc_segmap_parloop_77371_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77371_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77371_total_end -
                 futhark_mc_segmap_parloop_77371_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77371_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77371_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77371_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77369_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77369_end -
                 futhark_mc_segmap_task_77369_start;
        
        ctx->futhark_mc_segmap_task_77369_runs[tid]++;
        ctx->futhark_mc_segmap_task_77369_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77369_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77377 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_q_65346;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    bool free_x_65359;
    int64_t free_min_res_65364;
    bool free_loop_cond_65369;
    int64_t free_last_res_69623;
    int64_t free_min_arg_69642;
    int64_t free_min_arg_69643;
    int64_t free_min_res_69644;
    float free_max_res_69648;
    unsigned char *free_mem_71312;
    unsigned char *free_mem_71315;
    unsigned char *free_mem_71318;
    int64_t free_bytes_71320;
    unsigned char *free_mem_71321;
    unsigned char *free_mem_71396;
    unsigned char *free_mem_71399;
};
struct futhark_mc_task_77383 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_69623;
    unsigned char *free_mem_71315;
    unsigned char *free_mem_71321;
    int64_t free_min_res_76158;
    int64_t free_max_res_76223;
    float free_defunc_1_f_res_76242;
    unsigned char *free_mem_76243;
    unsigned char *free_mem_76244;
};
struct futhark_mc_segmap_parloop_struct_77385 {
    struct futhark_context *ctx;
    int64_t free_q_65346;
    int64_t free_last_res_69623;
    unsigned char *free_mem_71315;
    unsigned char *free_mem_71321;
    int64_t free_min_res_76158;
    int64_t free_max_res_76223;
    float free_defunc_1_f_res_76242;
    unsigned char *free_mem_76243;
    unsigned char *free_mem_76244;
};
static int futhark_mc_segmap_parloop_77386(void *args, int64_t start,
                                           int64_t end, int flat_tid_76780,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77385
    *futhark_mc_segmap_parloop_struct_77385 =
    (struct futhark_mc_segmap_parloop_struct_77385 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77385->ctx;
    uint64_t futhark_mc_segmap_parloop_77386_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77386_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77385->free_q_65346;
    int64_t last_res_69623 =
            futhark_mc_segmap_parloop_struct_77385->free_last_res_69623;
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_segmap_parloop_struct_77385->free_mem_71315,
                                 .size =0, .references =NULL};
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_segmap_parloop_struct_77385->free_mem_71321,
                                 .size =0, .references =NULL};
    int64_t min_res_76158 =
            futhark_mc_segmap_parloop_struct_77385->free_min_res_76158;
    int64_t max_res_76223 =
            futhark_mc_segmap_parloop_struct_77385->free_max_res_76223;
    float defunc_1_f_res_76242 =
          futhark_mc_segmap_parloop_struct_77385->free_defunc_1_f_res_76242;
    struct memblock mem_76243 = {.desc ="mem_76243", .mem =
                                 futhark_mc_segmap_parloop_struct_77385->free_mem_76243,
                                 .size =0, .references =NULL};
    struct memblock mem_76244 = {.desc ="mem_76244", .mem =
                                 futhark_mc_segmap_parloop_struct_77385->free_mem_76244,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76858 = start;
    
    for (; iter_76858 < end; iter_76858++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76862 = q_65346;
        int64_t gtid_76781 = iter_76858;
        int64_t remnant_76863 = iter_76858 - gtid_76781;
        float x_76782;
        
        x_76782 = ((float *) mem_71321.mem)[gtid_76781];
        
        bool cond_76783 = sle64(last_res_69623, gtid_76781);
        int64_t defunc_0_f_res_76784;
        
        if (cond_76783) {
            defunc_0_f_res_76784 = (int64_t) 0;
        } else {
            int64_t i_76859 = add64(max_res_76223, gtid_76781);
            int64_t defunc_0_add_arg_76860;
            
            defunc_0_add_arg_76860 = ((int64_t *) mem_71315.mem)[i_76859];
            
            int64_t defunc_1_add_res_76861 = add64((int64_t) 1,
                                                   defunc_0_add_arg_76860);
            
            defunc_0_f_res_76784 = defunc_1_add_res_76861;
        }
        
        int64_t binop_p_76788 = sub64(defunc_0_f_res_76784, min_res_76158);
        float defunc_0_f_res_76789 = sitofp_i64_f32(binop_p_76788);
        float abs_res_76790 = (float) fabs(defunc_0_f_res_76789);
        float tmp1_76791 = abs_res_76790 / defunc_1_f_res_76242;
        float x_76792 = tmp1_76791 * tmp1_76791;
        float y_76793 = tmp1_76791 * x_76792;
        float tmp2_76794 = 1.0F - y_76793;
        float x_76795 = tmp2_76794 * tmp2_76794;
        float tmp3_76796 = tmp2_76794 * x_76795;
        float tmp4_76797 = x_76782 * tmp3_76796;
        
        ((float *) mem_76243.mem)[gtid_76781] = defunc_0_f_res_76789;
        ((float *) mem_76244.mem)[gtid_76781] = tmp4_76797;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77386_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77386_end -
                 futhark_mc_segmap_parloop_77386_start;
        
        ctx->futhark_mc_segmap_parloop_77386_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77386_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77386_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77384(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76780 = tid;
    int num_tasks_76857 = info.nsubtasks;
    struct futhark_mc_task_77383 *futhark_mc_task_77383 =
                                 (struct futhark_mc_task_77383 *) args;
    struct futhark_context *ctx = futhark_mc_task_77383->ctx;
    uint64_t futhark_mc_segmap_task_77384_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77384_start = get_wall_time();
    
    int64_t q_65346 = futhark_mc_task_77383->free_q_65346;
    int64_t last_res_69623 = futhark_mc_task_77383->free_last_res_69623;
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_task_77383->free_mem_71315, .size =
                                 0, .references =NULL};
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_task_77383->free_mem_71321, .size =
                                 0, .references =NULL};
    int64_t min_res_76158 = futhark_mc_task_77383->free_min_res_76158;
    int64_t max_res_76223 = futhark_mc_task_77383->free_max_res_76223;
    float defunc_1_f_res_76242 =
          futhark_mc_task_77383->free_defunc_1_f_res_76242;
    struct memblock mem_76243 = {.desc ="mem_76243", .mem =
                                 futhark_mc_task_77383->free_mem_76243, .size =
                                 0, .references =NULL};
    struct memblock mem_76244 = {.desc ="mem_76244", .mem =
                                 futhark_mc_task_77383->free_mem_76244, .size =
                                 0, .references =NULL};
    int64_t iter_76858;
    struct futhark_mc_segmap_parloop_struct_77385
    futhark_mc_segmap_parloop_struct_77385;
    
    futhark_mc_segmap_parloop_struct_77385.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77385.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77385.free_last_res_69623 = last_res_69623;
    futhark_mc_segmap_parloop_struct_77385.free_mem_71315 = mem_71315.mem;
    futhark_mc_segmap_parloop_struct_77385.free_mem_71321 = mem_71321.mem;
    futhark_mc_segmap_parloop_struct_77385.free_min_res_76158 = min_res_76158;
    futhark_mc_segmap_parloop_struct_77385.free_max_res_76223 = max_res_76223;
    futhark_mc_segmap_parloop_struct_77385.free_defunc_1_f_res_76242 =
        defunc_1_f_res_76242;
    futhark_mc_segmap_parloop_struct_77385.free_mem_76243 = mem_76243.mem;
    futhark_mc_segmap_parloop_struct_77385.free_mem_76244 = mem_76244.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77386_task;
    
    futhark_mc_segmap_parloop_77386_task.name =
        "futhark_mc_segmap_parloop_77386";
    futhark_mc_segmap_parloop_77386_task.fn = futhark_mc_segmap_parloop_77386;
    futhark_mc_segmap_parloop_77386_task.args =
        &futhark_mc_segmap_parloop_struct_77385;
    futhark_mc_segmap_parloop_77386_task.iterations = iterations;
    futhark_mc_segmap_parloop_77386_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77386_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77386_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77386_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77386_task);
    
    if (futhark_mc_segmap_parloop_77386_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77386_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77386_total_end -
                 futhark_mc_segmap_parloop_77386_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77386_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77386_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77386_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77384_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77384_end -
                 futhark_mc_segmap_task_77384_start;
        
        ctx->futhark_mc_segmap_task_77384_runs[tid]++;
        ctx->futhark_mc_segmap_task_77384_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77384_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77387 {
    struct futhark_context *ctx;
    unsigned char *free_mem_76243;
    unsigned char *free_mem_76244;
    float *retval_defunc_2_reduce_res_76267;
    float *retval_defunc_2_reduce_res_76268;
    float *retval_defunc_2_reduce_res_76269;
    float *retval_defunc_2_reduce_res_76270;
    float *retval_defunc_2_reduce_res_76271;
    unsigned char *retval_mem_76265;
    unsigned char *retval_mem_76266;
};
struct futhark_mc_segred_stage_1_parloop_struct_77394 {
    struct futhark_context *ctx;
    unsigned char *free_mem_76243;
    unsigned char *free_mem_76244;
    unsigned char *free_mem_76265;
    unsigned char *free_mem_76266;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_76865;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_76867;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_76869;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_76871;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_76873;
};
static int futhark_mc_segred_stage_1_parloop_77395(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_76798, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77394
    *futhark_mc_segred_stage_1_parloop_struct_77394 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77394 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77394->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77395_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77395_start = get_wall_time();
    
    struct memblock mem_76243 = {.desc ="mem_76243", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77394->free_mem_76243,
                                 .size =0, .references =NULL};
    struct memblock mem_76244 = {.desc ="mem_76244", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77394->free_mem_76244,
                                 .size =0, .references =NULL};
    struct memblock mem_76265 = {.desc ="mem_76265", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77394->free_mem_76265,
                                 .size =0, .references =NULL};
    struct memblock mem_76266 = {.desc ="mem_76266", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77394->free_mem_76266,
                                 .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_76865 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_76865",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77394->free_reduce_stage_1_tid_res_arr_mem_76865,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_76867 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_76867",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77394->free_reduce_stage_1_tid_res_arr_mem_76867,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_76869 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_76869",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77394->free_reduce_stage_1_tid_res_arr_mem_76869,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_76871 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_76871",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77394->free_reduce_stage_1_tid_res_arr_mem_76871,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_76873 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_76873",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77394->free_reduce_stage_1_tid_res_arr_mem_76873,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76875 = start;
    float x_76800;
    float x_76801;
    float x_76803;
    float x_76804;
    float x_76806;
    float x_76807;
    float x_76809;
    float x_76810;
    float x_76812;
    float x_76813;
    float local_acc_76876 = 0.0F;
    float local_acc_76877 = 0.0F;
    float local_acc_76878 = 0.0F;
    float local_acc_76879 = 0.0F;
    float local_acc_76880 = 0.0F;
    
    for (; iter_76875 < end; iter_76875++) {
        int64_t gtid_76799 = iter_76875;
        float x_76815;
        
        x_76815 = ((float *) mem_76243.mem)[gtid_76799];
        
        float x_76816;
        
        x_76816 = ((float *) mem_76244.mem)[gtid_76799];
        
        float defunc_1_f_res_76817 = x_76815 * x_76816;
        float defunc_1_f_res_76818 = x_76815 * defunc_1_f_res_76817;
        float defunc_1_f_res_76819 = x_76815 * defunc_1_f_res_76818;
        float defunc_1_f_res_76820 = x_76815 * defunc_1_f_res_76819;
        
        // save map-out results
        {
            ((float *) mem_76265.mem)[gtid_76799] = defunc_1_f_res_76818;
            ((float *) mem_76266.mem)[gtid_76799] = defunc_1_f_res_76817;
        }
        // Load accum params
        {
            x_76800 = local_acc_76876;
        }
        // Load next params
        {
            x_76801 = x_76816;
        }
        // Red body
        {
            float defunc_1_op_res_76802 = x_76800 + x_76801;
            
            local_acc_76876 = defunc_1_op_res_76802;
        }
        // Load accum params
        {
            x_76803 = local_acc_76877;
        }
        // Load next params
        {
            x_76804 = defunc_1_f_res_76817;
        }
        // Red body
        {
            float defunc_1_op_res_76805 = x_76803 + x_76804;
            
            local_acc_76877 = defunc_1_op_res_76805;
        }
        // Load accum params
        {
            x_76806 = local_acc_76878;
        }
        // Load next params
        {
            x_76807 = defunc_1_f_res_76818;
        }
        // Red body
        {
            float defunc_1_op_res_76808 = x_76806 + x_76807;
            
            local_acc_76878 = defunc_1_op_res_76808;
        }
        // Load accum params
        {
            x_76809 = local_acc_76879;
        }
        // Load next params
        {
            x_76810 = defunc_1_f_res_76819;
        }
        // Red body
        {
            float defunc_1_op_res_76811 = x_76809 + x_76810;
            
            local_acc_76879 = defunc_1_op_res_76811;
        }
        // Load accum params
        {
            x_76812 = local_acc_76880;
        }
        // Load next params
        {
            x_76813 = defunc_1_f_res_76820;
        }
        // Red body
        {
            float defunc_1_op_res_76814 = x_76812 + x_76813;
            
            local_acc_76880 = defunc_1_op_res_76814;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_76865.mem)[flat_tid_76798] =
        local_acc_76876;
    ((float *) reduce_stage_1_tid_res_arr_mem_76867.mem)[flat_tid_76798] =
        local_acc_76877;
    ((float *) reduce_stage_1_tid_res_arr_mem_76869.mem)[flat_tid_76798] =
        local_acc_76878;
    ((float *) reduce_stage_1_tid_res_arr_mem_76871.mem)[flat_tid_76798] =
        local_acc_76879;
    ((float *) reduce_stage_1_tid_res_arr_mem_76873.mem)[flat_tid_76798] =
        local_acc_76880;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77395_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77395_end -
                 futhark_mc_segred_stage_1_parloop_77395_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77395_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77395_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77395_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77388(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76798 = tid;
    int num_tasks_76864 = info.nsubtasks;
    struct futhark_mc_task_77387 *futhark_mc_task_77387 =
                                 (struct futhark_mc_task_77387 *) args;
    struct futhark_context *ctx = futhark_mc_task_77387->ctx;
    uint64_t futhark_mc_segred_task_77388_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77388_start = get_wall_time();
    
    struct memblock mem_76243 = {.desc ="mem_76243", .mem =
                                 futhark_mc_task_77387->free_mem_76243, .size =
                                 0, .references =NULL};
    struct memblock mem_76244 = {.desc ="mem_76244", .mem =
                                 futhark_mc_task_77387->free_mem_76244, .size =
                                 0, .references =NULL};
    float defunc_2_reduce_res_76267 =
          *futhark_mc_task_77387->retval_defunc_2_reduce_res_76267;
    float defunc_2_reduce_res_76268 =
          *futhark_mc_task_77387->retval_defunc_2_reduce_res_76268;
    float defunc_2_reduce_res_76269 =
          *futhark_mc_task_77387->retval_defunc_2_reduce_res_76269;
    float defunc_2_reduce_res_76270 =
          *futhark_mc_task_77387->retval_defunc_2_reduce_res_76270;
    float defunc_2_reduce_res_76271 =
          *futhark_mc_task_77387->retval_defunc_2_reduce_res_76271;
    struct memblock mem_76265 = {.desc ="mem_76265", .mem =
                                 futhark_mc_task_77387->retval_mem_76265,
                                 .size =0, .references =NULL};
    struct memblock mem_76266 = {.desc ="mem_76266", .mem =
                                 futhark_mc_task_77387->retval_mem_76266,
                                 .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_76865_cached_sizze_77389 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_76865 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_76867_cached_sizze_77390 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_76867 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_76869_cached_sizze_77391 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_76869 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_76871_cached_sizze_77392 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_76871 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_76873_cached_sizze_77393 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_76873 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_76865_cached_sizze_77389 <
        (size_t) ((int64_t) 4 * num_tasks_76864)) {
        reduce_stage_1_tid_res_arr_mem_76865 =
            realloc(reduce_stage_1_tid_res_arr_mem_76865, (int64_t) 4 *
                    num_tasks_76864);
        reduce_stage_1_tid_res_arr_mem_76865_cached_sizze_77389 = (int64_t) 4 *
            num_tasks_76864;
    }
    if (reduce_stage_1_tid_res_arr_mem_76867_cached_sizze_77390 <
        (size_t) ((int64_t) 4 * num_tasks_76864)) {
        reduce_stage_1_tid_res_arr_mem_76867 =
            realloc(reduce_stage_1_tid_res_arr_mem_76867, (int64_t) 4 *
                    num_tasks_76864);
        reduce_stage_1_tid_res_arr_mem_76867_cached_sizze_77390 = (int64_t) 4 *
            num_tasks_76864;
    }
    if (reduce_stage_1_tid_res_arr_mem_76869_cached_sizze_77391 <
        (size_t) ((int64_t) 4 * num_tasks_76864)) {
        reduce_stage_1_tid_res_arr_mem_76869 =
            realloc(reduce_stage_1_tid_res_arr_mem_76869, (int64_t) 4 *
                    num_tasks_76864);
        reduce_stage_1_tid_res_arr_mem_76869_cached_sizze_77391 = (int64_t) 4 *
            num_tasks_76864;
    }
    if (reduce_stage_1_tid_res_arr_mem_76871_cached_sizze_77392 <
        (size_t) ((int64_t) 4 * num_tasks_76864)) {
        reduce_stage_1_tid_res_arr_mem_76871 =
            realloc(reduce_stage_1_tid_res_arr_mem_76871, (int64_t) 4 *
                    num_tasks_76864);
        reduce_stage_1_tid_res_arr_mem_76871_cached_sizze_77392 = (int64_t) 4 *
            num_tasks_76864;
    }
    if (reduce_stage_1_tid_res_arr_mem_76873_cached_sizze_77393 <
        (size_t) ((int64_t) 4 * num_tasks_76864)) {
        reduce_stage_1_tid_res_arr_mem_76873 =
            realloc(reduce_stage_1_tid_res_arr_mem_76873, (int64_t) 4 *
                    num_tasks_76864);
        reduce_stage_1_tid_res_arr_mem_76873_cached_sizze_77393 = (int64_t) 4 *
            num_tasks_76864;
    }
    
    int64_t iter_76875;
    struct futhark_mc_segred_stage_1_parloop_struct_77394
    futhark_mc_segred_stage_1_parloop_struct_77394;
    
    futhark_mc_segred_stage_1_parloop_struct_77394.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_mem_76243 =
        mem_76243.mem;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_mem_76244 =
        mem_76244.mem;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_mem_76265 =
        mem_76265.mem;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_mem_76266 =
        mem_76266.mem;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_reduce_stage_1_tid_res_arr_mem_76865 =
        reduce_stage_1_tid_res_arr_mem_76865;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_reduce_stage_1_tid_res_arr_mem_76867 =
        reduce_stage_1_tid_res_arr_mem_76867;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_reduce_stage_1_tid_res_arr_mem_76869 =
        reduce_stage_1_tid_res_arr_mem_76869;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_reduce_stage_1_tid_res_arr_mem_76871 =
        reduce_stage_1_tid_res_arr_mem_76871;
    futhark_mc_segred_stage_1_parloop_struct_77394.free_reduce_stage_1_tid_res_arr_mem_76873 =
        reduce_stage_1_tid_res_arr_mem_76873;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77395_task;
    
    futhark_mc_segred_stage_1_parloop_77395_task.name =
        "futhark_mc_segred_stage_1_parloop_77395";
    futhark_mc_segred_stage_1_parloop_77395_task.fn =
        futhark_mc_segred_stage_1_parloop_77395;
    futhark_mc_segred_stage_1_parloop_77395_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77394;
    futhark_mc_segred_stage_1_parloop_77395_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77395_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77395_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77395_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77395_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77395_task);
    
    if (futhark_mc_segred_stage_1_parloop_77395_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77395_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77395_total_end -
                 futhark_mc_segred_stage_1_parloop_77395_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77395_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77395_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77395_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_76267 = 0.0F;
        defunc_2_reduce_res_76268 = 0.0F;
        defunc_2_reduce_res_76269 = 0.0F;
        defunc_2_reduce_res_76270 = 0.0F;
        defunc_2_reduce_res_76271 = 0.0F;
    }
    
    float x_76881;
    float x_76882;
    float x_76884;
    float x_76885;
    float x_76887;
    float x_76888;
    float x_76890;
    float x_76891;
    float x_76893;
    float x_76894;
    
    for (int32_t i_76896 = 0; i_76896 < num_tasks_76864; i_76896++) {
        flat_tid_76798 = i_76896;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_76881 = defunc_2_reduce_res_76267;
            }
            // load next params
            {
                x_76882 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_76865)[flat_tid_76798];
            }
            // red body
            {
                float defunc_1_op_res_76883 = x_76881 + x_76882;
                
                defunc_2_reduce_res_76267 = defunc_1_op_res_76883;
            }
            // load acc params
            {
                x_76884 = defunc_2_reduce_res_76268;
            }
            // load next params
            {
                x_76885 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_76867)[flat_tid_76798];
            }
            // red body
            {
                float defunc_1_op_res_76886 = x_76884 + x_76885;
                
                defunc_2_reduce_res_76268 = defunc_1_op_res_76886;
            }
            // load acc params
            {
                x_76887 = defunc_2_reduce_res_76269;
            }
            // load next params
            {
                x_76888 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_76869)[flat_tid_76798];
            }
            // red body
            {
                float defunc_1_op_res_76889 = x_76887 + x_76888;
                
                defunc_2_reduce_res_76269 = defunc_1_op_res_76889;
            }
            // load acc params
            {
                x_76890 = defunc_2_reduce_res_76270;
            }
            // load next params
            {
                x_76891 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_76871)[flat_tid_76798];
            }
            // red body
            {
                float defunc_1_op_res_76892 = x_76890 + x_76891;
                
                defunc_2_reduce_res_76270 = defunc_1_op_res_76892;
            }
            // load acc params
            {
                x_76893 = defunc_2_reduce_res_76271;
            }
            // load next params
            {
                x_76894 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_76873)[flat_tid_76798];
            }
            // red body
            {
                float defunc_1_op_res_76895 = x_76893 + x_76894;
                
                defunc_2_reduce_res_76271 = defunc_1_op_res_76895;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_76865);
        free(reduce_stage_1_tid_res_arr_mem_76867);
        free(reduce_stage_1_tid_res_arr_mem_76869);
        free(reduce_stage_1_tid_res_arr_mem_76871);
        free(reduce_stage_1_tid_res_arr_mem_76873);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77388_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77388_end -
                 futhark_mc_segred_task_77388_start;
        
        ctx->futhark_mc_segred_task_77388_runs[tid]++;
        ctx->futhark_mc_segred_task_77388_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77388_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77387->retval_defunc_2_reduce_res_76267 =
            defunc_2_reduce_res_76267;
        *futhark_mc_task_77387->retval_defunc_2_reduce_res_76268 =
            defunc_2_reduce_res_76268;
        *futhark_mc_task_77387->retval_defunc_2_reduce_res_76269 =
            defunc_2_reduce_res_76269;
        *futhark_mc_task_77387->retval_defunc_2_reduce_res_76270 =
            defunc_2_reduce_res_76270;
        *futhark_mc_task_77387->retval_defunc_2_reduce_res_76271 =
            defunc_2_reduce_res_76271;
        futhark_mc_task_77387->retval_mem_76265 = mem_76265.mem;
        futhark_mc_task_77387->retval_mem_76266 = mem_76266.mem;
    }
    return err;
}
struct futhark_mc_task_77396 {
    struct futhark_context *ctx;
    int64_t free_last_res_69623;
    unsigned char *free_mem_71312;
    int64_t free_max_res_76223;
    unsigned char *free_mem_76244;
    unsigned char *free_mem_76265;
    unsigned char *free_mem_76266;
    float free_a12_76317;
    float free_b12_76318;
    float free_c12_76319;
    float free_b2_76320;
    float free_c2_76321;
    float *retval_defunc_2_reduce_res_76322;
    float *retval_defunc_2_reduce_res_76323;
};
struct futhark_mc_segred_stage_1_parloop_struct_77400 {
    struct futhark_context *ctx;
    int64_t free_last_res_69623;
    unsigned char *free_mem_71312;
    int64_t free_max_res_76223;
    unsigned char *free_mem_76244;
    unsigned char *free_mem_76265;
    unsigned char *free_mem_76266;
    float free_a12_76317;
    float free_b12_76318;
    float free_c12_76319;
    float free_b2_76320;
    float free_c2_76321;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_76898;
    unsigned char *free_reduce_stage_1_tid_res_arr_mem_76900;
};
static int futhark_mc_segred_stage_1_parloop_77401(void *args, int64_t start,
                                                   int64_t end,
                                                   int flat_tid_76821, int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_77400
    *futhark_mc_segred_stage_1_parloop_struct_77400 =
    (struct futhark_mc_segred_stage_1_parloop_struct_77400 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_77400->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_77401_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77401_start = get_wall_time();
    
    int64_t last_res_69623 =
            futhark_mc_segred_stage_1_parloop_struct_77400->free_last_res_69623;
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77400->free_mem_71312,
                                 .size =0, .references =NULL};
    int64_t max_res_76223 =
            futhark_mc_segred_stage_1_parloop_struct_77400->free_max_res_76223;
    struct memblock mem_76244 = {.desc ="mem_76244", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77400->free_mem_76244,
                                 .size =0, .references =NULL};
    struct memblock mem_76265 = {.desc ="mem_76265", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77400->free_mem_76265,
                                 .size =0, .references =NULL};
    struct memblock mem_76266 = {.desc ="mem_76266", .mem =
                                 futhark_mc_segred_stage_1_parloop_struct_77400->free_mem_76266,
                                 .size =0, .references =NULL};
    float a12_76317 =
          futhark_mc_segred_stage_1_parloop_struct_77400->free_a12_76317;
    float b12_76318 =
          futhark_mc_segred_stage_1_parloop_struct_77400->free_b12_76318;
    float c12_76319 =
          futhark_mc_segred_stage_1_parloop_struct_77400->free_c12_76319;
    float b2_76320 =
          futhark_mc_segred_stage_1_parloop_struct_77400->free_b2_76320;
    float c2_76321 =
          futhark_mc_segred_stage_1_parloop_struct_77400->free_c2_76321;
    struct memblock reduce_stage_1_tid_res_arr_mem_76898 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_76898",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77400->free_reduce_stage_1_tid_res_arr_mem_76898,
                                                            .size =0,
                                                            .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_76900 = {.desc =
                                                            "reduce_stage_1_tid_res_arr_mem_76900",
                                                            .mem =
                                                            futhark_mc_segred_stage_1_parloop_struct_77400->free_reduce_stage_1_tid_res_arr_mem_76900,
                                                            .size =0,
                                                            .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_76902 = start;
    float x_76823;
    float x_76824;
    float x_76826;
    float x_76827;
    float local_acc_76903 = 0.0F;
    float local_acc_76904 = 0.0F;
    
    for (; iter_76902 < end; iter_76902++) {
        int64_t gtid_76822 = iter_76902;
        float x_76829;
        
        x_76829 = ((float *) mem_76244.mem)[gtid_76822];
        
        float x_76830;
        
        x_76830 = ((float *) mem_76266.mem)[gtid_76822];
        
        float x_76831;
        
        x_76831 = ((float *) mem_76265.mem)[gtid_76822];
        
        bool cond_76832 = sle64(last_res_69623, gtid_76822);
        float defunc_0_f_res_76833;
        
        if (cond_76832) {
            defunc_0_f_res_76833 = 0.0F;
        } else {
            int64_t i_76834 = add64(max_res_76223, gtid_76822);
            float defunc_0_add_arg_76835;
            
            defunc_0_add_arg_76835 = ((float *) mem_71312.mem)[i_76834];
            defunc_0_f_res_76833 = defunc_0_add_arg_76835;
        }
        
        float x_76836 = a12_76317 * x_76829;
        float y_76837 = b12_76318 * x_76830;
        float x_76838 = x_76836 + y_76837;
        float y_76839 = c12_76319 * x_76831;
        float x_76840 = x_76838 + y_76839;
        float defunc_9_fit_fun_res_76841 = defunc_0_f_res_76833 * x_76840;
        float x_76842 = b12_76318 * x_76829;
        float y_76843 = b2_76320 * x_76830;
        float x_76844 = x_76842 + y_76843;
        float y_76845 = c2_76321 * x_76831;
        float x_76846 = x_76844 + y_76845;
        float defunc_9_slope_fun_res_76847 = defunc_0_f_res_76833 * x_76846;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_76823 = local_acc_76903;
        }
        // Load next params
        {
            x_76824 = defunc_9_fit_fun_res_76841;
        }
        // Red body
        {
            float defunc_1_op_res_76825 = x_76823 + x_76824;
            
            local_acc_76903 = defunc_1_op_res_76825;
        }
        // Load accum params
        {
            x_76826 = local_acc_76904;
        }
        // Load next params
        {
            x_76827 = defunc_9_slope_fun_res_76847;
        }
        // Red body
        {
            float defunc_1_op_res_76828 = x_76826 + x_76827;
            
            local_acc_76904 = defunc_1_op_res_76828;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_76898.mem)[flat_tid_76821] =
        local_acc_76903;
    ((float *) reduce_stage_1_tid_res_arr_mem_76900.mem)[flat_tid_76821] =
        local_acc_76904;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77401_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77401_end -
                 futhark_mc_segred_stage_1_parloop_77401_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_77401_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_77401_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_77401_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_77397(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76821 = tid;
    int num_tasks_76897 = info.nsubtasks;
    struct futhark_mc_task_77396 *futhark_mc_task_77396 =
                                 (struct futhark_mc_task_77396 *) args;
    struct futhark_context *ctx = futhark_mc_task_77396->ctx;
    uint64_t futhark_mc_segred_task_77397_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_77397_start = get_wall_time();
    
    int64_t last_res_69623 = futhark_mc_task_77396->free_last_res_69623;
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_task_77396->free_mem_71312, .size =
                                 0, .references =NULL};
    int64_t max_res_76223 = futhark_mc_task_77396->free_max_res_76223;
    struct memblock mem_76244 = {.desc ="mem_76244", .mem =
                                 futhark_mc_task_77396->free_mem_76244, .size =
                                 0, .references =NULL};
    struct memblock mem_76265 = {.desc ="mem_76265", .mem =
                                 futhark_mc_task_77396->free_mem_76265, .size =
                                 0, .references =NULL};
    struct memblock mem_76266 = {.desc ="mem_76266", .mem =
                                 futhark_mc_task_77396->free_mem_76266, .size =
                                 0, .references =NULL};
    float a12_76317 = futhark_mc_task_77396->free_a12_76317;
    float b12_76318 = futhark_mc_task_77396->free_b12_76318;
    float c12_76319 = futhark_mc_task_77396->free_c12_76319;
    float b2_76320 = futhark_mc_task_77396->free_b2_76320;
    float c2_76321 = futhark_mc_task_77396->free_c2_76321;
    float defunc_2_reduce_res_76322 =
          *futhark_mc_task_77396->retval_defunc_2_reduce_res_76322;
    float defunc_2_reduce_res_76323 =
          *futhark_mc_task_77396->retval_defunc_2_reduce_res_76323;
    size_t reduce_stage_1_tid_res_arr_mem_76898_cached_sizze_77398 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_76898 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_76900_cached_sizze_77399 = 0;
    unsigned char *reduce_stage_1_tid_res_arr_mem_76900 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_76898_cached_sizze_77398 <
        (size_t) ((int64_t) 4 * num_tasks_76897)) {
        reduce_stage_1_tid_res_arr_mem_76898 =
            realloc(reduce_stage_1_tid_res_arr_mem_76898, (int64_t) 4 *
                    num_tasks_76897);
        reduce_stage_1_tid_res_arr_mem_76898_cached_sizze_77398 = (int64_t) 4 *
            num_tasks_76897;
    }
    if (reduce_stage_1_tid_res_arr_mem_76900_cached_sizze_77399 <
        (size_t) ((int64_t) 4 * num_tasks_76897)) {
        reduce_stage_1_tid_res_arr_mem_76900 =
            realloc(reduce_stage_1_tid_res_arr_mem_76900, (int64_t) 4 *
                    num_tasks_76897);
        reduce_stage_1_tid_res_arr_mem_76900_cached_sizze_77399 = (int64_t) 4 *
            num_tasks_76897;
    }
    
    int64_t iter_76902;
    struct futhark_mc_segred_stage_1_parloop_struct_77400
    futhark_mc_segred_stage_1_parloop_struct_77400;
    
    futhark_mc_segred_stage_1_parloop_struct_77400.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_last_res_69623 =
        last_res_69623;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_mem_71312 =
        mem_71312.mem;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_max_res_76223 =
        max_res_76223;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_mem_76244 =
        mem_76244.mem;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_mem_76265 =
        mem_76265.mem;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_mem_76266 =
        mem_76266.mem;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_a12_76317 = a12_76317;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_b12_76318 = b12_76318;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_c12_76319 = c12_76319;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_b2_76320 = b2_76320;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_c2_76321 = c2_76321;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_reduce_stage_1_tid_res_arr_mem_76898 =
        reduce_stage_1_tid_res_arr_mem_76898;
    futhark_mc_segred_stage_1_parloop_struct_77400.free_reduce_stage_1_tid_res_arr_mem_76900 =
        reduce_stage_1_tid_res_arr_mem_76900;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_77401_task;
    
    futhark_mc_segred_stage_1_parloop_77401_task.name =
        "futhark_mc_segred_stage_1_parloop_77401";
    futhark_mc_segred_stage_1_parloop_77401_task.fn =
        futhark_mc_segred_stage_1_parloop_77401;
    futhark_mc_segred_stage_1_parloop_77401_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_77400;
    futhark_mc_segred_stage_1_parloop_77401_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_77401_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_77401_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_77401_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_77401_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_77401_task);
    
    if (futhark_mc_segred_stage_1_parloop_77401_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_77401_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_77401_total_end -
                 futhark_mc_segred_stage_1_parloop_77401_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77401_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77401_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_77401_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_76322 = 0.0F;
        defunc_2_reduce_res_76323 = 0.0F;
    }
    
    float x_76905;
    float x_76906;
    float x_76908;
    float x_76909;
    
    for (int32_t i_76911 = 0; i_76911 < num_tasks_76897; i_76911++) {
        flat_tid_76821 = i_76911;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_76905 = defunc_2_reduce_res_76322;
            }
            // load next params
            {
                x_76906 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_76898)[flat_tid_76821];
            }
            // red body
            {
                float defunc_1_op_res_76907 = x_76905 + x_76906;
                
                defunc_2_reduce_res_76322 = defunc_1_op_res_76907;
            }
            // load acc params
            {
                x_76908 = defunc_2_reduce_res_76323;
            }
            // load next params
            {
                x_76909 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_76900)[flat_tid_76821];
            }
            // red body
            {
                float defunc_1_op_res_76910 = x_76908 + x_76909;
                
                defunc_2_reduce_res_76323 = defunc_1_op_res_76910;
            }
        }
    }
    
  cleanup:
    {
        free(reduce_stage_1_tid_res_arr_mem_76898);
        free(reduce_stage_1_tid_res_arr_mem_76900);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_77397_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_77397_end -
                 futhark_mc_segred_task_77397_start;
        
        ctx->futhark_mc_segred_task_77397_runs[tid]++;
        ctx->futhark_mc_segred_task_77397_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_77397_iter[tid] += iterations;
    }
    if (err == 0) {
        *futhark_mc_task_77396->retval_defunc_2_reduce_res_76322 =
            defunc_2_reduce_res_76322;
        *futhark_mc_task_77396->retval_defunc_2_reduce_res_76323 =
            defunc_2_reduce_res_76323;
    }
    return err;
}
static int futhark_mc_segmap_parloop_77378(void *args, int64_t start,
                                           int64_t end, int flat_tid_76155,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77377
    *futhark_mc_segmap_parloop_struct_77377 =
    (struct futhark_mc_segmap_parloop_struct_77377 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77377->ctx;
    uint64_t futhark_mc_segmap_parloop_77378_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77378_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77377->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77377->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77377->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77377->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77377->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77377->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77377->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77377->free_loop_cond_65369;
    int64_t last_res_69623 =
            futhark_mc_segmap_parloop_struct_77377->free_last_res_69623;
    int64_t min_arg_69642 =
            futhark_mc_segmap_parloop_struct_77377->free_min_arg_69642;
    int64_t min_arg_69643 =
            futhark_mc_segmap_parloop_struct_77377->free_min_arg_69643;
    int64_t min_res_69644 =
            futhark_mc_segmap_parloop_struct_77377->free_min_res_69644;
    float max_res_69648 =
          futhark_mc_segmap_parloop_struct_77377->free_max_res_69648;
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_segmap_parloop_struct_77377->free_mem_71312,
                                 .size =0, .references =NULL};
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_segmap_parloop_struct_77377->free_mem_71315,
                                 .size =0, .references =NULL};
    struct memblock mem_71318 = {.desc ="mem_71318", .mem =
                                 futhark_mc_segmap_parloop_struct_77377->free_mem_71318,
                                 .size =0, .references =NULL};
    int64_t bytes_71320 =
            futhark_mc_segmap_parloop_struct_77377->free_bytes_71320;
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_segmap_parloop_struct_77377->free_mem_71321,
                                 .size =0, .references =NULL};
    struct memblock mem_71396 = {.desc ="mem_71396", .mem =
                                 futhark_mc_segmap_parloop_struct_77377->free_mem_71396,
                                 .size =0, .references =NULL};
    struct memblock mem_71399 = {.desc ="mem_71399", .mem =
                                 futhark_mc_segmap_parloop_struct_77377->free_mem_71399,
                                 .size =0, .references =NULL};
    size_t mem_76243_cached_sizze_77379 = 0;
    unsigned char *mem_76243 = NULL;
    size_t mem_76244_cached_sizze_77380 = 0;
    unsigned char *mem_76244 = NULL;
    size_t mem_76265_cached_sizze_77381 = 0;
    unsigned char *mem_76265 = NULL;
    size_t mem_76266_cached_sizze_77382 = 0;
    unsigned char *mem_76266 = NULL;
    int64_t iterations = end - start;
    int64_t iter_76724 = start;
    
    if (mem_76243_cached_sizze_77379 < (size_t) bytes_71320) {
        mem_76243 = realloc(mem_76243, bytes_71320);
        mem_76243_cached_sizze_77379 = bytes_71320;
    }
    if (mem_76244_cached_sizze_77380 < (size_t) bytes_71320) {
        mem_76244 = realloc(mem_76244, bytes_71320);
        mem_76244_cached_sizze_77380 = bytes_71320;
    }
    if (mem_76265_cached_sizze_77381 < (size_t) bytes_71320) {
        mem_76265 = realloc(mem_76265, bytes_71320);
        mem_76265_cached_sizze_77381 = bytes_71320;
    }
    if (mem_76266_cached_sizze_77382 < (size_t) bytes_71320) {
        mem_76266 = realloc(mem_76266, bytes_71320);
        mem_76266_cached_sizze_77382 = bytes_71320;
    }
    for (; iter_76724 < end; iter_76724++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76848 = n_m_65352;
        int64_t gtid_76156 = iter_76724;
        int64_t remnant_76849 = iter_76724 - gtid_76156;
        int64_t min_arg_76157 = mul64(jump_65348, gtid_76156);
        int64_t min_res_76158 = smin64(i_65358, min_arg_76157);
        int64_t defunc_0_g_res_76159 = add64((int64_t) 1, min_res_76158);
        bool init_idx_76160;
        int64_t init_idx_76161;
        int64_t init_idx_76162;
        bool loop_while_76725;
        int64_t low_76726;
        int64_t high_76727;
        
        loop_while_76725 = x_65359;
        low_76726 = (int64_t) 0;
        high_76727 = i_65358;
        while (loop_while_76725) {
            int64_t x_76728 = add64(low_76726, high_76727);
            int64_t mid_76729 = sdiv64(x_76728, (int64_t) 2);
            bool x_76730 = sle64((int64_t) 0, mid_76729);
            bool y_76731 = slt64(mid_76729, n_65344);
            bool bounds_check_76732 = x_76730 && y_76731;
            bool index_certs_76733;
            
            if (!bounds_check_76732) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) mid_76729,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:449: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t mid_id_76734;
            
            mid_id_76734 = ((int64_t *) mem_71318.mem)[mid_76729];
            
            bool cond_76735 = slt64(mid_id_76734, (int64_t) 0);
            int64_t mid_idx_76736;
            
            if (cond_76735) {
                mid_idx_76736 = (int64_t) 9223372036854775807;
            } else {
                mid_idx_76736 = mid_id_76734;
            }
            
            bool cond_76737 = sle64(defunc_0_g_res_76159, mid_idx_76736);
            int64_t loopres_76738;
            int64_t loopres_76739;
            
            if (cond_76737) {
                int64_t loopres_t_res_76740 = sub64(mid_76729, (int64_t) 1);
                
                loopres_76738 = low_76726;
                loopres_76739 = loopres_t_res_76740;
            } else {
                int64_t loopres_f_res_76741 = add64((int64_t) 1, mid_76729);
                
                loopres_76738 = loopres_f_res_76741;
                loopres_76739 = high_76727;
            }
            
            bool loop_cond_76742 = sle64(loopres_76738, loopres_76739);
            bool loop_while_tmp_76850 = loop_cond_76742;
            int64_t low_tmp_76851 = loopres_76738;
            int64_t high_tmp_76852 = loopres_76739;
            
            loop_while_76725 = loop_while_tmp_76850;
            low_76726 = low_tmp_76851;
            high_76727 = high_tmp_76852;
        }
        init_idx_76160 = loop_while_76725;
        init_idx_76161 = low_76726;
        init_idx_76162 = high_76727;
        
        bool idx_76181;
        int64_t idx_76182;
        int64_t idx_76183;
        int64_t idx_76184;
        bool loop_while_76743;
        int64_t l_idx_76744;
        int64_t r_idx_76745;
        int64_t span_76746;
        
        loop_while_76743 = loop_cond_65369;
        l_idx_76744 = init_idx_76161;
        r_idx_76745 = init_idx_76161;
        span_76746 = (int64_t) 1;
        while (loop_while_76743) {
            int64_t max_arg_76747 = sub64(l_idx_76744, (int64_t) 1);
            int64_t max_res_76748 = smax64((int64_t) 0, max_arg_76747);
            int64_t min_arg_76749 = add64((int64_t) 1, r_idx_76745);
            int64_t min_res_76750 = smin64(min_arg_69642, min_arg_76749);
            bool x_76751 = sle64((int64_t) 0, max_res_76748);
            bool y_76752 = slt64(max_res_76748, n_65344);
            bool bounds_check_76753 = x_76751 && y_76752;
            bool index_certs_76754;
            
            if (!bounds_check_76753) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) max_res_76748,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #0  loess.fut:459: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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_76755;
            
            x_76755 = ((int64_t *) mem_71318.mem)[max_res_76748];
            
            int64_t abs_arg_76756 = sub64(x_76755, defunc_0_g_res_76159);
            int64_t abs_res_76757 = abs64(abs_arg_76756);
            bool x_76758 = sle64((int64_t) 0, min_res_76750);
            bool y_76759 = slt64(min_res_76750, n_65344);
            bool bounds_check_76760 = x_76758 && y_76759;
            bool index_certs_76761;
            
            if (!bounds_check_76760) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) min_res_76750,
                              "] out of bounds for array of shape [",
                              (long long) n_65344, "].",
                              "-> #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:442:3-469:10\n   #5  loess.fut:502:15-61\n   #6  loess.fut:589:13-56\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:588:5-590:26\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            int64_t x_76762;
            
            x_76762 = ((int64_t *) mem_71318.mem)[min_res_76750];
            
            int64_t abs_arg_76763 = sub64(x_76762, defunc_0_g_res_76159);
            int64_t abs_res_76764 = abs64(abs_arg_76763);
            bool cond_76765 = max_res_76748 == l_idx_76744;
            int64_t loopres_76766;
            int64_t loopres_76767;
            int64_t loopres_76768;
            
            if (cond_76765) {
                loopres_76766 = l_idx_76744;
                loopres_76767 = r_idx_76745;
                loopres_76768 = min_res_65364;
            } else {
                bool cond_76769 = slt64(abs_res_76757, abs_res_76764);
                bool cond_f_res_76770 = min_res_76750 == r_idx_76745;
                bool x_76771 = !cond_76769;
                bool y_76772 = cond_f_res_76770 && x_76771;
                bool cond_76773 = cond_76769 || y_76772;
                int64_t loopres_f_res_76774;
                
                if (cond_76773) {
                    loopres_f_res_76774 = max_res_76748;
                } else {
                    loopres_f_res_76774 = l_idx_76744;
                }
                
                int64_t loopres_f_res_76775;
                
                if (cond_76773) {
                    loopres_f_res_76775 = r_idx_76745;
                } else {
                    loopres_f_res_76775 = min_res_76750;
                }
                
                int64_t loopres_f_res_76776;
                
                if (cond_76773) {
                    int64_t loopres_f_res_t_res_76777 = add64((int64_t) 1,
                                                              span_76746);
                    
                    loopres_f_res_76776 = loopres_f_res_t_res_76777;
                } else {
                    int64_t loopres_f_res_f_res_76778 = add64((int64_t) 1,
                                                              span_76746);
                    
                    loopres_f_res_76776 = loopres_f_res_f_res_76778;
                }
                loopres_76766 = loopres_f_res_76774;
                loopres_76767 = loopres_f_res_76775;
                loopres_76768 = loopres_f_res_76776;
            }
            
            bool loop_cond_76779 = slt64(loopres_76768, min_res_65364);
            bool loop_while_tmp_76853 = loop_cond_76779;
            int64_t l_idx_tmp_76854 = loopres_76766;
            int64_t r_idx_tmp_76855 = loopres_76767;
            int64_t span_tmp_76856 = loopres_76768;
            
            loop_while_76743 = loop_while_tmp_76853;
            l_idx_76744 = l_idx_tmp_76854;
            r_idx_76745 = r_idx_tmp_76855;
            span_76746 = span_tmp_76856;
        }
        idx_76181 = loop_while_76743;
        idx_76182 = l_idx_76744;
        idx_76183 = r_idx_76745;
        idx_76184 = span_76746;
        
        int64_t min_res_76222 = smin64(min_arg_69643, idx_76182);
        int64_t max_res_76223 = smax64((int64_t) 0, min_res_76222);
        int64_t x_76224 = add64(min_res_69644, max_res_76223);
        int64_t r_76225 = sub64(x_76224, (int64_t) 1);
        bool x_76226 = sle64((int64_t) 0, r_76225);
        bool y_76227 = slt64(r_76225, n_65344);
        bool bounds_check_76228 = x_76226 && y_76227;
        bool index_certs_76229;
        
        if (!bounds_check_76228) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) r_76225,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #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:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_76230;
        
        x_76230 = ((int64_t *) mem_71315.mem)[r_76225];
        
        int64_t abs_arg_76231 = sub64(x_76230, min_res_76158);
        int64_t abs_res_76232 = abs64(abs_arg_76231);
        bool x_76233 = sle64((int64_t) 0, max_res_76223);
        bool y_76234 = slt64(max_res_76223, n_65344);
        bool bounds_check_76235 = x_76233 && y_76234;
        bool index_certs_76236;
        
        if (!bounds_check_76235) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) max_res_76223,
                                   "] out of bounds for array of shape [",
                                   (long long) n_65344, "].",
                                   "-> #0  loess.fut:483:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:479:3-487:25\n   #4  loess.fut:503:16-51\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        int64_t x_76237;
        
        x_76237 = ((int64_t *) mem_71315.mem)[max_res_76223];
        
        int64_t abs_arg_76238 = sub64(x_76237, min_res_76158);
        int64_t abs_res_76239 = abs64(abs_arg_76238);
        int64_t max_res_76240 = smax64(abs_res_76232, abs_res_76239);
        float defunc_0_f_res_76241 = sitofp_i64_f32(max_res_76240);
        float defunc_1_f_res_76242 = max_res_69648 + defunc_0_f_res_76241;
        int64_t flat_tid_76780 = (int64_t) 0;
        int32_t num_tasks_76857;
        struct futhark_mc_task_77383 futhark_mc_task_77383;
        
        futhark_mc_task_77383.ctx = ctx;
        futhark_mc_task_77383.free_q_65346 = q_65346;
        futhark_mc_task_77383.free_last_res_69623 = last_res_69623;
        futhark_mc_task_77383.free_mem_71315 = mem_71315.mem;
        futhark_mc_task_77383.free_mem_71321 = mem_71321.mem;
        futhark_mc_task_77383.free_min_res_76158 = min_res_76158;
        futhark_mc_task_77383.free_max_res_76223 = max_res_76223;
        futhark_mc_task_77383.free_defunc_1_f_res_76242 = defunc_1_f_res_76242;
        futhark_mc_task_77383.free_mem_76243 = mem_76243;
        futhark_mc_task_77383.free_mem_76244 = mem_76244;
        
        struct scheduler_segop futhark_mc_task_77383_task;
        
        futhark_mc_task_77383_task.args = &futhark_mc_task_77383;
        futhark_mc_task_77383_task.top_level_fn = futhark_mc_segmap_task_77384;
        futhark_mc_task_77383_task.name = "futhark_mc_segmap_task_77384";
        futhark_mc_task_77383_task.iterations = q_65346;
        futhark_mc_task_77383_task.task_time =
            &ctx->futhark_mc_segmap_task_77384_total_time;
        futhark_mc_task_77383_task.task_iter =
            &ctx->futhark_mc_segmap_task_77384_total_iter;
        futhark_mc_task_77383_task.sched = STATIC;
        futhark_mc_task_77383_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77384_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77383_task);
        
        if (futhark_mc_segmap_task_77384_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        float defunc_2_reduce_res_76267;
        float defunc_2_reduce_res_76268;
        float defunc_2_reduce_res_76269;
        float defunc_2_reduce_res_76270;
        float defunc_2_reduce_res_76271;
        int64_t flat_tid_76798 = (int64_t) 0;
        int32_t num_tasks_76864;
        
        defunc_2_reduce_res_76267 = 0.0F;
        defunc_2_reduce_res_76268 = 0.0F;
        defunc_2_reduce_res_76269 = 0.0F;
        defunc_2_reduce_res_76270 = 0.0F;
        defunc_2_reduce_res_76271 = 0.0F;
        
        struct futhark_mc_task_77387 futhark_mc_task_77387;
        
        futhark_mc_task_77387.ctx = ctx;
        futhark_mc_task_77387.free_mem_76243 = mem_76243;
        futhark_mc_task_77387.free_mem_76244 = mem_76244;
        futhark_mc_task_77387.retval_defunc_2_reduce_res_76267 =
            &defunc_2_reduce_res_76267;
        futhark_mc_task_77387.retval_defunc_2_reduce_res_76268 =
            &defunc_2_reduce_res_76268;
        futhark_mc_task_77387.retval_defunc_2_reduce_res_76269 =
            &defunc_2_reduce_res_76269;
        futhark_mc_task_77387.retval_defunc_2_reduce_res_76270 =
            &defunc_2_reduce_res_76270;
        futhark_mc_task_77387.retval_defunc_2_reduce_res_76271 =
            &defunc_2_reduce_res_76271;
        futhark_mc_task_77387.retval_mem_76265 = mem_76265;
        futhark_mc_task_77387.retval_mem_76266 = mem_76266;
        
        struct scheduler_segop futhark_mc_task_77387_task;
        
        futhark_mc_task_77387_task.args = &futhark_mc_task_77387;
        futhark_mc_task_77387_task.top_level_fn = futhark_mc_segred_task_77388;
        futhark_mc_task_77387_task.name = "futhark_mc_segred_task_77388";
        futhark_mc_task_77387_task.iterations = q_65346;
        futhark_mc_task_77387_task.task_time =
            &ctx->futhark_mc_segred_task_77388_total_time;
        futhark_mc_task_77387_task.task_iter =
            &ctx->futhark_mc_segred_task_77388_total_iter;
        futhark_mc_task_77387_task.sched = STATIC;
        futhark_mc_task_77387_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77388_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77387_task);
        
        if (futhark_mc_segred_task_77388_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        float x_76297 = defunc_2_reduce_res_76269 * defunc_2_reduce_res_76271;
        float y_76298 = defunc_2_reduce_res_76270 * defunc_2_reduce_res_76270;
        float a12_76299 = x_76297 - y_76298;
        float x_76300 = defunc_2_reduce_res_76269 * defunc_2_reduce_res_76270;
        float y_76301 = defunc_2_reduce_res_76268 * defunc_2_reduce_res_76271;
        float b12_76302 = x_76300 - y_76301;
        float x_76303 = defunc_2_reduce_res_76268 * defunc_2_reduce_res_76270;
        float y_76304 = defunc_2_reduce_res_76269 * defunc_2_reduce_res_76269;
        float c12_76305 = x_76303 - y_76304;
        float x_76306 = defunc_2_reduce_res_76267 * defunc_2_reduce_res_76271;
        float b2_76307 = x_76306 - y_76304;
        float x_76308 = defunc_2_reduce_res_76268 * defunc_2_reduce_res_76269;
        float y_76309 = defunc_2_reduce_res_76267 * defunc_2_reduce_res_76270;
        float c2_76310 = x_76308 - y_76309;
        float x_76311 = defunc_2_reduce_res_76267 * a12_76299;
        float y_76312 = defunc_2_reduce_res_76268 * b12_76302;
        float x_76313 = x_76311 + y_76312;
        float y_76314 = defunc_2_reduce_res_76269 * c12_76305;
        float y_76315 = x_76313 + y_76314;
        float det_76316 = 1.0F / y_76315;
        float a12_76317 = a12_76299 * det_76316;
        float b12_76318 = b12_76302 * det_76316;
        float c12_76319 = c12_76305 * det_76316;
        float b2_76320 = b2_76307 * det_76316;
        float c2_76321 = c2_76310 * det_76316;
        float defunc_2_reduce_res_76322;
        float defunc_2_reduce_res_76323;
        int64_t flat_tid_76821 = (int64_t) 0;
        int32_t num_tasks_76897;
        
        defunc_2_reduce_res_76322 = 0.0F;
        defunc_2_reduce_res_76323 = 0.0F;
        
        struct futhark_mc_task_77396 futhark_mc_task_77396;
        
        futhark_mc_task_77396.ctx = ctx;
        futhark_mc_task_77396.free_last_res_69623 = last_res_69623;
        futhark_mc_task_77396.free_mem_71312 = mem_71312.mem;
        futhark_mc_task_77396.free_max_res_76223 = max_res_76223;
        futhark_mc_task_77396.free_mem_76244 = mem_76244;
        futhark_mc_task_77396.free_mem_76265 = mem_76265;
        futhark_mc_task_77396.free_mem_76266 = mem_76266;
        futhark_mc_task_77396.free_a12_76317 = a12_76317;
        futhark_mc_task_77396.free_b12_76318 = b12_76318;
        futhark_mc_task_77396.free_c12_76319 = c12_76319;
        futhark_mc_task_77396.free_b2_76320 = b2_76320;
        futhark_mc_task_77396.free_c2_76321 = c2_76321;
        futhark_mc_task_77396.retval_defunc_2_reduce_res_76322 =
            &defunc_2_reduce_res_76322;
        futhark_mc_task_77396.retval_defunc_2_reduce_res_76323 =
            &defunc_2_reduce_res_76323;
        
        struct scheduler_segop futhark_mc_task_77396_task;
        
        futhark_mc_task_77396_task.args = &futhark_mc_task_77396;
        futhark_mc_task_77396_task.top_level_fn = futhark_mc_segred_task_77397;
        futhark_mc_task_77396_task.name = "futhark_mc_segred_task_77397";
        futhark_mc_task_77396_task.iterations = q_65346;
        futhark_mc_task_77396_task.task_time =
            &ctx->futhark_mc_segred_task_77397_total_time;
        futhark_mc_task_77396_task.task_iter =
            &ctx->futhark_mc_segred_task_77397_total_iter;
        futhark_mc_task_77396_task.sched = STATIC;
        futhark_mc_task_77396_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_77397_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77396_task);
        
        if (futhark_mc_segred_task_77397_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        ((float *) mem_71396.mem)[gtid_76156] = defunc_2_reduce_res_76322;
        ((float *) mem_71399.mem)[gtid_76156] = defunc_2_reduce_res_76323;
    }
    
  cleanup:
    { }
    free(mem_76243);
    free(mem_76244);
    free(mem_76265);
    free(mem_76266);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77378_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77378_end -
                 futhark_mc_segmap_parloop_77378_start;
        
        ctx->futhark_mc_segmap_parloop_77378_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77378_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77378_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77376(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76155 = tid;
    int num_tasks_76581 = info.nsubtasks;
    struct futhark_mc_task_77368 *futhark_mc_task_77368 =
                                 (struct futhark_mc_task_77368 *) args;
    struct futhark_context *ctx = futhark_mc_task_77368->ctx;
    uint64_t futhark_mc_segmap_nested_task_77376_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77376_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77368->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77368->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77368->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77368->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77368->free_i_65358;
    bool x_65359 = futhark_mc_task_77368->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77368->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77368->free_loop_cond_65369;
    int64_t last_res_69623 = futhark_mc_task_77368->free_last_res_69623;
    int64_t min_arg_69642 = futhark_mc_task_77368->free_min_arg_69642;
    int64_t min_arg_69643 = futhark_mc_task_77368->free_min_arg_69643;
    int64_t min_res_69644 = futhark_mc_task_77368->free_min_res_69644;
    float max_res_69648 = futhark_mc_task_77368->free_max_res_69648;
    struct memblock mem_71312 = {.desc ="mem_71312", .mem =
                                 futhark_mc_task_77368->free_mem_71312, .size =
                                 0, .references =NULL};
    struct memblock mem_71315 = {.desc ="mem_71315", .mem =
                                 futhark_mc_task_77368->free_mem_71315, .size =
                                 0, .references =NULL};
    struct memblock mem_71318 = {.desc ="mem_71318", .mem =
                                 futhark_mc_task_77368->free_mem_71318, .size =
                                 0, .references =NULL};
    int64_t bytes_71320 = futhark_mc_task_77368->free_bytes_71320;
    struct memblock mem_71321 = {.desc ="mem_71321", .mem =
                                 futhark_mc_task_77368->free_mem_71321, .size =
                                 0, .references =NULL};
    struct memblock mem_71396 = {.desc ="mem_71396", .mem =
                                 futhark_mc_task_77368->free_mem_71396, .size =
                                 0, .references =NULL};
    struct memblock mem_71399 = {.desc ="mem_71399", .mem =
                                 futhark_mc_task_77368->free_mem_71399, .size =
                                 0, .references =NULL};
    int64_t iter_76724;
    struct futhark_mc_segmap_parloop_struct_77377
    futhark_mc_segmap_parloop_struct_77377;
    
    futhark_mc_segmap_parloop_struct_77377.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77377.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77377.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77377.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77377.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77377.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77377.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77377.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77377.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77377.free_last_res_69623 = last_res_69623;
    futhark_mc_segmap_parloop_struct_77377.free_min_arg_69642 = min_arg_69642;
    futhark_mc_segmap_parloop_struct_77377.free_min_arg_69643 = min_arg_69643;
    futhark_mc_segmap_parloop_struct_77377.free_min_res_69644 = min_res_69644;
    futhark_mc_segmap_parloop_struct_77377.free_max_res_69648 = max_res_69648;
    futhark_mc_segmap_parloop_struct_77377.free_mem_71312 = mem_71312.mem;
    futhark_mc_segmap_parloop_struct_77377.free_mem_71315 = mem_71315.mem;
    futhark_mc_segmap_parloop_struct_77377.free_mem_71318 = mem_71318.mem;
    futhark_mc_segmap_parloop_struct_77377.free_bytes_71320 = bytes_71320;
    futhark_mc_segmap_parloop_struct_77377.free_mem_71321 = mem_71321.mem;
    futhark_mc_segmap_parloop_struct_77377.free_mem_71396 = mem_71396.mem;
    futhark_mc_segmap_parloop_struct_77377.free_mem_71399 = mem_71399.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77378_task;
    
    futhark_mc_segmap_parloop_77378_task.name =
        "futhark_mc_segmap_parloop_77378";
    futhark_mc_segmap_parloop_77378_task.fn = futhark_mc_segmap_parloop_77378;
    futhark_mc_segmap_parloop_77378_task.args =
        &futhark_mc_segmap_parloop_struct_77377;
    futhark_mc_segmap_parloop_77378_task.iterations = iterations;
    futhark_mc_segmap_parloop_77378_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77378_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77378_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77378_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77378_task);
    
    if (futhark_mc_segmap_parloop_77378_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77378_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77378_total_end -
                 futhark_mc_segmap_parloop_77378_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77378_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77378_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77378_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77376_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77376_end -
                 futhark_mc_segmap_nested_task_77376_start;
        
        ctx->futhark_mc_segmap_nested_task_77376_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77376_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77376_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_77341(void *args, int64_t start,
                                           int64_t end, int flat_tid_69610,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77340
    *futhark_mc_segmap_parloop_struct_77340 =
    (struct futhark_mc_segmap_parloop_struct_77340 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77340->ctx;
    uint64_t futhark_mc_segmap_parloop_77341_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77341_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77340->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77340->free_n_65344;
    int64_t q_65346 = futhark_mc_segmap_parloop_struct_77340->free_q_65346;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77340->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77340->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77340->free_i_65358;
    bool x_65359 = futhark_mc_segmap_parloop_struct_77340->free_x_65359;
    int64_t min_res_65364 =
            futhark_mc_segmap_parloop_struct_77340->free_min_res_65364;
    bool loop_cond_65369 =
         futhark_mc_segmap_parloop_struct_77340->free_loop_cond_65369;
    float i64_res_65370 =
          futhark_mc_segmap_parloop_struct_77340->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_segmap_parloop_struct_77340->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71308 =
            futhark_mc_segmap_parloop_struct_77340->free_bytes_71308;
    int64_t bytes_71311 =
            futhark_mc_segmap_parloop_struct_77340->free_bytes_71311;
    int64_t bytes_71320 =
            futhark_mc_segmap_parloop_struct_77340->free_bytes_71320;
    int64_t bytes_71395 =
            futhark_mc_segmap_parloop_struct_77340->free_bytes_71395;
    struct memblock mem_71568 = {.desc ="mem_71568", .mem =
                                 futhark_mc_segmap_parloop_struct_77340->free_mem_71568,
                                 .size =0, .references =NULL};
    struct memblock mem_71572 = {.desc ="mem_71572", .mem =
                                 futhark_mc_segmap_parloop_struct_77340->free_mem_71572,
                                 .size =0, .references =NULL};
    size_t mem_71309_cached_sizze_77342 = 0;
    unsigned char *mem_71309 = NULL;
    size_t mem_71312_cached_sizze_77343 = 0;
    unsigned char *mem_71312 = NULL;
    size_t mem_71315_cached_sizze_77344 = 0;
    unsigned char *mem_71315 = NULL;
    size_t mem_71318_cached_sizze_77345 = 0;
    unsigned char *mem_71318 = NULL;
    size_t mem_71321_cached_sizze_77346 = 0;
    unsigned char *mem_71321 = NULL;
    size_t mem_71396_cached_sizze_77347 = 0;
    unsigned char *mem_71396 = NULL;
    size_t mem_71399_cached_sizze_77348 = 0;
    unsigned char *mem_71399 = NULL;
    int64_t iterations = end - start;
    int64_t iter_76129 = start;
    
    if (mem_71309_cached_sizze_77342 < (size_t) bytes_71308) {
        mem_71309 = realloc(mem_71309, bytes_71308);
        mem_71309_cached_sizze_77342 = bytes_71308;
    }
    if (mem_71312_cached_sizze_77343 < (size_t) bytes_71311) {
        mem_71312 = realloc(mem_71312, bytes_71311);
        mem_71312_cached_sizze_77343 = bytes_71311;
    }
    if (mem_71315_cached_sizze_77344 < (size_t) bytes_71308) {
        mem_71315 = realloc(mem_71315, bytes_71308);
        mem_71315_cached_sizze_77344 = bytes_71308;
    }
    if (mem_71318_cached_sizze_77345 < (size_t) bytes_71308) {
        mem_71318 = realloc(mem_71318, bytes_71308);
        mem_71318_cached_sizze_77345 = bytes_71308;
    }
    if (mem_71321_cached_sizze_77346 < (size_t) bytes_71320) {
        mem_71321 = realloc(mem_71321, bytes_71320);
        mem_71321_cached_sizze_77346 = bytes_71320;
    }
    if (mem_71396_cached_sizze_77347 < (size_t) bytes_71395) {
        mem_71396 = realloc(mem_71396, bytes_71395);
        mem_71396_cached_sizze_77347 = bytes_71395;
    }
    if (mem_71399_cached_sizze_77348 < (size_t) bytes_71395) {
        mem_71399 = realloc(mem_71399, bytes_71395);
        mem_71399_cached_sizze_77348 = bytes_71395;
    }
    for (; iter_76129 < end; iter_76129++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76549 = m_65343;
        int64_t gtid_69611 = iter_76129;
        int64_t remnant_76550 = iter_76129 - gtid_69611;
        int64_t flat_tid_76130 = (int64_t) 0;
        int32_t num_tasks_76551;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_77349 futhark_mc_task_77349;
        
        futhark_mc_task_77349.ctx = ctx;
        futhark_mc_task_77349.free_n_65344 = n_65344;
        futhark_mc_task_77349.free_gtid_69611 = gtid_69611;
        futhark_mc_task_77349.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77349.free_mem_71309 = mem_71309;
        
        struct scheduler_segop futhark_mc_task_77349_task;
        
        futhark_mc_task_77349_task.args = &futhark_mc_task_77349;
        futhark_mc_task_77349_task.top_level_fn = futhark_mc_segscan_task_77350;
        futhark_mc_task_77349_task.name = "futhark_mc_segscan_task_77350";
        futhark_mc_task_77349_task.iterations = n_65344;
        futhark_mc_task_77349_task.task_time =
            &ctx->futhark_mc_segscan_task_77350_total_time;
        futhark_mc_task_77349_task.task_iter =
            &ctx->futhark_mc_segscan_task_77350_total_iter;
        futhark_mc_task_77349_task.sched = STATIC;
        futhark_mc_task_77349_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_77350_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77349_task);
        
        if (futhark_mc_segscan_task_77350_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_69623;
        
        last_res_69623 = ((int64_t *) mem_71309)[i_65358];
        for (int64_t i_76565 = 0; i_76565 < n_65344; i_76565++) {
            ((float *) mem_71312)[i_76565] = 0.0F;
        }
        for (int64_t i_76566 = 0; i_76566 < n_65344; i_76566++) {
            ((int64_t *) mem_71315)[i_76566] = (int64_t) -1;
        }
        
        int64_t flat_tid_76139 = (int64_t) 0;
        int32_t num_tasks_76567;
        struct futhark_mc_task_77356 futhark_mc_task_77356;
        
        futhark_mc_task_77356.ctx = ctx;
        futhark_mc_task_77356.free_n_65344 = n_65344;
        futhark_mc_task_77356.free_gtid_69611 = gtid_69611;
        futhark_mc_task_77356.free_Y_mem_70569 = Y_mem_70569.mem;
        futhark_mc_task_77356.free_mem_71309 = mem_71309;
        futhark_mc_task_77356.free_mem_71312 = mem_71312;
        futhark_mc_task_77356.free_mem_71315 = mem_71315;
        
        struct scheduler_segop futhark_mc_task_77356_task;
        
        futhark_mc_task_77356_task.args = &futhark_mc_task_77356;
        futhark_mc_task_77356_task.top_level_fn = futhark_mc_segmap_task_77357;
        futhark_mc_task_77356_task.name = "futhark_mc_segmap_task_77357";
        futhark_mc_task_77356_task.iterations = n_65344;
        futhark_mc_task_77356_task.task_time =
            &ctx->futhark_mc_segmap_task_77357_total_time;
        futhark_mc_task_77356_task.task_iter =
            &ctx->futhark_mc_segmap_task_77357_total_iter;
        futhark_mc_task_77356_task.sched = STATIC;
        futhark_mc_task_77356_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77357_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77356_task);
        
        if (futhark_mc_segmap_task_77357_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_76147 = (int64_t) 0;
        int32_t num_tasks_76573;
        struct futhark_mc_task_77360 futhark_mc_task_77360;
        
        futhark_mc_task_77360.ctx = ctx;
        futhark_mc_task_77360.free_n_65344 = n_65344;
        futhark_mc_task_77360.free_mem_71315 = mem_71315;
        futhark_mc_task_77360.free_mem_71318 = mem_71318;
        
        struct scheduler_segop futhark_mc_task_77360_task;
        
        futhark_mc_task_77360_task.args = &futhark_mc_task_77360;
        futhark_mc_task_77360_task.top_level_fn = futhark_mc_segmap_task_77361;
        futhark_mc_task_77360_task.name = "futhark_mc_segmap_task_77361";
        futhark_mc_task_77360_task.iterations = n_65344;
        futhark_mc_task_77360_task.task_time =
            &ctx->futhark_mc_segmap_task_77361_total_time;
        futhark_mc_task_77360_task.task_iter =
            &ctx->futhark_mc_segmap_task_77361_total_iter;
        futhark_mc_task_77360_task.sched = STATIC;
        futhark_mc_task_77360_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77361_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77360_task);
        
        if (futhark_mc_segmap_task_77361_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_69642 = sub64(last_res_69623, (int64_t) 1);
        int64_t min_arg_69643 = sub64(last_res_69623, min_res_65364);
        int64_t min_res_69644 = smin64(q_65346, last_res_69623);
        float i64_res_69645 = sitofp_i64_f32(last_res_69623);
        float x_69646 = i64_res_65370 - i64_res_69645;
        float max_arg_69647 = x_69646 / 2.0F;
        float max_res_69648 = fmax32(0.0F, max_arg_69647);
        int64_t flat_tid_76151 = (int64_t) 0;
        int32_t num_tasks_76577;
        struct futhark_mc_task_77364 futhark_mc_task_77364;
        
        futhark_mc_task_77364.ctx = ctx;
        futhark_mc_task_77364.free_q_65346 = q_65346;
        futhark_mc_task_77364.free_last_res_69623 = last_res_69623;
        futhark_mc_task_77364.free_mem_71321 = mem_71321;
        
        struct scheduler_segop futhark_mc_task_77364_task;
        
        futhark_mc_task_77364_task.args = &futhark_mc_task_77364;
        futhark_mc_task_77364_task.top_level_fn = futhark_mc_segmap_task_77365;
        futhark_mc_task_77364_task.name = "futhark_mc_segmap_task_77365";
        futhark_mc_task_77364_task.iterations = q_65346;
        futhark_mc_task_77364_task.task_time =
            &ctx->futhark_mc_segmap_task_77365_total_time;
        futhark_mc_task_77364_task.task_iter =
            &ctx->futhark_mc_segmap_task_77365_total_iter;
        futhark_mc_task_77364_task.sched = STATIC;
        futhark_mc_task_77364_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77365_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77364_task);
        
        if (futhark_mc_segmap_task_77365_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_76351 = (int64_t) 0;
        int32_t num_tasks_76581;
        int64_t flat_tid_76155 = (int64_t) 0;
        struct futhark_mc_task_77368 futhark_mc_task_77368;
        
        futhark_mc_task_77368.ctx = ctx;
        futhark_mc_task_77368.free_n_65344 = n_65344;
        futhark_mc_task_77368.free_q_65346 = q_65346;
        futhark_mc_task_77368.free_jump_65348 = jump_65348;
        futhark_mc_task_77368.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77368.free_i_65358 = i_65358;
        futhark_mc_task_77368.free_x_65359 = x_65359;
        futhark_mc_task_77368.free_min_res_65364 = min_res_65364;
        futhark_mc_task_77368.free_loop_cond_65369 = loop_cond_65369;
        futhark_mc_task_77368.free_last_res_69623 = last_res_69623;
        futhark_mc_task_77368.free_min_arg_69642 = min_arg_69642;
        futhark_mc_task_77368.free_min_arg_69643 = min_arg_69643;
        futhark_mc_task_77368.free_min_res_69644 = min_res_69644;
        futhark_mc_task_77368.free_max_res_69648 = max_res_69648;
        futhark_mc_task_77368.free_mem_71312 = mem_71312;
        futhark_mc_task_77368.free_mem_71315 = mem_71315;
        futhark_mc_task_77368.free_mem_71318 = mem_71318;
        futhark_mc_task_77368.free_bytes_71320 = bytes_71320;
        futhark_mc_task_77368.free_mem_71321 = mem_71321;
        futhark_mc_task_77368.free_mem_71396 = mem_71396;
        futhark_mc_task_77368.free_mem_71399 = mem_71399;
        
        struct scheduler_segop futhark_mc_task_77368_task;
        
        futhark_mc_task_77368_task.args = &futhark_mc_task_77368;
        futhark_mc_task_77368_task.top_level_fn = futhark_mc_segmap_task_77369;
        futhark_mc_task_77368_task.name = "futhark_mc_segmap_task_77369";
        futhark_mc_task_77368_task.iterations = n_m_65352;
        futhark_mc_task_77368_task.task_time =
            &ctx->futhark_mc_segmap_task_77369_total_time;
        futhark_mc_task_77368_task.task_iter =
            &ctx->futhark_mc_segmap_task_77369_total_iter;
        futhark_mc_task_77368_task.sched = DYNAMIC;
        futhark_mc_task_77368_task.nested_fn =
            futhark_mc_segmap_nested_task_77376;
        
        int futhark_mc_segmap_task_77369_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77368_task);
        
        if (futhark_mc_segmap_task_77369_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71568.mem + gtid_69611 * n_m_65352 * (int64_t) 4,
                    mem_71396 + (int64_t) 0, n_m_65352 * (int64_t) 4);
        if (n_m_65352 * (int64_t) 4 > 0)
            memmove(mem_71572.mem + gtid_69611 * n_m_65352 * (int64_t) 4,
                    mem_71399 + (int64_t) 0, n_m_65352 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_71309);
    free(mem_71312);
    free(mem_71315);
    free(mem_71318);
    free(mem_71321);
    free(mem_71396);
    free(mem_71399);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77341_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77341_end -
                 futhark_mc_segmap_parloop_77341_start;
        
        ctx->futhark_mc_segmap_parloop_77341_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77341_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77341_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77339(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_69610 = tid;
    int num_tasks_75869 = info.nsubtasks;
    struct futhark_mc_task_77324 *futhark_mc_task_77324 =
                                 (struct futhark_mc_task_77324 *) args;
    struct futhark_context *ctx = futhark_mc_task_77324->ctx;
    uint64_t futhark_mc_segmap_nested_task_77339_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77339_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77324->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77324->free_n_65344;
    int64_t q_65346 = futhark_mc_task_77324->free_q_65346;
    int64_t jump_65348 = futhark_mc_task_77324->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77324->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77324->free_i_65358;
    bool x_65359 = futhark_mc_task_77324->free_x_65359;
    int64_t min_res_65364 = futhark_mc_task_77324->free_min_res_65364;
    bool loop_cond_65369 = futhark_mc_task_77324->free_loop_cond_65369;
    float i64_res_65370 = futhark_mc_task_77324->free_i64_res_65370;
    struct memblock Y_mem_70569 = {.desc ="Y_mem_70569", .mem =
                                   futhark_mc_task_77324->free_Y_mem_70569,
                                   .size =0, .references =NULL};
    int64_t bytes_71308 = futhark_mc_task_77324->free_bytes_71308;
    int64_t bytes_71311 = futhark_mc_task_77324->free_bytes_71311;
    int64_t bytes_71320 = futhark_mc_task_77324->free_bytes_71320;
    int64_t bytes_71395 = futhark_mc_task_77324->free_bytes_71395;
    struct memblock mem_71568 = {.desc ="mem_71568", .mem =
                                 futhark_mc_task_77324->free_mem_71568, .size =
                                 0, .references =NULL};
    struct memblock mem_71572 = {.desc ="mem_71572", .mem =
                                 futhark_mc_task_77324->free_mem_71572, .size =
                                 0, .references =NULL};
    int64_t iter_76129;
    struct futhark_mc_segmap_parloop_struct_77340
    futhark_mc_segmap_parloop_struct_77340;
    
    futhark_mc_segmap_parloop_struct_77340.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77340.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77340.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77340.free_q_65346 = q_65346;
    futhark_mc_segmap_parloop_struct_77340.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77340.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77340.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77340.free_x_65359 = x_65359;
    futhark_mc_segmap_parloop_struct_77340.free_min_res_65364 = min_res_65364;
    futhark_mc_segmap_parloop_struct_77340.free_loop_cond_65369 =
        loop_cond_65369;
    futhark_mc_segmap_parloop_struct_77340.free_i64_res_65370 = i64_res_65370;
    futhark_mc_segmap_parloop_struct_77340.free_Y_mem_70569 = Y_mem_70569.mem;
    futhark_mc_segmap_parloop_struct_77340.free_bytes_71308 = bytes_71308;
    futhark_mc_segmap_parloop_struct_77340.free_bytes_71311 = bytes_71311;
    futhark_mc_segmap_parloop_struct_77340.free_bytes_71320 = bytes_71320;
    futhark_mc_segmap_parloop_struct_77340.free_bytes_71395 = bytes_71395;
    futhark_mc_segmap_parloop_struct_77340.free_mem_71568 = mem_71568.mem;
    futhark_mc_segmap_parloop_struct_77340.free_mem_71572 = mem_71572.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77341_task;
    
    futhark_mc_segmap_parloop_77341_task.name =
        "futhark_mc_segmap_parloop_77341";
    futhark_mc_segmap_parloop_77341_task.fn = futhark_mc_segmap_parloop_77341;
    futhark_mc_segmap_parloop_77341_task.args =
        &futhark_mc_segmap_parloop_struct_77340;
    futhark_mc_segmap_parloop_77341_task.iterations = iterations;
    futhark_mc_segmap_parloop_77341_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77341_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77341_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77341_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77341_task);
    
    if (futhark_mc_segmap_parloop_77341_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77341_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77341_total_end -
                 futhark_mc_segmap_parloop_77341_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77341_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77341_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77341_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77339_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77339_end -
                 futhark_mc_segmap_nested_task_77339_start;
        
        ctx->futhark_mc_segmap_nested_task_77339_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77339_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77339_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_task_77402 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    int64_t free_y_66637;
    unsigned char *free_ext_mem_71577;
    unsigned char *free_ext_mem_71578;
    int64_t free_bytes_71580;
    unsigned char *free_mem_71600;
};
struct futhark_mc_segmap_parloop_struct_77404 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    int64_t free_y_66637;
    unsigned char *free_ext_mem_71577;
    unsigned char *free_ext_mem_71578;
    int64_t free_bytes_71580;
    unsigned char *free_mem_71600;
};
static int futhark_mc_segmap_parloop_77405(void *args, int64_t start,
                                           int64_t end, int flat_tid_70041,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77404
    *futhark_mc_segmap_parloop_struct_77404 =
    (struct futhark_mc_segmap_parloop_struct_77404 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77404->ctx;
    uint64_t futhark_mc_segmap_parloop_77405_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77405_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77404->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77404->free_n_65344;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77404->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77404->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77404->free_i_65358;
    int64_t y_66637 = futhark_mc_segmap_parloop_struct_77404->free_y_66637;
    struct memblock ext_mem_71577 = {.desc ="ext_mem_71577", .mem =
                                     futhark_mc_segmap_parloop_struct_77404->free_ext_mem_71577,
                                     .size =0, .references =NULL};
    struct memblock ext_mem_71578 = {.desc ="ext_mem_71578", .mem =
                                     futhark_mc_segmap_parloop_struct_77404->free_ext_mem_71578,
                                     .size =0, .references =NULL};
    int64_t bytes_71580 =
            futhark_mc_segmap_parloop_struct_77404->free_bytes_71580;
    struct memblock mem_71600 = {.desc ="mem_71600", .mem =
                                 futhark_mc_segmap_parloop_struct_77404->free_mem_71600,
                                 .size =0, .references =NULL};
    size_t mem_71584_cached_sizze_77406 = 0;
    unsigned char *mem_71584 = NULL;
    int64_t iterations = end - start;
    int64_t iter_76913 = start;
    
    if (mem_71584_cached_sizze_77406 < (size_t) bytes_71580) {
        mem_71584 = realloc(mem_71584, bytes_71580);
        mem_71584_cached_sizze_77406 = bytes_71580;
    }
    for (; iter_76913 < end; iter_76913++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_76963 = m_65343;
        int64_t gtid_70042 = iter_76913;
        int64_t remnant_76964 = iter_76913 - gtid_70042;
        
        for (int64_t i_76914 = 0; i_76914 < n_65344; i_76914++) {
            int64_t m_v_76916 = sdiv64(i_76914, jump_65348);
            bool cond_76917 = m_v_76916 == y_66637;
            int64_t j_76918;
            
            if (cond_76917) {
                int64_t j_t_res_76919 = sub64(m_v_76916, (int64_t) 1);
                
                j_76918 = j_t_res_76919;
            } else {
                j_76918 = m_v_76916;
            }
            
            int64_t min_arg_76920 = mul64(jump_65348, j_76918);
            int64_t min_res_76921 = smin64(i_65358, min_arg_76920);
            int64_t defunc_0_m_fun_arg_76922 = add64((int64_t) 1, j_76918);
            int64_t min_arg_76923 = mul64(jump_65348, defunc_0_m_fun_arg_76922);
            int64_t min_res_76924 = smin64(i_65358, min_arg_76923);
            int64_t i64_arg_76925 = sub64(min_res_76924, min_res_76921);
            float i64_res_76926 = sitofp_i64_f32(i64_arg_76925);
            int64_t i64_arg_76927 = sub64(i_76914, min_res_76921);
            float i64_res_76928 = sitofp_i64_f32(i64_arg_76927);
            float u_76929 = i64_res_76928 / i64_res_76926;
            float u2_76930 = u_76929 * u_76929;
            float u3_76931 = u_76929 * u2_76930;
            float x_76932 = 2.0F * u3_76931;
            float y_76933 = 3.0F * u2_76930;
            float x_76934 = x_76932 - y_76933;
            float x_76935 = 1.0F + x_76934;
            bool x_76936 = sle64((int64_t) 0, j_76918);
            bool y_76937 = slt64(j_76918, n_m_65352);
            bool bounds_check_76938 = x_76936 && y_76937;
            bool index_certs_76939;
            
            if (!bounds_check_76938) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) j_76918,
                              "] out of bounds for array of shape [",
                              (long long) n_m_65352, "].",
                              "-> #0  loess.fut:535:27-33\n   #1  loess.fut:548: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:545:3-549:9\n   #6  loess.fut:608:13-59\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:607:5-609:29\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            float y_76940;
            
            y_76940 = ((float *) ext_mem_71578.mem)[gtid_70042 * n_m_65352 +
                                                    j_76918];
            
            float x_76941 = x_76935 * y_76940;
            float x_76942 = y_76933 - x_76932;
            bool x_76943 = sle64((int64_t) 0, defunc_0_m_fun_arg_76922);
            bool y_76944 = slt64(defunc_0_m_fun_arg_76922, n_m_65352);
            bool bounds_check_76945 = x_76943 && y_76944;
            bool index_certs_76946;
            
            if (!bounds_check_76945) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", (long long) defunc_0_m_fun_arg_76922,
                              "] out of bounds for array of shape [",
                              (long long) n_m_65352, "].",
                              "-> #0  loess.fut:536:27-37\n   #1  loess.fut:548: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:545:3-549:9\n   #6  loess.fut:608:13-59\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:607:5-609:29\n   #10 loess.fut:572:1-611:26\n");
                err = 1;
                goto cleanup;
            }
            
            float y_76947;
            
            y_76947 = ((float *) ext_mem_71578.mem)[gtid_70042 * n_m_65352 +
                                                    defunc_0_m_fun_arg_76922];
            
            float y_76948 = x_76942 * y_76947;
            float x_76949 = x_76941 + y_76948;
            float y_76950 = 2.0F * u2_76930;
            float x_76951 = u3_76931 - y_76950;
            float x_76952 = u_76929 + x_76951;
            float y_76953;
            
            y_76953 = ((float *) ext_mem_71577.mem)[gtid_70042 * n_m_65352 +
                                                    j_76918];
            
            float x_76954 = x_76952 * y_76953;
            float y_76955 = i64_res_76926 * x_76954;
            float x_76956 = x_76949 + y_76955;
            float x_76957 = u3_76931 - u2_76930;
            float y_76958;
            
            y_76958 = ((float *) ext_mem_71577.mem)[gtid_70042 * n_m_65352 +
                                                    defunc_0_m_fun_arg_76922];
            
            float x_76959 = x_76957 * y_76958;
            float y_76960 = i64_res_76926 * x_76959;
            float defunc_4_interpolate_proc_res_76961 = x_76956 + y_76960;
            
            ((float *) mem_71584)[i_76914] =
                defunc_4_interpolate_proc_res_76961;
        }
        if (n_65344 * (int64_t) 4 > 0)
            memmove(mem_71600.mem + gtid_70042 * n_65344 * (int64_t) 4,
                    mem_71584 + (int64_t) 0, n_65344 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_71584);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77405_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77405_end -
                 futhark_mc_segmap_parloop_77405_start;
        
        ctx->futhark_mc_segmap_parloop_77405_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77405_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77405_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77403(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_70041 = tid;
    int num_tasks_76912 = info.nsubtasks;
    struct futhark_mc_task_77402 *futhark_mc_task_77402 =
                                 (struct futhark_mc_task_77402 *) args;
    struct futhark_context *ctx = futhark_mc_task_77402->ctx;
    uint64_t futhark_mc_segmap_task_77403_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77403_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77402->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77402->free_n_65344;
    int64_t jump_65348 = futhark_mc_task_77402->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77402->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77402->free_i_65358;
    int64_t y_66637 = futhark_mc_task_77402->free_y_66637;
    struct memblock ext_mem_71577 = {.desc ="ext_mem_71577", .mem =
                                     futhark_mc_task_77402->free_ext_mem_71577,
                                     .size =0, .references =NULL};
    struct memblock ext_mem_71578 = {.desc ="ext_mem_71578", .mem =
                                     futhark_mc_task_77402->free_ext_mem_71578,
                                     .size =0, .references =NULL};
    int64_t bytes_71580 = futhark_mc_task_77402->free_bytes_71580;
    struct memblock mem_71600 = {.desc ="mem_71600", .mem =
                                 futhark_mc_task_77402->free_mem_71600, .size =
                                 0, .references =NULL};
    int64_t iter_76913;
    struct futhark_mc_segmap_parloop_struct_77404
    futhark_mc_segmap_parloop_struct_77404;
    
    futhark_mc_segmap_parloop_struct_77404.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77404.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77404.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77404.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77404.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77404.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77404.free_y_66637 = y_66637;
    futhark_mc_segmap_parloop_struct_77404.free_ext_mem_71577 =
        ext_mem_71577.mem;
    futhark_mc_segmap_parloop_struct_77404.free_ext_mem_71578 =
        ext_mem_71578.mem;
    futhark_mc_segmap_parloop_struct_77404.free_bytes_71580 = bytes_71580;
    futhark_mc_segmap_parloop_struct_77404.free_mem_71600 = mem_71600.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77405_task;
    
    futhark_mc_segmap_parloop_77405_task.name =
        "futhark_mc_segmap_parloop_77405";
    futhark_mc_segmap_parloop_77405_task.fn = futhark_mc_segmap_parloop_77405;
    futhark_mc_segmap_parloop_77405_task.args =
        &futhark_mc_segmap_parloop_struct_77404;
    futhark_mc_segmap_parloop_77405_task.iterations = iterations;
    futhark_mc_segmap_parloop_77405_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77405_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77405_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77405_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77405_task);
    
    if (futhark_mc_segmap_parloop_77405_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77405_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77405_total_end -
                 futhark_mc_segmap_parloop_77405_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77405_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77405_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77405_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77403_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77403_end -
                 futhark_mc_segmap_task_77403_start;
        
        ctx->futhark_mc_segmap_task_77403_runs[tid]++;
        ctx->futhark_mc_segmap_task_77403_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77403_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_77408 {
    struct futhark_context *ctx;
    int64_t free_m_65343;
    int64_t free_n_65344;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    int64_t free_y_66637;
    unsigned char *free_ext_mem_71577;
    unsigned char *free_ext_mem_71578;
    int64_t free_bytes_71580;
    unsigned char *free_mem_71600;
};
struct futhark_mc_task_77411 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    int64_t free_y_66637;
    int64_t free_gtid_70048;
    unsigned char *free_ext_mem_71577;
    unsigned char *free_ext_mem_71578;
    unsigned char *free_mem_71581;
};
struct futhark_mc_segmap_parloop_struct_77413 {
    struct futhark_context *ctx;
    int64_t free_n_65344;
    int64_t free_jump_65348;
    int64_t free_n_m_65352;
    int64_t free_i_65358;
    int64_t free_y_66637;
    int64_t free_gtid_70048;
    unsigned char *free_ext_mem_71577;
    unsigned char *free_ext_mem_71578;
    unsigned char *free_mem_71581;
};
static int futhark_mc_segmap_parloop_77414(void *args, int64_t start,
                                           int64_t end, int flat_tid_76967,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77413
    *futhark_mc_segmap_parloop_struct_77413 =
    (struct futhark_mc_segmap_parloop_struct_77413 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77413->ctx;
    uint64_t futhark_mc_segmap_parloop_77414_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77414_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77413->free_n_65344;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77413->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77413->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77413->free_i_65358;
    int64_t y_66637 = futhark_mc_segmap_parloop_struct_77413->free_y_66637;
    int64_t gtid_70048 =
            futhark_mc_segmap_parloop_struct_77413->free_gtid_70048;
    struct memblock ext_mem_71577 = {.desc ="ext_mem_71577", .mem =
                                     futhark_mc_segmap_parloop_struct_77413->free_ext_mem_71577,
                                     .size =0, .references =NULL};
    struct memblock ext_mem_71578 = {.desc ="ext_mem_71578", .mem =
                                     futhark_mc_segmap_parloop_struct_77413->free_ext_mem_71578,
                                     .size =0, .references =NULL};
    struct memblock mem_71581 = {.desc ="mem_71581", .mem =
                                 futhark_mc_segmap_parloop_struct_77413->free_mem_71581,
                                 .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_77018 = start;
    
    for (; iter_77018 < end; iter_77018++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_77020 = n_65344;
        int64_t gtid_76968 = iter_77018;
        int64_t remnant_77021 = iter_77018 - gtid_76968;
        int64_t m_v_76969 = sdiv64(gtid_76968, jump_65348);
        bool cond_76970 = m_v_76969 == y_66637;
        int64_t j_76971;
        
        if (cond_76970) {
            int64_t j_t_res_77019 = sub64(m_v_76969, (int64_t) 1);
            
            j_76971 = j_t_res_77019;
        } else {
            j_76971 = m_v_76969;
        }
        
        int64_t min_arg_76973 = mul64(jump_65348, j_76971);
        int64_t min_res_76974 = smin64(i_65358, min_arg_76973);
        int64_t defunc_0_m_fun_arg_76975 = add64((int64_t) 1, j_76971);
        int64_t min_arg_76976 = mul64(jump_65348, defunc_0_m_fun_arg_76975);
        int64_t min_res_76977 = smin64(i_65358, min_arg_76976);
        int64_t i64_arg_76978 = sub64(min_res_76977, min_res_76974);
        float i64_res_76979 = sitofp_i64_f32(i64_arg_76978);
        int64_t i64_arg_76980 = sub64(gtid_76968, min_res_76974);
        float i64_res_76981 = sitofp_i64_f32(i64_arg_76980);
        float u_76982 = i64_res_76981 / i64_res_76979;
        float u2_76983 = u_76982 * u_76982;
        float u3_76984 = u_76982 * u2_76983;
        float x_76985 = 2.0F * u3_76984;
        float y_76986 = 3.0F * u2_76983;
        float x_76987 = x_76985 - y_76986;
        float x_76988 = 1.0F + x_76987;
        bool x_76989 = sle64((int64_t) 0, j_76971);
        bool y_76990 = slt64(j_76971, n_m_65352);
        bool bounds_check_76991 = x_76989 && y_76990;
        bool index_certs_76992;
        
        if (!bounds_check_76991) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", (long long) j_76971,
                                   "] out of bounds for array of shape [",
                                   (long long) n_m_65352, "].",
                                   "-> #0  loess.fut:535:27-33\n   #1  loess.fut:548: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:545:3-549:9\n   #6  loess.fut:608:13-59\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:607:5-609:29\n   #10 loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        float y_76993;
        
        y_76993 = ((float *) ext_mem_71578.mem)[gtid_70048 * n_m_65352 +
                                                j_76971];
        
        float x_76994 = x_76988 * y_76993;
        float x_76995 = y_76986 - x_76985;
        bool x_76996 = sle64((int64_t) 0, defunc_0_m_fun_arg_76975);
        bool y_76997 = slt64(defunc_0_m_fun_arg_76975, n_m_65352);
        bool bounds_check_76998 = x_76996 && y_76997;
        bool index_certs_76999;
        
        if (!bounds_check_76998) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [",
                                   (long long) defunc_0_m_fun_arg_76975,
                                   "] out of bounds for array of shape [",
                                   (long long) n_m_65352, "].",
                                   "-> #0  loess.fut:536:27-37\n   #1  loess.fut:548: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:545:3-549:9\n   #6  loess.fut:608:13-59\n   #7  /prelude/soacs.fut:67:19-23\n   #8  /prelude/soacs.fut:67:3-37\n   #9  loess.fut:607:5-609:29\n   #10 loess.fut:572:1-611:26\n");
            err = 1;
            goto cleanup;
        }
        
        float y_77000;
        
        y_77000 = ((float *) ext_mem_71578.mem)[gtid_70048 * n_m_65352 +
                                                defunc_0_m_fun_arg_76975];
        
        float y_77001 = x_76995 * y_77000;
        float x_77002 = x_76994 + y_77001;
        float y_77003 = 2.0F * u2_76983;
        float x_77004 = u3_76984 - y_77003;
        float x_77005 = u_76982 + x_77004;
        float y_77006;
        
        y_77006 = ((float *) ext_mem_71577.mem)[gtid_70048 * n_m_65352 +
                                                j_76971];
        
        float x_77007 = x_77005 * y_77006;
        float y_77008 = i64_res_76979 * x_77007;
        float x_77009 = x_77002 + y_77008;
        float x_77010 = u3_76984 - u2_76983;
        float y_77011;
        
        y_77011 = ((float *) ext_mem_71577.mem)[gtid_70048 * n_m_65352 +
                                                defunc_0_m_fun_arg_76975];
        
        float x_77012 = x_77010 * y_77011;
        float y_77013 = i64_res_76979 * x_77012;
        float defunc_4_interpolate_proc_res_77014 = x_77009 + y_77013;
        
        ((float *) mem_71581.mem)[gtid_76968] =
            defunc_4_interpolate_proc_res_77014;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77414_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77414_end -
                 futhark_mc_segmap_parloop_77414_start;
        
        ctx->futhark_mc_segmap_parloop_77414_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77414_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77414_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_77412(void *args, int64_t iterations, int tid,
                                 struct scheduler_info info)
{
    int err = 0;
    int flat_tid_76967 = tid;
    int num_tasks_77017 = info.nsubtasks;
    struct futhark_mc_task_77411 *futhark_mc_task_77411 =
                                 (struct futhark_mc_task_77411 *) args;
    struct futhark_context *ctx = futhark_mc_task_77411->ctx;
    uint64_t futhark_mc_segmap_task_77412_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_77412_start = get_wall_time();
    
    int64_t n_65344 = futhark_mc_task_77411->free_n_65344;
    int64_t jump_65348 = futhark_mc_task_77411->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77411->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77411->free_i_65358;
    int64_t y_66637 = futhark_mc_task_77411->free_y_66637;
    int64_t gtid_70048 = futhark_mc_task_77411->free_gtid_70048;
    struct memblock ext_mem_71577 = {.desc ="ext_mem_71577", .mem =
                                     futhark_mc_task_77411->free_ext_mem_71577,
                                     .size =0, .references =NULL};
    struct memblock ext_mem_71578 = {.desc ="ext_mem_71578", .mem =
                                     futhark_mc_task_77411->free_ext_mem_71578,
                                     .size =0, .references =NULL};
    struct memblock mem_71581 = {.desc ="mem_71581", .mem =
                                 futhark_mc_task_77411->free_mem_71581, .size =
                                 0, .references =NULL};
    int64_t iter_77018;
    struct futhark_mc_segmap_parloop_struct_77413
    futhark_mc_segmap_parloop_struct_77413;
    
    futhark_mc_segmap_parloop_struct_77413.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77413.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77413.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77413.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77413.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77413.free_y_66637 = y_66637;
    futhark_mc_segmap_parloop_struct_77413.free_gtid_70048 = gtid_70048;
    futhark_mc_segmap_parloop_struct_77413.free_ext_mem_71577 =
        ext_mem_71577.mem;
    futhark_mc_segmap_parloop_struct_77413.free_ext_mem_71578 =
        ext_mem_71578.mem;
    futhark_mc_segmap_parloop_struct_77413.free_mem_71581 = mem_71581.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77414_task;
    
    futhark_mc_segmap_parloop_77414_task.name =
        "futhark_mc_segmap_parloop_77414";
    futhark_mc_segmap_parloop_77414_task.fn = futhark_mc_segmap_parloop_77414;
    futhark_mc_segmap_parloop_77414_task.args =
        &futhark_mc_segmap_parloop_struct_77413;
    futhark_mc_segmap_parloop_77414_task.iterations = iterations;
    futhark_mc_segmap_parloop_77414_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77414_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77414_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77414_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77414_task);
    
    if (futhark_mc_segmap_parloop_77414_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77414_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77414_total_end -
                 futhark_mc_segmap_parloop_77414_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77414_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77414_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77414_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_77412_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_77412_end -
                 futhark_mc_segmap_task_77412_start;
        
        ctx->futhark_mc_segmap_task_77412_runs[tid]++;
        ctx->futhark_mc_segmap_task_77412_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_77412_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
static int futhark_mc_segmap_parloop_77409(void *args, int64_t start,
                                           int64_t end, int flat_tid_70047,
                                           int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_77408
    *futhark_mc_segmap_parloop_struct_77408 =
    (struct futhark_mc_segmap_parloop_struct_77408 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_77408->ctx;
    uint64_t futhark_mc_segmap_parloop_77409_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77409_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_segmap_parloop_struct_77408->free_m_65343;
    int64_t n_65344 = futhark_mc_segmap_parloop_struct_77408->free_n_65344;
    int64_t jump_65348 =
            futhark_mc_segmap_parloop_struct_77408->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_segmap_parloop_struct_77408->free_n_m_65352;
    int64_t i_65358 = futhark_mc_segmap_parloop_struct_77408->free_i_65358;
    int64_t y_66637 = futhark_mc_segmap_parloop_struct_77408->free_y_66637;
    struct memblock ext_mem_71577 = {.desc ="ext_mem_71577", .mem =
                                     futhark_mc_segmap_parloop_struct_77408->free_ext_mem_71577,
                                     .size =0, .references =NULL};
    struct memblock ext_mem_71578 = {.desc ="ext_mem_71578", .mem =
                                     futhark_mc_segmap_parloop_struct_77408->free_ext_mem_71578,
                                     .size =0, .references =NULL};
    int64_t bytes_71580 =
            futhark_mc_segmap_parloop_struct_77408->free_bytes_71580;
    struct memblock mem_71600 = {.desc ="mem_71600", .mem =
                                 futhark_mc_segmap_parloop_struct_77408->free_mem_71600,
                                 .size =0, .references =NULL};
    size_t mem_71581_cached_sizze_77410 = 0;
    unsigned char *mem_71581 = NULL;
    int64_t iterations = end - start;
    int64_t iter_76966 = start;
    
    if (mem_71581_cached_sizze_77410 < (size_t) bytes_71580) {
        mem_71581 = realloc(mem_71581, bytes_71580);
        mem_71581_cached_sizze_77410 = bytes_71580;
    }
    for (; iter_76966 < end; iter_76966++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_77015 = m_65343;
        int64_t gtid_70048 = iter_76966;
        int64_t remnant_77016 = iter_76966 - gtid_70048;
        int64_t flat_tid_76967 = (int64_t) 0;
        int32_t num_tasks_77017;
        struct futhark_mc_task_77411 futhark_mc_task_77411;
        
        futhark_mc_task_77411.ctx = ctx;
        futhark_mc_task_77411.free_n_65344 = n_65344;
        futhark_mc_task_77411.free_jump_65348 = jump_65348;
        futhark_mc_task_77411.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77411.free_i_65358 = i_65358;
        futhark_mc_task_77411.free_y_66637 = y_66637;
        futhark_mc_task_77411.free_gtid_70048 = gtid_70048;
        futhark_mc_task_77411.free_ext_mem_71577 = ext_mem_71577.mem;
        futhark_mc_task_77411.free_ext_mem_71578 = ext_mem_71578.mem;
        futhark_mc_task_77411.free_mem_71581 = mem_71581;
        
        struct scheduler_segop futhark_mc_task_77411_task;
        
        futhark_mc_task_77411_task.args = &futhark_mc_task_77411;
        futhark_mc_task_77411_task.top_level_fn = futhark_mc_segmap_task_77412;
        futhark_mc_task_77411_task.name = "futhark_mc_segmap_task_77412";
        futhark_mc_task_77411_task.iterations = n_65344;
        futhark_mc_task_77411_task.task_time =
            &ctx->futhark_mc_segmap_task_77412_total_time;
        futhark_mc_task_77411_task.task_iter =
            &ctx->futhark_mc_segmap_task_77412_total_iter;
        futhark_mc_task_77411_task.sched = STATIC;
        futhark_mc_task_77411_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_77412_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77411_task);
        
        if (futhark_mc_segmap_task_77412_err != 0) {
            ;
            err = 1;
            goto cleanup;
        }
        if (n_65344 * (int64_t) 4 > 0)
            memmove(mem_71600.mem + gtid_70048 * n_65344 * (int64_t) 4,
                    mem_71581 + (int64_t) 0, n_65344 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_71581);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77409_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77409_end -
                 futhark_mc_segmap_parloop_77409_start;
        
        ctx->futhark_mc_segmap_parloop_77409_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_77409_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_77409_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_77407(void *args, int64_t iterations, int tid,
                                        struct scheduler_info info)
{
    int err = 0;
    int flat_tid_70047 = tid;
    int num_tasks_76912 = info.nsubtasks;
    struct futhark_mc_task_77402 *futhark_mc_task_77402 =
                                 (struct futhark_mc_task_77402 *) args;
    struct futhark_context *ctx = futhark_mc_task_77402->ctx;
    uint64_t futhark_mc_segmap_nested_task_77407_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_77407_start = get_wall_time();
    
    int64_t m_65343 = futhark_mc_task_77402->free_m_65343;
    int64_t n_65344 = futhark_mc_task_77402->free_n_65344;
    int64_t jump_65348 = futhark_mc_task_77402->free_jump_65348;
    int64_t n_m_65352 = futhark_mc_task_77402->free_n_m_65352;
    int64_t i_65358 = futhark_mc_task_77402->free_i_65358;
    int64_t y_66637 = futhark_mc_task_77402->free_y_66637;
    struct memblock ext_mem_71577 = {.desc ="ext_mem_71577", .mem =
                                     futhark_mc_task_77402->free_ext_mem_71577,
                                     .size =0, .references =NULL};
    struct memblock ext_mem_71578 = {.desc ="ext_mem_71578", .mem =
                                     futhark_mc_task_77402->free_ext_mem_71578,
                                     .size =0, .references =NULL};
    int64_t bytes_71580 = futhark_mc_task_77402->free_bytes_71580;
    struct memblock mem_71600 = {.desc ="mem_71600", .mem =
                                 futhark_mc_task_77402->free_mem_71600, .size =
                                 0, .references =NULL};
    int64_t iter_76966;
    struct futhark_mc_segmap_parloop_struct_77408
    futhark_mc_segmap_parloop_struct_77408;
    
    futhark_mc_segmap_parloop_struct_77408.ctx = ctx;
    futhark_mc_segmap_parloop_struct_77408.free_m_65343 = m_65343;
    futhark_mc_segmap_parloop_struct_77408.free_n_65344 = n_65344;
    futhark_mc_segmap_parloop_struct_77408.free_jump_65348 = jump_65348;
    futhark_mc_segmap_parloop_struct_77408.free_n_m_65352 = n_m_65352;
    futhark_mc_segmap_parloop_struct_77408.free_i_65358 = i_65358;
    futhark_mc_segmap_parloop_struct_77408.free_y_66637 = y_66637;
    futhark_mc_segmap_parloop_struct_77408.free_ext_mem_71577 =
        ext_mem_71577.mem;
    futhark_mc_segmap_parloop_struct_77408.free_ext_mem_71578 =
        ext_mem_71578.mem;
    futhark_mc_segmap_parloop_struct_77408.free_bytes_71580 = bytes_71580;
    futhark_mc_segmap_parloop_struct_77408.free_mem_71600 = mem_71600.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_77409_task;
    
    futhark_mc_segmap_parloop_77409_task.name =
        "futhark_mc_segmap_parloop_77409";
    futhark_mc_segmap_parloop_77409_task.fn = futhark_mc_segmap_parloop_77409;
    futhark_mc_segmap_parloop_77409_task.args =
        &futhark_mc_segmap_parloop_struct_77408;
    futhark_mc_segmap_parloop_77409_task.iterations = iterations;
    futhark_mc_segmap_parloop_77409_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_77409_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_77409_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_77409_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_77409_task);
    
    if (futhark_mc_segmap_parloop_77409_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_77409_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_77409_total_end -
                 futhark_mc_segmap_parloop_77409_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77409_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77409_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_77409_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_77407_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_77407_end -
                 futhark_mc_segmap_nested_task_77407_start;
        
        ctx->futhark_mc_segmap_nested_task_77407_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_77407_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_77407_iter[tid] += iterations;
    }
    if (err == 0) { }
    return err;
}
struct futhark_f32_2d {
    struct memblock mem;
    int64_t shape[2];
};
struct futhark_f32_2d *futhark_new_f32_2d(struct futhark_context *ctx, const
                                          float *data, int64_t dim0,
                                          int64_t dim1)
{
    struct futhark_f32_2d *bad = NULL;
    struct futhark_f32_2d *arr =
                          (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    arr->mem.references = NULL;
    if (memblock_alloc(ctx, &arr->mem, dim0 * dim1 * 4, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    if ((size_t) (dim0 * dim1) * 4 > 0)
        memmove(arr->mem.mem + 0, data + 0, (size_t) (dim0 * dim1) * 4);
    lock_unlock(&ctx->lock);
    return arr;
}
struct futhark_f32_2d *futhark_new_raw_f32_2d(struct futhark_context *ctx, const
                                              unsigned char *data,
                                              int64_t offset, int64_t dim0,
                                              int64_t dim1)
{
    struct futhark_f32_2d *bad = NULL;
    struct futhark_f32_2d *arr =
                          (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    arr->mem.references = NULL;
    if (memblock_alloc(ctx, &arr->mem, dim0 * dim1 * 4, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    if ((size_t) (dim0 * dim1) * 4 > 0)
        memmove(arr->mem.mem + 0, data + offset, (size_t) (dim0 * dim1) * 4);
    lock_unlock(&ctx->lock);
    return arr;
}
int futhark_free_f32_2d(struct futhark_context *ctx, struct futhark_f32_2d *arr)
{
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    if (memblock_unref(ctx, &arr->mem, "arr->mem") != 0)
        return 1;
    lock_unlock(&ctx->lock);
    free(arr);
    return 0;
}
int futhark_values_f32_2d(struct futhark_context *ctx,
                          struct futhark_f32_2d *arr, float *data)
{
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    if ((size_t) (arr->shape[0] * arr->shape[1]) * 4 > 0)
        memmove(data + 0, arr->mem.mem + 0, (size_t) (arr->shape[0] *
                                                      arr->shape[1]) * 4);
    lock_unlock(&ctx->lock);
    return 0;
}
unsigned char *futhark_values_raw_f32_2d(struct futhark_context *ctx,
                                         struct futhark_f32_2d *arr)
{
    (void) ctx;
    return arr->mem.mem;
}
const int64_t *futhark_shape_f32_2d(struct futhark_context *ctx,
                                    struct futhark_f32_2d *arr)
{
    (void) ctx;
    return arr->shape;
}

static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock *mem_out_p_77022,
                             struct memblock Y_mem_70569, int64_t m_65343,
                             int64_t n_65344, int64_t q_65346,
                             int64_t degree_65347, int64_t jump_65348,
                             int64_t jump_threshold_65349,
                             int64_t q_threshold_65350)
{
    (void) ctx;
    
    int err = 0;
    struct memblock mem_out_71618;
    
    mem_out_71618.references = NULL;
    
    bool cond_65351 = jump_65348 == (int64_t) 1;
    int64_t n_m_65352;
    
    if (cond_65351) {
        n_m_65352 = n_65344;
    } else {
        bool zzero_65353 = jump_65348 == (int64_t) 0;
        bool nonzzero_65354 = !zzero_65353;
        bool nonzzero_cert_65355;
        
        if (!nonzzero_65354) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  loess.fut:579:38-45\n   #1  loess.fut:572:1-611:26\n");
            if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t x_65356 = sdiv64(n_65344, jump_65348);
        int64_t n_m_f_res_65357 = add64((int64_t) 1, x_65356);
        
        n_m_65352 = n_m_f_res_65357;
    }
    
    int64_t i_65358 = sub64(n_65344, (int64_t) 1);
    bool x_65359 = sle64((int64_t) 0, i_65358);
    bool y_65360 = slt64(i_65358, n_65344);
    bool bounds_check_65361 = x_65359 && y_65360;
    bool index_certs_65362;
    
    if (!bounds_check_65361) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", (long long) i_65358,
                               "] out of bounds for array of shape [",
                               (long long) n_65344, "].",
                               "-> #0  /prelude/array.fut:26:29-34\n   #1  utils.fut:45:13-20\n   #2  loess.fut:584:5-54\n   #3  loess.fut:572:1-611:26\n");
        if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_65364 = smin64(n_65344, q_65346);
    bool bounds_invalid_upwards_65365 = slt64(n_m_65352, (int64_t) 0);
    bool valid_65366 = !bounds_invalid_upwards_65365;
    bool range_valid_c_65367;
    
    if (!valid_65366) {
        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_65352, " 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:442:3-469:10\n   #4  loess.fut:502:15-61\n   #5  loess.fut:589:13-56\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:588:5-590:26\n   #9  loess.fut:572:1-611:26\n");
        if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
            return 1;
        err = 1;
        goto cleanup;
    }
    
    bool loop_cond_65369 = slt64((int64_t) 1, min_res_65364);
    float i64_res_65370 = sitofp_i64_f32(q_65346);
    bool cond_65371 = slt64(jump_65348, jump_threshold_65349);
    bool cond_f_res_65372 = slt64(q_threshold_65350, q_65346);
    bool x_65373 = !cond_65371;
    bool y_65374 = cond_f_res_65372 && x_65373;
    bool cond_65375 = cond_65371 || y_65374;
    struct memblock ext_mem_71578;
    
    ext_mem_71578.references = NULL;
    
    struct memblock ext_mem_71577;
    
    ext_mem_71577.references = NULL;
    if (cond_65375) {
        bool match_lit_65378 = (int64_t) 0 == degree_65347;
        int64_t binop_x_70570 = m_65343 * n_m_65352;
        int64_t binop_y_70571 = (int64_t) 4 * binop_x_70570;
        int64_t bytes_70572 = smax64((int64_t) 0, binop_y_70571);
        struct memblock ext_mem_70957;
        
        ext_mem_70957.references = NULL;
        
        struct memblock ext_mem_70956;
        
        ext_mem_70956.references = NULL;
        if (match_lit_65378) {
            struct memblock mem_70573;
            
            mem_70573.references = NULL;
            if (memblock_alloc(ctx, &mem_70573, bytes_70572, "mem_70573")) {
                err = 1;
                goto cleanup;
            }
            for (int64_t i_71619 = 0; i_71619 < m_65343; i_71619++) {
                for (int64_t i_71620 = 0; i_71620 < n_m_65352; i_71620++) {
                    ((float *) mem_70573.mem)[i_71619 * n_m_65352 + i_71620] =
                        0.0F;
                }
            }
            
            struct memblock mem_70685;
            
            mem_70685.references = NULL;
            if (memblock_alloc(ctx, &mem_70685, bytes_70572, "mem_70685")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t binop_y_70574 = (int64_t) 8 * n_65344;
            int64_t bytes_70575 = smax64((int64_t) 0, binop_y_70574);
            int64_t binop_y_70577 = (int64_t) 4 * n_65344;
            int64_t bytes_70578 = smax64((int64_t) 0, binop_y_70577);
            int64_t binop_y_70586 = (int64_t) 4 * q_65346;
            int64_t bytes_70587 = smax64((int64_t) 0, binop_y_70586);
            int64_t binop_y_70589 = (int64_t) 4 * n_m_65352;
            int64_t bytes_70590 = smax64((int64_t) 0, binop_y_70589);
            int64_t flat_tid_66692 = (int64_t) 0;
            int32_t num_tasks_71621;
            int64_t flat_tid_66853 = (int64_t) 0;
            struct futhark_mc_task_77023 futhark_mc_task_77023;
            
            futhark_mc_task_77023.ctx = ctx;
            futhark_mc_task_77023.free_m_65343 = m_65343;
            futhark_mc_task_77023.free_n_65344 = n_65344;
            futhark_mc_task_77023.free_q_65346 = q_65346;
            futhark_mc_task_77023.free_jump_65348 = jump_65348;
            futhark_mc_task_77023.free_n_m_65352 = n_m_65352;
            futhark_mc_task_77023.free_i_65358 = i_65358;
            futhark_mc_task_77023.free_x_65359 = x_65359;
            futhark_mc_task_77023.free_min_res_65364 = min_res_65364;
            futhark_mc_task_77023.free_loop_cond_65369 = loop_cond_65369;
            futhark_mc_task_77023.free_i64_res_65370 = i64_res_65370;
            futhark_mc_task_77023.free_Y_mem_70569 = Y_mem_70569.mem;
            futhark_mc_task_77023.free_bytes_70575 = bytes_70575;
            futhark_mc_task_77023.free_bytes_70578 = bytes_70578;
            futhark_mc_task_77023.free_bytes_70587 = bytes_70587;
            futhark_mc_task_77023.free_bytes_70590 = bytes_70590;
            futhark_mc_task_77023.free_mem_70685 = mem_70685.mem;
            
            struct scheduler_segop futhark_mc_task_77023_task;
            
            futhark_mc_task_77023_task.args = &futhark_mc_task_77023;
            futhark_mc_task_77023_task.top_level_fn =
                futhark_mc_segmap_task_77024;
            futhark_mc_task_77023_task.name = "futhark_mc_segmap_task_77024";
            futhark_mc_task_77023_task.iterations = m_65343;
            futhark_mc_task_77023_task.task_time =
                &ctx->futhark_mc_segmap_task_77024_total_time;
            futhark_mc_task_77023_task.task_iter =
                &ctx->futhark_mc_segmap_task_77024_total_iter;
            futhark_mc_task_77023_task.sched = DYNAMIC;
            futhark_mc_task_77023_task.nested_fn =
                futhark_mc_segmap_nested_task_77033;
            
            int futhark_mc_segmap_task_77024_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_77023_task);
            
            if (futhark_mc_segmap_task_77024_err != 0) {
                if (memblock_unref(ctx, &mem_70685, "mem_70685") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_70573, "mem_70573") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_70956, "ext_mem_70956") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_70957, "ext_mem_70957") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_set(ctx, &ext_mem_70957, &mem_70685, "mem_70685") != 0)
                return 1;
            if (memblock_set(ctx, &ext_mem_70956, &mem_70573, "mem_70573") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_70685, "mem_70685") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_70573, "mem_70573") != 0)
                return 1;
        } else {
            bool match_lit_65557 = (int64_t) 1 == degree_65347;
            struct memblock ext_mem_70955;
            
            ext_mem_70955.references = NULL;
            
            struct memblock ext_mem_70954;
            
            ext_mem_70954.references = NULL;
            if (match_lit_65557) {
                struct memblock mem_70815;
                
                mem_70815.references = NULL;
                if (memblock_alloc(ctx, &mem_70815, bytes_70572, "mem_70815")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock mem_70819;
                
                mem_70819.references = NULL;
                if (memblock_alloc(ctx, &mem_70819, bytes_70572, "mem_70819")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t binop_y_70686 = (int64_t) 8 * n_65344;
                int64_t bytes_70687 = smax64((int64_t) 0, binop_y_70686);
                int64_t binop_y_70689 = (int64_t) 4 * n_65344;
                int64_t bytes_70690 = smax64((int64_t) 0, binop_y_70689);
                int64_t binop_y_70698 = (int64_t) 4 * q_65346;
                int64_t bytes_70699 = smax64((int64_t) 0, binop_y_70698);
                int64_t binop_y_70701 = (int64_t) 4 * n_m_65352;
                int64_t bytes_70702 = smax64((int64_t) 0, binop_y_70701);
                int64_t flat_tid_67177 = (int64_t) 0;
                int32_t num_tasks_72380;
                int64_t flat_tid_67366 = (int64_t) 0;
                struct futhark_mc_task_77078 futhark_mc_task_77078;
                
                futhark_mc_task_77078.ctx = ctx;
                futhark_mc_task_77078.free_m_65343 = m_65343;
                futhark_mc_task_77078.free_n_65344 = n_65344;
                futhark_mc_task_77078.free_q_65346 = q_65346;
                futhark_mc_task_77078.free_jump_65348 = jump_65348;
                futhark_mc_task_77078.free_n_m_65352 = n_m_65352;
                futhark_mc_task_77078.free_i_65358 = i_65358;
                futhark_mc_task_77078.free_x_65359 = x_65359;
                futhark_mc_task_77078.free_min_res_65364 = min_res_65364;
                futhark_mc_task_77078.free_loop_cond_65369 = loop_cond_65369;
                futhark_mc_task_77078.free_i64_res_65370 = i64_res_65370;
                futhark_mc_task_77078.free_Y_mem_70569 = Y_mem_70569.mem;
                futhark_mc_task_77078.free_bytes_70687 = bytes_70687;
                futhark_mc_task_77078.free_bytes_70690 = bytes_70690;
                futhark_mc_task_77078.free_bytes_70699 = bytes_70699;
                futhark_mc_task_77078.free_bytes_70702 = bytes_70702;
                futhark_mc_task_77078.free_mem_70815 = mem_70815.mem;
                futhark_mc_task_77078.free_mem_70819 = mem_70819.mem;
                
                struct scheduler_segop futhark_mc_task_77078_task;
                
                futhark_mc_task_77078_task.args = &futhark_mc_task_77078;
                futhark_mc_task_77078_task.top_level_fn =
                    futhark_mc_segmap_task_77079;
                futhark_mc_task_77078_task.name =
                    "futhark_mc_segmap_task_77079";
                futhark_mc_task_77078_task.iterations = m_65343;
                futhark_mc_task_77078_task.task_time =
                    &ctx->futhark_mc_segmap_task_77079_total_time;
                futhark_mc_task_77078_task.task_iter =
                    &ctx->futhark_mc_segmap_task_77079_total_iter;
                futhark_mc_task_77078_task.sched = DYNAMIC;
                futhark_mc_task_77078_task.nested_fn =
                    futhark_mc_segmap_nested_task_77089;
                
                int futhark_mc_segmap_task_77079_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_77078_task);
                
                if (futhark_mc_segmap_task_77079_err != 0) {
                    if (memblock_unref(ctx, &mem_70819, "mem_70819") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_70815, "mem_70815") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70954, "ext_mem_70954") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70955, "ext_mem_70955") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70956, "ext_mem_70956") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70957, "ext_mem_70957") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") !=
                        0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_70955, &mem_70815,
                                 "mem_70815") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_70954, &mem_70819,
                                 "mem_70819") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_70819, "mem_70819") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_70815, "mem_70815") != 0)
                    return 1;
            } else {
                struct memblock mem_70949;
                
                mem_70949.references = NULL;
                if (memblock_alloc(ctx, &mem_70949, bytes_70572, "mem_70949")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock mem_70953;
                
                mem_70953.references = NULL;
                if (memblock_alloc(ctx, &mem_70953, bytes_70572, "mem_70953")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t binop_y_70820 = (int64_t) 8 * n_65344;
                int64_t bytes_70821 = smax64((int64_t) 0, binop_y_70820);
                int64_t binop_y_70823 = (int64_t) 4 * n_65344;
                int64_t bytes_70824 = smax64((int64_t) 0, binop_y_70823);
                int64_t binop_y_70832 = (int64_t) 4 * q_65346;
                int64_t bytes_70833 = smax64((int64_t) 0, binop_y_70832);
                int64_t binop_y_70835 = (int64_t) 4 * n_m_65352;
                int64_t bytes_70836 = smax64((int64_t) 0, binop_y_70835);
                int64_t flat_tid_67747 = (int64_t) 0;
                int32_t num_tasks_73277;
                int64_t flat_tid_67968 = (int64_t) 0;
                struct futhark_mc_task_77138 futhark_mc_task_77138;
                
                futhark_mc_task_77138.ctx = ctx;
                futhark_mc_task_77138.free_m_65343 = m_65343;
                futhark_mc_task_77138.free_n_65344 = n_65344;
                futhark_mc_task_77138.free_q_65346 = q_65346;
                futhark_mc_task_77138.free_jump_65348 = jump_65348;
                futhark_mc_task_77138.free_n_m_65352 = n_m_65352;
                futhark_mc_task_77138.free_i_65358 = i_65358;
                futhark_mc_task_77138.free_x_65359 = x_65359;
                futhark_mc_task_77138.free_min_res_65364 = min_res_65364;
                futhark_mc_task_77138.free_loop_cond_65369 = loop_cond_65369;
                futhark_mc_task_77138.free_i64_res_65370 = i64_res_65370;
                futhark_mc_task_77138.free_Y_mem_70569 = Y_mem_70569.mem;
                futhark_mc_task_77138.free_bytes_70821 = bytes_70821;
                futhark_mc_task_77138.free_bytes_70824 = bytes_70824;
                futhark_mc_task_77138.free_bytes_70833 = bytes_70833;
                futhark_mc_task_77138.free_bytes_70836 = bytes_70836;
                futhark_mc_task_77138.free_mem_70949 = mem_70949.mem;
                futhark_mc_task_77138.free_mem_70953 = mem_70953.mem;
                
                struct scheduler_segop futhark_mc_task_77138_task;
                
                futhark_mc_task_77138_task.args = &futhark_mc_task_77138;
                futhark_mc_task_77138_task.top_level_fn =
                    futhark_mc_segmap_task_77139;
                futhark_mc_task_77138_task.name =
                    "futhark_mc_segmap_task_77139";
                futhark_mc_task_77138_task.iterations = m_65343;
                futhark_mc_task_77138_task.task_time =
                    &ctx->futhark_mc_segmap_task_77139_total_time;
                futhark_mc_task_77138_task.task_iter =
                    &ctx->futhark_mc_segmap_task_77139_total_iter;
                futhark_mc_task_77138_task.sched = DYNAMIC;
                futhark_mc_task_77138_task.nested_fn =
                    futhark_mc_segmap_nested_task_77149;
                
                int futhark_mc_segmap_task_77139_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_77138_task);
                
                if (futhark_mc_segmap_task_77139_err != 0) {
                    if (memblock_unref(ctx, &mem_70953, "mem_70953") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_70949, "mem_70949") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70954, "ext_mem_70954") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70955, "ext_mem_70955") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70956, "ext_mem_70956") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_70957, "ext_mem_70957") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") !=
                        0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_70955, &mem_70949,
                                 "mem_70949") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_70954, &mem_70953,
                                 "mem_70953") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_70953, "mem_70953") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_70949, "mem_70949") != 0)
                    return 1;
            }
            if (memblock_set(ctx, &ext_mem_70957, &ext_mem_70955,
                             "ext_mem_70955") != 0)
                return 1;
            if (memblock_set(ctx, &ext_mem_70956, &ext_mem_70954,
                             "ext_mem_70954") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_70954, "ext_mem_70954") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_70955, "ext_mem_70955") != 0)
                return 1;
        }
        if (memblock_set(ctx, &ext_mem_71578, &ext_mem_70957,
                         "ext_mem_70957") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_71577, &ext_mem_70956,
                         "ext_mem_70956") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_70956, "ext_mem_70956") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_70957, "ext_mem_70957") != 0)
            return 1;
    } else {
        bool match_lit_66002 = (int64_t) 0 == degree_65347;
        int64_t binop_x_70958 = m_65343 * n_m_65352;
        int64_t binop_y_70959 = (int64_t) 4 * binop_x_70958;
        int64_t bytes_70960 = smax64((int64_t) 0, binop_y_70959);
        struct memblock ext_mem_71576;
        
        ext_mem_71576.references = NULL;
        
        struct memblock ext_mem_71575;
        
        ext_mem_71575.references = NULL;
        if (match_lit_66002) {
            struct memblock mem_70961;
            
            mem_70961.references = NULL;
            if (memblock_alloc(ctx, &mem_70961, bytes_70960, "mem_70961")) {
                err = 1;
                goto cleanup;
            }
            for (int64_t i_74306 = 0; i_74306 < m_65343; i_74306++) {
                for (int64_t i_74307 = 0; i_74307 < n_m_65352; i_74307++) {
                    ((float *) mem_70961.mem)[i_74306 * n_m_65352 + i_74307] =
                        0.0F;
                }
            }
            
            struct memblock mem_71106;
            
            mem_71106.references = NULL;
            if (memblock_alloc(ctx, &mem_71106, bytes_70960, "mem_71106")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t binop_y_70962 = (int64_t) 8 * n_65344;
            int64_t bytes_70963 = smax64((int64_t) 0, binop_y_70962);
            int64_t binop_y_70965 = (int64_t) 4 * n_65344;
            int64_t bytes_70966 = smax64((int64_t) 0, binop_y_70965);
            int64_t binop_y_70974 = (int64_t) 4 * q_65346;
            int64_t bytes_70975 = smax64((int64_t) 0, binop_y_70974);
            int64_t binop_y_70995 = (int64_t) 4 * n_m_65352;
            int64_t bytes_70996 = smax64((int64_t) 0, binop_y_70995);
            int64_t flat_tid_68413 = (int64_t) 0;
            int32_t num_tasks_74308;
            int64_t flat_tid_68561 = (int64_t) 0;
            struct futhark_mc_task_77200 futhark_mc_task_77200;
            
            futhark_mc_task_77200.ctx = ctx;
            futhark_mc_task_77200.free_m_65343 = m_65343;
            futhark_mc_task_77200.free_n_65344 = n_65344;
            futhark_mc_task_77200.free_q_65346 = q_65346;
            futhark_mc_task_77200.free_jump_65348 = jump_65348;
            futhark_mc_task_77200.free_n_m_65352 = n_m_65352;
            futhark_mc_task_77200.free_i_65358 = i_65358;
            futhark_mc_task_77200.free_x_65359 = x_65359;
            futhark_mc_task_77200.free_min_res_65364 = min_res_65364;
            futhark_mc_task_77200.free_loop_cond_65369 = loop_cond_65369;
            futhark_mc_task_77200.free_i64_res_65370 = i64_res_65370;
            futhark_mc_task_77200.free_Y_mem_70569 = Y_mem_70569.mem;
            futhark_mc_task_77200.free_bytes_70963 = bytes_70963;
            futhark_mc_task_77200.free_bytes_70966 = bytes_70966;
            futhark_mc_task_77200.free_bytes_70975 = bytes_70975;
            futhark_mc_task_77200.free_bytes_70996 = bytes_70996;
            futhark_mc_task_77200.free_mem_71106 = mem_71106.mem;
            
            struct scheduler_segop futhark_mc_task_77200_task;
            
            futhark_mc_task_77200_task.args = &futhark_mc_task_77200;
            futhark_mc_task_77200_task.top_level_fn =
                futhark_mc_segmap_task_77201;
            futhark_mc_task_77200_task.name = "futhark_mc_segmap_task_77201";
            futhark_mc_task_77200_task.iterations = m_65343;
            futhark_mc_task_77200_task.task_time =
                &ctx->futhark_mc_segmap_task_77201_total_time;
            futhark_mc_task_77200_task.task_iter =
                &ctx->futhark_mc_segmap_task_77201_total_iter;
            futhark_mc_task_77200_task.sched = DYNAMIC;
            futhark_mc_task_77200_task.nested_fn =
                futhark_mc_segmap_nested_task_77211;
            
            int futhark_mc_segmap_task_77201_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_77200_task);
            
            if (futhark_mc_segmap_task_77201_err != 0) {
                if (memblock_unref(ctx, &mem_71106, "mem_71106") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_70961, "mem_70961") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_71575, "ext_mem_71575") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_71576, "ext_mem_71576") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") != 0)
                    return 1;
                if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
                    return 1;
                ;
                err = 1;
                goto cleanup;
            }
            if (memblock_set(ctx, &ext_mem_71576, &mem_71106, "mem_71106") != 0)
                return 1;
            if (memblock_set(ctx, &ext_mem_71575, &mem_70961, "mem_70961") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_71106, "mem_71106") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_70961, "mem_70961") != 0)
                return 1;
        } else {
            bool match_lit_66168 = (int64_t) 1 == degree_65347;
            struct memblock ext_mem_71574;
            
            ext_mem_71574.references = NULL;
            
            struct memblock ext_mem_71573;
            
            ext_mem_71573.references = NULL;
            if (match_lit_66168) {
                struct memblock mem_71302;
                
                mem_71302.references = NULL;
                if (memblock_alloc(ctx, &mem_71302, bytes_70960, "mem_71302")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock mem_71306;
                
                mem_71306.references = NULL;
                if (memblock_alloc(ctx, &mem_71306, bytes_70960, "mem_71306")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t binop_y_71107 = (int64_t) 8 * n_65344;
                int64_t bytes_71108 = smax64((int64_t) 0, binop_y_71107);
                int64_t binop_y_71110 = (int64_t) 4 * n_65344;
                int64_t bytes_71111 = smax64((int64_t) 0, binop_y_71110);
                int64_t binop_y_71119 = (int64_t) 4 * q_65346;
                int64_t bytes_71120 = smax64((int64_t) 0, binop_y_71119);
                int64_t binop_y_71158 = (int64_t) 4 * n_m_65352;
                int64_t bytes_71159 = smax64((int64_t) 0, binop_y_71158);
                int64_t flat_tid_68859 = (int64_t) 0;
                int32_t num_tasks_75012;
                int64_t flat_tid_69036 = (int64_t) 0;
                struct futhark_mc_task_77258 futhark_mc_task_77258;
                
                futhark_mc_task_77258.ctx = ctx;
                futhark_mc_task_77258.free_m_65343 = m_65343;
                futhark_mc_task_77258.free_n_65344 = n_65344;
                futhark_mc_task_77258.free_q_65346 = q_65346;
                futhark_mc_task_77258.free_jump_65348 = jump_65348;
                futhark_mc_task_77258.free_n_m_65352 = n_m_65352;
                futhark_mc_task_77258.free_i_65358 = i_65358;
                futhark_mc_task_77258.free_x_65359 = x_65359;
                futhark_mc_task_77258.free_min_res_65364 = min_res_65364;
                futhark_mc_task_77258.free_loop_cond_65369 = loop_cond_65369;
                futhark_mc_task_77258.free_i64_res_65370 = i64_res_65370;
                futhark_mc_task_77258.free_Y_mem_70569 = Y_mem_70569.mem;
                futhark_mc_task_77258.free_bytes_71108 = bytes_71108;
                futhark_mc_task_77258.free_bytes_71111 = bytes_71111;
                futhark_mc_task_77258.free_bytes_71120 = bytes_71120;
                futhark_mc_task_77258.free_bytes_71159 = bytes_71159;
                futhark_mc_task_77258.free_mem_71302 = mem_71302.mem;
                futhark_mc_task_77258.free_mem_71306 = mem_71306.mem;
                
                struct scheduler_segop futhark_mc_task_77258_task;
                
                futhark_mc_task_77258_task.args = &futhark_mc_task_77258;
                futhark_mc_task_77258_task.top_level_fn =
                    futhark_mc_segmap_task_77259;
                futhark_mc_task_77258_task.name =
                    "futhark_mc_segmap_task_77259";
                futhark_mc_task_77258_task.iterations = m_65343;
                futhark_mc_task_77258_task.task_time =
                    &ctx->futhark_mc_segmap_task_77259_total_time;
                futhark_mc_task_77258_task.task_iter =
                    &ctx->futhark_mc_segmap_task_77259_total_iter;
                futhark_mc_task_77258_task.sched = DYNAMIC;
                futhark_mc_task_77258_task.nested_fn =
                    futhark_mc_segmap_nested_task_77271;
                
                int futhark_mc_segmap_task_77259_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_77258_task);
                
                if (futhark_mc_segmap_task_77259_err != 0) {
                    if (memblock_unref(ctx, &mem_71306, "mem_71306") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_71302, "mem_71302") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71573, "ext_mem_71573") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71574, "ext_mem_71574") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71575, "ext_mem_71575") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71576, "ext_mem_71576") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") !=
                        0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_71574, &mem_71302,
                                 "mem_71302") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_71573, &mem_71306,
                                 "mem_71306") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_71306, "mem_71306") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_71302, "mem_71302") != 0)
                    return 1;
            } else {
                struct memblock mem_71568;
                
                mem_71568.references = NULL;
                if (memblock_alloc(ctx, &mem_71568, bytes_70960, "mem_71568")) {
                    err = 1;
                    goto cleanup;
                }
                
                struct memblock mem_71572;
                
                mem_71572.references = NULL;
                if (memblock_alloc(ctx, &mem_71572, bytes_70960, "mem_71572")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t binop_y_71307 = (int64_t) 8 * n_65344;
                int64_t bytes_71308 = smax64((int64_t) 0, binop_y_71307);
                int64_t binop_y_71310 = (int64_t) 4 * n_65344;
                int64_t bytes_71311 = smax64((int64_t) 0, binop_y_71310);
                int64_t binop_y_71319 = (int64_t) 4 * q_65346;
                int64_t bytes_71320 = smax64((int64_t) 0, binop_y_71319);
                int64_t binop_y_71394 = (int64_t) 4 * n_m_65352;
                int64_t bytes_71395 = smax64((int64_t) 0, binop_y_71394);
                int64_t flat_tid_69393 = (int64_t) 0;
                int32_t num_tasks_75869;
                int64_t flat_tid_69610 = (int64_t) 0;
                struct futhark_mc_task_77324 futhark_mc_task_77324;
                
                futhark_mc_task_77324.ctx = ctx;
                futhark_mc_task_77324.free_m_65343 = m_65343;
                futhark_mc_task_77324.free_n_65344 = n_65344;
                futhark_mc_task_77324.free_q_65346 = q_65346;
                futhark_mc_task_77324.free_jump_65348 = jump_65348;
                futhark_mc_task_77324.free_n_m_65352 = n_m_65352;
                futhark_mc_task_77324.free_i_65358 = i_65358;
                futhark_mc_task_77324.free_x_65359 = x_65359;
                futhark_mc_task_77324.free_min_res_65364 = min_res_65364;
                futhark_mc_task_77324.free_loop_cond_65369 = loop_cond_65369;
                futhark_mc_task_77324.free_i64_res_65370 = i64_res_65370;
                futhark_mc_task_77324.free_Y_mem_70569 = Y_mem_70569.mem;
                futhark_mc_task_77324.free_bytes_71308 = bytes_71308;
                futhark_mc_task_77324.free_bytes_71311 = bytes_71311;
                futhark_mc_task_77324.free_bytes_71320 = bytes_71320;
                futhark_mc_task_77324.free_bytes_71395 = bytes_71395;
                futhark_mc_task_77324.free_mem_71568 = mem_71568.mem;
                futhark_mc_task_77324.free_mem_71572 = mem_71572.mem;
                
                struct scheduler_segop futhark_mc_task_77324_task;
                
                futhark_mc_task_77324_task.args = &futhark_mc_task_77324;
                futhark_mc_task_77324_task.top_level_fn =
                    futhark_mc_segmap_task_77325;
                futhark_mc_task_77324_task.name =
                    "futhark_mc_segmap_task_77325";
                futhark_mc_task_77324_task.iterations = m_65343;
                futhark_mc_task_77324_task.task_time =
                    &ctx->futhark_mc_segmap_task_77325_total_time;
                futhark_mc_task_77324_task.task_iter =
                    &ctx->futhark_mc_segmap_task_77325_total_iter;
                futhark_mc_task_77324_task.sched = DYNAMIC;
                futhark_mc_task_77324_task.nested_fn =
                    futhark_mc_segmap_nested_task_77339;
                
                int futhark_mc_segmap_task_77325_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_77324_task);
                
                if (futhark_mc_segmap_task_77325_err != 0) {
                    if (memblock_unref(ctx, &mem_71572, "mem_71572") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_71568, "mem_71568") != 0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71573, "ext_mem_71573") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71574, "ext_mem_71574") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71575, "ext_mem_71575") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71576, "ext_mem_71576") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") !=
                        0)
                        return 1;
                    if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") !=
                        0)
                        return 1;
                    ;
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &ext_mem_71574, &mem_71568,
                                 "mem_71568") != 0)
                    return 1;
                if (memblock_set(ctx, &ext_mem_71573, &mem_71572,
                                 "mem_71572") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_71572, "mem_71572") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_71568, "mem_71568") != 0)
                    return 1;
            }
            if (memblock_set(ctx, &ext_mem_71576, &ext_mem_71574,
                             "ext_mem_71574") != 0)
                return 1;
            if (memblock_set(ctx, &ext_mem_71575, &ext_mem_71573,
                             "ext_mem_71573") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71573, "ext_mem_71573") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71574, "ext_mem_71574") != 0)
                return 1;
        }
        if (memblock_set(ctx, &ext_mem_71578, &ext_mem_71576,
                         "ext_mem_71576") != 0)
            return 1;
        if (memblock_set(ctx, &ext_mem_71577, &ext_mem_71575,
                         "ext_mem_71575") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_71575, "ext_mem_71575") != 0)
            return 1;
        if (memblock_unref(ctx, &ext_mem_71576, "ext_mem_71576") != 0)
            return 1;
    }
    
    bool cond_66632 = slt64((int64_t) 1, jump_65348);
    int64_t ext_71602;
    
    if (cond_66632) {
        ext_71602 = n_65344;
    } else {
        ext_71602 = n_m_65352;
    }
    
    int64_t binop_x_71597 = m_65343 * n_65344;
    int64_t binop_y_71598 = (int64_t) 4 * binop_x_71597;
    int64_t bytes_71599 = smax64((int64_t) 0, binop_y_71598);
    struct memblock ext_mem_71601;
    
    ext_mem_71601.references = NULL;
    if (cond_66632) {
        bool zzero_66634 = jump_65348 == (int64_t) 0;
        bool nonzzero_66635 = !zzero_66634;
        bool nonzzero_cert_66636;
        
        if (!nonzzero_66635) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  loess.fut:546: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:545:3-549:9\n   #5  loess.fut:608:13-59\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  loess.fut:607:5-609:29\n   #9  loess.fut:572:1-611:26\n");
            if (memblock_unref(ctx, &ext_mem_71601, "ext_mem_71601") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        
        int64_t y_66637 = sub64(n_m_65352, (int64_t) 1);
        struct memblock mem_71600;
        
        mem_71600.references = NULL;
        if (memblock_alloc(ctx, &mem_71600, bytes_71599, "mem_71600")) {
            err = 1;
            goto cleanup;
        }
        
        int64_t binop_y_71579 = (int64_t) 4 * n_65344;
        int64_t bytes_71580 = smax64((int64_t) 0, binop_y_71579);
        int64_t flat_tid_70041 = (int64_t) 0;
        int32_t num_tasks_76912;
        int64_t flat_tid_70047 = (int64_t) 0;
        struct futhark_mc_task_77402 futhark_mc_task_77402;
        
        futhark_mc_task_77402.ctx = ctx;
        futhark_mc_task_77402.free_m_65343 = m_65343;
        futhark_mc_task_77402.free_n_65344 = n_65344;
        futhark_mc_task_77402.free_jump_65348 = jump_65348;
        futhark_mc_task_77402.free_n_m_65352 = n_m_65352;
        futhark_mc_task_77402.free_i_65358 = i_65358;
        futhark_mc_task_77402.free_y_66637 = y_66637;
        futhark_mc_task_77402.free_ext_mem_71577 = ext_mem_71577.mem;
        futhark_mc_task_77402.free_ext_mem_71578 = ext_mem_71578.mem;
        futhark_mc_task_77402.free_bytes_71580 = bytes_71580;
        futhark_mc_task_77402.free_mem_71600 = mem_71600.mem;
        
        struct scheduler_segop futhark_mc_task_77402_task;
        
        futhark_mc_task_77402_task.args = &futhark_mc_task_77402;
        futhark_mc_task_77402_task.top_level_fn = futhark_mc_segmap_task_77403;
        futhark_mc_task_77402_task.name = "futhark_mc_segmap_task_77403";
        futhark_mc_task_77402_task.iterations = m_65343;
        futhark_mc_task_77402_task.task_time =
            &ctx->futhark_mc_segmap_task_77403_total_time;
        futhark_mc_task_77402_task.task_iter =
            &ctx->futhark_mc_segmap_task_77403_total_iter;
        futhark_mc_task_77402_task.sched = STATIC;
        futhark_mc_task_77402_task.nested_fn =
            futhark_mc_segmap_nested_task_77407;
        
        int futhark_mc_segmap_task_77403_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_77402_task);
        
        if (futhark_mc_segmap_task_77403_err != 0) {
            if (memblock_unref(ctx, &mem_71600, "mem_71600") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71601, "ext_mem_71601") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
                return 1;
            ;
            err = 1;
            goto cleanup;
        }
        if (memblock_set(ctx, &ext_mem_71601, &mem_71600, "mem_71600") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_71600, "mem_71600") != 0)
            return 1;
    } else {
        bool dim_match_66689 = n_65344 == n_m_65352;
        bool empty_or_match_cert_66690;
        
        if (!dim_match_66689) {
            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_65343, ", ", (long long) n_m_65352,
                          ") cannot match shape of type `[",
                          (long long) m_65343, "][", (long long) n_65344,
                          "]f32`.",
                          "-> #0  loess.fut:611:5-26\n   #1  loess.fut:572:1-611:26\n");
            if (memblock_unref(ctx, &ext_mem_71601, "ext_mem_71601") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") != 0)
                return 1;
            if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
                return 1;
            err = 1;
            goto cleanup;
        }
        if (memblock_set(ctx, &ext_mem_71601, &ext_mem_71578,
                         "ext_mem_71578") != 0)
            return 1;
    }
    if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") != 0)
        return 1;
    
    struct memblock mem_71606;
    
    mem_71606.references = NULL;
    if (memblock_alloc(ctx, &mem_71606, bytes_71599, "mem_71606")) {
        err = 1;
        goto cleanup;
    }
    if (m_65343 * n_65344 * (int64_t) 4 > 0)
        memmove(mem_71606.mem + (int64_t) 0, ext_mem_71601.mem + (int64_t) 0,
                m_65343 * n_65344 * (int64_t) 4);
    if (memblock_unref(ctx, &ext_mem_71601, "ext_mem_71601") != 0)
        return 1;
    if (memblock_set(ctx, &mem_out_71618, &mem_71606, "mem_71606") != 0)
        return 1;
    (*mem_out_p_77022).references = NULL;
    if (memblock_set(ctx, &*mem_out_p_77022, &mem_out_71618, "mem_out_71618") !=
        0)
        return 1;
    if (memblock_unref(ctx, &mem_71606, "mem_71606") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_71601, "ext_mem_71601") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_71577, "ext_mem_71577") != 0)
        return 1;
    if (memblock_unref(ctx, &ext_mem_71578, "ext_mem_71578") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_out_71618, "mem_out_71618") != 0)
        return 1;
    
  cleanup:
    { }
    return err;
}

int futhark_entry_main(struct futhark_context *ctx,
                       struct futhark_f32_2d **out0, const
                       struct futhark_f32_2d *in0, const int64_t in1, const
                       int64_t in2, const int64_t in3, const int64_t in4, const
                       int64_t in5)
{
    struct memblock Y_mem_70569;
    
    Y_mem_70569.references = NULL;
    
    int64_t m_65343;
    int64_t n_65344;
    int64_t q_65346;
    int64_t degree_65347;
    int64_t jump_65348;
    int64_t jump_threshold_65349;
    int64_t q_threshold_65350;
    struct memblock mem_out_71618;
    
    mem_out_71618.references = NULL;
    
    int ret = 0;
    
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    Y_mem_70569 = in0->mem;
    m_65343 = in0->shape[0];
    n_65344 = in0->shape[1];
    q_65346 = in1;
    degree_65347 = in2;
    jump_65348 = in3;
    jump_threshold_65349 = in4;
    q_threshold_65350 = in5;
    if (!(m_65343 == in0->shape[0] && n_65344 == 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_71618, Y_mem_70569, m_65343,
                                n_65344, q_65346, degree_65347, jump_65348,
                                jump_threshold_65349, q_threshold_65350);
        if (ret == 0) {
            assert((*out0 =
                    (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d))) !=
                NULL);
            (*out0)->mem = mem_out_71618;
            (*out0)->shape[0] = m_65343;
            (*out0)->shape[1] = n_65344;
        }
    }
    lock_unlock(&ctx->lock);
    return ret;
}
  
